> 1) In the link script file (lpc2129-rom.ld)I see:
> 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
> 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
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
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
> 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
> 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
Michael Fischer has some information on his pages www.yagarto.de.