add M core firmware to bootfs

Hello.

I made a recipe that builds two binaries for the M7 core, one .bin and one .elf.
My issue is that i can’t figure out the right way to make the .bin visible in uboot, as to make the mcore run it.

Best regards, Jérémie

Hey @fennecdjay,

Can you tell me what Torizon OS BSP you are using? The output from command line tdx-info will let us know if you are using BSP 6.x.y

Are you able to access u-boot? When the system is booting, you can hit any key at the start to boot into u-boot. You’ll also need to have access to the serial console, via using a program like minicom.

You can follow these guides in order to run a .bin file on the M7 processor.

Setting up SDK and toolchain for M core

loading the binary

Keep in mind, you’ll need to transfer the .bin file to the target on the linux side. And reference it via the correct file path. (information is in the guide).

-Eric

Hello @eric.tx.

I did actually fix my issue a few hours after posting this, but i did not manage to update you as the post was getting checked.
I’m using the same bsp as in my previous post, version 6.5.
this post is what helped me sort this out. Not sure why i did not find it before.

Allow me to explain how i did, maybe this will help others.

I have a recipe that builds both a .bin and a .elf for the firmware i want to run on the m7 core.
the .elf is put in /usr/lib/firmware, while i added a do_deploy task that puts the .bin in the deploy directory.

for baking images to the board i have a little script which i used to modify the image.json:

(the .bin firmware is called lightshow in the script as it is used to light some leds in a timed manner)

grep "$LIGHTSHOW" ${JSON_CONF} > /dev/null ||
  sed -i "s/\"uncompressed_size\":\(.*\)/\"uncompressed_size\":\1,\n\"filelist\":  [\"$LIGHTSHOW:\/ostree\/deploy\/torizon\/var\/\"]/" ${JSON_CONF}

then what was left to do is modify the uboot script so that is loads the firmware automatically;

# modify the default boot command
sed -i 's/bootcmd=run bootcmd_mmc2/bootcmd=run lightshow; run bootcmd_mmc2/' ${UBOOT_CONF}

# define the *lightshow* variable
grep 'lightshow=' ${UBOOT_CONF} > /dev/null ||
  echo "lightshow=setenv m4addr 0x7e0000 && saveenv && ext4load mmc 2 0x48000000 ostree/deploy/torizon/var/${LIGHTSHOW} && dcache flush && cp.b 0x48000000 \${m4addr} 0x20000 && bootaux \${m4addr}" >> ${UBOOT_CONF}

also, following the previous post, i can confirm i can’t get rpmsg to work if i did not launch some firmware on the mcore previously.
i also tested with torizon-rt and while the same limitations apply, rpmsg works there too.

I hope all this makes sense, let me know if you need more infos.

Thank you for the support, sorry for the annoyance,
Have a nice day,
Jérémie.

@fennecdjay,

Thank you for posting the update! Glad you were able make it work.

-Eric