I decided to test the MCU inside the RV1106 and will share my steps with you. I’m using the Luckfox Pico Ultra W board for these tests.
You need download the https://github.com/luyi1888/rv1106-mcu and build it. This issue also helped me: https://github.com/LuckfoxTECH/luckfox-pico/issues/112
After cloning and build the rv1106-mcu branch I copied the mcutool to my board and tried to run it:
root@luckfoxpuw:/data# chmod a+x mcutool
root@luckfoxpuw:/data# echo none > /sys/class/leds/work/trigger
root@luckfoxpuw:/data# ./mcutool execute 0xff6c0000 rv1106-mcu-led-blinky.bin
-sh: ./mcutool: cannot execute: required file not found
Then I tried to see if the file was dynamically linked or statically, but file command doesn’t exist on my image:
root@luckfoxpuw:/data# file mcutool
-sh: file: command not found
Let see if strace helps (strange: file command is not available, but strace is available)
root@luckfoxpuw:/data# strace -f ./mcutool
execve("./mcutool", ["./mcutool"], 0xaea5dde4 /* 16 vars */) = -1 ENOENT (No such file or directory)
strace: exec: No such file or directory
+++ exited with 1 +++
root@luckfoxpuw:/data#
Strace didn’t help much, but this ENOENT error could indicate the ld is missing (I confirmed the file is statically linked).
So let’s see which LD it is using (unfortunately objdump and other tools are not available), let use this trick that I learnt from chatgpt:
root@luckfoxpuw:/data# strings ./mcutool | grep ld-
/lib/ld-uClibc.so.0
I don’t think I have this lib:
root@luckfoxpuw:/data# ls /lib/ld-uClibc.so.0
ls: /lib/ld-uClibc.so.0: No such file or directory
Hmm in fact the toolchain used by the mcutool uClibc, but my board has an image created using Yocto:
root@luckfoxpuw:/data# ls /lib/ld-* -l
-rwxr-xr-x 1 root root 122316 Aug 21 19:19 /lib/ld-linux-armhf.so.3
Then after install the gcc-arm-linux-gnueabihf on my build machine and modify the rv1106-mcu Makefile to use the new toolchain:
diff --git a/Makefile b/Makefile
index 1e9902f..74b1b0c 100755
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,8 @@
-CROSS_COMPILE ?= arm-rockchip830-linux-uclibcgnueabihf-
+CROSS_COMPILE ?= arm-linux-gnueabihf-
CC = $(CROSS_COMPILE)gcc
Everything worked as expected:
root@luckfoxpuw:~# echo none > /sys/class/leds/work/trigger
root@luckfoxpuw:~# cd /data
root@luckfoxpuw:/data# ./mcutool execute 0xff6c0000 rv1106-mcu-led-blinky.bin
MCU reset.
MCU FW load to 0xff6c0000.
MCU boot addr set to 0xff6c0000.
MCU release.
root@luckfoxpuw:/data#