Hello, I am trying to add a user module written in C++ on the stm32 port. I have compiled the shared library with appropriate flags and written part of my python wrapper. The module micropython.mk looks like this:
EXAMPLE_MOD_DIR := $(USERMOD_DIR)
SRC_USERMOD += $(EXAMPLE_MOD_DIR)/test.c
LDFLAGS_USERMOD += $(EXAMPLE_MOD_DIR)/libupybotan.a /usr/arm-none-eabi/lib/libstdc++.a
However, when I try to build the firmware, I get the following error:
arm-none-eabi-ld: error: build-PYBV11/firmware.elf uses VFP register arguments, /usr/arm-none-eabi/lib/libstdc++.a(chrono.o) does not
I have seen this for modules I have compiled myself and was able to fix that. This time though I am bit confused on how to approach this since the libstdc++.a was simply downloaded with the GNU Arm Embedded toolchain.
Some help would be very appreciated
arm-none-eabi-gcc -dumpversion: 9.2.1
Error trying to build a C++ module that uses the standard c++ library
- saiftyfirst
- Posts: 12
- Joined: Wed Mar 04, 2020 4:58 pm
Re: Error trying to build a C++ module that uses the standard c++ library
It's because the compiler's libstdc++ is compiled with different floating point support to MicroPython.
On pybv11 we use -mfloat-abi=hard (i.e. VFP register arguments)
On pybv11 we use -mfloat-abi=hard (i.e. VFP register arguments)
- saiftyfirst
- Posts: 12
- Joined: Wed Mar 04, 2020 4:58 pm
Re: Error trying to build a C++ module that uses the standard c++ library
What I understand is that there is no way I can use it ?
Re: Error trying to build a C++ module that uses the standard c++ library
You could try building micropython with -mfloat-abi=soft? I'm not sure which ABI exactly the C++ stdlib uses, but some trial and error you may be able to find an option that matches.saiftyfirst wrote: ↑Sat Mar 21, 2020 10:12 pmWhat I understand is that there is no way I can use it ?
- saiftyfirst
- Posts: 12
- Joined: Wed Mar 04, 2020 4:58 pm
Re: Error trying to build a C++ module that uses the standard c++ library
Building everything with -mfloat-abi=softfp seems to have worked