On Wed, Aug 16, 2023 at 11:18:19AM +0200, Milan Obuch wrote: > Hi, > > at the moment, I am able to build NuttX on FreeBSD for arm (Raspberry > Pi Pico boards and similar, QuickFeather), xtensa (Espressif ESP32 and > ESP32S2) and risc-v (Espressif ESP32C3 and ESP32C6, and PineCone - > BL602 based), some of them with tests on real hardware. > > While in general the process is quite easy, there are some annoyances > in the process. All builds follow the same recipe: > > 1. configure build for the board - standard > > tools/configure.sh <board:config> > > involved. Nothing special here. > > 2. do the build itself. As some paths are set differently in FreeBSD, > typical invocation is (example for Raspberry Pi Pico): > > gmake CROSSDEV=/usr/local/gcc-arm-embedded-10.3-2021.10/bin/arm-none-eabi- > PICO_SDK_PATH=/wrk/pico/pico-sdk > > This does the build, just with one error message at the start reading > > /usr/local/bin/bash: line 1: arm-none-eabi-gcc: command not found > > and then the whole build process continues, ending with nuttx file > being created. Error message mentioned seems to be just spurious, it > would be nice to locate where it comes from and fix. Could someone help > me with this, hopefully small, task? > > Additionally, for Raspberry Pi Pico, there is one more error message, > this time somewhat serious: > > Generating: nuttx.uf2 > tools/rp2040/elf2uf2 nuttx nuttx.uf2; > ld-elf.so.1: /usr/local/lib/gcc10/libstdc++.so.6: version GLIBCXX_3.4.29 > required by /wrk/usr/ports/devel/apache-nuttx/work/nuttx/tools/rp2040/elf2uf2 > not found > gmake: *** [tools/Unix.mk:541: nuttx] Error 1 > > and, consequently, nuttx.uf2 file for uploading to the board is not > prepared. This is not fatal for me, because I can execute command > > /wrk/pico/pico-examples/build/elf2uf2/elf2uf2 -v nuttx nuttx.bin.uf2 > > manually and got it. Again, it would be nice to fix this. In my eyes, > the preferable way for this would be just using already available > elf2uf2 binary, either in path, or, maybe, with explicitly assigned via > some ELF2UF2= assignment. The PICO_SDK_PATH=/wrk/pico/pico-sdk > assignment used above is just for building this binary. I'd prefer to > do it just once as part of working setup preparation and not for every > build, which could be just done the way I mentioned.
I run into that problem as well. It is very specific to the RP2040 build and Nuttx compiles some kind of tool, but uses a disfunctional GCC version, because it doesn't use the system compiler. Unfortunately the broken compiler is a dependency of the xtensa compiler toolchain. So you either have the xtensa build tools or you compile for RP2040. This is my local workaround: diff --git a/contrib/nuttx/tools/rp2040/Makefile.host b/contrib/nuttx/tools/rp2040/Makefile.host index 32717c11f7..aada7f9709 100644 --- a/contrib/nuttx/tools/rp2040/Makefile.host +++ b/contrib/nuttx/tools/rp2040/Makefile.host @@ -28,7 +28,7 @@ CFLAGS = -O2 -std=c++14 CFLAGS += -I$(PICO_SDK_PATH)/src/common/boot_uf2/include elf2uf2: $(PICO_SDK_PATH)/tools/elf2uf2/main.cpp - @g++ $(CFLAGS) -o $@ $< + @c++ $(CFLAGS) -o $@ $< clean: @rm -f *.o *.a *.dSYM *~ .*.swp > > 3. clean up after build, so I can repeat the process for another > board/configuration combo: > > gmake distclean > > This does the job, spitting maybe a hundred lines of > > /usr/local/bin/bash: line 1: arm-none-eabi-gcc: command not found > > Note I am using sources from git as of yesterday. All these errors did > not appear with 12.0.0 source tarball, but started with newer ones, I > tested 12.1.0, 12.2.0 and git newer than that. > > The exact message differs depending on the build (and consequently > toolset) used. > > At present, I do not know the whole build process that well to dig into > it myself, thus some help, hints, patches to test, all is greatly > appreciated. > > Regards, > Milan -- B.Walter <be...@bwct.de> https://www.bwct.de Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm.