You are on page 1of 16
sniting, 412 PM [LNB Boot process and creating @ bootable image - NXP Community Home / i.MX Forums / -ilimx-processorse40ikbartilesdi058 16 ‘iva, 442 PM LIKE Boot process and erating a bootable image -NXP Community ROM loads data from the predefined addresses above (depending on the selected boot device) to the System Controller Unit (SCU) internal memory (tightly coupled memory) and parses it to find the image container. It can also boot by downloading an image through USB. The image container has all the information needed to load all the images to the system, the first images that get loaded are the System Controller Firmware (SCFW) and Security Controller Firmware (SECO). hitpsscommunitymxp.com/5itkblartileprintpagertk>-ilimx-processorse40ibartilesdi058 216 snit22, 412 PM [MB Boot process and creating @ bootable image - NXP Community Primary Image Container Set 18t Container Header 18! signature Block Padding for 1KB alignment 2nd Container Header 2nd Signature Block SECO FW SCU FW with DDR initialization Image embedded CM4 Image AP IPL Secondary Image Container Set Figure 5-25. Typical Boot Image Layout hitpsscommunitymxp.com/5itkblartileprintpagertk>-ilimx-processorse40ibartilesdi058 snitiag, 412 PM LM Boot process and ereating @ bootable image -NXP Community The SECO FW needs to be loaded to refresh the watchdog timer (kick the dog) in th < » ‘Once the SCFW is loaded, ROM jumps to it and starts executing it. The SCFW then initializes the DDR and starts loading the images for the Cortex-M4 (optional) and the Cortex-A cores (optional). ‘Once the images are loaded to their destination memory the SCFW boots the cores and sets them in their start address. Creating a bootable image As a recap a bootable image is comprised of as minimum the System Controller Firmware and the Security Controller Firmware, optionally it can contain images for the Cortex M4 cores (if more than one available as in the case of QM devices) and Cortex A cores. SECO FW Cortex-M4 image (Optional) [eolat OW t (Optional) Itis possible to boot an image that only contains the SCFW and SECO FW, this could be useful in the first stages of porting the SCFW to the target board. It is also possible to boot an image with only the Cortex-M4 image (baremetal, FreeRTOS, AutoSAR...), only the Cortex-A image (U-boot or any bootloader) or both Cortex-M4 and Cortex-A images. Mkimage tool hitpsicommunty.nxp.comtsitkbarticleprintpagertkb-ifimx-processorsYe4DKbartilesdi058 ane. ‘we, 412 PM LIKE Boot process and erating a bootable image -NXP Community The tool in charge of merging all these images and creating a bootable image for the i.MX8 is called mkimage, and can be obtained in source form in the following repository: https://source.codeaurora.org/extermal/imx/imx-mkimage mkimage is only supported in Linux So the first step is to clone the mkimage repository into our machine and checkout the latest branch, at the time of writing this document the latest release is 4.14.98_02: git clone https: //source.codeaurora.org/external/imx/imx-mkimage cd. imx-mkimage git checkout imx_4.14.98_2.0.@_ga You should now be able to see the following folders: COPYING ine fore imxegn X8QX perrant a ate Getting the SCFW Now that you have the mkimage tool you need some actual images to work with, if you are using a custom board you might need to port the SCFW and DDR configuration files for it (depending on how close it follows NXP's reference board). The following is a compendium of documents on the basics of the SCFW and how to build it from scratch you can go there if you need help getting started with the porting process: https://community,nxp.com/docs/DOC-342654 If you are trying this on one of NXP's reference board you can use a pre-built SCFW binary, this can be obtained through the building process of the Yocto project or by downloading the porting Kit and following these steps: Dow! FW binaries for release 4.14.98 02 her chmod atx imx-sc-firmware-1.2.bin « /imx-sc-firmware-1.2.bin htpsscommunitynxp.comi5tkblartileprintpagerk-ilimx-processorste40ikblartitesdi258 516 sniting, 412 PM [MB Boot process and creating @ bootable image - NXP Community You will prompted to accept a license agreement and after that the binaries will be extracted Pieeeen tree ned laa tia mx8qn-a0-ddr4-scfw-tcm.bin Le ea eaten aa) Leena aaa) mx8qn-ddr4-scfw-tcm.bin ihe ee eat ee Gee Ue eee Get oes ees ese Cees sean Getting the SECO FW The Security Controller Firmware is only distributed in binary form and can be obtained from the NXP website. Download SECO FW binaries for release 4.14.98 02 here. chmod atx firmware-imx-8.1.bin «/firmware-imx-8.1.bin ‘You will prompted to accept a license agreement and after that the binaries will be extracted hitpsscommunitymxp.com/5itkblartileprintpagertk>-ilimx-processorse40ibartilesdi058 66 swine, 4412 PM LM Boot process and creating @ bootable image - NXP Community ECR eecre! raaita ate ect SSL eld Cem By ese) Omer a sane a Se doe Be Ruste ac) crue ou sdma Erneta s ets) Gree ee areas a a Serer a ere a Sree ea) Sere ea ere) er) Peg eT ee) PCr eee ene et rch eas mcrae) VT me raa rea) Re mre ere Ve mee) RT me) Pam rcr r a Vereen Rar ORe at) Rome The SECO FW is under firmware/seco > SECO FW for QM devices > SECO FW for QXP devices + mx8qm-ahab-container.img + mx8qx-ahab-container.img ~ Getting an image for the Cortex-M4 The image for the Cortex-M4 can be generated using the SDK: hittps://meuxpresso.nxp.com/en/select hitpsscommunitymxp.com/5itkblartileprintpagertk>-ilimx-processorse40ibartilesdi058 m6 snintag, 412 PM LM Boot process and creating @ bootable image - NXP Community f#sxcwums Select Development Board & oe eae Gs — erommiat cre manem os Just select the device you are working with and click Build MCUXpresso SDK, then you will prompted to select your IDE and host SDK Builder Vntuason nage ‘ns cnet x cota ir et eld a vo ceeesnertsel Click on Download SDK and a compressed file containing the SDK will be dowloaded to your computer, Now you only need to uncompress the file and follow the steps in the getting started document to generate the image. hitpsileommunitynxp.comstkbartileprintpagerkb-ilimy-processorsYe40iKbartiedMi368 ane snittag, 412 PM LM Boot process and creating @ bootable image - NXP Community SDK_2.5.2_MEK-MIMX8QX fori emaruncr ys e138 aac pra pias Cea Ros cher PNIETEse eaters aa frig tt Cena PLD Cre) Neb ie ea Cee enc ae ee ne Ca TESOLC OSL Cit tae eee eS OLC Ome e ei Breeiernie eee at) aa ede ome ec esos Pari ear ahr eee The getting started document includes steps to setup the toolchain and build an image for the M4. An M4 binary for the QM and QXP MEKs is also attached in this document, the exame Getting an image for the Cortex-A The bootloader for the Cortex-A cores can be obtained through the Yocto BSP: hitpsscommunitymxp.com/5itkblartileprintpagertk>-ilimx-processorse40ibartilesdi058 one sniting, 412 PM [MB Boot process and creating @ bootable image - NXP Community i.MX Software and Development Tool urpared ‘OVERVIEW DOCUMENTATION Jump To Overview Suet Building your designs and getting to market quickly is easier with market-tocused development tools, based on the LMX RT, i.MX 6, (MX 7, LIM 8 series processors. Complete with reference software, an optimized OS, and a system-validated board support package (BSP), NXP provides you with the tools to test and maximize the performance of the applications you develop. i.MX BSP Updates and Releases & anatroie [+] Android AUTO GB tinux () Linux 4.14.98_2.0.0 @) Archived The steps on generating the image for the 4.14.98 release can be found here: htt ‘Some more details on the Yocto BSP can be found here: https://community.nxp.com/docs/DOC-94849 All the required binaries to create a bootable image for the Cortex-A cores on th Building a bootable image Once all the required pieces have been built/obtained, the bootable image can be created. The SCFW, SECO FW and respective Cortex-MA/A images need to be copied to the folder for the target device, i.e. if you are building an image for an i.MX8QX variant copy the binaries for that variant to its folder: hitpsscommunitymxp.com/5itkblartileprintpagertk>-ilimx-processorse40ibartilesdi058 1016 snintag, 412 PM [MB Boot process and creating @ bootable image - NXP Community en) eC erg Peesaat cons Pagty Here is a list of the required files to build a bootable image: + scfw_tem.bin —— System Controller Firmware binary for the target board + mx8qm(qx)-ahab-containerimage ~ Security Controller Firmware for the QM or QXP variants + bI31.bin — -- ARM Trusted Firmware binary (Required if using u-boot with ATF) Only needed to create Cortex-A image with u-boot + u-boot.bin —______----— U-boot binary (optional) © m4_image - M4 binary image, the QM variant has 2 Cortex-M4s and in this case to M4 binaries might be required (optional) Once the required binaries have been copied to the desired variant folder (QXP or QM in this, example), you are ready to start building some images. All the targets for building different images are defined on the soc.mak file contained in each folder, this file contains different examples for creating a lot of the supported bootable images. Creating a SCFW only image The target used to create a SCFW only image is flash_bO_scfw and it is defined under the soc.mak file of each variant. To invoke this target for QXP from the imx-mkimage directory: make SOC=iNX8QX flash_b@_scfw To invoke this target for QM from the imx-mkimage directory: make SOC=iMX8QM flash_b@_scfw The target definition for flash_b0_scfw can be seen below. Definition for QXP: hitpsscommunitymxp.com/5itkblartileprintpagertk>-ilimx-processorse40ibartilesdi058 ne snitiag, 412 PM LLM Boot process and creating @ bootable image - NXP Community flash_scfw flash_b@_scfw: $(MKIMG) mx8qx-ahab-container. img scfw_tem.bin -/$(NKIMG) =Soc QX -rev B@ -ded skip -append mx8qx-ahab-container.img -c -scfw scfw_tem.bin -out flash.bin Definition for QM: flash_b@_scfw: $(MKIMG) mx8qm-ahab-container.img scfw_tem.bin -/$(MKIMG) -soc QM -rev BO -dcd skip -append mx8qm-ahab-container.img -c -scfw scfw_tem.bin -out flash.bin Creating a Cortex-A image only The target used to create a Cortex-A image only is callled flash_b0. To invoke this target for QXP from the imx-mkimage directory: make SOt iMX8QX flash_b@ To invoke this target for QM from the imx-mkimage directory: make SOt iMX8QM Flash_b@ The target definition for flash_bO can be seen below. Definition for QXP: flash flash_b@: $(MKING) mx8qx-ahab-container.img scfw_tem.bin u-boot-atf.bin «/$(NKIMG) -s0c QX -rev B@ -append mxBqx-ahab-container.img bin -ap u-boot-atf.bin a35 @x80000000 -out flash.bin -scfw sefw_tem, Definition for QM flash_b@: $(MKIMG) mx8qm-ahab-container.img scfw_tem.bin u-boot-atf.bin -/$(NKING) -soc QM -rev B@ -append mxBqm-ahab-container. img bin -ap u-boot-atf.bin a53 @x8@@00000 -out flash. bin -scfw scfw_tem. hitpsscommunitymxp.com/5itkblartileprintpagertk>-ilimx-processorse40ibartilesdi058 126 sniting, 412 PM [MB Boot process and creating @ bootable image - NXP Community Creating a Cortex-M4 image only The target used to create a Cortex-m4 image only is called flash_b0_cm4 on QXP and QM has different targets since there are two M4s available in the system. To invoke this target for QXP from the imx-mkimage directory: make SOC=iMX8QX flash_b@_cm4 To invoke this target for QM from the imx-mkimage directory // For Cortex-m4_@ only make SOC=iMX8QM flash_b@_cm4_0 // For Cortex-M4_1 only make SOC=iMX8QM flash_b@_cm4_1 J/ For both Cortex-M4_@ and Cortex-M4_1 make SOC=iMX8QM flash_b@_mas_tcm The target definition for flash_b0_cm4 can be seen below. Definition for QXP: flash_cm4 flash_b0_cm e.bin -/$(NKIMG) -soc QX -rev B@ -append mx8qx-ahab-container. img bin -p1 -m4 m4_image.bin @ @x34FE@@0@ -out flash. bin Definitions for QM hitpsscommunitymxp.com/5itkblartileprintpagertk>-ilimx-processorse40ibartilesdi058 $(MKIMG) mx8qx-ahab-container.img scfw_tem.bin m4_imag -scfw scfw_tem. sa6 snitiag, 412 PM LLM Boot process and creating @ bootable image - NXP Community flash_b@_cm4_@: $(MKIMG) mx8qm-ahab-container.img scfw_tem.bin m4_image.bin -/$(NKIMG) =Soc QM -rev B@ -ded skip -append mx8qm-ahab-container. img -c -scfw scfw_tem.bin -p1 -m4 m4_image.bin @ @x34FE@000 -out flash.bin flash_b@_cm4_1: $(MKIMG) mx8qm-ahab-container. img scfw_tcm.bin m4_image.bin «/$(NKING) -soc QM -rev B@ -ded skip -append mx8qm-ahab-container. img -c -scfw scfw_tem.bin -p1 -m4 m4_image.bin 1 @x38FE@00@ -out flash.bin flash_b@_m4s_tem: $(MKIMG) mx8qm-ahab-container.img scfw_tcm.bin m4@_tem.bin m4 1_tem.bin -/$(MKING) -soc QM -rev B@ -ded skip -append mx8qm-ahab-container. img -c -scfw scfw_tem.bin -p1 -m4 m4@_tem.bin @ @x34FE@@80 -m4 m41_tem.bin 1 @x38FE@G00 -out flash. bin The examples above are for M4 images booting from TCM, the M4 is capable of booti Creating an image with both Cortex-A and Cortex-M4 images The target used to create an image with software for all the cores is called flash_linux_m4. To invoke this target for QXP from the imx-mkimage directory: make SOt iMX8QX flash_linux_m4 To invoke this target for QM from the imx-mkimage directory: make SOt iMX8QM flash_linux_m4 The target definition for flash_linux_m4 can be seen below. Definition for QXP: hitpsscommunitymxp.com/5itkblartileprintpagertk>-ilimx-processorse40ibartilesdi058 146 snitiag, 412 PM LLM Boot process and creating @ bootable image - NXP Community flash_linux_m4: $(MKIMG) mx8qx-ahab-container. img scfw_tem.bin u-boot-atf.bin m 4_image.bin -/$(NKIMG) -soc QX -rev BO -append mx8qx-ahab-container.img -c -flags @x02000 0 -scfw scfw_tem.bin -ap u-boot-atf.bin 235 @x8@00000 -p3 -m4 m4_image.bin @ @x34FE0000 -out flash. bin Definition for QM: flash_linux_m4: $(MKIMG) mx8qm-ahab-container. img scfw_tcm.bin u-boot-atf.bin m 4_@_image.bin m4_1_image. bin -/$(NKIMG) -soc QM -rev B® -append mx8qn-ahab-container.img -c -flags @x02000 @0 -scfw scfw_tem.bin -ap u-boot-atf.bin a53 @x8@00000 -p3 -m4 m4_@_image.bin @ @x34FE@G00 -p4 -m4 m4_1_image.bin 1 @x38FEQ@00 -out flash.bin Flash image This will create a bootable image named flash.bin, to flash this image to the SD card and boot it on your MEK simply do: sudo dd if=iMX8QX/flash.bin of=/dev/mmcblkX bs=1k seek=32 If the desired target is a QM variant change if=iMX8QX... to if=IMX8QM. Then match your SD card device on "of=/devimmcbIkX" you can see how your SD card enumerates by typing Isblk on your console before and after inserting your SD card. Remember from the information above that the i.MX8 will search for the image at 3 » For more examples please look at the soc.mak file, it includes examples for different boot media (NAND/QSPI) as well as different configurations and usage. Additional resources Reference Manual Chapter 5 System Boot ‘SCFW API and Port document imx-mkimage README ‘System Controller Firmware 104 hitpsscommunitymxp.com/5itkblartileprintpagertk>-ilimx-processorse40ibartilesdi058 1916 sniting, 412 PM [MB Boot process and creating @ bootable image - NXP Community i.MX 8 Family | LMX 8QuadMax (80M) | 8QuadPlus. boot process bootable imx8 Attachments bootable image. tar.gz & © tekudos Was this article helpful? SHARE hitpsscommunitymxp.com/5itkblartileprintpagertk>-ilimx-processorse40ibartilesdi058 1616

You might also like