Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't build for Blue Pill with Arduino framework #10

Closed
vshymanskyy opened this issue Sep 21, 2016 · 19 comments
Closed

Can't build for Blue Pill with Arduino framework #10

vshymanskyy opened this issue Sep 21, 2016 · 19 comments
Assignees
Labels

Comments

@vshymanskyy
Copy link

Example of failed build task:
https://travis-ci.org/blynkkk/blynk-library/jobs/161392538

@ivankravets
Copy link
Member

@ubis, would be thankful for any help on it.

@ubis
Copy link
Contributor

ubis commented Sep 22, 2016

Seems like _sbrk function is in variants/mcu_variant/syscalls.c.
For some reason it's not linking, due that undefined reference appears.
I will look into this tomorrow, I'm really busy today, sorry.

@ubis
Copy link
Contributor

ubis commented Sep 23, 2016

Okay, seems like I found what's causing this. I've added "libc" to builder LIBS(array..?) And it linked properly. However, I found that there are libgcc/libc/libm used in ld scripts, and as I noticed, builder script have:

LIBS=["c", "gcc", "m", "stdc++", "nosys"]

What's the difference? If I remove c from LIBS and add libc it won't link. But, if I add libc and keep c, it does link.

@ivankravets
Copy link
Member

Check linker output with pio run --verbose. Is this command correct?

@ubis
Copy link
Contributor

ubis commented Sep 23, 2016

Okay, this is wierd. Without "libc":

-lc -lgcc -lm -lstdc++ -lnosys

With "libc":

-lc -lgcc -lm -lstdc++ -lnosys -lc

So I changed "libc" to "c" and it still worked. I thought, maybe position could be wrong... But, it doesn't work if there is only one "c" in LIBS. Even this one works:

-lgcc -lm -lc -lc

I checked linker params when bulding with Arduino IDE. It has only libm and libgcc, and it includes syscalls object file in linker start/end group.

@ivankravets
Copy link
Member

  1. libc == c. The same, use c.
  2. Double c is very strange. Something is wrong with GCC LD circle finder.

Could you try to replace env.BuildLibrary with env.BuildSources?

@ubis
Copy link
Contributor

ubis commented Sep 23, 2016

So i've changed env.BuildLibrary with env.BuildSources.
Still no luck - won't link with one c and still does with double c.

@ivankravets
Copy link
Member

Ok, let's keep env.BuildLibrary and double c. I don't want to waste your time. We will take a look at it later.

@ubis
Copy link
Contributor

ubis commented Sep 23, 2016

Ups, my bad sorry(again, lol). I actually changed it on my fork and I didn't moved it to stm platform folder.

Now, it produces error:

*** [.pioenvs\genericSTM32F103RB\firmware.elf] Implicit dependency .pioenvs\genericSTM32F103RB\None not found, needed by target .pioenvs\genericSTM32F103RB\firmware.elf.

Since now it doesn't make *.a lib, it can't go further, I think..
Eh.. And that's okay. I'm free now, and actually we are wasting your time with this platform ;)

@ivankravets
Copy link
Member

Would be good to see build output from Make or Arduino IDE, to compare commands. How do you program STM32Duino without PlatformIO?

@ubis
Copy link
Contributor

ubis commented Sep 23, 2016

You can use Arduino IDE, and get arduino stm32 from repo. It has installation page aswell.

But, I could upload log to pastebin or so.

@ivankravets
Copy link
Member

Would be thankful for pastebin log.

@ubis
Copy link
Contributor

ubis commented Sep 23, 2016

Here it is: http://pastebin.com/8MnCWLYv.
It's kinda ugly. And when I was adding support for STM32Duino, I had to compare aswell. It has some duplicate flags.

Ah, I forgot that I'm using compiler toolchain from PlatformIO. I did that to see if there is any changes(Arduino IDE uses older toolchain), but there wasn't any, so I left it.

@ivankravets
Copy link
Member

-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

I don't see here c lib. Maybe this is problem? Need to remove all libs and pass only m and gcc.
Within builder/framework/arduino.py

env.Replace(LIBS=["m", "gcc"])

@ubis
Copy link
Contributor

ubis commented Sep 23, 2016

Yes, I tried, no luck. I updated my comment back then.

@leodesigner
Copy link

Hi,
I have exactly the same problem.
At the moment I am fixing this with:

env.Replace(LIBS=["c", "gcc", "m", "stdc++", "nosys", "c"])

in arduino.py (line 124)

@leodesigner
Copy link

leodesigner commented Oct 6, 2016

Also - this may be relevant to compiler/linker options:
The binary file produced by the platformio is a bit bigger comparing to the file compiled by the stm32duino(Arduino 1.6.12). It contains debugging info probably - some text lines like:

.platformio/packages/framework-arduinoststm32/STM32F1/cores/maple/HardwareTimer.cpp

in the resulting binary file.

@vshymanskyy
Copy link
Author

Any ideas how this can be fixed?

@ivankravets
Copy link
Member

Development platform will be released today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants