Hello,
I'm working with SAM-ICE and AT91SAM9XE512. Everything works just fine, when I'm debugging the program running in external SDRAM (with Eclipse and gdb). But if I load the program into the internal flash, the stack pointer has wrong values (or gdb gets wrong values). To show this behaviour, I have logged the debugging session in plain gdb.
In line 57 of the log file the instruction 'ldr sp, =_sstack' works well and the stack pointer is set to the value 0x304000.
After 'stmfd sp!, {r0}' (line 62) the stack pointer should be decreased by 4, but still has the value 0x304000.
'ldmfd sp!, {r0}' (line 75) does not change the stack pointer as well.
After 'sub r4, sp, #IRQ_STACK_SIZE'(line 96) r4 should have the value 0x303fa0
(IRQ_STACK_SIZE is 8*3*4), but the value is 0.
Is this a problem of the SAM-ICE or must I change my gdbinit to get correct results?
Thanks for your help
Siegward
Display All
I'm working with SAM-ICE and AT91SAM9XE512. Everything works just fine, when I'm debugging the program running in external SDRAM (with Eclipse and gdb). But if I load the program into the internal flash, the stack pointer has wrong values (or gdb gets wrong values). To show this behaviour, I have logged the debugging session in plain gdb.
In line 57 of the log file the instruction 'ldr sp, =_sstack' works well and the stack pointer is set to the value 0x304000.
After 'stmfd sp!, {r0}' (line 62) the stack pointer should be decreased by 4, but still has the value 0x304000.
'ldmfd sp!, {r0}' (line 75) does not change the stack pointer as well.
After 'sub r4, sp, #IRQ_STACK_SIZE'(line 96) r4 should have the value 0x303fa0
(IRQ_STACK_SIZE is 8*3*4), but the value is 0.
Is this a problem of the SAM-ICE or must I change my gdbinit to get correct results?
Thanks for your help
Siegward
Source Code
- user1@core-i3-530:~/Develop/Siegward/EKF-ARM/EKF-ARM-Standalone$
- /usr/share/gnuarm.4.4.4-arm-none-eabi/bin/arm-none-eabi-gdb -n -x gdbinit.flash
- GNU gdb (GDB) 7.1
- Copyright (C) 2010 Free Software Foundation, Inc.
- License GPLv3+: GNU GPL version 3 or later
- This is free software: you are free to change and redistribute it.
- There is NO WARRANTY, to the extent permitted by law. Type "show copying"
- and "show warranty" for details.
- This GDB was configured as "--host=x86_64-unknown-linux-gnu --target=arm-none-
- eabi".
- For bug reporting instructions, please see:
- .
- 0x00200efc in ?? ()
- Target endianess set to "little endian"
- Select auto JTAG speed (65535 kHz)
- Resetting target (halt after reset)
- Sleep 100ms
- Writing 0xA5000004 @ address 0xFFFFFD00
- Sleep 10ms
- Writing 0x00008000 @ address 0xFFFFFD44
- Enable main oscillatorWriting 0x00004001 @ address 0xFFFFFC20
- Sleep 100ms
- Writing 0x2060BF09 @ address 0xFFFFFC28
- Sleep 100ms
- Writing 0x207C7F0C @ address 0xFFFFFC2C
- Sleep 100ms
- Writing 0x00000100 @ address 0xFFFFFC30
- Sleep 100ms
- Writing 0x00000102 @ address 0xFFFFFC30
- Sleep 10ms
- JTAG speed set to 9600 kHz
- Sleep 100ms
- Select flash device: AT91SAM9XE512
- Flash download enabled
- Loading section .vectors, size 0x6c lma 0x200000
- Loading section .exidx, size 0x608 lma 0x20006c
- Loading section .ARM.extab, size 0x5b0 lma 0x200674
- Loading section .internal_text, size 0xf3f8 lma 0x200c30
- Loading section .text, size 0x4d930 lma 0x210028
- Loading section .init_array, size 0xc lma 0x25d958
- Loading section .data, size 0x944 lma 0x301348
- Loading section .external_text, size 0xba058 lma 0x20000000
- Loading section .dma_buffers, size 0x400 lma 0x20f00000
- Start address 0x200ca0, load size 1148660
- Transfer rate: 53 KB/sec, 14917 bytes/write.
- (gdb) display /x $pc
- 1: /x $pc = 0x200ca0
- (gdb) display /x $sp
- 2: /x $sp = 0x0
- (gdb) i b
- No breakpoints or watchpoints.
- (gdb) si
- 133 ldr pc, =1f
- 2: /x $sp = 0x0
- 1: /x $pc = 0x200ca4
- (gdb)
- 159 ldr sp, =_sstack
- 2: /x $sp = 0x0
- 1: /x $pc = 0x200ca8
- (gdb)
- resetHandler () at board_cstartup.S:160
- 160 stmfd sp!, {r0}
- 2: /x $sp = 0x304000
- 1: /x $pc = 0x200cac
- (gdb)
- resetHandler () at board_cstartup.S:161
- 161 ldr r0, =LowLevelInit
- 2: /x $sp = 0x304000
- 1: /x $pc = 0x200cb0
- (gdb)
- 162 blx r0
- 2: /x $sp = 0x304000
- 1: /x $pc = 0x200cb4
- (gdb)
- 164 ldmfd sp!, {r0}
- 2: /x $sp = 0x304000
- 1: /x $pc = 0x200cb8
- (gdb)
- 178 ldr r0, =_szero
- 2: /x $sp = 0x304000
- 1: /x $pc = 0x200cbc
- (gdb) b 189
- Breakpoint 1 at 0x200cd4: file board_cstartup.S, line 189.
- (gdb) c
- Continuing.
- Breakpoint 1, resetHandler () at board_cstartup.S:189
- 189 msr CPSR_c, #ARM_MODE_IRQ | I_BIT | F_BIT
- 2: /x $sp = 0x304000
- 1: /x $pc = 0x200cd4
- (gdb) si
- 190 ldr sp, =_sstack
- 2: /x $sp = 0x304000
- 1: /x $pc = 0x200cd8
- (gdb)
- 191 sub r4, sp, #IRQ_STACK_SIZE
- 2: /x $sp = 0x304000
- 1: /x $pc = 0x200cdc
- (gdb) display /x $r4
- 3: /x $r4 = 0x0
- (gdb) print IRQ_STACK_SIZE
- No symbol "IRQ_STACK_SIZE" in current context.
- (gdb) si
- 194 msr CPSR_c, #ARM_MODE_SVC | F_BIT
- 3: /x $r4 = 0x0
- 2: /x $sp = 0x304000
- 1: /x $pc = 0x200ce0
- (gdb)
- 195 mov sp, r4
- 3: /x $r4 = 0x0
- 2: /x $sp = 0x304000
- 1: /x $pc = 0x200ce4
- (gdb)
- resetHandler () at board_cstartup.S:203
- 203 LDR r12,=__libc_init_array
- 3: /x $r4 = 0x0
- 2: /x $sp = 0x0
- 1: /x $pc = 0x200ce8
- (gdb)