gdb - Need help debugging my bare metal Cortex-m3 system -
i trying setup bare-metal environment cortex-m3. first hands-on arm. hardware-wise, using stm32l-discovery board. toolchain-wise, using gnu toolchain (found on internet, readily-compiled win7). debuggin-wise, using gnu gdb (insight) , openocd on st_link on discovery kit.
a brief explanation of trying on m3... trying write startup routine in assembly, low-level initialisation in c , main() routine in c. write linker script myself. purposes of doing these go low-level , understand basics...
the system initialisation routines (clock setup, core voltage setup etc) using c file generated clock tool provided stmicroelectronics.
attached zip: source/object files here
startup.s:
- setup vector table in rom.
- reset_handler branch lowlevelinit.c
- after return lowlevelinit(), carry out copying of code/data rom ram.
- after finish rom2ram copy, branch main
lowlevelinit.c:
- setup vector table in ram.
- call systeminit() setup clock , core voltage.
- remap memory prepare running of main code ram
main.c:
- setup gpio port b output mode
- set pb6 , pb7 1 turn on leds attached
- go endless loop
the compilation , linking went ok , return no errors.. did objdump on .elf , sections address looked ok.
i use objcopy .hex elf , flashed hex board using stm32 st-link utility , downloading looks ok.
however, on reset, leds still off... :(
when try debug using gdb-insight , openocd. openocd can connect board. insight can connect openocd gdb server.
but not know how proceed here debug program... did 'load' in gdb-console , realised 'start address' odd value (0x80000f7)!!
i realised .rambss output section (.bss equivalent) has got lma automatically set vma (ram)... how set section vma-only?
i have attached files on zip , hope kind answer of queries , take little time debug program...
the start address in insight location set in linker script @ entry(location)?? showing odd-value address because reset_handler .thumb_func??
i know how use insight debug on simulator mode in general when connect insight physical board, , load elf board, how insight sync free-running board? how insight halt board @ entry(location) after board power up?
thank much
Comments
Post a Comment