Flash/Reset the RTOS core on the DUO-S

Hi!

From reading the docs and this forum, I understand that the source code running on the RTOS core is located in the buildroot SDK ( freertos/cvitek/task/comm/src/riscv64/comm_main.c) and that the binary file must be copied to boot/fip.bin on the SD card to run it on the RTOS code.

However, I was wondering what “magic” allows this binary file to be loaded and run on the RTOS code? Is there a flashing tool similar to 8051_up for the 8051 core? Can we manually “flash” a new firmware and reset the RTOS code without rebooting the Linux one?

Thanks!

1 Like

It’s possible to flash from linux. You need an image built with the patches from the arduino branch of GitHub - milkv-duo/duo-buildroot-sdk: Milk-V Duo Official buildroot SDK

Copy the firmware elf file in /lib/firmware then run the following commands, replacing firmware.elf by the filename of your firmware:

echo -n firmware.elf > /sys/class/remoteproc/remoteproc0/firmware
echo stop > /sys/class/remoteproc/remoteproc0/state
echo start > /sys/class/remoteproc/remoteproc0/state

2 Likes

Thanks that’s exactly what I’m looking for!

But since this is available on the arduino branch, I’m curious : how does the firmware gets uploaded on the rtos core on the main branch?

1 Like

During its boot-up stage. That’s why the default way of restarting secondary core is restarting the whole board.

Yes, it’s probably done while the board is booting. But I was wondering when exactly? Is it done by U-Boot, a kernel module, a script that is run when linux is loading,…? Are the source for this step available?

1 Like

Hi, I am using a Duo 256m. I loaded the arduino but it doesn’t seem to be working.

Do you know how can I fix it? Maybe the drivers are not suitable for duo 256m?

1 Like

Does your firmware has the “.resource_table” section ?
Missing this section produce an error when starting, but I don’t remember if this is this one.

1 Like

Yes, it has that section, also tried with another elf image that doesn’t have a resource table and it gives the same error.

1 Like

So the actual problem was i wasn’t correctly setting up the firmware in /lib/firmware directory. Error -2 means it couldn’t find the file. After that I did get in fact the error -22 because of the missing .resource_table section.
Thks :love_you_gesture: !!

1 Like