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

Development environment specific, Arduino, Eclipse, VS2013,Em::Blocks etc
User avatar
martinayotte
Posts: 1171
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 6:24 pm

Ah ! I see ...
No, the issue still probably there.
Did you try what Roger tried, ie : having a *.ino only to include a *.cpp and having all the code itself into the *.cpp ?

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 11:25 pm

Yes, I tried... but I'm getting a lot of compile errors, and it's really clunkier than the modified IDE and a worse workflow. So I decided to ask (why make an effort when you can ask instead :)) and see if I can find the modified IDE. I hope someone downloaded a copy and is open to share

BTW: Michael's writeup is really good, I would suggest adding it to the SMT32duino wiki. I read all the wiki, and kept wondering how I could debug. Sure, people can find it by searching the forum, but if proven to work, Michael's writeup deserves to be in the wiki, imho

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

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

Post by stevech » Wed Dec 23, 2015 12:38 am

robca wrote:Windows x64.... everything works when used normally, I simply need the modified Arduino IDE at this point, to create the right .elf file
Why not use Visual Micro? Supports Arduino's concept for compiling. Supports ARM Cortex targets. It is a plugin to the free Visual Studio which IMO is the best IDE there is.
And both are free. But WIndows-only.
No tool fighting. Just use the install wizard and it works in 10 minutes. Intuitive.

I suffered a year working with Eclipse every day on a project. When that ended, I gladly stopped wearing the Eclipse shoes-with-rocks.

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

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

Post by robca » Wed Dec 23, 2015 2:33 pm

stevech wrote:
robca wrote:Windows x64.... everything works when used normally, I simply need the modified Arduino IDE at this point, to create the right .elf file
Why not use Visual Micro? Supports Arduino's concept for compiling. Supports ARM Cortex targets. It is a plugin to the free Visual Studio which IMO is the best IDE there is.
And both are free. But WIndows-only.
No tool fighting. Just use the install wizard and it works in 10 minutes. Intuitive.

I suffered a year working with Eclipse every day on a project. When that ended, I gladly stopped wearing the Eclipse shoes-with-rocks.
I'd be happy to try, but... does it support OCD or any other debugger that uses STLink? from the docs I saw, it only supports a "USB debugger" that inserts code for each breakpoint, and no real debugging (memory, variables, single stepping, etc)

The only reason why I'm doing all this is to use ST Link as a debugger, otherwise I'm not keen on Eclipse either :)

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

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

Post by stevech » Wed Dec 23, 2015 7:26 pm

robca wrote:
stevech wrote:
robca wrote:Windows x64.... everything works when used normally, I simply need the modified Arduino IDE at this point, to create the right .elf file
Why not use Visual Micro? Supports Arduino's concept for compiling. Supports ARM Cortex targets. It is a plugin to the free Visual Studio which IMO is the best IDE there is.
And both are free. But WIndows-only.
No tool fighting. Just use the install wizard and it works in 10 minutes. Intuitive.

I suffered a year working with Eclipse every day on a project. When that ended, I gladly stopped wearing the Eclipse shoes-with-rocks.
I'd be happy to try, but... does it support OCD or any other debugger that uses STLink? from the docs I saw, it only supports a "USB debugger" that inserts code for each breakpoint, and no real debugging (memory, variables, single stepping, etc)

The only reason why I'm doing all this is to use ST Link as a debugger, otherwise I'm not keen on Eclipse either :)
this is a question of (free) Visual Studio more than Visual Micro. MS has of late greatly expanded support for embedded targets. But I've not used SWD with this. I use IAR (licensed, but they have a free 32KB limited license). Then there's Visual GDB - not free. It might support SWD debugging. And there's Atollic, now free. It too may support SWD.

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

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

Post by robca » Wed Dec 23, 2015 11:50 pm

Atollic seems promising, and even the free edition seems to support SWD. I'll give it a try tomorrow, thanks for the pointer

Meanwhile, if anyone can find the modified IDE, please post a note here :)

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

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

Post by zmemw16 » Thu Dec 24, 2015 12:26 am

the odd site and books i've looked in say to export from as truestudio from CubeMX if arm-gcc compiler is to be used.
some other actions are also needed, such as to how the files or libraries are copied or not.
srp

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

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

Post by robca » Fri Dec 25, 2015 2:38 pm

To close the loop: I figured out how to use the rick of having an empty *.INO and use a *.CPP of the same name to hold the code. I kept getting a meaningless error "multiple definition" for every function. The trick is to:

create an empty *.ino with only an include to a *.h with the same name and a 2 added to the end (i.e. foo.ino, foo2.h, foo2.cpp). In that *.h file you need to "declare" the function that you will call from the *.ino

i.e. the foo.ino file will have:

#include "<full path>foo2.h"
void setup() {
// put your setup code here, to run once:
}

void loop() {
// put your main code here, to run repeatedly:
foomain();
}

foo2.h will have

void foomain(void); (or whatever parameters the function uses)

and foo2.cpp will contain your foomain() function plus anything else you need

At this point Michael's instructions will allow you to use Eclipse+OpenOCD+STLink to debug your code in the device. I'm still struggling to wrap my head around Eclipse's quirks and its debugger interface

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

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

Post by zmemw16 » Fri Dec 25, 2015 3:40 pm

out of curiosity i tried these files 1.6.5r5 andarduino_stm32 from 111215
so i created the files foo.ino, foo2.h & foo2.cpp as in attachment
well it compiles and didn't stop after error was printed
this is for a maple mini
haven't tried running it either:D
Attachments
foo.tar.gz
(1.31 KiB) Downloaded 12 times

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

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

Post by michael_l » Sun Jan 03, 2016 6:47 pm

Found the modified ide zip. Please save and share this:

http://phenoboy.kapsi.fi/arduino-02-Sep-2015.zip

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest