CodeBlocks as debugging IDE with STM32Duino

Development environment specific, Arduino, Eclipse, VS2013,Em::Blocks etc
michael_l
Posts: 219
Joined: Mon Aug 24, 2015 6:11 pm

Re: CodeBlocks as debugging IDE with STM32Duino

Postby michael_l » Sat Jul 30, 2016 8:15 pm

Thanks! I'll try this in near future and let you know. So would you say that Eclipse offerw more 'debugging' capabilities (register windows etc) than CodeBlocks/EmIde ?

User avatar
Slammer
Posts: 241
Joined: Tue Mar 01, 2016 10:35 pm
Location: Athens, Greece

Re: CodeBlocks as debugging IDE with STM32Duino

Postby Slammer » Sat Jul 30, 2016 8:51 pm

I don't think that Eclipse offers more debugging capabilities than Codeblocks. Both systems support standard gdb. Embiz is a bit different, it is Codeblocks with some plugins dedicated to embedded development.
Actually, I am using codeblocks for many years as my professional development IDE for developing linux embedded systems (same sources, different architectures), and I am very familiar with it, this is the main reason for me, to use it for stm32 development.
Codeblocks is small and fast, with very good editor (code completion, symbol browser etc) and a versatile build system. Except from its own build system supports plain makefiles. I tried eclipse, but it is very slow in my machines....


FYI, Here are the links for programs used:
Arm toolchains : https://launchpad.net/gcc-arm-embedded
Code::Blocks : http://www.codeblocks.org/downloads/binaries
OpenOCD : https://sourceforge.net/projects/openoc ... rce=navbar
STM32 Codeblocks library project and Templates for halmx/mbed (I will try to make one for arduino_stm32) : https://github.com/evark/cbp-mbed & https://github.com/evark/cbp-halmx

zmemw16
Posts: 986
Joined: Wed Jul 08, 2015 2:09 pm
Location: St Annes, Lancs,UK

Re: CodeBlocks as debugging IDE with STM32Duino

Postby zmemw16 » Sun Jul 31, 2016 7:42 pm

quick tip, took longer for the "whats's it looking for?" thought to occur :D
change the executable names from arm-elf-xyz to arm-none-eabi-xyz
cb-setup.png
cb-setup.png (105.94 KiB) Viewed 388 times


srp

michael_l
Posts: 219
Joined: Mon Aug 24, 2015 6:11 pm

Re: CodeBlocks as debugging IDE with STM32Duino

Postby michael_l » Wed Aug 03, 2016 10:42 am

Installed CodeBlocks but I'm currently having problems with OpenOCD. I suspect some problems with USB Driver library it uses. I'm not exactly sure what

Code: Select all

USB Driver should be installed for ST Link V2-1 under windows.

C:\Program Files (x86)\STMicroelectronics\STM32 ST-LINK Utility\ST-LINK Utility>ST-LINK_CLI.exe -c
STM32 ST-LINK CLI v2.5.0
STM32 ST-LINK Command Line Interface

ST-LINK SN : 0671FF485452785087212719
ST-LINK Firmware version : V2J27M15
Connected via SWD.
SWD Frequency = 4000K.
Target voltage = 3.2 V.
Connection mode : Normal.
Device ID:0x410
Device flash Size : 128 Kbytes
Device family :STM32F10xx Medium-density


The device is there but... openocd can't connect. Sometimes I just hate wasting my time with Windows and various driver problems.

Code: Select all

C:\Program Files (x86)\GNU ARM Eclipse\OpenOCD\0.9.0-201505190955\bin>openocd.exe -f ..\scripts\board\st_nucleo_f103rb.cfg
GNU ARM Eclipse 32-bits Open On-Chip Debugger 0.9.0-00073-gdd34716-dirty (2015-05-19-09:56)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 1000 kHz
adapter_nsrst_delay: 100
none separate
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : clock speed 950 kHz
Error: open failed
in procedure 'init'
in procedure 'ocd_bouncer'

User avatar
Slammer
Posts: 241
Joined: Tue Mar 01, 2016 10:35 pm
Location: Athens, Greece

Re: CodeBlocks as debugging IDE with STM32Duino

Postby Slammer » Wed Aug 03, 2016 10:56 am

Try binaries from here: http://gnuarmeclipse.github.io/openocd/install/

PS: probably you are already using these binaries....

michael_l
Posts: 219
Joined: Mon Aug 24, 2015 6:11 pm

Re: CodeBlocks as debugging IDE with STM32Duino

Postby michael_l » Wed Aug 03, 2016 10:58 am

Slammer wrote:Try binaries from here: http://gnuarmeclipse.github.io/openocd/install/

PS: probably you are already using these binaries....


Thanks, I'll check it.

michael_l
Posts: 219
Joined: Mon Aug 24, 2015 6:11 pm

Re: CodeBlocks as debugging IDE with STM32Duino

Postby michael_l » Wed Aug 03, 2016 11:39 am

michael_l wrote:
Slammer wrote:Try binaries from here: http://gnuarmeclipse.github.io/openocd/install/

PS: probably you are already using these binaries....


Thanks, I'll check it.


No, it didn't help. I'll try tonight with another PC. ST-Link works so the problem has to be in OpenOCD? This has worked before so I'm not sure what has changed in this computer..

Image

Code: Select all

Debug: 247 915 transport.c:240 handle_transport_init(): handle_transport_init
Debug: 248 918 hla_transport.c:154 hl_transport_init(): hl_transport_init
Debug: 249 921 hla_transport.c:171 hl_transport_init(): current transport hla_swd
Debug: 250 924 hla_interface.c:44 hl_interface_open(): hl_interface_open
Debug: 251 926 hla_layout.c:42 hl_layout_open(): hl_layout_open
Debug: 252 928 stlink_usb.c:1602 stlink_usb_open(): stlink_usb_open
Debug: 253 931 stlink_usb.c:1619 stlink_usb_open(): transport: 1 vid: 0x0483 pid: 0x374b serial:
Error: 254 1207 stlink_usb.c:1632 stlink_usb_open(): open failed
Debug: 255 1209 hla_layout.c:49 hl_layout_open(): failed
Debug: 256 1211 command.c:628 run_command(): Command failed with error code -4
User : 257 1214 command.c:689 command_run_line(): in procedure 'init'
in procedure 'ocd_bouncer'
Debug: 258 1218 command.c:628 run_command(): Command failed with error code -4
User : 259 1221 command.c:689 command_run_line():
Debug: 260 1223 hla_interface.c:119 hl_interface_quit(): hl_interface_quit

C:\Program Files (x86)\GNU ARM Eclipse\OpenOCD\0.9.0-201505190955\bin>

michael_l
Posts: 219
Joined: Mon Aug 24, 2015 6:11 pm

Re: CodeBlocks as debugging IDE with STM32Duino

Postby michael_l » Wed Aug 03, 2016 4:51 pm

Got it working with BP.

EDIT: seems to work okay! Couldn't find global variables though..

Anyway. I added these in 'Additional GDB commands'

load <file.elf>
symbol-file <file.elf>

And in debuuger search dirs I added build folder from Arduino IDE and some folder from STM32F1/cores

Image

User avatar
Slammer
Posts: 241
Joined: Tue Mar 01, 2016 10:35 pm
Location: Athens, Greece

Re: CodeBlocks as debugging IDE with STM32Duino

Postby Slammer » Wed Aug 03, 2016 7:40 pm

Open Variables window (watch) on Debug session... below Local variables in an empty cell, write the Global's variable name, it should work....

PS: I compile the sources with -ggdb flag, I think this helps because the debug info are oprimised for gdb.... (use also -Og optimization for better debug experience)

michael_l
Posts: 219
Joined: Mon Aug 24, 2015 6:11 pm

Re: CodeBlocks as debugging IDE with STM32Duino

Postby michael_l » Wed Aug 03, 2016 8:23 pm

Slammer wrote:Open Variables window (watch) on Debug session... below Local variables in an empty cell, write the Global's variable name, it should work....

PS: I compile the sources with -ggdb flag, I think this helps because the debug info are oprimised for gdb.... (use also -Og optimization for better debug experience)


Yes, it works now. Thanks! CB is very nice and fast IDE.

I currently use Arduino IDE for compiling so I'd have to change it there somewhere? But it seems current build parameters produce files with good debugging info so no need to change that.


Return to “IDE's”

Who is online

Users browsing this forum: No registered users and 1 guest