Hi,
I am new to embedded programming and I’m trying to follow the developing guide for Verdin imx8m mini with a dahlia carrier board. I am using windows and visual studio code for the development.
I want to run the hello_world.bin example from FreeRTOS on the Cortex-M4 of a Verdin iMX8M Mini | Toradex Developer Center
but I would like to load the binary file from the internal eMMC instead of the SD card, but I don’t know where to place the file on the eMMC so that I can access its address with the bootaux.
Thanks in advance.
Hello @swiss ,
Please check this article on the developer website :
It contains information about the EMMC, it might help you.
Best regards,
Josep
Hi @swiss,
In order to do that, you’ll need to copy your binary file to your Linux system (either using SSH or a storage device) and place it somewhere in your filesystem. For example, here I added my hello world to /var/.
Then, you’ll need to reboot your module, go to uBoot terminal and use the ext4 commands:
Colibri iMX8X # ext4ls mmc 0:2 /var/
<DIR> 4096 .
<DIR> 4096 ..
<DIR> 4096 backups
<DIR> 4096 cache
<DIR> 4096 lib
<DIR> 4096 local
<SYM> 11 lock
<SYM> 12 log
<SYM> 6 run
<DIR> 4096 spool
<SYM> 12 tmp
<DIR> 4096 volatile
208 .updated
15040 hello_world.bin
Colibri iMX8X # ext4load mmc 0:2 ${loadaddr} /var/hello_world.bin
15040 bytes read in 18 ms (815.4 KiB/s)
Colibri iMX8X # dcache flush
Colibri iMX8X # bootaux ${loadaddr}
Power on aux core 0
Copy image from 0x87000000 to 0x34fe0000
Start M4
bootaux complete
Colibri iMX8X #
“0:2” means device 0 and partition 2, which is the partition of the Linux Kernel.
First, I used the ext4ls to see my files in the eMMC. Next, I used the ext4load to load my binary to the right address. Finally, I ran dcache flush (which is recommended by NXP) and booted my M4 using the bootaux command.
I hope this answer your question.
Best Regards,
Hiago.
Hi @hfranco.tx, thanks for the fast response. When I run the mmc part
i have only one partition on my mmc so I can’t run the ext4ls with the 0:2 parameter.
The thing I forgot to mention is that I have the TorizonCore with evaluation containers installed. I placed the binary file inside the /home/torizon/ directory, but when I stop the booting process and use the ext4ls command I can see only these directories:
Verdin iMX8MM # ext4ls mmc 0
<DIR> 4096 .
<DIR> 4096 …
<DIR> 16384 lost+found
973 boot.scr
<DIR> 4096 ostree
<DIR> 4096 boot
Is it possible to see the files inside the Linux from here?
P.S. I am using this technique just because it is mentioned in the development guide, I would much rather put the code onto M-chip from the linux running on the A-chip without needing to stop the booting process if that’s possible. If this is another topic I can start a new question. Thanks.
Hi @swiss,
For Torizon, it’s a little bit different, because Torizon uses OStree to manage its filesystem.
Since OSTree does not update the /var/ files, I placed my hello_world.bin inside /var/hello_world.bin.
Then, inside uBoot, you should run these commands to load your binary:
Colibri iMX8X # ext4ls mmc 0:1 /ostree/deploy/torizon/var
<DIR> 4096 .
<DIR> 4096 ..
<DIR> 4096 rootdirs
<DIR> 4096 lib
<DIR> 4096 tmp
<SYM> 11 lock
<SYM> 6 run
0 .ostree-selabeled
<SYM> 17 log
<DIR> 4096 sota
<DIR> 4096 volatile
<DIR> 4096 usrlocal
<DIR> 4096 cache
<DIR> 4096 spool
8720 hello_world.bin
190 .updated
Colibri iMX8X # ext4load mmc 0:1 ${loadaddr} /ostree/deploy/torizon/var/hello_world.bin
8720 bytes read in 29 ms (293 KiB/s)
Colibri iMX8X # dcache flush
Colibri iMX8X # bootaux ${loadaddr}
Power on aux core 0
Copy image from 0x87000000 to 0x34fe0000
Start M4
bootaux complete
Colibri iMX8X #
As you can see, you /var/ is actually inside /ostree/deploy/torizon/var/.
For the M4 to boot automatically, you can use the commands “m4_0_image” and “m4boot_0”
Colibri iMX8X # setenv load_cmd "ext4load mmc 0:1"
Colibri iMX8X # setenv m4_0_image "/ostree/deploy/torizon/var/hello_world.bin"
Colibri iMX8X # setenv bootcmd "run m4boot_0; run bootcmd_mmc0"
Colibri iMX8X # saveenv
Saving Environment to MMC... Writing to MMC(0)... OK
Colibri iMX8X # reset
With these commands, you will set your bootcmd to launch the M4 and the cortex A automatically. But remember that your code needs to be inside /var/, because uBoot will load the binary from there.
Now I have another question, are you using a UART to USB converter device to see your “Hello World!” from M4?
Because if you run this, probably it won’t work because you need to change the device tree and the pinx_mux.h from the NXP demo. Have you changed these files?
Best Regards,
Hiago.
Hi Hiago,
Thank you, I was able to copy the binary file inside the~~ /var and access it from the boot. The output is as follows:
>Verdin iMX8MM # ext4load mmc 0:1 ${loadaddr} /ostree/deploy/torizon/var/hello_world.bin
6112 bytes read in 28 ms (212.9 KiB/s)
Verdin iMX8MM # dcache flush
Verdin iMX8MM # bootaux ${loadaddr}
## Starting auxiliary core stack = 0x20020000, pc = 0x1FFE030D…
Verdin iMX8MM #
I am using the Dahlia Carrier board and the debug USB-C connector X18. When I connect it I see two COM ports, the second one (COM8 in my case) works fine for the serial connection with the boot/linux console, and my guess is that the first one (COM7) is connected to the Cortex-M debug output.There is no output when I run the hello_\world though, so does that mean that the overlay is needed?
I had the faulty binary file now everything works! Also, the debug Cortex-M port already works without the device tree overlay.
Thanks!
Hi @swiss,
Sorry for my late response. I’m glad you were able to solve your problem!
Just for others to know, the M4 debug port usually is one of the ports that show in your computer when you are connected through the USB port on connector X18 from the Dahlia board. Here I’m using Linux and the debug port for me is ttyUSB2, while ttyUSB3 is used to access the Linux Terminal.
Best Regards,
Hiago.
Hi @hfranco.tx,
Additional question to automatic M4 boot that you explained here (tell me if you would like it rather as a new topic):
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!