Generic STM32F103 + Eclipse

escarneiro
Sun Apr 16, 2017 9:37 pm
Hello all

I’m trying to code something for this generic STM32F103 – known as blue pill – thru eclipse + arm plugins +openocd and a generic STLink V2

Well, I couldn’t make it work. I’ve followed the steps listed here, I have set the parameteres for opencd as: -f hinterface/stlink-v2.cfg -f target/stm32f1x.cfg

Then, the debugger starts, the stlink starts blinks (and doesn’t stop blinking until I stop the debugger) but nothing else happens. No messages are displayed in console, no variables are shown in debugger windows, and it doesn’t stop running too.

The STlink dongle is working pretty well with arduino ide. So I guess I have no hardware problems here.

Did anyone out there succeded in using eclipse+blue pill ? Please tell me how.


Pito
Sun Apr 16, 2017 10:27 pm
Search in this forum. A lot of stuff to find on Eclipse..

sheepdoll
Sun Apr 16, 2017 11:32 pm
I think the OP is looking for blue pill specific stuff. I did not answer as I use Nucleo and Discovery boards.

It is best to install the minimal eclipse, then add the CDT, GDB and other support. Using the package installers brings over a lot of extra stuff.

Eclipse has a lot of options, there are at least three different ways to use STM32 with it.

1) AC6 Software workbench. This is best for pure code using ST’s CUBEMX and the HAL Libraries. This is not really Arduino friendly.

2) makefiles. Point the Eclipse at the Arduino cross compilers. Point the GDB tools at the ST link interface. Either hand edit a make file or use a scripting language like Python or postscript to create the make file. The tricky part is getting the source tree set up so that eclipse does not complain about a zillion pre-processing errors in the Arduino core.

3) install an eclipse Arduino environment. I have not tried that one. Supposedly it allows for use of the .ino sketch folders and the processing pre-processor.

There are probably others.

The biggest issue with eclipse is that projects are kept in private workspaces. These in turn contain copies if the code, so it makes for having files outside the eclipse/git SCM to be problematic. Eclipse also tends to use these copies for the pre-processor checks and expects a nice orderly project source tree. I had to do a lot of hacking of the project XML as I got tired of typing the same file paths over and over into the project options menus, half the time which I can not find.

The next issue is the linker scripts. If your linker script does not match the IDE, then you get exceptions at the code start and the board just hangs. The linker script is where the reset vectors and the code blocks are stored. It works with the assembly .S file to place the code modules into the right places. More confusing is there is a difference between .s files and .S file as these are case sensitive.

Also watch for the SWD pins being disabled after the code is loaded. This one got me a few times.

It may be the way I set up GDB in eclipse, a lot of the time I have to telnet/ssh into the GDB server and kill it as the eclipse does not seem to terminate it. Especially after a reset vector hang.


Rick Kimball
Mon Apr 17, 2017 1:00 am
opencd as: -f hinterface/stlink-v2.cfg -f target/stm32f1x.cfg

? shouldn’t that be -f interface/stlink-v2.cfg


escarneiro
Mon Apr 17, 2017 2:23 am
Rick Kimball wrote:opencd as: -f hinterface/stlink-v2.cfg -f target/stm32f1x.cfg

? shouldn’t that be -f interface/stlink-v2.cfg


stevestrong
Mon Apr 17, 2017 7:32 am
Maybe it works, just that you have no sources linked to debug interface.
So it may have something to do with project settings.
Alternatively, you may try to combine PlatformIO with Eclipse.

escarneiro
Mon Apr 17, 2017 1:05 pm
sheepdoll wrote:

Also watch for the SWD pins being disabled after the code is loaded. This one got me a few times.


sheepdoll
Mon Apr 17, 2017 5:58 pm
escarneiro wrote:

Could you say more about that? How do someone enable or disable the swd pins ?

Pito
Mon Apr 17, 2017 6:09 pm
Could you say more about that? How do someone enable or disable the swd pins ?
-DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1

ag123
Mon Apr 17, 2017 9:07 pm
hi i’m using gnu-arm-eclipse

note that the in the f103 codes, there is this particular define CONFIG_MAPLE_MINI_NO_DISABLE_DEBUG
if you do not set this define, the jtag and maybe swd pins would be disabled. hence you can’t connect via swd/jtag

this is used in the variant files e.g. STM32F1/variants/maple_mini/board.cpp
/* Since we want the Serial Wire/JTAG pins as GPIOs, disable both SW
* and JTAG debug support, unless configured otherwise. */
void boardInit(void) {
#ifndef CONFIG_MAPLE_MINI_NO_DISABLE_DEBUG
disableDebugPorts();
#endif
}


goran.mahovlic
Fri Jun 09, 2017 11:55 am
I got eclipse working for bluepill and can debug it with st-link v2

I can send you my settings or something so you could try.

Do you get some error from gdb or it just hangs?
If you get error try to hold reset while entering debugging mode and on first show of gdb release reset.
That is needed only first time (I think it is when you use board with arduino first…)


zmemw16
Fri Jun 09, 2017 3:40 pm
if you could do snapshots of the various screens that would be a really good start.

i keep going back around the loop from eclipse, …, …, ac6 and trying each, never seem to get very far.
eclipse, gnuarmeclipse and system workbench all seem to want use of a config directory dot/dot eclipse also a dot/dot p2, dot/ dot ac6.
ok some are program specific, but starting a tree from their own names might be a good start :?:
all exceedingly annoying.

currently with system workbench (ac6) just because that’s what CubeMX wants to use and i’ve no idea how to change that :)

stephen


goran.mahovlic
Fri Jun 09, 2017 4:55 pm
kk

will do post with screens

As I can remember it is just eclipse neon with gnu arm plugins (and lots of settings to get it work )…


goran.mahovlic
Fri Jun 09, 2017 5:40 pm
F… my portal locked me because it thinks Im a robot :)

I just copy pasted my pic here so try to spot differences
https://yadi.sk/d/bPKhpIVT3JypQQ

and one impressive article that help me with just one settings (OS_USE_TRACExxxxxx) is here
http://www.count-zero.ru/2016/stm32_intro/


Leave a Reply

Your email address will not be published. Required fields are marked *