Questions regarding USB-HID bootloader programming spinor with eFuses in iMXRT1064

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Questions regarding USB-HID bootloader programming spinor with eFuses in iMXRT1064

702 Views
Davidino
Contributor IV

Goodmorning,

I'm and electronic engineer and I've been staring to use imx product since a couple of weeks. My current purpose is to program internal flexispi via USB-HID boot. I succeded to do that using the programs contained in FLASHLOADER-RT1064-1.0, but first I ask you to double check if it is correct. Then I have some questions.

Here the procedure:

1) Set switch for Serial boot (SW7 = 1000)
2) Copy flashloader.srec from folder Flashloader in Tools/elftosb/win
3) Copy imx-dtcm-unsigned.bd from folder Tools/bd_file/imx10xx in Tools/elftosb/win
4) Call the command:
    elftosb.exe -f imx -V -c imx-dtcm-unsigned.bd -o ivt_flashloader.bin flashloader.srec
    Section: 0x0
    iMX bootable image generated successfully
5) Transfer the executable generated in ram with sdphost:
    sdphost.exe -u 0x1fc9,0x0135 -- write-file 0x20000000 "..\..\elftosb\win\ivt_flashloader.bin"
    Preparing to send 90529 (0x161a1) bytes to the target.
    (1/1)0%Status (HAB mode) = 1450735702 (0x56787856) HAB disabled.
    Reponse Status = 2290649224 (0x88888888) Write File complete.
6) I start the Flashloader with:
    sdphost.exe -u 0x1fc9,0x0135 -- jump-address 0x20000400
    Status (HAB mode) = 1450735702 (0x56787856) HAB disabled.
7) Check the comunication with Flashloader:
    blhost.exe -u 0x15a2,0x0073 -- get-property 1
    Inject command 'get-property'
    Response status = 0 (0x0) Success.
    Response word 1 = 1258422528 (0x4b020100)
    Current Version = K2.1.0
Copy the example application led_demo_evk_flexspi_nor_0x70002000.srec from folder example_images in Tools/elftosb/win.
9) Copy imx-flexspinor-normal-unsigned.bd from folder Tools/bd_file/imx10xx to Tools/elftosb/win.
10) Convert the executable ".srec" in a bootable image ".bin":
    elftosb.exe -f imx -V -c imx-flexspinor-normal-unsigned.bd -o ivt_flexspi_nor_led.bin led_demo_evk_flexspi_nor_0x70002000.srec
    Section: 0x0
    iMX bootable image generated successfully
    In the further step I use the ivt_flexspi_nor_led_nopadding.bin generated version.
11) Copy program_flexspinor_image_qspinor.bd from fodler Tools/bd_file/imx10xx to Tools/elftosb/win.
12) Generated the secure boot image ".sb" with:
    elftosb.exe -f kinetis -V -c program_flexspinor_image_qspinor.bd -o boot_image.sb  ivt_flexspi_nor_led_nopadding.bin
    Boot Section 0x00000000:
    FILL | adr=0x00002000 | len=0x00000004 | ptn=0xc0000008
    ENA | adr=0x00002000 | cnt=0x00000004 | flg=0x0900
    ERAS | adr=0x70000000 | cnt=0x00040000 | flg=0x0000
    FILL | adr=0x00003000 | len=0x00000004 | ptn=0xf000000f
    ENA | adr=0x00003000 | cnt=0x00000004 | flg=0x0900
    LOAD | adr=0x70001000 | len=0x000016cc | crc=0x7076145e | flg=0x0000
13) Copy the bootable image boot_image.sb in the folder Tools/mfgtools-rel/Profiles/MXRT106X/OS Firmware
14) Modify if needed cfg.ini contained in folder Tools/mfgtools-rel
15) Open the application Mfgtool, press Start, then when it finished Stop, at last Exit.
16) Set the board switches for Internal Flash mode (SW7 = 0100), turn off the board and turn it on again. The application should works with the led blinking.

My questions are:

  1. Are the steps listed above correct?
  2. I tested the same procedure with a different application "hello world" got from the SDK Example and it works as well. The only changes that I made are to set XIP_BOOT_HEADER_ENABLE=0 and XIP_BOOT_DCD_ENABLE=0. Is it enough or I need to change the memory subdivision in Project->Properties->McuSettings? I ask you this because I don't understand the demo application named "led_demo_evk_flexspi_nor_0x70002000.srec". Why there is 0x70002000? Does it refer to flash memory starting address (0x70000000 -> 0x70002000) ?
  3. The next step that I need to achieve consists of avoiding the necessity to move the physical switches on the board (too much complicated for a customer). As far as I know this is possible setting the board in Boot From Fuses (SW7 = 0000) and do the switch between serial mode and internal flash mode using only eFuses read and write commands. More specifically modifying BT_FUSE_SEL. How can I do it?

For information, I'm using the board https://www.nxp.com/design/development-boards/i-mx-evaluation-and-development-boards/mimxrt1064-evk-... with MCUXpresso IDE v11.2.0 [Build 4120] [2020-07-09].

P.S. The application https://github.com/JayHeng/NXP-MCUBootUtility is not usable by a customer since it's too complicated. It's easier to write a visual basic software that does the steps listed above automatically.

Thank you.

Best Regards,

Davide

0 Kudos
1 Reply

657 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Davidino

    Today, I can reply your post now. Just past the answer in the case which I reply you yesterday at first:

 

Thank you for your interest in the NXP MIMXRT product, I would like to provide service for your.
Sorry for my later reply because of the weekends.
1. Are the steps listed above correct?
Answer: Your steps list is correct, but you don't need to work too much complicated like that, other that you want to understanding the whole downloading process.
Let me introduce you some easy ways, make you get start more quickly and effectively.
1) Use the flashloader with the MFGTool, elftosb, blhost.
Check our application note: https://www.nxp.com/docs/en/application-note/AN12107.pdf
This application note is based on the hyperflash, your RT1064 just the internal QSPI flash, it is similar.
Just when you use the bd files, use the qspi related bd and the program bd files.
2) Very easy way and tool, you just need to provide the app.bin, .sres, .hex is OK, all otherthings, the tool help you finish it.
This is my prefer tool, which is designed by our NXP AE colleagues:
https://github.com/JayHeng/NXP-MCUBootUtility/archive/v2.3.1.zip
the related user manual is:
https://github.com/JayHeng/NXP-MCUBootUtility
Refer to the manual, very easy steps to help you get start the RT program.
If you meet any issues, just let me know.

2. I tested the same procedure with a different application "hello world" got from the SDK Example and it works as well. The only changes that I made are to set XIP_BOOT_HEADER_ENABLE=0 and XIP_BOOT_DCD_ENABLE=0. Is it enough or I need to change the memory subdivision in Project->Properties->McuSettings? I ask you this because I don't understand the demo application named "led_demo_evk_flexspi_nor_0x70002000.srec". Why there is 0x70002000? Does it refer to flash memory starting address (0x70000000 -> 0x70002000) ?
Answer: Yes, it's enought, to the flashloader, take your examples, step 10) Convert the executable ".srec" in a bootable image ".bin":
elftosb.exe -f imx -V -c imx-flexspinor-normal-unsigned.bd -o ivt_flexspi_nor_led.bin led_demo_evk_flexspi_nor_0x70002000.srec
This step used to use your generated .srec app files, which didn't contains the IVT header, then use the imx-flexspinor-normal-unsigned.bd help you add the header, then you will find ivt_flexspi_nor_led.bin will add the IVT header which compare with your original led_demo_evk_flexspi_nor_0x70002000.srec.
But please note, when you want to debug the code in the IDE, you need to XIP_BOOT_HEADER_ENABLE=1.
XIP_BOOT_DCD_ENABLE it is used to configure the DCD area, which is used to the external SDRAM, the SEMC module configuration.
In your simple code, which don't need to use the external SDRAM, you totally can configure it as 0.
Even when you want to add the external SDRAM, you also can use the MCUBOOTUTILITY tool to add the dcd file directly.
Let me tell you why you need to use 0x70002000, if you read the above application which I give you, it will make you more easy to understand it.
In general, for the external memory devices that support XIP feature, the IVT offset is 0x1000 else it is 0x400. For example, for FlexSPI NOR on RT1052, the IVT must start at address 0x60001000 (start address is 0x6000_0000, IVT offset is 0x1000).
RT1064 is the same, your code is the XIP code, so your IVT will located in the 0X70001000 area, then you can leave some area for the IVT and the DCD area, then we normally locate the RT1064 app code from 0X70002000.
I highly recommend you try the MCUBootutility tool, that tool will also download the code, and readout the memory map, and tell which which area is which data, it will help you to understand the memory map easily.

3. The next step that I need to achieve consists of avoiding the necessity to move the physical switches on the board (too much complicated for a customer). As far as I know this is possible setting the board in Boot From Fuses (SW7 = 0000) and do the switch between serial mode and internal flash mode using only eFuses read and write commands. How can I do it?
For information, I'm using the board https://www.nxp.com/design/development-boards/i-mx-evaluation-and-development-boards/mimxrt1064-evk-... with MCUXpresso IDE v11.2.0 [Build 4120] [2020-07-09].
Answer: No, I think in your desig phase, I highly recommend you add the GPIO BOOT_CFG pins, AND BOOT_MODE pins.
Please note BOOT_MODE is the must, it is used to select the mode.
BOOT_CFG pins can use the fuse to configure it, but please note, the fuse is one time operation, if you already modify the fuse, and set boot from fuse, then you can't go back to the serial download mode, that operation should in the application last phase.
About the fuse operation, the recommended MCUBootUtility tool also can help you to write it, but when you didn't familar with the RT chip, I highly recommend you don't try to burn the fuse, it can't be write back, just one time operation.

Wish it helps you!

If you still have questions about it, please kindly let me know!

Best Regards,

Kerry

-------------------------------------------------------------------------------

Note:

- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored

Please open a new thread and refer to the closed one, if you have a related question at a later point in time.

-----------------------------------------------------------------------------

0 Kudos