EmbDev.net

Forum: ARM programming with GCC/GNU tools Debugging on Arm9 LDMIA instruction is crashes my program execution when its time to return


von wellington m. (Company: Newcastle university) (wellyjinx)


Rate this post
useful
not useful
STMDB and LDMIA are not popping and pushing correctly hence my program 
execution crashes at this instruction
.

I am using GCC 4.3.2 tools to make an elf file for an Arm9 
"arm926ej-s"(at91sam9261) the example Disassemble is as listed below

<OSMutexAccept+0xb0>
    4378:  e5931000   ldr  r1, [r3]
    437c:  e5d12036   ldrb  r2, [r1, #54]
    4380:  e3cc30ff   bic  r3, ip, #255  ; 0xff
    4384:  e152042c   cmp  r2, ip, lsr #8
    .
    .This Code left for as its not neccessary
    .
    43b8:  e8bd8070   pop  {r4, r5, r6, pc}
    43bc:  ebfff066   bl  55c <OS_CPU_SR_Restore>
    43c0:  e5c56000   strb  r6, [r5]
    43c4:  e3a00001   mov  r0, #1  ; 0x1
    43c8:  e8bd8070   pop  {r4, r5, r6, pc}
    43cc:  000219e4   .word  0x000219e4
    43d0:  000219e8   .word  0x000219e


When I debug the image on an ARM at91Sam The program loses control at 
instruction 43c8(pop  {r4, pc}, In the debugger this instruction is 
dissassembled to:
     LDMIA  R13!, {R4, PC}
Which is a thumb instruction, how can i enforce that this is not used if 
it is the source of my problems

von alibaba (Guest)


Rate this post
useful
not useful
could be a stack overflow. If you say execution crashes, what 
exception/interrupt vector is the processor going to?

von wellington m. (Company: Newcastle university) (wellyjinx)


Rate this post
useful
not useful
Thank you for the reply. The program does not point to an interrupt.
its actually the PC that runs wild after loading from an address with no 
valid instruction, I have since found out more, and need help to fix the 
problem with the stack pointer and memory/RAM that is addressable. If i 
move the stack pointer to a lower address than 00027A00 the program 
executes fine for a while until reset and SP goes back to that address 
range. The STMDB/STMFD instruction is unable to write to the address 
that the SP will be pointing to, then on the POP instruction the 
"2A2A2A2A" is loaded as PC

I arm trying to run the uC-OS II that I have compiled on this board, . 
I have made a simple startup file and linker script from the templates 
online, examples smaller size

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
No account? Register here.