Debugging Arduino sketch with STM32 Nucleo in Eclipse .. works !

Development environment specific, Arduino, Eclipse, VS2013,Em::Blocks etc
User avatar
RogerClark
Posts: 6917
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Debugging Arduino sketch with STM32 Nucleo in Eclipse .. works !

Post by RogerClark » Sun Sep 06, 2015 9:11 pm

Hi Michael

I think I made the dummy project correctly, but as you say, I must be missing some config.

The laptop I was using for testing did not have STM's STLink driver, but I have now installed this.

I will take another look this evening to see if I can figure out which paths are missing, but I have followed all of your instructions as far as I can tell.

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

Re: Debugging Arduino sketch with STM32 Nucleo in Eclipse .. works !

Post by michael_l » Mon Sep 07, 2015 7:28 pm

Yes, this is interesting. I don't remember setting those cross_prefix and cross_suffix variables anywhere. They must come within toolchain I think. Also where to find those variables under preferences or project settings is a bit of a mystery to me. Eclipse surely is a very nice IDE and there are many configuration options.

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

Re: Debugging Arduino sketch with STM32 Nucleo in Eclipse .. works !

Post by michael_l » Wed Sep 09, 2015 3:03 pm

Roger, did you have any time to test this further ?

I just received my first "blue pill" and St-Link V2 dongle (clone). I'll try how debugging works in next few days I believe.

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

Re: Debugging Arduino sketch with STM32 Nucleo in Eclipse .. works !

Post by michael_l » Wed Sep 09, 2015 7:49 pm

Just tried debugging with ST-Link V2 "Dongle" Mini Metal Shield and 'Blue Pill' and it works okay. I used STLINK for uploading and I don't have uploaded a bootloader.

For OpenOCD config I created a new file with this contents (thanks to Rick)

Code: Select all


# This is for the $4.29 ebay ST-Link V2 Mini Metal Shell and an stm32f103 board
# http://www.ebay.com/itm/251642538698

source [find interface/stlink-v2.cfg]

transport select hla_swd

set WORKAREASIZE 0x2000
source [find target/stm32f1x.cfg]

reset_config none
and pointed openOcd to use this file. It finds stlink-v2 dongle and connects to the board

ilg
Posts: 18
Joined: Tue Oct 06, 2015 5:10 pm
Location: Bucharest
Contact:

Re: Debugging Arduino sketch with STM32 Nucleo in Eclipse .. works !

Post by ilg » Fri Oct 09, 2015 7:25 am

RogerClark wrote:Anyway, lets hope the Eclipse team accept it as a bug and fix it.
I don't want to discourage you, but from my experience (I had to fix some CDT bugs in order for GNU ARM Eclipse plug-ins to work properly), both the Eclipse team and the CDT team accept mostly Gerrit patches, and it takes months to be accepted and integrated.

Could you provide a link to the bugzilla record?

Regards,

Liviu

robca
Posts: 54
Joined: Sat Nov 21, 2015 11:55 pm

Re: Debugging Arduino sketch with STM32 Nucleo in Eclipse .. works !

Post by robca » Tue Dec 22, 2015 10:44 am

I'm trying to install the full toolchain to debug. I've done everything, but I can't get the last step. The file http://www.megafileupload.com/54w6/ardu ... p-2015.zip has been removed from megaupload due to lack of activity

I tried using the xxx.cpp trick (admittedly with a slightly more complex project), but I'm getting a lot of compile errors in the last phase. So I wanted to use the modified IDE instead but, well :)

stevech
Posts: 441
Joined: Thu Aug 27, 2015 6:32 am

Re: Debugging Arduino sketch with STM32 Nucleo in Eclipse .. works !

Post by stevech » Tue Dec 22, 2015 3:25 pm

using what OS?

robca
Posts: 54
Joined: Sat Nov 21, 2015 11:55 pm

Re: Debugging Arduino sketch with STM32 Nucleo in Eclipse .. works !

Post by robca » Tue Dec 22, 2015 3:43 pm

Windows x64.... everything works when used normally, I simply need the modified Arduino IDE at this point, to create the right .elf file

User avatar
martinayotte
Posts: 1222
Joined: Mon Apr 27, 2015 1:45 pm

Re: Debugging Arduino sketch with STM32 Nucleo in Eclipse .. works !

Post by martinayotte » Tue Dec 22, 2015 4:01 pm

What do you mean by "create the right .elf file" ?
It is already generated in the /tmp folder, and from it, the .bin is created.
This mechanism is driven by commands and flags located in the platform.txt

robca
Posts: 54
Joined: Sat Nov 21, 2015 11:55 pm

Re: Debugging Arduino sketch with STM32 Nucleo in Eclipse .. works !

Post by robca » Tue Dec 22, 2015 4:08 pm

I'm referring to this:
Switch to Arduino IDE

enable 'Show verbose output during [x] compilation' from Arduino IDE

Now you have two choices:

1) Use regular Arduino IDE:
because of a bug in Eclipse Win32 IDE you have to make a small change in your .ino file. Without this step you won't be able to debug original .ino file. Let's say you have a sketch called blink.ino

for 'blink.ino' create blink2.cpp file (not blink.cpp)

copy contents of blink.ino into blink2.cpp

edit original blink.ino file so that it contains only this line: #include "C:\Program Files (x86)\Arduino\examples\01.Basics\myblink\myblink2.cpp" and add #include <Arduino.h> to the first line.

2) use modified Arduino IDE. Download link is here: http://www.megafileupload.com/54w6/ardu ... p-2015.zip. During compilation of .ino file it will remove #line directives from the .cpp that Arduino generates. #line directive generates reference to blink.ino file in the .elf and it seems to confuse Eclipse IDE (Win32 at least) so that it can't find the file. More about that in this thread.
In this post http://www.stm32duino.com/viewtopic.php ... t=60#p5475

Or has that problem been since fixed?

Post Reply