stm32duino core with System Workbench for bluepill

Development environment specific, Arduino, Eclipse, VS2013,Em::Blocks etc
User avatar
Rick Kimball
Posts: 754
Joined: Tue Apr 28, 2015 1:26 am
Location: Eastern NC, US
Contact:

Re: Eclipse importable bluepill project

Postby Rick Kimball » Sun Oct 02, 2016 10:43 pm

stevestrong wrote:First, I read about the Eclipse plugin for Arduino. After several unsuccessful tries and errors (two days of pain..) I wanted to give a try to Rick's project.


Are you using this version of eclipse? http://www.openstm32.org/System+Workbench+for+STM32 My project only works with that. You must use the openstm32 version of eclipse and its configuration if you want to import my project and use it successfully. It depends on this customized version of eclipse.

-rick
-rick

stevestrong
Posts: 884
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: Eclipse importable bluepill project

Postby stevestrong » Mon Oct 03, 2016 8:39 am

Rick,
thanks a lot, I finally managed to successfully build the project on my Win10 machine, without Linux VM.

What I did is:
- I followed the steps recommended to install SW4STM32, onto the existing Eclipse installation,
- adapted the paths for GCC (from Arduino directory) and make.exe (from Ac6 plugin directory of Eclipse)

Now I will try to debug...

edogaldo
Posts: 213
Joined: Fri Jun 03, 2016 8:19 am

Re: Eclipse importable bluepill project

Postby edogaldo » Thu Oct 06, 2016 8:49 am

Hi Rick, would it be possible to add USB2Serial upload method in your project template? If yes, can you advice for it?

ps: I know that USB2Serial does not support debugging but at the moment I don't have a ST-Link device and I just need the upload feature..


Thanks in advance and best, E.

User avatar
Rick Kimball
Posts: 754
Joined: Tue Apr 28, 2015 1:26 am
Location: Eastern NC, US
Contact:

Re: Eclipse importable bluepill project

Postby Rick Kimball » Thu Oct 06, 2016 1:29 pm

edogaldo wrote: .. would it be possible to add USB2Serial upload method in your project template?

Yes, you could use the "External Tools" feature to create a custom menu item that would do that. Use the quick access feature to search on "External Tools" or go to the Menus: Run/External Tools/External Tools Configuration... Create a new item and fill in the executable and its arguments. You can use eclipse variable parameters to make it less hard coded.

-rick
-rick

edogaldo
Posts: 213
Joined: Fri Jun 03, 2016 8:19 am

Re: Eclipse importable bluepill project

Postby edogaldo » Thu Oct 06, 2016 2:09 pm

Thanks Rick, I'll try to setup it.

Interesting thing: I tried to compile the bluepill project with the default SW compiler (gcc 5.2.1) and I get error: "conflicting declaration of C function 'char* utoa(long unsigned int, char*, int)'" on file "itoa.h" where utoa is defined as:

Code: Select all

extern char* utoa( unsigned long value, char *string, int radix ) ;

using instead gcc 4.8.3 the error does not happen..

User avatar
sheepdoll
Posts: 224
Joined: Fri May 22, 2015 12:58 am
Location: Silicon Valley Vortex
Contact:

Re: Eclipse importable bluepill project

Postby sheepdoll » Thu Oct 06, 2016 3:43 pm

edogaldo wrote:Thanks Rick, I'll try to setup it.

Interesting thing: I tried to compile the bluepill project with the default SW compiler (gcc 5.2.1) and I get error: "conflicting declaration of C function 'char* utoa(long unsigned int, char*, int)'" on file "itoa.h" where utoa is defined as:

Code: Select all

extern char* utoa( unsigned long value, char *string, int radix ) ;

using instead gcc 4.8.3 the error does not happen..


I ran into this one a couple weeks back. It means your compiler flags have an issue and are including stdlib. Normally the projects are built with -nostdlib on the C(++) command line. The core contains a stub for stdlib, which is where the conflict comes from.

edogaldo
Posts: 213
Joined: Fri Jun 03, 2016 8:19 am

Re: Eclipse importable bluepill project

Postby edogaldo » Thu Oct 06, 2016 4:13 pm

Even with the -nostdlib I get the error:

Code: Select all

'Building file: ../cores/maple/WString.cpp'
'Invoking: MCU G++ Compiler'
C:\EDOGALDO\STM32\RickKimball_bluepill\bluepill\Debug
arm-none-eabi-g++ -mcpu=cortex-m3 -mthumb -mfloat-abi=soft -DSTM32F103C8Tx -DDEBUG -DVECT_TAB_ADDR=0x8000000 -DGENERIC_STM32F103C -DF_CPU=72000000L -DBOARD_GENERIC_STM32F103C -DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG -DSERIAL_USB -D__STM32F1__ -DARDUINO=10605 -DBOARD_generic_stm32f103c -DMCU_STM32F103CB -DGENERIC_BOOTLOADER -DARDUINO_ARCH_STM32F1 -DERROR_LED_PORT=GPIOB -DERROR_LED_PIN=1 -I"C:/EDOGALDO/STM32/RickKimball_bluepill/bluepill/system/libmaple" -I"C:/EDOGALDO/STM32/RickKimball_bluepill/bluepill/system/libmaple/include" -I"C:/EDOGALDO/STM32/RickKimball_bluepill/bluepill/system/libmaple/stm32f1/include" -I"C:/EDOGALDO/STM32/RickKimball_bluepill/bluepill/system/libmaple/usb/stm32f1" -I"C:/EDOGALDO/STM32/RickKimball_bluepill/bluepill/system/libmaple/usb/usb_lib" -I"C:/EDOGALDO/STM32/RickKimball_bluepill/bluepill/cores/maple" -I"C:/EDOGALDO/STM32/RickKimball_bluepill/bluepill/variants/generic_stm32f103c"  -Os -g3 -Wall -fmessage-length=0 --param max-inline-insns-single=500 -nostdlib -ffunction-sections -c -fno-exceptions -fno-rtti -MMD -MP -MF"cores/maple/WString.d" -MT"cores/maple/WString.o" -o "cores/maple/WString.o" "../cores/maple/WString.cpp"
In file included from ../cores/maple/WString.cpp:23:0:
../cores/maple/itoa.h:34:65: error: conflicting declaration of C function 'char* utoa(long unsigned int, char*, int)'
 extern char* utoa( unsigned long value, char *string, int radix ) ;
                                                                 ^
In file included from c:\users\EDOGALDO\.p2\pool\plugins\fr.ac6.mcu.externaltools.arm-none.win32_1.7.0.201602121829\tools\compiler\arm-none-eabi\include\stdlib.h:11:0,
                 from ../cores/maple/WString.h:26,
                 from ../cores/maple/WString.cpp:22:
c:\users\EDOGALDO\.p2\pool\plugins\fr.ac6.mcu.externaltools.arm-none.win32_1.7.0.201602121829\tools\compiler\arm-none-eabi\include\stdlib.h:185:8: note: previous declaration 'char* utoa(unsigned int, char*, int)'
 char * _EXFUN(utoa,(unsigned, char *, int));
        ^
../cores/maple/WString.cpp: In constructor 'String::String(unsigned char, unsigned char)':
../cores/maple/WString.cpp:74:23: error: call of overloaded 'utoa(unsigned char&, char [9], unsigned char&)' is ambiguous
  utoa(value, buf, base);
                       ^
In file included from c:\users\EDOGALDO\.p2\pool\plugins\fr.ac6.mcu.externaltools.arm-none.win32_1.7.0.201602121829\tools\compiler\arm-none-eabi\include\stdlib.h:11:0,
                 from ../cores/maple/WString.h:26,
                 from ../cores/maple/WString.cpp:22:
c:\users\EDOGALDO\.p2\pool\plugins\fr.ac6.mcu.externaltools.arm-none.win32_1.7.0.201602121829\tools\compiler\arm-none-eabi\include\stdlib.h:185:8: note: candidate: char* utoa(unsigned int, char*, int)
 char * _EXFUN(utoa,(unsigned, char *, int));
        ^
In file included from ../cores/maple/WString.cpp:23:0:
../cores/maple/itoa.h:34:14: note: candidate: char* utoa(long unsigned int, char*, int)
 extern char* utoa( unsigned long value, char *string, int radix ) ;
              ^
make: *** [cores/maple/WString.o] Error 1

User avatar
Rick Kimball
Posts: 754
Joined: Tue Apr 28, 2015 1:26 am
Location: Eastern NC, US
Contact:

Re: Eclipse importable bluepill project

Postby Rick Kimball » Thu Oct 06, 2016 4:42 pm

-nostdlib is a linker flag not a compile time flag it has nothing to do with compiling.
-rick

User avatar
sheepdoll
Posts: 224
Joined: Fri May 22, 2015 12:58 am
Location: Silicon Valley Vortex
Contact:

Re: Eclipse importable bluepill project

Postby sheepdoll » Thu Oct 06, 2016 4:47 pm

edogaldo;

This is the relevant section of the makefile that is working for me on the Nucleo (I do not have a blue pill.) I am using BSD under OSX.

Code: Select all

# compile gcc flags
ASFLAGS =  -MMD -mcpu=cortex-m3 -DF_CPU=72000000L -DARDUINO=10604 -DARDUINO_STM_NUCLEO_F103RE -DARDUINO_ARCH_HALMX -DSTM32F103xE -DSTM32_MEDIUM_DENSITY -DSTM32F1 -DBOARD_NUCLEO_F103RE -mthumb -D__STM32F1__
ASFLAGS += $(AS_INCLUDES) -fdata-sections -ffunction-sections
CFLAGS = -g -Os -w -DDEBUG_LEVEL=DEBUG_NONE -MMD -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500
CFLAGS += -DBOARD_MXNucleoF103 -mcpu=cortex-m3 -DF_CPU=72000000L -DARDUINO=10604 -DARDUINO_STM_NUCLEO_F103RE
CFLAGS += -DARDUINO_ARCH_HALMX -DSTM32F103xE -DSTM32_MEDIUM_DENSITY -DSTM32F1 -DBOARD_NUCLEO_F103RE -mthumb -D__STM32F1__ $(C_INCLUDES)
ifeq ($(DEBUG), 1)
CFLAGS += -g -gdwarf-2
endif
# Generate dependency information
CPPFLAGS = -g -Os -w -DDEBUG_LEVEL=DEBUG_NONE -MMD -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500
CPPFLAGS += -fno-rtti -fno-exceptions -DBOARD_MXNucleoF103 -mcpu=cortex-m3 -DF_CPU=72000000L -DARDUINO=10604 -DARDUINO_STM_NUCLEO_F103RE
CPPFLAGS += -DARDUINO_ARCH_HALMX -DSTM32F103xE -DSTM32_MEDIUM_DENSITY -DSTM32F1 -DBOARD_NUCLEO_F103RE -mthumb -D__STM32F1__ $(C_INCLUDES)


In eclipse I had to add these flags to the "Properties .. C C++ General .. Paths and Symbols .. #Symbols tab." Otherwise the eclipse syntax checker kept giving me this same error. You have to include the #Symbols for each language module.

At present my code compiles. Hangs with a nill pointer exception somewhere in the startup static allocation code relating to USB/CDC or I2C.

There are other threads relating to some of the weirdness using make and the newer M$ operating systems. When I now need to run dos command line stuff I have been using Dosbox, which conveniently runs on *nix machines like OSX and BSD. The modern command line on the newer M$ OS like 8 and 10 is an emulator anyway. More reason to install Linux and be done with it.

edogaldo
Posts: 213
Joined: Fri Jun 03, 2016 8:19 am

Re: Eclipse importable bluepill project

Postby edogaldo » Thu Oct 06, 2016 4:59 pm

sheepdoll wrote:In eclipse I had to add these flags to the "Properties .. C C++ General .. Paths and Symbols .. #Symbols tab." Otherwise the eclipse syntax checker kept giving me this same error. You have to include the #Symbols for each language module.

At present my code compiles. Hangs with a nill pointer exception somewhere in the startup static allocation code relating to USB/CDC or I2C.
[...]

Thank you Sheepdoll, I'll better investigate in case, in thruth it's not that much important as long as GCC 4.8 is not complaining..
Anyway, based on Rick's note:
Rick Kimball wrote:-nostdlib is a linker flag not a compile time flag it has nothing to do with compiling.

At linker level the option is already set.

@Rick: one more question: is there a way to make the project use the Maple core available in the [Arduino installation]/hardware folder without duplicating it within the project's path?

Thanks and bye, E.
Last edited by edogaldo on Thu Oct 06, 2016 5:00 pm, edited 1 time in total.


Return to “IDE's”

Who is online

Users browsing this forum: No registered users and 1 guest