Verdin Cortex-M4 autoboot

Hi,
I have a question concerning automatic M4 boot that was mentioned in this question

you didnt specify how the m4boot_0 command should look like in this case. I tried just copying the commands that I usually use to start the process inside this variable. I usually start the code like this:

ext4load mmc 0 0x48000000 m4_0_image && dcache flush && cp.b 0x48000000 ${m4addr} 0x20000

bootaux ${m4addr}

My env variables look like this

bootcmd=run m4boot_0; run bootcmd_mmc0
load_cmd=ext4load mmc 0:1
m4addr=0x7e0000
m4boot_0=run load_cmd 0x48000000 m4_0_image; run dcache flush; run cp.b 0x48000000 0x7e0000 0x20000; run bootaux 0x7e0000
m4_0_image=/ostree/deploy/torizon/var/cmsis_ecspi_int_loopback_transfer.bin

but I get an error:

** No boot file defined **
# Error: "dcache" not defined
# Error: "cp.b" not defined
# Error: "bootaux" not defined

Thanks in advance!

Hi @swiss,

Thanks for opening a new ticket.

Here is a quick guide that I made some while ago:


Using Ext4Load

Make sure to set the right device and partition:

Verdin iMX8MM # setenv load_cmd "ext4load mmc 0:1"

Set the binary path

Set the full path for your binary. If you’re using TorizonCore and ext4load, for example, it should be like this:

Verdin iMX8MM # setenv m4image "/boot/deploy/torizon/var/hello_world.bin"`

Now, we need to set one more alias, this will track the size of the binary that we’re using. In the case of my hello world binary, it has 15KB:

Verdin iMX8MM # setenv m4image_size 15000

If you set more space than it needs, it shouldn’t be a problem.

Now, we can set the rest of the commands:

Verdin iMX8MM # setenv loadm4image "${load_cmd} ${loadaddr} ${m4image}"
Verdin iMX8MM # setenv m4boot "${loadm4image}; cp.b ${loadaddr} 0x7e0000 ${m4image_size}; dcache flush; bootaux 0x7e0000"

Save all your modifications by running:

Verdin iMX8MM # saveenv

Run “run m4boot“ and your Cortex-M will start running.

Verdin iMX8MM # run m4boot

The problem is that you used “run dcache”, “run cp.b” and “run bootaux”, but these are commands already, you can only use “run” with aliases, just like in my examples above. This will fix your problem.

Best Regards,
Hiago.

Hi Hiago,
Thank you for your fast reply.
It’s working now!

1 Like