Hi All,
I am currently using i.MX8 plus evaluation board. Currently this has prebuilt linux image in eMMC and when I connect my serial port - I see the linux prompt and I can check basic linux commands.
As I am not using A53 cores (as of now) - I focused on Cortex M7 core and developed some application to interact with the sensor/ input/ output etc. This I used to test and debug with Jlink. Now I am done with cortex M7 code and wanted to flash it so that cortex M7 boots as power on and I can see the cortex M7 working (A53 is not used at all at this point of time).
While searching for this, I found this article https://www.embeddedartists.com/wp-content/uploads/2019/03/iMX8M_Working_with_Cortex-M.pdf and seems following section 4 is sufficient to get this.
Gist of the steps are
1. Copy the cortexM7.bin (image that needs to be run from Cortex M7) to USB
2. Put it in iMX8Plus evk board
a. New drive is detected -sda: sda1 (I can see this in my linux prompt when I put USB drive)
b. Follow the mounting of USB and eMMC as below
# mkdir /mnt/usb
# mount /dev/sda1 /mnt/usb
# mkdir /mnt/mmcboot
# mount /dev/mmcblk2p1 /mnt/mmcboot
c. Copy cortexM7.bin the into eMMC
# cp /mnt/usb/cortexM7.bin /mnt/mmcboot/
d. unmount - as these mount points are not any more required. ( umount /mnt/usb and umount /mnt/mmcboot)
3. Get into uboot mode and Change the device tree file (currently my fdt_file=imx8mp-evk.dtb in uboot environment) - Comment in the above .pdf [Change which device tree file to use by Linux. The example below sets the file to use for the iMX8M Mini uCOM Developer’s Kit V2. If you are using a different board just use the same name as set by default in the fdt_file variable and append ‘-m4’. ]
setenv fdt_file=imx8mp-evk.dtb in-m4.dtb
saveenv
4. Run from TCM (basically instructing to copy image to TCM memory and start running).
setenv cm_image cortexM7.bin
setenv cm_addr 0x7e0000
setenv cm_loadimage 'fatload mmc ${mmcdev} ${loadaddr} ${cm_image}'
setenv cm_boot 'run cm_loadimage; cp.b ${loadaddr} ${cm_addr} ${filesize}; dcache flush; bootaux ${cm_addr}'
saveenv
run cm_boot
5. And to automatically boot every power on,
setenv bootcmd "run cm_boot; ${bootcmd}"
saveenv
Doubt 1 : As I am very new to linux/ iMX8 - do you guys think this is correct way (for me to get only Cortex M7 image running)
Doubt 2 : If something goes wrong, would it be possible to get back to my eMMC linux image? I thought I can put the
"bootcmd=mmc dev" and "fdt_file=imx8mp-evk.dtb" in uboot environment.
With best regards,
//P