Debug VRbrain con ARM-USB-OCD-H by Olimex

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.whereby HELP -> Install New Software install from source: Zylin - http://opensource.zylin.com/zylincdt the plugin Zylin Embedded CDT 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.) 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. 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:  --> External Tool Configuretor New Launch Configurator ... I am attaching pictures of the various screens and copy the parameters.

12232299456?profile=original

 

12232299289?profile=original

 

 

 

3° Inpostiamo il Debug Configurator ... vi allego le immagini ... copiate i parametri.

 Set the Debug Build ... I am attaching pictures ... copied parameters.

 

12232299856?profile=original

 

 

 

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

 

12232300658?profile=original12232300854?profile=original12232300886?profile=original4° 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

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 ...) 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.

 

 

E-mail me when people leave their comments –

You need to be a member of FOXTEAM UAV CLAN to add comments!

Join FOXTEAM UAV CLAN

Comments

  • Bene bene.

    Sono riuscito a preparare l'ambiente per il debug sia con Olimex che ST_Link. Driver installati correttamente, lanciati i due External tools (senza aver collegato la VRB), make all eseguito con successo ed infine la consolle mi dice che li vede ma non vede ("Polling target" continuo con Olimex e "Target voltage too low" con ST-Link) la scheda con il suo procio. Ora mi devo costruire un adattatore da 20 a 10 pin per collegare JTAG alla VRB e ci dovrei essere.

  • Sto seguendo questo tutorial, che ti ringrazio immensamente di aver pubblicato, per fare debug con VRBrain ed ho alcune domande da fare:

    1. Nel  tutorial scrivi "Installare il pacchetto Olimex ODS IDE scaricabile dal sito olimex" che è praticamente un ambiente eclipse completo con esempi. Hai usato questo ambiente per il tutorial e per la compilazione (uno dei prerequisiti che indichi è di avere il "Sistema di sviluppo VrBrain (eclipse etc.) installato e funzionante"  il che significa un altro ambiente eclipse +compilatore +debugger) ?
    2. Ci sono differenze tra questi due ambienti di sviluppo e quale consiglieresti?
    3. Nel caso volessi utilizzare il sistema di sviluppo fornito da VRobotix, visto che è gia tutto impostato ma ha la versione 6.0 di openOCD, posso eseguire le impostazioni come da tutorial sostituendo il debugger presente con la versione 7 che consigli di scaricare.

    Se riesco a far girare l'ambiente di debug con Olimex ARM-USB-OCD-H (e magari anche con ST-Link V2) ti meriti una cassa di birra, non una birra qualsiasi ma di quella che produco io, all-grain e ben luppolata.  ;-)

  • Ho trovato una migliore configurazione per settare i breakpoint.

    Nella sezione INITIALIZE:

     

    target remote localhost:3333
    monitor reset halt
    monitor wait_halt
    monitor sleep 100
    monitor poll
    monitor flash protect 0 0 11 off
    monitor flash erase_sector 0 0 11
    monitor flash write_image "C:/vr-universal-ide/workspaces/UF4_AP/vrbrain/Acopter32-STM32F4/build/laserlab_MP32V1F4.elf" 0 elf
    monitor sleep 200

     

    Mentre nella sezione RUN:

     

    symbol-file  build/laserlab_MP32V1F4.elf
    monitor soft_reset_halt
    monitor wait_halt
    monitor poll
    set breakpoint auto-hw off
    set can-use-hw-watchpoints 0
    info breakpoint

This reply was deleted.

Blog Topics by Tags

Monthly Archives