stm32duino core with System Workbench for bluepill

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

Re: Eclipse importable bluepill project

Post by Rick Kimball » Thu Oct 06, 2016 4:59 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..
The newer arm-none-eabi-gcc has utoa defined in stdlib.h ...

just fixup the code so it matches the way stdlib has it.

// in the header itoa.h

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

...

// in the itoa.c

char* utoa( unsigned value, char *string, int radix )
{
return ultoa( value, string, radix ) ;
}

...
Last edited by Rick Kimball on Thu Oct 06, 2016 5:08 pm, edited 1 time in total.
-rick

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

Re: Eclipse importable bluepill project

Post by Rick Kimball » Thu Oct 06, 2016 5:07 pm

wait ...

man libstd says:

...
Non-standard (i.e. non-ISO C) functions.
char * ltoa (long val, char *s, int radix)
char * utoa (unsigned int val, char *s, int radix)
char * ultoa (unsigned long val, char *s, int radix)
long random (void)
void srandom (unsigned long __seed)
long random_r (unsigned long *__ctx)
char * itoa (int val, char *s, int radix)
#define RANDOM_MAX 0x7FFFFFFF

..
so you just want to change utoa not ultoa .

-rick
-rick

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

Re: Eclipse importable bluepill project

Post by Rick Kimball » Thu Oct 06, 2016 5:11 pm

Turns out the arduino code has a "fix" in for this

https://github.com/arduino/Arduino/pull/4830/files
-rick

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

Re: Eclipse importable bluepill project

Post by edogaldo » Thu Oct 06, 2016 5:19 pm

Rick Kimball wrote:Turns out the arduino code has a "fix" in for this

https://github.com/arduino/Arduino/pull/4830/files
Huh!!!
What about applying it also to the Maple core?!

ps: 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.

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

Re: Eclipse importable bluepill project

Post by Rick Kimball » Thu Oct 06, 2016 5:35 pm

We will have to apply a fix at some point. When the arm-none-eabi-gcc version gets greater than 4.9.2 in the arduino IDE we will forced to deal with it.
-rick

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

Re: Eclipse importable bluepill project

Post by Rick Kimball » Thu Oct 06, 2016 6:05 pm

edogaldo wrote:Even with the -nostdlib I get the error:

Code: Select all

'Building file: ../cores/maple/WString.cpp'
'Invoking: MCU G++ Compiler'
...
For what it's worth. The platform.txt file for the STM32F1 isn't setup properly. It adds the -nostdlib argument to the compiles and not to the linker. So it actually does use the stdlib files.

Here is the link line (no -nostdlib in sight, and adds -lm and -lgcc) :
"/home/kimballr/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-g++" -Os -Wl,--gc-sections -mcpu=cortex-m3 "-T/home/kimballr/Arduino/hardware/Arduino_STM32/STM32F1/variants/generic_stm32f103c/ld/jtag_c8.ld" "-Wl,-Map,/tmp/arduino_build_242485/ASCIITable.ino.map" "-L/home/kimballr/Arduino/hardware/Arduino_STM32/STM32F1/variants/generic_stm32f103c/ld" -o "/tmp/arduino_build_242485/ASCIITable.ino.elf" "-L/tmp/arduino_build_242485" -lm -lgcc -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols -Wl,--start-group "/tmp/arduino_build_242485/sketch/ASCIITable.ino.cpp.o" "/tmp/arduino_build_242485/core/wirish/start.S.o" "/tmp/arduino_build_242485/core/wirish/start_c.c.o" "/tmp/arduino_build_242485/core/wirish/syscalls.c.o" "/tmp/arduino_build_242485/core/board.cpp.o" "/tmp/arduino_build_242485/core/wirish/boards.cpp.o" "/tmp/arduino_build_242485/core/wirish/boards_setup.cpp.o" "/tmp/arduino_build_242485/core/core.a" -Wl,--end-group
"/home/kimballr/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-objcopy" -O binary "/tmp/arduino_build_242485/ASCIITable.ino.elf" "/tmp/arduino_build_242485/ASCIITable.ino.bin"
If you grep the /tmp/buildxxx/ASCIITable.ino.map you can see it is linking in all the stuff from libc
/home/kimballr/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/../lib/gcc/arm-none-eabi/4.8.3/../../../../arm-none-eabi/lib/armv7-m/libc.a(lib_a-memset.o)
The way the core is written, it isn't actually possible to not use the arm stdlibs.
-rick

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

Re: Eclipse importable bluepill project

Post by stevestrong » Thu Oct 06, 2016 8:08 pm

edogaldo wrote:ps: 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?
As alternative:
http://www.stm32duino.com/viewtopic.php?f=41&t=655

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

Re: Eclipse importable bluepill project

Post by Rick Kimball » Thu Oct 06, 2016 8:12 pm

stevestrong wrote:
edogaldo wrote:ps: 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?
As alternative:
http://www.stm32duino.com/viewtopic.php?f=41&t=655
Yeah this thread indicated that I was doing something different @stevestrong and yes I know the other thing exists.
Rick Kimball wrote:... My approach is different than what most people do, this setup isn't using the Arduino Plugin. The required defines, and include paths, and executable paths are just set in the eclipse project properties. ...
I'm not saying that this is better. I just offered it up as a different alternative

-rick
-rick

User avatar
RogerClark
Posts: 6361
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Eclipse importable bluepill project

Post by RogerClark » Thu Oct 06, 2016 8:45 pm

Rick

I am happy to add that change for utoi etc and the platform.txt fix,

can you check it works with the proposed changes to platform.txt and post the few lines that need changing, or just tell me what to remove ?

The utoi issue is already hitting me as some other cores have updated to require gcc 5.x I and I get issues if I add the compiler to the IDEs hidden gcc toolchain folder

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

Re: Eclipse importable bluepill project

Post by edogaldo » Thu Oct 06, 2016 8:57 pm

stevestrong wrote:
edogaldo wrote:ps: 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?
As alternative:
http://www.stm32duino.com/viewtopic.php?f=41&t=655
Are you referring to the Eclipse c++ ide for Arduino?
I installed the sistem workbench because it's supported ootb by the STM's Cube samples, I'd prefer to avoid installing other "concurrent" plug-ins in Eclipse if possible...

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest