Difference between revisions of "OpenOCD"
ChristopheH (talk | contribs) |
|||
(8 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
+ | |||
⚫ | |||
+ | '''Open On-Chip Debugger''' |
||
+ | |||
+ | |||
+ | ''Free and Open On-Chip Debugging, In-System Programming and Boundary-Scan Testing'' |
||
+ | |||
⚫ | |||
+ | |||
+ | =Pré-requis= |
||
+ | |||
+ | Disposer d'une board et d'un programmateur JTAG/SWD supportés par OpenOCD : par exemple, un [[STM32 Nucleo]] L152RE (qui inclut le programmateur ST-Link v2 |
||
+ | |||
+ | Télécharger la distribution d'OpenOCD pour votre OS (Win, Mac, Debian): |
||
+ | * http://openocd.sourceforge.net/ |
||
+ | * http://openocd.sourceforge.net/supported-jtag-interfaces/ |
||
+ | |||
+ | =Installation= |
||
+ | |||
+ | Suivre les consignes suivantes http://gnuarmeclipse.livius.net/blog/openocd-install/ |
||
+ | |||
+ | Remarque : Installer le driver du programmateur utilisé |
||
+ | |||
+ | =Premiers Pas= |
||
+ | |||
+ | Sur MacOS |
||
+ | <pre> |
||
+ | cd /Applications/GNU\ ARM\ Eclipse/OpenOCD/0.9.0-201505191004/ |
||
+ | |||
+ | bin/openocd --help |
||
+ | |||
+ | ls scripts/board/ |
||
+ | </pre> |
||
+ | |||
+ | Brancher la board sur le port USB de la machine |
||
+ | <pre> |
||
+ | bin/openocd --file scripts/board/st_nucleo_l1.cfg |
||
+ | </pre> |
||
+ | |||
+ | Aller sur https://developer.mbed.org/compiler pour récupérer un programme de test Nucleo_blink_led_NUCLEO_L152RE.bin compilé pour votre carte. |
||
+ | |||
+ | <pre> |
||
+ | bin/openocd \ |
||
+ | -f scripts/interface/stlink-v2-1.cfg \ |
||
+ | -f scripts/board/st_nucleo_l1.cfg \ |
||
+ | -c "init" \ |
||
+ | -c "reset init" \ |
||
+ | -c "halt" \ |
||
+ | -c "flash write_image erase Nucleo_blink_led_NUCLEO_L152RE.bin 0x08000000" \ |
||
+ | -c "shutdown" |
||
+ | </pre> |
||
+ | |||
+ | C'est fini ! |
||
+ | |||
+ | Remarque: les commandes peuvent être aussi placées dans un fichier de script: |
||
+ | <pre> |
||
+ | init |
||
+ | reset init |
||
+ | halt |
||
+ | flash write_image erase Nucleo_blink_led_NUCLEO_L152RE.bin 0x08000000 |
||
+ | shutdown |
||
+ | </pre> |
||
+ | |||
+ | <pre> |
||
+ | bin/openocd \ |
||
+ | -f scripts/interface/stlink-v2-1.cfg \ |
||
+ | -f scripts/board/st_nucleo_l1.cfg \ |
||
+ | -f myscript.cfg |
||
+ | </pre> |
||
+ | |||
+ | =Debug avec GDB et OpenOCD= |
||
+ | Voir chaiptre 22 du manuel |
||
+ | |||
+ | =Pour compléter= |
||
+ | * https://balau82.wordpress.com/2014/11/11/st-nucleo-f103rb-works-with-openocd-0-8-0/ |
||
+ | * [[libopencm3]] https://balau82.wordpress.com/2015/04/19/libopencm3-on-stm32-nucleo-board/ |
Latest revision as of 10:05, 1 June 2015
Open On-Chip Debugger
Free and Open On-Chip Debugging, In-System Programming and Boundary-Scan Testing
Ce logiciel permet de piloter des sondes matérielles (principalement de type JTAG ou SWD) et un contrôle précis de microcontrolleur.
Pré-requis
Disposer d'une board et d'un programmateur JTAG/SWD supportés par OpenOCD : par exemple, un STM32 Nucleo L152RE (qui inclut le programmateur ST-Link v2
Télécharger la distribution d'OpenOCD pour votre OS (Win, Mac, Debian):
Installation
Suivre les consignes suivantes http://gnuarmeclipse.livius.net/blog/openocd-install/
Remarque : Installer le driver du programmateur utilisé
Premiers Pas
Sur MacOS
cd /Applications/GNU\ ARM\ Eclipse/OpenOCD/0.9.0-201505191004/ bin/openocd --help ls scripts/board/
Brancher la board sur le port USB de la machine
bin/openocd --file scripts/board/st_nucleo_l1.cfg
Aller sur https://developer.mbed.org/compiler pour récupérer un programme de test Nucleo_blink_led_NUCLEO_L152RE.bin compilé pour votre carte.
bin/openocd \ -f scripts/interface/stlink-v2-1.cfg \ -f scripts/board/st_nucleo_l1.cfg \ -c "init" \ -c "reset init" \ -c "halt" \ -c "flash write_image erase Nucleo_blink_led_NUCLEO_L152RE.bin 0x08000000" \ -c "shutdown"
C'est fini !
Remarque: les commandes peuvent être aussi placées dans un fichier de script:
init reset init halt flash write_image erase Nucleo_blink_led_NUCLEO_L152RE.bin 0x08000000 shutdown
bin/openocd \ -f scripts/interface/stlink-v2-1.cfg \ -f scripts/board/st_nucleo_l1.cfg \ -f myscript.cfg
Debug avec GDB et OpenOCD
Voir chaiptre 22 du manuel