Debugging on Arm9 LDMIA instruction is crashes my program execution when its time to return

OP (Company: Newcastle university) #2309576
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
Guest #2313924
could be a stack overflow. If you say execution crashes, what 
exception/interrupt vector is the processor going to?
OP (Company: Newcastle university) #2314630
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

Reply

A question of your own? This thread is over 15 years old. Ask it in a thread of its own – more people read along there, and it gets answered more often and sooner.

Start a new thread

A fix, an addition or feedback on this thread? Then reply here.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.