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

PIO Core 6.1.17 broke linking object files directly #5089

Open
norandomtechie opened this issue Feb 13, 2025 · 2 comments
Open

PIO Core 6.1.17 broke linking object files directly #5089

norandomtechie opened this issue Feb 13, 2025 · 2 comments
Milestone

Comments

@norandomtechie
Copy link

I'm an instructor using PlatformIO for our embedded systems course. We are really thankful to you all for your hard work on this project!

It appears that upgrading to PlatformIO Core 6.1.17 prevented our students from being able to import a shared library that we distribute as an object (.o) file. We're now getting an error when building:

(hidden-path)/.platformio/packages/[email protected]/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld: cannot find -l(hidden-path)/src/autotest.o

Here is our PlatformIO INI for our custom STM32F091RCT6-based devboard that works on Core 6.1.16:

[env:nucleo_f091rc]
platform = ststm32
board = nucleo_f091rc
framework = cmsis
upload_command = openocd -f openocd.cfg -c "program .pio/build/nucleo_f091rc/firmware.elf verify reset exit"
debug_server = 
    ${platformio.packages_dir}/tool-openocd/bin/openocd
    -f
    openocd.cfg
build_src_flags = -DSTM32F091 "${platformio.src_dir}/shared.o"
build_flags = -Wl,-u_printf_float
upload_protocol = stlink
debug_init_break = tbreak main
board_build.f_cpu = 48000000L
monitor_speed = 115200
monitor_eol = LF

We also tried variations of the following:

build_flags = -Wl,-u_printf_float -Wl,-L"${platformio.src_dir}" -Wl,-lshared

Please let us know if we can provide other info.

@ivankravets ivankravets transferred this issue from platformio/platformio-core Feb 14, 2025
@valeros
Copy link
Member

valeros commented Feb 14, 2025

Hi @norandomtechie, thanks for reaching out.

It seems that the latest PlatformIO Core 6.1.17 has brought a fix that may have affected your configuration. Anyway, I believe that your approach was erroneous in the first place and it was working just fine probably because there is an issue with improper processing of external object files on the PlatformIO build API side.

As a solution, I'd recommend using the -Wl, prefix to explicitly specify that your flag is meant to be added to the linker command:

build_flags = -DSTM32F091 -Wl,$PROJECT_SRC_DIR/shared.o

Note: The $PROJECT_SRC_DIR variable is used instead of ${platformio.src_dir} because there is an unrelated issue with it on Windows.

@valeros valeros transferred this issue from platformio/platform-ststm32 Feb 14, 2025
@valeros valeros added this to the 6.1.18 milestone Feb 14, 2025
@norandomtechie
Copy link
Author

norandomtechie commented Feb 14, 2025

Hi @valeros, thank you for the speedy response. It works on my machine personally which is great, but we'll need to identfy and test with students using Windows/macOS to be sure. I'll get back as soon as we find out!

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

No branches or pull requests

2 participants