Pico C example execution issues ...
Posted: 2024-11-25 9:29
I got some issues with a Pico Mini, in particular, I cannot get any of the C examples to run on the target.
I have checked out the recent SDK with git, installed the cross toolchain, and successfully built an example.
In this case, the iio ADC example.
But it seems the SDK / toolchain and the OS on the target don't add up.
Here are more details.
First, the OS running on the target (a Luckfox Pico Mini B).
I downloaded an Ubuntu Linux image from the Google Cloud directory the Wiki links to.
In this case, ../firmware/buildroot/Luckfox_Pico_Mini_Ubuntu_MicroSD.zip (671,3MB)
Installation on a SD card went fine, and board boots up correctly.
Her is what it says :
pico@luckfox:~$ uname -a
Linux luckfox 5.10.160 #2 Fri Oct 18 12:03:14 CST 2024 armv7l armv7l armv7l GNU/Linux
pico@luckfox:~$ cat /proc/version
Linux version 5.10.160 (root@DESKTOP-RUMO6US) (arm-rockchip830-linux-uclibcgnueabihf-gcc (crosstool-NG 1.24.0) 8.3.0, GNU ld (crosstool-NG 1.24.0) 2.32) #2 Fri Oct 18 12:03:14 CST 2024
pico@luckfox:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.3 LTS
Release: 22.04
Codename: jammy
pico@luckfox:~$
Building the C example and deploying it to the target (via scp), works fine as well.
Trying to execute yields :
pico@luckfox:~/dev$ ./iio_adc
-bash: ./iio_adc: No such file or directory
pico@luckfox:~/dev$
Checking with ldd, it seems libraries are missing.
After manually copying libc.so.0 and ld-uClibc.so.1 to the target, ldd tells me this :
pico@luckfox:~/dev$ ldd ./iio_adc
libc.so.0 => /lib/arm-linux-gnueabihf/libc.so.0 (0xa6f00000)
ld-uClibc.so.1 => /lib/arm-linux-gnueabihf/ld-uClibc.so.1 (0xa6ee0000)
pico@luckfox:~/dev$
But it still does not execute, error message is the same as above.
Trying to build the example on the target didn't work either, for the same reason (I guess):
pico@luckfox:~/dev$ gcc -o iio_adc iio_adc.c
/usr/bin/ld: cannot find /usr/lib/arm-linux-gnueabihf/libc_nonshared.a: No such file or directory
collect2: error: ld returned 1 exit status
pico@luckfox:~/dev$
Finally, here the version information of the cross toolchain on the host:
fm@fm-ThinkPad-T480:~$ arm-rockchip830-linux-uclibcgnueabihf-gcc -v
Using built-in specs.
COLLECT_GCC=arm-rockchip830-linux-uclibcgnueabihf-gcc
COLLECT_LTO_WRAPPER=/home/fm/tools/lf_sdk/arm-rockchip830-linux-uclibcgnueabihf/bin/../libexec/gcc/arm-rockchip830-linux-uclibcgnueabihf/8.3.0/lto-wrapper
Target: arm-rockchip830-linux-uclibcgnueabihf
Configured with: /opt/.build/arm-rockchip830-linux-uclibcgnueabihf/src/gcc/configure --build=x86_64-build_pc-linux-gnu --host=x86_64-build_pc-linux-gnu --target=arm-rockchip830-linux-uclibcgnueabihf --prefix=/opt/x-tool/arm-rockchip830-linux-uclibcgnueabihf --with-sysroot=/opt/x-tool/arm-rockchip830-linux-uclibcgnueabihf/arm-rockchip830-linux-uclibcgnueabihf/sysroot --enable-languages=c,c++ --with-arch=armv7-a --with-fpu=neon-vfpv4 --with-float=hard --with-pkgversion='crosstool-NG 1.24.0' --enable-__cxa_atexit --disable-libmudflap --disable-libgomp --disable-libssp --disable-libquadmath --disable-libquadmath-support --disable-libsanitizer --disable-libmpx --with-gmp=/opt/.build/arm-rockchip830-linux-uclibcgnueabihf/buildtools --with-mpfr=/opt/.build/arm-rockchip830-linux-uclibcgnueabihf/buildtools --with-mpc=/opt/.build/arm-rockchip830-linux-uclibcgnueabihf/buildtools --with-isl=/opt/.build/arm-rockchip830-linux-uclibcgnueabihf/buildtools --enable-lto --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --enable-threads=posix --enable-target-optspace --enable-plugin --enable-gold --disable-nls --disable-multilib --with-local-prefix=/opt/x-tool/arm-rockchip830-linux-uclibcgnueabihf/arm-rockchip830-linux-uclibcgnueabihf/sysroot --enable-long-long
Thread model: posix
gcc version 8.3.0 (crosstool-NG 1.24.0)
fm@fm-ThinkPad-T480:~$
The Version so far matches with the Ubuntu output on the target.
As a side note, I have not done a full build of the SDK, only a "build.sh lunch" to setup the configuration.
I am fine with user space applications, and had not intended to modify/compile the OS.
I have the suspicion the Ubuntu image I installed is not the OS the SDK is intended to build against.
If this is correct, can I get my self-built examples to run with another image - and which one ?
Thank you !
I have checked out the recent SDK with git, installed the cross toolchain, and successfully built an example.
In this case, the iio ADC example.
But it seems the SDK / toolchain and the OS on the target don't add up.
Here are more details.
First, the OS running on the target (a Luckfox Pico Mini B).
I downloaded an Ubuntu Linux image from the Google Cloud directory the Wiki links to.
In this case, ../firmware/buildroot/Luckfox_Pico_Mini_Ubuntu_MicroSD.zip (671,3MB)
Installation on a SD card went fine, and board boots up correctly.
Her is what it says :
pico@luckfox:~$ uname -a
Linux luckfox 5.10.160 #2 Fri Oct 18 12:03:14 CST 2024 armv7l armv7l armv7l GNU/Linux
pico@luckfox:~$ cat /proc/version
Linux version 5.10.160 (root@DESKTOP-RUMO6US) (arm-rockchip830-linux-uclibcgnueabihf-gcc (crosstool-NG 1.24.0) 8.3.0, GNU ld (crosstool-NG 1.24.0) 2.32) #2 Fri Oct 18 12:03:14 CST 2024
pico@luckfox:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.3 LTS
Release: 22.04
Codename: jammy
pico@luckfox:~$
Building the C example and deploying it to the target (via scp), works fine as well.
Trying to execute yields :
pico@luckfox:~/dev$ ./iio_adc
-bash: ./iio_adc: No such file or directory
pico@luckfox:~/dev$
Checking with ldd, it seems libraries are missing.
After manually copying libc.so.0 and ld-uClibc.so.1 to the target, ldd tells me this :
pico@luckfox:~/dev$ ldd ./iio_adc
libc.so.0 => /lib/arm-linux-gnueabihf/libc.so.0 (0xa6f00000)
ld-uClibc.so.1 => /lib/arm-linux-gnueabihf/ld-uClibc.so.1 (0xa6ee0000)
pico@luckfox:~/dev$
But it still does not execute, error message is the same as above.
Trying to build the example on the target didn't work either, for the same reason (I guess):
pico@luckfox:~/dev$ gcc -o iio_adc iio_adc.c
/usr/bin/ld: cannot find /usr/lib/arm-linux-gnueabihf/libc_nonshared.a: No such file or directory
collect2: error: ld returned 1 exit status
pico@luckfox:~/dev$
Finally, here the version information of the cross toolchain on the host:
fm@fm-ThinkPad-T480:~$ arm-rockchip830-linux-uclibcgnueabihf-gcc -v
Using built-in specs.
COLLECT_GCC=arm-rockchip830-linux-uclibcgnueabihf-gcc
COLLECT_LTO_WRAPPER=/home/fm/tools/lf_sdk/arm-rockchip830-linux-uclibcgnueabihf/bin/../libexec/gcc/arm-rockchip830-linux-uclibcgnueabihf/8.3.0/lto-wrapper
Target: arm-rockchip830-linux-uclibcgnueabihf
Configured with: /opt/.build/arm-rockchip830-linux-uclibcgnueabihf/src/gcc/configure --build=x86_64-build_pc-linux-gnu --host=x86_64-build_pc-linux-gnu --target=arm-rockchip830-linux-uclibcgnueabihf --prefix=/opt/x-tool/arm-rockchip830-linux-uclibcgnueabihf --with-sysroot=/opt/x-tool/arm-rockchip830-linux-uclibcgnueabihf/arm-rockchip830-linux-uclibcgnueabihf/sysroot --enable-languages=c,c++ --with-arch=armv7-a --with-fpu=neon-vfpv4 --with-float=hard --with-pkgversion='crosstool-NG 1.24.0' --enable-__cxa_atexit --disable-libmudflap --disable-libgomp --disable-libssp --disable-libquadmath --disable-libquadmath-support --disable-libsanitizer --disable-libmpx --with-gmp=/opt/.build/arm-rockchip830-linux-uclibcgnueabihf/buildtools --with-mpfr=/opt/.build/arm-rockchip830-linux-uclibcgnueabihf/buildtools --with-mpc=/opt/.build/arm-rockchip830-linux-uclibcgnueabihf/buildtools --with-isl=/opt/.build/arm-rockchip830-linux-uclibcgnueabihf/buildtools --enable-lto --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --enable-threads=posix --enable-target-optspace --enable-plugin --enable-gold --disable-nls --disable-multilib --with-local-prefix=/opt/x-tool/arm-rockchip830-linux-uclibcgnueabihf/arm-rockchip830-linux-uclibcgnueabihf/sysroot --enable-long-long
Thread model: posix
gcc version 8.3.0 (crosstool-NG 1.24.0)
fm@fm-ThinkPad-T480:~$
The Version so far matches with the Ubuntu output on the target.
As a side note, I have not done a full build of the SDK, only a "build.sh lunch" to setup the configuration.
I am fine with user space applications, and had not intended to modify/compile the OS.
I have the suspicion the Ubuntu image I installed is not the OS the SDK is intended to build against.
If this is correct, can I get my self-built examples to run with another image - and which one ?
Thank you !