Hi jeremyzhou,
scenario 2) has 2 projects.
First of all, consider Flash partitions:
0x60000000 to 0x60100000 -> Main application
0x60100000 to 0x60200000 -> Slave application (our goal is to start this not-XIP application from Main application)
0x60200000 to ... -> Free
As far as first project is concerned (ram_iled_blinky.zip), please, start importing SDK EVK-MIMXRT1060 demo apps -> iled_blinky project.
Then, change C/C++ Build Settings -> Managed Linker Script -> select Link application to Ram.
Then create .bin by using Binary Utilities -> Create binary on .axf
Now, we've to write resulting .bin file to address 0x60100000 of Flash.
So, by using sdphost and blhost utilities from Flashloader 1060 Tools (please, boot board in Serial Downloader Mode):
dp$ ./sdphost -V -u 0x1fc9,0x0135 -- error-status
Status (HAB mode) = 1450735702 (0x56787856) HAB disabled.
Reponse Status = 4042322160 (0xf0f0f0f0) HAB Success.
dp$ ./sdphost -V -u 0x1fc9,0x0135 -- write-file 0x20000000 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.
dp$ ./sdphost -V -u 0x1fc9,0x0135 -- jump-address 0x20000400
Status (HAB mode) = 1450735702 (0x56787856) HAB disabled.
dp$ cd /[...]/Flashloader_RT106x_1.0_GA/Tools/blhost/mac
dp$ ./blhost -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
dp$ ./blhost -u 0x15a2,0x0073 -- fill-memory 0x2000 4 0xc0000007
Inject command 'fill-memory'
Successful generic response to command 'fill-memory'
Response status = 0 (0x0) Success.
dp$ ./blhost -u 0x15a2,0x0073 -- configure-memory 0x9 0x2000
Inject command 'configure-memory'
Successful generic response to command 'configure-memory'
Response status = 0 (0x0) Success.
dp$ ./blhost -u 0x15a2,0x0073 -- flash-erase-region 0x60100000 0x100000
Inject command 'flash-erase-region'
sendCommandGetResponse.readPacket error 5.
Response status = 10004 (0x2714) No response packet from target device.
dp$ ./blhost -u 0x15a2,0x0073 -- flash-erase-region 0x60100000 0x100000
Inject command 'flash-erase-region'
Successful generic response to command 'flash-erase-region'
Response status = 0 (0x0) Success.
dp$ ./blhost -u 0x15a2,0x0073 -- write-memory 0x60100000 ram_iled_blinky.bin
Inject command 'write-memory'
Preparing to send 19580 (0x4c7c) bytes to the target.
usbhid: received data phase abort
Error: expected commandTag 0x7, received 0x4
Warning: Failed to get packet size. Using default size(32)Successful generic response to command 'write-memory'
(1/1)100% Completed!
Successful generic response to command 'write-memory'
Response status = 0 (0x0) Success.
Wrote 19580 of 19580 bytes.
Regarding second project (boot_iled_blinky.zip) , start by importing SDK EVK-MIMXRT1060 demo apps -> iled_blinky project.
Change C/C++ Build Settings -> MCU Settings -> Flash Location 0x60000000 Size 0x100000 (instead of 0x800000 because we've reserved 0x60100000 to 0x60200000 for .bin image of the first project).
Now, create a header file and define two variables:
- int value; // this variable is useful for creating an offset of blinky variable address
- uint8_t blinky[19584]; // this is the content of the previous generated .bin file
Then, modify main for jumping to blinky's address.
If we don't set SET_OFFSET, then blinky's address is 0x20000000 and everything works fine (IS_RAM enabled).
If we set SET_OFFSET, then blinky's address is 0x20000004 and it doesn't work.
If we set IS_RAM, then blinky is populated by .bin defined array.
If we don't set IS_RAM, then blinky is populated from Flash (copy Flash to Ram).
Please, advice us if you need more details.
BR,
Daniele