iMX8 flashing Cortex M4 image

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

iMX8 flashing Cortex M4 image

680件の閲覧回数
phanids
Contributor II

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

0 件の賞賛
返信
2 返答(返信)

617件の閲覧回数
phanids
Contributor II

Thanks Josesh. Your suggestion helped me to understand some more details. 

Now I am done with it and getting on to my actual custom board (not sure, if I need to create a new question for this - but anyway I will update here).

Basically my custom board has only NAND Flash (and no eMMC or any other memory) and I need to boot C4 as same way I did with eMMC. I am thinking of following steps - please let me know if you have any suggestions.

Approach I

1. Download the linux image for my controller - i.MX8MQ. Flash this to NAND using Seggar and see if I get the linux prompt with required switch settings (just to make sure I can on to linux with Nand flash)

2. Add cortexM4.bin (generated image for Cortex M4) - to this image. This part I am not sure - is it possible and if yes what way I can make my cortexM4.bin as part of linux image.

3. Now update the uboot as done with eMMC. This part again I am not very sure - as this may not be possible to update Flash as in eMMC (unless we use external tools like Seggar).

Approach II

1. Download the yacto setup for  i.MX8MQ and create the linux image.

2. Use "some tool" to make the final image with generated linux image + cortexM4.bin along with boot sequence (which tweaks the uboot part). I read we have this "some tool" but I need to do search more and figure it out

Basically I am trying to boot cortexM4.bin from NAND only  i.MX8MQ custom board 

Thanks a lot,

//P

0 件の賞賛
返信

654件の閲覧回数
JosephAtNXP
NXP TechSupport
NXP TechSupport

Hi,

Thank you for your interest in NXP Semiconductor products,

Steps 1 to 2 can be avoided with stopping the boot at U-boot.

=> fastboot 0

Connect the USB type C cable to the board (as when you burnt the Linux image) and with run the following command in the host.

$ uuu -v -b fat_write hello_world.bin mmc 0:1 cortexM7.bin

I couldn't find step 3 in the guide, but you can skip this. DTB is for Linux so you don't need to change it for booting Cortex-M. Remember

Step 4 and step 5 are ok. In case that something goes wrong (U-boot, U-boot env and cortexM7.bin are in the same partition) you just need to update imx-boot, in serial download mode, run:

$ uuu -b -b emmc imx-boot...

Finally, you can use this alternative to step 4 and 5, so it runs after the bootloader, the difference is that you don't have access to U-boot console prior to loading the binary.

Regards