No I was just using the startup file given with Keil's IDE for
ADS...
Section of Startup.s
; Setup Stack for each mode
LDR R0, =Top_Stack
; Enter Undefined Instruction Mode and set its Stack Pointer
MSR CPSR_c, #Mode_UND:OR:I_Bit:OR:F_Bit
MOV SP, R0
SUB R0, R0, #UND_Stack_Size
; Enter Abort Mode and set its Stack Pointer
MSR CPSR_c, #Mode_ABT:OR:I_Bit:OR:F_Bit
MOV SP, R0
SUB R0, R0, #ABT_Stack_Size
; Enter FIQ Mode and set its Stack Pointer
MSR CPSR_c, #Mode_FIQ:OR:I_Bit:OR:F_Bit
MOV SP, R0
SUB R0, R0, #FIQ_Stack_Size
; Enter IRQ Mode and set its Stack Pointer
MSR CPSR_c, #Mode_IRQ:OR:I_Bit:OR:F_Bit
MOV SP, R0
SUB R0, R0, #IRQ_Stack_Size
; Enter Supervisor Mode and set its Stack Pointer
MSR CPSR_c, #Mode_SVC:OR:I_Bit:OR:F_Bit
MOV SP, R0
SUB R0, R0, #SVC_Stack_Size
; Enter User Mode and set its Stack Pointer
MSR CPSR_c, #Mode_USR
MOV SP, R0
; Enter the C code
IMPORT __main
LDR R0, =__main
BX R0
The gcc Startup files have the loop to move .data section and clear
the .bss section before jumping to main so I assume there is a setting in ADS to
do this automatically during assembly? Like I say, the code wont execute on
anything with global variables....I get either random data or program crash and
that it must be due to how im initializing the micro!
David.
Peter <p...@codesprite.com> wrote:
--- In l...@yahoogroups.com, David Bermingham
<crwpulsar@y...> wrote: > Hi Peter, > Thanks for the
info....that solved the IAP issue!!Works prefectly now! >
> As regards the second problem/issue, The startup file Im using just initialises the exception vectors, stacks and branches to main ().
Do I need another assembly routine to move the data from Flash to RAM?? I
thought the scatterloading file set that up? > The problem I have is
that any global variables or buffers in the code seem to cause the error!
I can remove the problem by using local variables and passing them between
functions but this is less than pretty!!! > >
Thanks, > David >
Hi David,
Excellent - glad the IAP is working now. For the scatterloading problem,
try branching to __main
instead of main. Have you also written your own version of
__user_initial_stackheap, to tell the C startup code where to place the
heap base and stack limit?
Peter.
|