Hi all, First of all I'm a newbie in ARM programming. I've a TinyArm evaluation board with a LPC2194 on it and have download WinArm which I want I to used it for the board. As this moment I'm looking at the example: lpc2129_adc_stdio. I have the following questions about this example: 1) In the link script file (lpc2129-rom.ld)I see: MEMORY { ROM (rx) : ORIGIN = 0x00000000, LENGTH = 0x0003E000 RAM (rw) : ORIGIN = 0x40000000, LENGTH = 0x00004000 } Is 3E000 correct? Shouldn't this be 40000? Because the Lpc2129 (like the 2194) has 256kb of Flash (256 * 1024 = 262144 == 0x040000). 2) The stacksize of the different mode is set in the startup file crt0.s. The last code of this is: sub r0,r0,#SVC_STACK_SIZE msr CPSR_c,#MODE_SYS|I_BIT|F_BIT // System Mode mov sp,r0 Does this mean that the program run is System mode and with interrupt disabled? If I want to use interrupts (vectored and FIQ) must I set it to user mode, or do I only have to remove |I_BIT|F_BIT? 3) Where should I set the (user) stack size? In crt0.s? (How?) or in the makefile? 4) Can someone explain me the difference(s) of the two link script files? Why there are two of them? 5) Where can I find tutorials about setting up the startup file, makefile and the linker script files. 6) Where can I find tutorials about debugging (open OCD) via the Jtag connection? Very much thanks in advance for your answers. Kind regard, Chic
Chic wrote: > 1) In the link script file (lpc2129-rom.ld)I see: > MEMORY > { > ROM (rx) : ORIGIN = 0x00000000, LENGTH = 0x0003E000 > RAM (rw) : ORIGIN = 0x40000000, LENGTH = 0x00004000 > } > > Is 3E000 correct? Shouldn't this be 40000? Because the Lpc2129 (like the > 2194) has 256kb of Flash (256 * 1024 = 262144 == 0x040000). I currently do not remember why I used a shorter length. Maybe I planed to use the remaining flash to store configuration-values (with IAP) in another application. Length 256K should work too. > 2) The stacksize of the different mode is set in the startup file > crt0.s. > > The last code of this is: > sub r0,r0,#SVC_STACK_SIZE > msr CPSR_c,#MODE_SYS|I_BIT|F_BIT // System Mode > mov sp,r0 > Does this mean that the program run is System mode and with interrupt > disabled? Yes. (Do you read comments?) > If I want to use interrupts (vectored and FIQ) must I set it to user > mode, or do I only have to remove |I_BIT|F_BIT? You can choose between system- and user-mode. If you use system-mode you can swith the I and F bit in CPSR anytime in the application to disable or enable INT/FIQ-exceptions. In user-mode this is not allowed. Just removing the bit-masks will let "the program" (main()) start in system-mode with INT/FIQ enabled. If you'd like to let the program run in user-mode with INT/FIQ enabled you can change the code like this: replace: msr CPSR_c,#MODE_SYS|I_BIT|F_BIT // System Mode with: msr CPSR_c,#MODE_USR // User Mode INT/FIQ enabled > 3) Where should I set the (user) stack size? In crt0.s? (How?) or in the > makefile? Top of stack for the application - either in USR- or SYS-Mode is the address for _stack assigned by the linker (_stack) minus the sizes of the stacks for the other modes. In the example total size of all stacks is defined in the linker-script (STACK_SIZE) stack sizes for the differnt modes are defined in crt0.S. > 4) Can someone explain me the difference(s) of the two link script > files? > Why there are two of them? Search for > ROM and > RAM to see the difference. One script lets the linker assign "fixed" values (code, consts) in the flash-memory ("ROM") and "variable" values (data, bss) in SRAM ("RAM"). The other script puts everything into the RAM memory adresse-range. Useful for debugging in RAM. > 5) Where can I find tutorials about setting up the startup file, > makefile and the linker script files. Makefiles: see the GNU make manual Linker-scripts: see the ld manual (part of the GNU binutils) Startup-files depend on the architecture. There are documents on www.arm.com and at least one applcation note from Atmel for AT91 ARM7TDMI but can be adpated easily for other devices based on this ARM core like the LPC2129. > 6) Where can I find tutorials about debugging (open OCD) via the Jtag > connection? Michael Fischer has some information on his pages www.yagarto.de. Martin Thomas
Hi Martin, Thank you very much for taking the time to answer my questions. Regards, ChiC
Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
Log in with Google account
No account? Register here.