Problem with building Hello World project

I am using VScode with Platformio. My target platform is the aceinna_imu platform. My board is OpenIMU300. Whenever I try to compile a very simple program, the output says:


Building in release mode
Linking .pio/build/OpenIMU300/firmware.elf
/home/jason/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld: warning: cannot find entry symbol Reset_Handler; defaulting to 0000000008010000
.pio/build/OpenIMU300/src/main.o: In function `__static_initialization_and_destruction_0(int, int)':
main.cpp:(.text._Z41__static_initialization_and_destruction_0ii+0x38): undefined reference to `__dso_handle'
/home/jason/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib/thumb/v7e-m/libc.a(lib_a-fini.o): In function `__libc_fini_array':
fini.c:(.text.__libc_fini_array+0x26): undefined reference to `_fini'
/home/jason/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib/thumb/v7e-m/libstdc++.a(cxx11-ios_failure.o): In function `(anonymous namespace)::__io_category_instance()':
cxx11-ios_failure.cc:(.text._ZN12_GLOBAL__N_122__io_category_instanceEv+0x38): undefined reference to `__dso_handle'
/home/jason/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib/thumb/v7e-m/libstdc++.a(system_error.o): In function `_GLOBAL__sub_I__ZSt20__throw_system_errori':
system_error.cc:(.text.startup._GLOBAL__sub_I__ZSt20__throw_system_errori+0x1c): undefined reference to `__dso_handle'
/home/jason/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld: .pio/build/OpenIMU300/firmware.elf: hidden symbol `__dso_handle' isn't defined
/home/jason/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
*** [.pio/build/OpenIMU300/firmware.elf] Error 1
====================== [FAILED] Took 1.18 seconds ======================

What’s this “very simple program” you’re compiling? Are you doing something with constructors?

Or rather static objects with destructors…

Can you provide the entire Hello World code incl. platformio.ini?

#include
int main()
{
std::cout << “hello world!” << std::endl;
}

#include what?

And you can use triple backticks (```) before and after your code when posting so that it is formatted as code.

#include <iostream>
int main()
{
std::cout << "hello world!" << std::endl;
}

Mod edit: code tags

#include iostream

\

Apologies, it appears the forum ate the include in your prior post, I can see it if I look at what you entered, rather than what the forum is showing/rendering.

Anyway, is this the same platformio.ini setup you’re using with that code?

[env:OpenIMU300]
platform = aceinna_imu
board = OpenIMU300

… as with this platformio.ini I can reproduce your error using that code.

Here is the output from a verbose build for reference:

Processing OpenIMU300 (platform: aceinna_imu; board: OpenIMU300)
-----------------------------------------------------------------------------------------------------------------------------------------------------------
CONFIGURATION: https://docs.platformio.org/page/boards/aceinna_imu/OpenIMU300.html
PLATFORM: Aceinna IMU 1.2.1 > Aceinna OpenIMU 300ZA
HARDWARE: STM32F405RG 120MHz, 128KB RAM, 1MB Flash
DEBUG: Current (stlink) External (blackmagic, jlink, stlink)
PACKAGES: toolchain-gccarmnoneeabi 1.70201.0 (7.2.1)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Platform incompatible library /home/pfeerick/.platformio/lib/AsyncTCP_ID1826
Framework incompatible library /home/pfeerick/.platformio/lib/ESP Async WebServer_ID306
Found 0 compatible libraries
Platform incompatible library /home/pfeerick/.platformio/lib/ESPAsyncTCP_ID305
Scanning dependencies...
More details about "Library Compatibility Mode": https://docs.platformio.org/page/librarymanager/ldf.html#ldf-compat-mode
No dependencies
Building in release mode
arm-none-eabi-g++ -o .pio/build/OpenIMU300/src/main.o -c -fno-rtti -fno-exceptions -O0 -ffunction-sections -fdata-sections -Wall -Wno-comment -mthumb -mcpu=cortex-m4 -mcpu=cortex-m4 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -DF_CPU=120000000L -DPLATFORMIO=40101 -DSTM32F4 -DSTM32F405RG -DSTM32F405xx -Iinclude -Isrc src/main.cpp
arm-none-eabi-g++ -o .pio/build/OpenIMU300/firmware.elf -T stm32f40x.ld -O0 -Wl,--gc-sections,--relax -nostartfiles -nostdlib -mcpu=cortex-m4 .pio/build/OpenIMU300/src/main.o -L/home/pfeerick/.platformio/platforms/aceinna_imu/ldscripts -L.pio/build/OpenIMU300 -Wl,--start-group -lc -lgcc -lm -lstdc++ -lnosys -Wl,--end-group
/home/pfeerick/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld: warning: cannot find entry symbol Reset_Handler; defaulting to 0000000008010000
.pio/build/OpenIMU300/src/main.o: In function `__static_initialization_and_destruction_0(int, int)':
main.cpp:(.text._Z41__static_initialization_and_destruction_0ii+0x38): undefined reference to `__dso_handle'
/home/pfeerick/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib/thumb/v7e-m/libc.a(lib_a-fini.o): In function `__libc_fini_array':
fini.c:(.text.__libc_fini_array+0x26): undefined reference to `_fini'
/home/pfeerick/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib/thumb/v7e-m/libstdc++.a(cxx11-ios_failure.o): In function `(anonymous namespace)::__io_category_instance()':
cxx11-ios_failure.cc:(.text._ZN12_GLOBAL__N_122__io_category_instanceEv+0x38): undefined reference to `__dso_handle'
/home/pfeerick/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib/thumb/v7e-m/libstdc++.a(system_error.o): In function `_GLOBAL__sub_I__ZSt20__throw_system_errori':
system_error.cc:(.text.startup._GLOBAL__sub_I__ZSt20__throw_system_errori+0x1c): undefined reference to `__dso_handle'
/home/pfeerick/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld: .pio/build/OpenIMU300/firmware.elf: hidden symbol `__dso_handle' isn't defined
/home/pfeerick/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
*** [.pio/build/OpenIMU300/firmware.elf] Error 1
=============================================================== [FAILED] Took 1.53 seconds ===============================================================

There is not stdio available out of the box. And without further code, some fundamental pieces are missing and the program won’t even run (see error message cannot find entry symbol Reset_Handler). That would usually be provided by a framework (such as Arduino) but the OpenIMU boards don’t seem to support any of these.

The best approach is to start with one of the examples (see link below). The include all the relevant parts (no stdio though, probably no C++ support).