C/C++ Raspberry Pi Pico

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,032
Messages: 38,480

Received a Raspberry Pi Pico in the mail today. I love getting new toys to play with. This thing is tiny ♥️

I assume this will just work fine on FreeBSD as you it just mounts a drive and you copy some application to it, then it should just work. But I want to try to compile some native C/C++ for it but you need to install the SDK for that. Anybody tried getting that pico-sdk and all working on FreeBSD yet?

Translating some of the (Linux) requirements it looks like I need at least devel/arm-none-eabi-gcc. Probably some other bits and pieces too, but it looks like I can find most of it in the ports tree. I'm going to need to do some experimenting tonight.
 

Zirias

Daemon

Reaction score: 1,418
Messages: 2,478

But I want to try to compile some native C/C++ for it
Just to make sure, by "native", you mean freestanding/bare metal? Cause that's what the SDK is for ;)
Anybody tried getting that pico-sdk and all working on FreeBSD yet?
I didn't, but it seems it only needs a cross-gcc and newlib for the ARM target, and both exist as ports, so hopefully it shouldn't be much of a problem.
 
OP
SirDice

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,032
Messages: 38,480

Just to make sure, by "native", you mean freestanding/bare metal?
Yes, exactly, looks like I need to compile a UF2 file for it. As opposed to running the 'standard' CircuitPython or MicroPython code. I'm definitely going to play with Python too but I'm more interested in getting to run C/C++ code on it.
 

kpedersen

Son of Beastie

Reaction score: 2,008
Messages: 2,879

Nice. I would be interested to hear how you get on with this. I am looking to grab a couple of these things myself.

Traditionally I like the Arduino Nano, not so much because it is "easy" (which it is) but because it is always possible to get hold of one. Raspberry Pi Foundation also does a great job at keeping up supplies so this will likely only mean good things for the Pi Nano.
 

Zirias

Daemon

Reaction score: 1,418
Messages: 2,478

I was just asking because a FreeBSD binary compiled for the RasPi would of course be "native" as well, and for cross-compiling, you could just use base clang with --target=arm-unknown-freebsd13.
 
OP
SirDice

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,032
Messages: 38,480

I was just asking because a FreeBSD binary compiled for the RasPi would of course be "native" as well, and for cross-compiling, you could just use base clang with --target=arm-unknown-freebsd13.
The Pi Pico is a micro-controller, it's an entirely different set up compared to the other Raspberry Pis. In this respect it has more in common with an Arduino or ESP32 for example.
 

Zirias

Daemon

Reaction score: 1,418
Messages: 2,478

The Pi Pico is a micro-controller, it's an entirely different set up compared to the other Raspberry Pis. In this respect it has more in common with an Arduino or ESP32 for example.
Ok I assumed you meant to run FreeBSD *on* it, but although the CPU would be fine for that, seeing the specs with e.g. 264KB RAM, I now realized you were just talking about connectivity 😁
 
OP
SirDice

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,032
Messages: 38,480

Yeah, I can see the confusion. I'm going to use FreeBSD to cross-compile for it and connect to it. I don't think it will ever be possible to get this tiny thing to boot FreeBSD 😁
 
OP
SirDice

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,032
Messages: 38,480

devel/thonny works. You can select the Pico from the option menu as indicated in the Pico's documentation. It can't automatically find the Pico though. You have to select /dev/cuaU0 (in my case) by hand. And set the proper permissions on the device, or else a user can't write to it.
 

ralphbsz

Son of Beastie

Reaction score: 2,301
Messages: 3,212

That Thonny thing is command-line based and doesn't need X? And is also available on platforms (Raspbian in particular)?

The Pi Pico sounds tempting. There are several places where I'm currently dreaming of installing Pi Zero boards, in my copious (pun for "non-existing") spare time. In several cases, I'd have to find WiFi capability though.
 
OP
SirDice

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,032
Messages: 38,480

That Thonny thing is command-line based and doesn't need X? And is also available on platforms (Raspbian in particular)?
It's GUI. And yes, it's available on other platforms. It's actually the recommended application to use in the Pico documentation.

You can access the Pico's MicroPython REPL just by connecting a serial console, documentation recommends comms/minicom. You can probably use cu(1) too, it's just a plain serial console connection.

Still need to figure out how to automount it. You connect the Pico by holding down the button, then plugging it in. It should show up as a disk. Then you copy (ordinary file copy) your application to it. When the copy is finished the Pico disconnects, restarts and starts running the application. Then reconnects as a serial device.
 
OP
SirDice

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,032
Messages: 38,480

If I read things correctly, the Arduino IDE recently added support for the Pi Pico too. Haven't tried that yet though.
 
OP
SirDice

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,032
Messages: 38,480

Needed devel/arm-none-eabi-gcc and devel/arm-none-eabi-newlib. Things look fine, following the instructions:
Code:
dice@williscorto:~/Sources/pico/mytest/build % cmake ..
Using PICO_SDK_PATH from environment ('/home/dice/Sources/pico/pico-sdk')
PICO_SDK_PATH is /home/dice/Sources/pico/pico-sdk
Defaulting PICO_PLATFORM to rp2040 since not specified.
Defaulting PICO platform compiler to pico_arm_gcc since not specified.
-- Defaulting build type to 'Release' since not specified.
PICO compiler is pico_arm_gcc
PICO_GCC_TRIPLE defaulted to arm-none-eabi
-- The C compiler identification is GNU 8.4.0
-- The CXX compiler identification is GNU 8.4.0
-- The ASM compiler identification is GNU
-- Found assembler: /usr/local/bin/arm-none-eabi-gcc
Defaulting PICO target board to pico since not specified.
Using board configuration from /home/dice/Sources/pico/pico-sdk/src/boards/include/boards/pico.h
-- Found Python3: /usr/local/bin/python3.7 (found version "3.7.10") found components: Interpreter
TinyUSB available at /home/dice/Sources/pico/pico-sdk/lib/tinyusb/src/portable/raspberrypi/rp2040; adding USB support.
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
ELF2UF2 will need to be built
-- Configuring done
-- Generating done
-- Build files have been written to: /home/dice/Sources/pico/mytest/build

But then the build fails with a compiler error:
Code:
dice@williscorto:~/Sources/pico/mytest/build % make
Scanning dependencies of target ELF2UF2Build
[  1%] Creating directories for 'ELF2UF2Build'
[  3%] No download step for 'ELF2UF2Build'
[  5%] No update step for 'ELF2UF2Build'
[  6%] No patch step for 'ELF2UF2Build'
[  8%] Performing configure step for 'ELF2UF2Build'
-- The C compiler identification is Clang 11.0.1
-- The CXX compiler identification is Clang 11.0.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/dice/Sources/pico/mytest/build/elf2uf2
[ 10%] Performing build step for 'ELF2UF2Build'
Scanning dependencies of target elf2uf2
[ 50%] Building CXX object CMakeFiles/elf2uf2.dir/main.cpp.o
[100%] Linking CXX executable elf2uf2
[100%] Built target elf2uf2
[ 11%] No install step for 'ELF2UF2Build'
[ 13%] Completed 'ELF2UF2Build'
[ 13%] Built target ELF2UF2Build
Scanning dependencies of target bs2_default
[ 15%] Building ASM object pico-sdk/src/rp2_common/boot_stage2/CMakeFiles/bs2_default.dir/boot2_w25q080.S.obj
[ 16%] Linking ASM executable bs2_default.elf
[ 16%] Built target bs2_default
Scanning dependencies of target bs2_default_padded_checksummed_asm
[ 18%] Generating bs2_default.bin
[ 20%] Generating bs2_default_padded_checksummed.S
[ 20%] Built target bs2_default_padded_checksummed_asm
Scanning dependencies of target hello_world
[ 22%] Building C object CMakeFiles/hello_world.dir/hello_world.c.obj
[ 23%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/pico_stdlib/stdlib.c.obj
[ 25%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/hardware_gpio/gpio.c.obj
[ 27%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/hardware_claim/claim.c.obj
[ 28%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/hardware_sync/sync.c.obj
[ 30%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/pico_platform/platform.c.obj
[ 32%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/hardware_uart/uart.c.obj
[ 33%] Building ASM object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/hardware_divider/divider.S.obj
[ 35%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/common/pico_time/time.c.obj
[ 37%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/common/pico_time/timeout_helper.c.obj
[ 38%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/hardware_timer/timer.c.obj
[ 40%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/common/pico_sync/sem.c.obj
[ 42%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/common/pico_sync/lock_core.c.obj
[ 44%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/common/pico_sync/mutex.c.obj
[ 45%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/common/pico_sync/critical_section.c.obj
[ 47%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/common/pico_util/datetime.c.obj
[ 49%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/common/pico_util/pheap.c.obj
[ 50%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/common/pico_util/queue.c.obj
[ 52%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/pico_runtime/runtime.c.obj
[ 54%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/hardware_clocks/clocks.c.obj
[ 55%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/hardware_watchdog/watchdog.c.obj
[ 57%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/hardware_xosc/xosc.c.obj
[ 59%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/hardware_pll/pll.c.obj
[ 61%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/hardware_vreg/vreg.c.obj
[ 62%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/hardware_irq/irq.c.obj
[ 64%] Building ASM object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/hardware_irq/irq_handler_chain.S.obj
[ 66%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/pico_printf/printf.c.obj
/home/dice/Sources/pico/pico-sdk/src/rp2_common/pico_printf/printf.c: In function '_ftoa':
/home/dice/Sources/pico/pico-sdk/src/rp2_common/pico_printf/printf.c:392:5: internal compiler error: Illegal instruction
     if (diff > 0.5) {
     ^~
no stack trace because unwind library not available
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
*** Error code 1

Stop.
make[2]: stopped in /usr/home/dice/Sources/pico/mytest/build
*** Error code 1

Stop.
make[1]: stopped in /usr/home/dice/Sources/pico/mytest/build
*** Error code 1

Stop.
make: stopped in /usr/home/dice/Sources/pico/mytest/build

Did the same on a recent Raspberry PI OS, and it builds just fine there. Looking a little closer I see the version of gcc-none-eabi-gcc on FreeBSD is newer than the one from Raspbian:
Code:
pi@raspberrypi:~/pico/mytest/build $ arm-none-eabi-gcc --version
arm-none-eabi-gcc (15:7-2018-q2-6) 7.3.1 20180622 (release) [ARM/embedded-7-branch revision 261907]
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Code:
dice@williscorto:~/Sources/pico/mytest/build % arm-none-eabi-gcc --version
arm-none-eabi-gcc (FreeBSD Ports Collection for armnoneeabi) 8.4.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Maybe there's a switch I can throw so it uses the older compiler settings, but haven't found anything yet. So I'm a little stuck at the moment.
 

balanga

Son of Beastie

Reaction score: 217
Messages: 4,024

Received a Raspberry Pi Pico in the mail today. I love getting new toys to play with. This thing is tiny ♥️

I assume this will just work fine on FreeBSD as you it just mounts a drive and you copy some application to it, then it should just work. But I want to try to compile some native C/C++ for it but you need to install the SDK for that. Anybody tried getting that pico-sdk and all working on FreeBSD yet?

Translating some of the (Linux) requirements it looks like I need at least devel/arm-none-eabi-gcc. Probably some other bits and pieces too, but it looks like I can find most of it in the ports tree. I'm going to need to do some experimenting tonight.
Just got one of these as a present and not really sure what it does...

Do you have any interesting links and what it is capable of?

Please update this thread with any progress you make.
 
OP
SirDice

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,032
Messages: 38,480

OP
SirDice

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,032
Messages: 38,480

If you want to use MicroPython then you can use FreeBSD, devel/thonny works (with the caveat that you have configure the port by hand, it can't seem to find it automatically). It's the same Thonny that's used in many of the Pico's documentation. I'm only having some problems with getting C/C++ code for the Pico to compile on FreeBSD.
 

balanga

Son of Beastie

Reaction score: 217
Messages: 4,024

I've just installed devel/thonny
and expected it to magically appear under the Progamming tab on LXDE, but no...
Whats the best way to launch it? This is what I get when running thonny
Code:
root@Multiboot:~ # thonny
Traceback (most recent call last):
  File "/usr/local/bin/thonny", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3251, in <module>
    @_call_aside
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3235, in _call_aside
    f(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3264, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 583, in _build_master
    ws.require(__requires__)
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 900, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 786, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'Send2Trash>=1.5' distribution was not found and is required by thonny
 
OP
SirDice

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,032
Messages: 38,480

Don't run applications as root. Open a terminal on your user account and start it from there. Make sure you're running X as Thonny is a GUI application. I have Thonny running on the Awesome window manager, so it doesn't need much with regards to desktop environments.
 

balanga

Son of Beastie

Reaction score: 217
Messages: 4,024

I have Thonny running and I can see the pico device attached if I run dmesg:
Code:
ugen2.3: <Raspberry Pi RP2 Boot> at usbus2
umass1 on uhub3
umass1: <Raspberry Pi RP2 Boot, class 0/0, rev 1.10/1.00, addr 3> on usbus2
umass1:  SCSI over Bulk-Only; quirks = 0x0100
umass1:5:1: Attached to scbus5
da1 at umass-sim1 bus 1 scbus5 target 0 lun 0
da1: <RPI RP2 1> Removable Direct Access SCSI-2 device
da1: Serial Number E0C912D24340
da1: 1.000MB/s transfers
da1: 128MB (262144 512 byte sectors)
da1: quirks=0x2<NO_6_BYTE>
gpart shows:-
Code:
root@Home:~ # gpart show da1
=>     1  262143  da1  MBR  (128M)
       1  262143    1  !14  (128M)
Following the Pico projects guide, I not sure what to expect when I try to Add the MicroPython firmware
... I've run pkg install micropython. Should I expect Thonny to add/find it somehow?

Not really sure what to expect...
 
OP
SirDice

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,032
Messages: 38,480


Download the UF2 file. Press the button on the pico and connect it. Drag 'n drop (or copy) that UF2 file to the pico's disk device. The pico will then disconnect and reconnect as a serial (modem) device.

Start Thonny. Go to Run -> Select Interpreter. Select "Micropython (Raspberry Pi Pico)" and select the correct Port (mine's on /dev/cuaU0). Make sure your user account has read/write permissions to the serial device or you won't be able to use it.

There is no need to install MicroPython locally. It runs on the Pico itself (it's the UF2 file you copied earlier).
 

balanga

Son of Beastie

Reaction score: 217
Messages: 4,024

When selecting interpreter I don't see "Micropython (Raspberry Pi Pico)", I selected "Micropython (BBC micro:blt)" - I don't know if that is equivalent, but I did manage to switch the LED on and off, so I guess that is some small amount of progress...

I did notice this when I hit Ctrl-D

Code:
MPY: soft reboot
MicroPython v1.14 on 2021-02-05; Raspberry Pi Pico with RP2040
Type "help()" for more information.

so it looks like I have installed the correct version of Micropython...

I guess I need to learn a bit of python before continuing.

Not managed to save anything yet using Thonny. When I goto File->Save->To MicroPythonDevice I get:-

Code:
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/tkinter/__init__.py", line 1705, in __call__
    return self.func(*args)
  File "/usr/local/lib/python3.7/site-packages/thonny/workbench.py", line 1063, in dispatch_from_menu
    dispatch(None)
  File "/usr/local/lib/python3.7/site-packages/thonny/workbench.py", line 989, in dispatch
    handler()
  File "/usr/local/lib/python3.7/site-packages/thonny/editors.py", line 809, in _cmd_save_file
    self.get_current_editor().save_file()
  File "/usr/local/lib/python3.7/site-packages/thonny/editors.py", line 245, in save_file
    save_filename = self.ask_new_path(node)
  File "/usr/local/lib/python3.7/site-packages/thonny/editors.py", line 362, in ask_new_path
    return self.ask_new_remote_path()
  File "/usr/local/lib/python3.7/site-packages/thonny/editors.py", line 365, in ask_new_remote_path
    target_path = ask_backend_path(self.winfo_toplevel(), "save")
  File "/usr/local/lib/python3.7/site-packages/thonny/base_file_browser.py", line 1298, in ask_backend_path
    dlg = BackendFileDialog(master, dialog_kind, proxy.get_cwd())
  File "/usr/local/lib/python3.7/site-packages/thonny/base_file_browser.py", line 1151, in __init__
    self.browser.request_focus_into(initial_dir)
  File "/usr/local/lib/python3.7/site-packages/thonny/base_file_browser.py", line 1062, in request_focus_into
    assert path == ""
AssertionError

Looks like something may be missing from Thonny's environment.
 
OP
SirDice

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,032
Messages: 38,480

I've made some progress with regards to compiling C/C++. On a Raspberry Pi 3 running FreeBSD 13.0 and the same version of arm-none-eabi-gcc as on my AMD64 machine I get a different compiler error. It does seem to build that pico-sdk/src/rp2_common/pico_printf/printf.c just fine but it chokes on something else. Why do I get different compiler errors on aarch64 and amd64 when everything else is exactly the same?

Code:
dice@pibsd:~/Sources/pico/mytest % setenv PICO_SDK_PATH /home/dice/Sources/pico/pico-sdk
dice@pibsd:~/Sources/pico/mytest % cd build/
dice@pibsd:~/Sources/pico/mytest/build % cmake ..
Using PICO_SDK_PATH from environment ('/home/dice/Sources/pico/pico-sdk')
PICO_SDK_PATH is /home/dice/Sources/pico/pico-sdk
Defaulting PICO_PLATFORM to rp2040 since not specified.
Defaulting PICO platform compiler to pico_arm_gcc since not specified.
-- Defaulting build type to 'Release' since not specified.
PICO compiler is pico_arm_gcc
PICO_GCC_TRIPLE defaulted to arm-none-eabi
-- The C compiler identification is GNU 8.4.0
-- The CXX compiler identification is GNU 8.4.0
-- The ASM compiler identification is GNU
-- Found assembler: /usr/local/bin/arm-none-eabi-gcc
Defaulting PICO target board to pico since not specified.
Using board configuration from /home/dice/Sources/pico/pico-sdk/src/boards/include/boards/pico.h
-- Found Python3: /usr/local/bin/python3.7 (found version "3.7.10") found components: Interpreter
TinyUSB available at /home/dice/Sources/pico/pico-sdk/lib/tinyusb/src/portable/raspberrypi/rp2040; adding USB support.
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
ELF2UF2 will need to be built
-- Configuring done
-- Generating done
-- Build files have been written to: /home/dice/Sources/pico/mytest/build
So far so good, same output as on my amd64 system with the same compilers installed.

Code:
dice@pibsd:~/Sources/pico/mytest/build % make hello_world
PICO_SDK_PATH is /home/dice/Sources/pico/pico-sdk
PICO platform is rp2040.
PICO compiler is
PICO_GCC_TRIPLE defaulted to arm-none-eabi
PICO target board is pico.
Using board configuration from /home/dice/Sources/pico/pico-sdk/src/boards/include/boards/pico.h
TinyUSB available at /home/dice/Sources/pico/pico-sdk/lib/tinyusb/src/portable/raspberrypi/rp2040; adding USB support.
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
ELF2UF2 will need to be built
-- Configuring done
-- Generating done
-- Build files have been written to: /home/dice/Sources/pico/mytest/build
PICO_SDK_PATH is /home/dice/Sources/pico/pico-sdk
PICO platform is rp2040.
PICO compiler is
PICO_GCC_TRIPLE defaulted to arm-none-eabi
PICO target board is pico.
Using board configuration from /home/dice/Sources/pico/pico-sdk/src/boards/include/boards/pico.h
TinyUSB available at /home/dice/Sources/pico/pico-sdk/lib/tinyusb/src/portable/raspberrypi/rp2040; adding USB support.
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
ELF2UF2 will need to be built
-- Configuring done
-- Generating done
-- Build files have been written to: /home/dice/Sources/pico/mytest/build
Scanning dependencies of target ELF2UF2Build
[  1%] Creating directories for 'ELF2UF2Build'
[  3%] No download step for 'ELF2UF2Build'
[  5%] No update step for 'ELF2UF2Build'
[  6%] No patch step for 'ELF2UF2Build'
[  8%] Performing configure step for 'ELF2UF2Build'
-- The C compiler identification is Clang 11.0.1
-- The CXX compiler identification is Clang 11.0.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/dice/Sources/pico/mytest/build/elf2uf2
[ 10%] Performing build step for 'ELF2UF2Build'
-- Configuring done
-- Generating done
-- Build files have been written to: /home/dice/Sources/pico/mytest/build/elf2uf2
Scanning dependencies of target elf2uf2
[ 50%] Building CXX object CMakeFiles/elf2uf2.dir/main.cpp.o
[100%] Linking CXX executable elf2uf2
[100%] Built target elf2uf2
[ 11%] No install step for 'ELF2UF2Build'
[ 13%] Completed 'ELF2UF2Build'
[ 13%] Built target ELF2UF2Build
Scanning dependencies of target bs2_default
[ 15%] Building ASM object pico-sdk/src/rp2_common/boot_stage2/CMakeFiles/bs2_default.dir/compile_time_choice.S.obj
[ 16%] Linking ASM executable bs2_default.elf
[ 16%] Built target bs2_default
Scanning dependencies of target bs2_default_padded_checksummed_asm
[ 18%] Generating bs2_default.bin
[ 20%] Generating bs2_default_padded_checksummed.S
[ 20%] Built target bs2_default_padded_checksummed_asm
Scanning dependencies of target hello_world
[ 22%] Building C object CMakeFiles/hello_world.dir/hello_world.c.obj
[ 23%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/pico_stdlib/stdlib.c.obj
[ 25%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/hardware_gpio/gpio.c.obj
[ 27%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/hardware_claim/claim.c.obj
[ 28%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/hardware_sync/sync.c.obj
[ 30%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/pico_platform/platform.c.obj
[ 32%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/hardware_uart/uart.c.obj
[ 33%] Building ASM object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/hardware_divider/divider.S.obj
[ 35%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/common/pico_time/time.c.obj
[ 37%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/common/pico_time/timeout_helper.c.obj
[ 38%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/hardware_timer/timer.c.obj
[ 40%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/common/pico_sync/sem.c.obj
[ 42%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/common/pico_sync/lock_core.c.obj
[ 44%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/common/pico_sync/mutex.c.obj
[ 45%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/common/pico_sync/critical_section.c.obj
[ 47%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/common/pico_util/datetime.c.obj
[ 49%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/common/pico_util/pheap.c.obj
[ 50%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/common/pico_util/queue.c.obj
[ 52%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/pico_runtime/runtime.c.obj
[ 54%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/hardware_clocks/clocks.c.obj
[ 55%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/hardware_watchdog/watchdog.c.obj
[ 57%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/hardware_xosc/xosc.c.obj
[ 59%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/hardware_pll/pll.c.obj
[ 61%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/hardware_vreg/vreg.c.obj
[ 62%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/hardware_irq/irq.c.obj
[ 64%] Building ASM object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/hardware_irq/irq_handler_chain.S.obj
[ 66%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/pico_printf/printf.c.obj
[ 67%] Building ASM object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/pico_bit_ops/bit_ops_aeabi.S.obj
[ 69%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/pico_bootrom/bootrom.c.obj
[ 71%] Building ASM object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/pico_divider/divider.S.obj
[ 72%] Building ASM object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/pico_double/double_aeabi.S.obj
[ 74%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/pico_double/double_init_rom.c.obj
[ 76%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/pico_double/double_math.c.obj
[ 77%] Building ASM object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/pico_double/double_v1_rom_shim.S.obj
[ 79%] Building ASM object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/pico_int64_ops/pico_int64_ops_aeabi.S.obj
[ 81%] Building ASM object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/pico_float/float_aeabi.S.obj
[ 83%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/pico_float/float_init_rom.c.obj
[ 84%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/pico_float/float_math.c.obj
[ 86%] Building ASM object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/pico_float/float_v1_rom_shim.S.obj
[ 88%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/pico_malloc/pico_malloc.c.obj
[ 89%] Building ASM object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/pico_mem_ops/mem_ops_aeabi.S.obj
[ 91%] Building ASM object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/pico_standard_link/crt0.S.obj
[ 93%] Building CXX object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/pico_standard_link/new_delete.cpp.obj
In file included from /usr/include/c++/v1/cstdlib:84,
                 from /home/dice/Sources/pico/pico-sdk/src/rp2_common/pico_standard_link/new_delete.cpp:10:
/usr/include/c++/v1/__config:1141:6: error: #error "No thread API"
 #    error "No thread API"
      ^~~~~
*** Error code 1

Stop.
make[3]: stopped in /home/dice/Sources/pico/mytest/build
*** Error code 1

Stop.
make[2]: stopped in /home/dice/Sources/pico/mytest/build
*** Error code 1

Stop.
make[1]: stopped in /home/dice/Sources/pico/mytest/build
*** Error code 1

Stop.
make: stopped in /home/dice/Sources/pico/mytest/build
This I don't get.
Code:
[ 66%] Building C object CMakeFiles/hello_world.dir/home/dice/Sources/pico/pico-sdk/src/rp2_common/pico_printf/printf.c.obj
It builds fine on the Pi but fails on my amd64 system. But it eventually still croaks.
 

arg

New Member

Reaction score: 3
Messages: 5

It looks like it's using the host compiler (perhaps inadvertently) - there is no instance of that error string in any of the Pico SDK source, nor anything else on my system apart from:


/usr/src/contrib/llvm-project/libcxx/include/__config:# error "No thread API"

/usr/include/c++/v1/__config:# error "No thread API"

Not immediately clear if it's using the host compiler where it should be using the target compiler, or is deliberately compiling a build tool to run on the host.
 
Top