-
-
Notifications
You must be signed in to change notification settings - Fork 312
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
multiple definition of premain()
, main()
when using MySensors
#283
Comments
@pfeerick One way to solve this using the advanced features of platformio is like this: In Then create the
This doesn't solve the initial problem of course but until then it's just a quick workaround let's say. What it does in essence is before building the project it will search for all the Hope it helps for now. |
Sounds nice! Thanks for that! :) Handy |
For anyone struggling with the same issue: If you get "KeyError: 'PROJECTPACKAGES_DIR':" change the expression accordingly. |
This issue should be solved since the 1.8.0 release of the STM32 core as I've planned to support MySensors and I've met this issue so I've fix it. |
I'm using platformio 4.3.4 and ST STM32 8.0.0, hitting the following error (building MySensors for BlackPill):
I'm a little confused by "1.8.0 relase". Does this refer to 8.0 or is there another libary involved? |
I'm talking about those version: For PIO, V7.0.0 include the STM32 core version 1.9.0: So as I mentioned the MySensors library requires some update to handle properly this core like it has been done for Roger's core. |
Have a closer look at the build output - it will tell you up the top (1) the platformio package version and (2) the framework version. PlatformIO package 7.0.0 (not a typo, 8.0.0 is only a few days old) onwards has used arduinoSTM32 1.9.0. @fpistm Not quite sure what you mean here ...
... since the issue was related to the maple/rogerclark BSP/core. Do you mean you were hoping to get MySensors to add support for the STSTM32 BSP/core after changes made in 1.8.0? i.e. like seeing this PR merged? |
Oh sorry, my mistake I thought it was with STM32 core not Roger's. Maybe a regression. About the PR, I was not aware there is already one. That's fine as it seems what I've made allows to port properly the library. I will give a try. |
Thanks for the clarification. I'm using arduinoststm32 v 1.9.0
Building the PR mentioned above I still hit the "multiple definition of `main'" issue:
platformio.ini
|
No problem ... to err is human and all that jazz ;)
When I initially had this issue, yes. As I said in the initial opening for the issue: "On the Arduino IDE, using the rogerclarkmelbourne/Arduino_STM32 core it works just fine." - hence the issue being lodged against PlatformIO since it's something PIO is doing differenet to the Arduino IDE, when using Rogers BSP. I haven't touched this since, so it's time for a revisit and poke and prod to see if anything has changes now that things have been updated a bit... 🧐 Plus I didn't know about the alternate 'STM32' BSP library forks, so that is a step forward! 😸 |
Hard'n'dirty workaround for STM32F1 boards: Force attribute((weak)) before framework-arduino preinit() and main() functions... Change main.cpp in ~.platformio/packages/framework-arduinoststm32/cores/arduino with : `/* This library is free software; you can redistribute it and/or This library is distributed in the hope that it will be useful, You should have received a copy of the GNU Lesser General Public #define ARDUINO_MAIN // Force init to be called first, i.e. before static object allocation. // Required by FreeRTOS, see http://www.freertos.org/RTOS-Cortex-M3-M4.html init(); /*
setup(); for (;;) { return 0; build-upload-log:
platformio.ini: `[env:bluepill_f103c8] upload_protocol = stlink lib_deps = |
When using the MySensors library, linking fails with...
... most likely due to the library also having a
premain()
andmain()
in the hal folder. On the Arduino IDE, using the rogerclarkmelbourne/Arduino_STM32 core it works just fine.But on PlatformIO, with
and the LightSensor example (picked as one of the shorter ones which should 'just compile/work' for any board) - with the requisite
#include <Arduino.h>
addition - it fails to build. Addinglib_archive = no
does not make any noticeable difference. The same code will compile successfully for an atmelavr/uno target with PlatformIO, even though it appears the same form of collision should be happening there also.Forum ref: https://community.platformio.org/t/how-to-eliminate-conflicting-symbols-arduinoststm32-maple-mysensors-lib/9509
Click to expand - Arduino IDE Compile verbose log
Click to expand - PlatformIO Verbose Build log
The text was updated successfully, but these errors were encountered: