OpenOCD

From air
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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

Pour compléter