Cercherò di spiegare come sono riuscito a configurare il debugger Jtag.
I will try to explain how I managed to configure the JTAG debugger.
Youtube video : http://youtu.be/AAGP1Vnus58
Prerequisiti:
1)Sistema di sviluppo VrBrain (eclipse etc.) installato e funzionante
2)Il debugger Jtag OLIMEX ARM-USB-OCD-H
3)Cavo di collegamento debugger -> Vrbrain.
Prerequisites:1) System development VrBrain (eclipse etc.) Installed and running2) The JTAG debugger OLIMEX ARM-USB-OCD-H3) Connection cable for debugger -> Vrbrain.
Incominciamo dal cavo, il pin-out da seguire e il seguente :
Let's start from the cable, the pin-out to follow and the following:
VRBRAIN DeBugger
3V3 (01) --------------------- (01) VREF
GND (03) --------------------- (04) GND
GND (05) --------------------- (06) GND
GND (07) --------------------- (08) GND
GND (09) --------------------- (10) GND
TMS (02) --------------------- (07) TMS
TCK (04) --------------------- (09) TCK
TDO (06) --------------------- (13) TDO
TDI (08) --------------------- (05) TDI
TRST (10) --------------------- (03) TRST
Il secondo passaggio e configurare Eclipse per poter utilizzare il nostro debugger.
Per cui
1° HELP-->Install New Software installare dalla sorgente : Zylin - http://opensource.zylin.com/zylincdt il plugin Zylin Embedded CDT
2° Installare il pacchetto Olimex ODS IDE scaricabile dal sito olimex
3° Scaricare la verione 0.7 del OpenOCD dal sito http://www.freddiechopin.info/pl/download/category/4-openocd?download=99%3Aopenocd-0.7.0 (Questo perche le Openocd fornite da Olimex non sono aggiornate a questa versione che supporta il processore della vrbrain.)
4° Sconpattare il file appena scaricato nella cartella C:\OlimexODS\openocd-0.6.1 (Se avete mantenuto i path standard) in questo modo sfrutteremo le nuove librerie e file di configurazione della cpu.
5° Aggiungere al Path di sistema "C:\OlimexODS\openocd-0.6.1\scripts\chip\st\stm32"
The second step and configure Eclipse to use our debugger.whereby1° HELP -> Install New Software install from source: Zylin - http://opensource.zylin.com/zylincdt the plugin Zylin Embedded CDT2° Install the package Olimex ODS IDE downloaded from the website olimex3° Download the 0.7 version of OpenOCD from the site http://www.freddiechopin.info/pl/download/category/4-openocd?download=99 3Aopenocd-0.7.0
(This is because the OpenOCD provided by Olimex are not updated to this version that supports the processor vrbrain.)4° Unzip the file you just downloaded into the folder C:\OlimexODS\openocd-0.6.1 (If you kept the standard path) in this way we will use the new libraries and configuration files of the cpu.5° Add to System Path "C:\OlimexODS\openocd-0.6.1\scripts\chip\st\stm32"
Adesso Iniziamo a configurare il Debugger di Eclipse :
1° -->External Tool Configuretor
2° New Launch Configurator ... vi allego le immagini delle varie schermate e copiatevi i parametri.
Now begin to configure the Eclipse Debugger: 1° --> External Tool Configuretor2° New Launch Configurator ... I am attaching pictures of the various screens and copy the parameters.
3° Inpostiamo il Debug Configurator ... vi allego le immagini ... copiate i parametri.
3° Set the Debug Build ... I am attaching pictures ... copied parameters.
Initialize:
target remote localhost:3333
monitor reset halt
monitor wait_halt
monitor sleep 100
monitor poll
monitor flash protect 0 0 11 off
load build/laserlab_MP32V1F4.elf
monitor sleep 200
Run:
symbol-file build/laserlab_MP32V1F4.elf
monitor soft_reset_halt
monitor wait_halt
monitor poll
set breakpoint auto-hw on
info breakpoint
continue
4° Ora create nella directory C:\vr-universal-ide\workspaces\UF4_AP\ACopter32_2.7_Beta1_VRBRAIN un file project.cfg con il notepad il testo seguente
4° Now create the directory C:\vr-universal-ide\workspaces\UF4_AP\ACopter32_2.7_Beta1_VRBRAIN project.cfg a file with notepad the following
# Find the board config file in the scripts/board/ directory
gdb_memory_map enable
gdb_flash_program enable
source [find scripts/board/olimex_stm32_e407.cfg]
(per inciso questo file di conf richiama soltanto il scripts/target/stm32f4x.cfg che e quello che ci serve ... )
5° ora editiamo il file C:\OlimexODS\openocd-0.6.1\scripts\target\stm32f4x.cfg perchè i nostri amici di Openocd si sono dimenticati due volete un '3' ... quindi vi allego il testo del file da sostituire all originale
(this conf file only addresses the scripts/target/stm32f4x.cfg and that what we need ...)5° now edit the file C:\OlimexODS\openocd-0.6.1\scripts\target\stm32f4x.cfg because our friends OpenOCD they forgot two want a '3 '... then I am attaching the text of the file to be replaced to original
# script for stm32f4x family
if { [info exists CHIPNAME] } {
set _CHIPNAME $CHIPNAME
} else {
set _CHIPNAME stm32f4x
}
if { [info exists ENDIAN] } {
set _ENDIAN $ENDIAN
} else {
set _ENDIAN little
}
# Work-area is a space in RAM used for flash programming
# By default use 64kB
if { [info exists WORKAREASIZE] } {
set _WORKAREASIZE $WORKAREASIZE
} else {
set _WORKAREASIZE 0x10000
}
# JTAG speed should be <= F_CPU/6. F_CPU after reset is 8MHz, so use F_JTAG = 1MHz
#
# Since we may be running of an RC oscilator, we crank down the speed a
# bit more to be on the safe side. Perhaps superstition, but if are
# running off a crystal, we can run closer to the limit. Note
# that there can be a pretty wide band where things are more or less stable.
adapter_khz 1000
adapter_nsrst_delay 100
jtag_ntrst_delay 100
#jtag scan chain
if { [info exists CPUTAPID] } {
set _CPUTAPID $CPUTAPID
} else {
# See STM Document RM0090
# Section 32.6.2 - corresponds to Cortex-M4 r0p1
set _CPUTAPID 0x4ba00477
}
jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID
if { [info exists BSTAPID] } {
set _BSTAPID $BSTAPID
} else {
# See STM Document RM0090
# Section 32.6.3
set _BSTAPID 0x06413041
}
jtag newtap $_CHIPNAME bs -irlen 5 -expected-id $_BSTAPID
set _TARGETNAME $_CHIPNAME.cpu
target create $_TARGETNAME cortex_m3 -endian $_ENDIAN -chain-position $_TARGETNAME
$_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0
set _FLASHNAME $_CHIPNAME.flash
flash bank $_FLASHNAME stm32f2x 0 0 0 0 $_TARGETNAME
# if srst is not fitted use SYSRESETREQ to
# perform a soft reset
cortex_m3 reset_config sysresetreq
OK FINITO!
OK FINISHED!
Ora per fare il debug lanciate dal menu di eclipse "external Tool" la configurazione creata prima con il nome ARM-USB-OCD-H, ricordatevi che il debugger deve essere collegato alla vr-brain sul connettore jtag, la vrbrain deve essere alimentata ... e il ponticello per entrare nella modalità "download firmware" non deve essere rimosso.
Fatto questo lanciate da Eclipse il debugger STM32 che abbiamo creato prima e voilà ... compilazione del codice, creazione del file, download del firmware su vrbrain, reset tutto in automatico .... e ... buon debug a tutti.
P.s I breakpoint non si possono mettere nei file arduino .pde ... per ora io sto inserendo i breakpoint nella main.cpp che e un file cpp nativo e che viene generato in automatico dal make ... in pratica unisce in un unico file tutt i file arduino. Messi li i breakpoint funzionano correttamente e potete interrompere dove volete l'esecuzione della vrbrain e controllarvi le variabili etc.
Con l'ausilio di Roberto e Emile stiamo cercando di ovviare al problema.
Now to debug launch menu eclipse "external tool" created before the configuration with the name ARM-USB-OCD-H, remember that the debugger must be connected to the JTAG connector on the vr-brain, the vrbrain must be supplied. .. and the bridge to enter the mode "download firmware" should not be removed.Once this is done run the debugger from Eclipse STM32 we created earlier and voila ... compiling your code, create the file, download the firmware on vrbrain, reset all automatically .... and ... good debugging at all.Ps. you can not put breakpoints in files arduino. Pde ... for now I'm inserting breakpoints in the cpp file main.cpp which is a native that is generated automatically by the make ... in practice combines into a single file tall files arduino. In this way the breakpoints work properly and you can stop where you want the execution and control you vrbrain and variables etc..With the help of Emile and Roberto we are trying to remedy the problem.