News How to Program Raspberry Pi Pico With the Arduino IDE

Apr 1, 2021
4
0
10
0
Just a heads-up. Following installation instructions for Linux I ran into a couple of snags.
(1) I'm compiling on Raspberry (Linux rpi 4.19.66-v7+ #1253 SMP Thu Aug 15 11:49:46 BST 2019 armv7l GNU/Linux). Not the most update but... "./pico_setup.sh" won't use cmake that comes with the OS. "apt-get" won't go above v3.7 which fails the script.

I backtracked and found instructions to install cmake v3.13.4 here. It took a while but that worked.

(2) returning to "./pico_setup.sh", I had to "rm -rf pico" to start over (not continuable from where it failed). Although the script tried to schedule installation of cmake v3.7 again, it was sophisticated enough to skip that (I think) as it did not fail again at the use of cmake when needed.

(3) unfortunately the C++ compilation failed here:

[ 74%] Building CXX object CMakeFiles/picoprobe.dir/home/pi/pico/pico-sdk/src/rp2_common/pico_standard_link/new_delete.cpp.obj
/home/pi/pico/pico-sdk/src/rp2_common/pico_standard_link/new_delete.cpp:20:55: error: expected initializer before 'noexcept'
void operator delete(void *p, __unused std::size_t n) noexcept { std::free(p); }
^
/home/pi/pico/pico-sdk/src/rp2_common/pico_standard_link/new_delete.cpp:24:33: error: expected initializer before 'noexcept'
void operator delete[](void *p) noexcept { std::free(p); }
^
CMakeFiles/picoprobe.dir/build.make:585: recipe for target 'CMakeFiles/picoprobe.dir/home/pi/pico/pico-sdk/src/rp2_common/pico_standard_link/new_delete.cpp.obj' failed
make[2]: *** [CMakeFiles/picoprobe.dir/home/pi/pico/pico-sdk/src/rp2_common/pico_standard_link/new_delete.cpp.obj] Error 1
make[2]: *** Waiting for unfinished jobs....
CMakeFiles/Makefile2:74: recipe for target 'CMakeFiles/picoprobe.dir/all' failed
make[1]: *** [CMakeFiles/picoprobe.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

I figured I should post before trying to fix the code error and getting stuck in another rabbit hole.

It's getting there - thanks for all the effort as I have a sneaky feeling the Arduino IDE guys won't be overly enthusiastic to come out with their own Raspberry Pico IDE as competition to their own pico hardware :)
 
Last edited:
Apr 1, 2021
4
0
10
0
Just a heads-up. Following installation instructions for Linux I ran into a couple of snags.
...
Replying to my own post (sorry). Just continuing the saga, trying to get Debian on Raspberry Pi to load the Linux package that gets the Arduino IDE to support Raspberry Pico development.

...continuing...

The source issue is the compiler keyword "noexcept", which was introduced into C++ by gcc at version11. I got as far as getting gcc++ v10.1 compiled and installed in Debian on my Raspberry Pi but it won't run since gcc++ v10.1 requires GLIBC_2.28 in "/lib/arm-linux-gnueabihf/libc.so.6", which only goes as far as GLIBC_2.27 in Debian. Fixing that would risk even booting Debian and (subsequently discovered) gcc++ v10.1 would not support "noexcept", so that was a dead end path.

Instead I checked what "noexcept" was meant to do. It's a compile time assert which should provide no features to the runtime result. Trouble is "fixing" the code by removing "noexcept" would be overwritten since the source is fetched, each time the "pico_setup.sh" script is run. "pico_setup,sh" is not reentrant, it complains at a "mkdir build" line that the directory exists. That directory is an artifact of the precious run. Even changing "mkdir build" to "mkdir -p build" fails further down as other directories exist and are not empty. I have to "rm -rf pico" between each attempt so my "fixes" don't survive :)-( ).

To get past that, I copied the source that trips up the compile:
pico/pico-sdk/src/rp2_common/pico_standard_link/new_delete.cpp
to the same directory as the "pico_setup.sh", "fixed" the source by commenting out both "noexcept" references:
C++:
void operator delete(void *p, __unused std::size_t n) noexcept { std::free(p); }

void operator delete(void *p) { std::free(p); }

void operator delete[](void *p) noexcept { std::free(p); }
became

C++:
void operator delete(void *p, __unused std::size_t n) /* noexcept */ { std::free(p); }

void operator delete(void *p) { std::free(p); }

void operator delete[](void *p) /* noexcept */ { std::free(p); }
and added a re-copy back step just before the relevant "make" in "pico_setup.sh" i.e.
Bash:
  cd build
  cmake ../
  make -j$JNUM
became:
Bash:
  cd build
  cmake ../
  cp ${HOME}/new_delete.cpp ${HOME}/pico/pico-sdk/src/rp2_common/pico_standard_link/new_delete.cpp
  make -j$JNUM
A bit of a kludge but that now compiles on Debian's gcc++ v6.3.

The saga continues... the next snag is:
Processing triggers for gnome-menus (3.13.3-9) ...
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package libegl-mesa0


That appears to be something to do with a video driver given as a dependency.

ONWARD!
 
Apr 1, 2021
4
0
10
0
Replying to my own post again (sorry). Still continuing the saga, trying to get Debian on Raspberry Pi v3 to load the Linux package that gets the Arduino IDE to support Raspberry Pico development.

...continuing...

Processing triggers for gnome-menus (3.13.3-9) ...
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package libegl-mesa0


That appears to be something to do with a video driver given as a dependency.

ONWARD!
It Works!

Last "fix" to the "pico_setup.sh" script for Raspberry Pico support to Arduino IDE hosted on a Raspberry Pi v3 (Linux rpi 4.19.66-v7+ #1253 SMP Thu Aug 15 11:49:46 BST 2019 armv7l GNU/Linux).
Bash:
from:
EXTRA_VSCODE_DEPS="libx11-xcb1 libxcb-dri3-0 libdrm2 libgbm1 libegl-mesa0"

to:
# was EXTRA_VSCODE_DEPS="libx11-xcb1 libxcb-dri3-0 libdrm2 libgbm1 libegl-mesa0"
EXTRA_VSCODE_DEPS="libx11-xcb1 libxcb-dri3-0 libdrm2 libgbm1"
I have one of my sketches ported from Arduino Mega to Raspberry Pico. Phew.

TY hardworking Arduino IDE board-porting people.

--Alen
 

ASK THE COMMUNITY