Difference between revisions of "Dev/Debugging"
Jump to navigation
Jump to search
P0rc0 r0ss0 (talk | contribs) |
|||
Line 6: | Line 6: | ||
#: To program the Lisa/L board run the command | #: To program the Lisa/L board run the command | ||
#:<pre>openocd -f interface/lisa-l.cfg -f board/lisa-l.cfg</pre> | #:<pre>openocd -f interface/lisa-l.cfg -f board/lisa-l.cfg</pre> | ||
#:or if your path is not set properly | |||
#:<pre>cd /opt/paparazzi/stm32/share/openocd/scripts/; /opt/paparazzi/stm32/bin/openocd -f interface/lisa-l.cfg -f board/lisa-l.cfg</pre> | |||
#: To program the Lisa/M board via JTAG change dir to "<paparazzi root>/arm-multilib/share/openocd/scripts", and run the command: | #: To program the Lisa/M board via JTAG change dir to "<paparazzi root>/arm-multilib/share/openocd/scripts", and run the command: | ||
#:<pre>openocd -f interface/flossjtag.cfg -f board/lisa-l.cfg</pre> | #:<pre>openocd -f interface/flossjtag.cfg -f board/lisa-l.cfg</pre> | ||
Line 11: | Line 13: | ||
#: If you programmed with the ap target then the command would be along the lines of | #: If you programmed with the ap target then the command would be along the lines of | ||
#:<pre>arm-none-eabi-gdb var/<airframe>/ap/ap.elf</pre> | #:<pre>arm-none-eabi-gdb var/<airframe>/ap/ap.elf</pre> | ||
#:or | |||
#:<pre>/opt/paparazzi/stm32/bin/arm-none-eabi-gdb ./var/<airframe>/ap/ap.elf</pre> | |||
#: Replace <airframe> with the name of the airframe that has been built. | #: Replace <airframe> with the name of the airframe that has been built. | ||
# Now connect GDB to the board | # Now connect GDB to the board |
Revision as of 03:23, 24 November 2011
Introduction
GDB can be used for debugging the code on the boards.
Procedure
- Start openocd in a new shell since this process needs to remain running.
- To program the Lisa/L board run the command
openocd -f interface/lisa-l.cfg -f board/lisa-l.cfg
- or if your path is not set properly
cd /opt/paparazzi/stm32/share/openocd/scripts/; /opt/paparazzi/stm32/bin/openocd -f interface/lisa-l.cfg -f board/lisa-l.cfg
- To program the Lisa/M board via JTAG change dir to "<paparazzi root>/arm-multilib/share/openocd/scripts", and run the command:
openocd -f interface/flossjtag.cfg -f board/lisa-l.cfg
- Start GDB with an argument of the elf file created and uploaded to the board.
- If you programmed with the ap target then the command would be along the lines of
arm-none-eabi-gdb var/<airframe>/ap/ap.elf
- or
/opt/paparazzi/stm32/bin/arm-none-eabi-gdb ./var/<airframe>/ap/ap.elf
- Replace <airframe> with the name of the airframe that has been built.
- Now connect GDB to the board
target remote localhost:3333
- Now we need to set some break points in the code.
- In this example the ap target was part of the rotorcraft and main.c contains the main program. Open rotorcraft sw/airborne/firmwares/rotorcraft/main.c and find a line at which you'd like to set a break point.
break main.c:113
- Stop the currently running code
monitor reset halt
- Reset the code back to the start
monitor reset init
- We probably want to ignore the interrupt calls for the moment so we can step through the code as it's being called. Note that we don't always want to do this.
monitor cortex_m3 maskisr on
- Now we can run the program which will stop at the break point we set.
continue
Useful commands
- A stack trace can be printed with the command
bt