AnsweredAssumed Answered

Converting MCUXpresso project to XIP in QSPI

Question asked by john hemmick on May 31, 2018
Latest reply on Jun 11, 2018 by Jing Pan

I'm currently trying to convert an MCUXPresso/Amazon FreeRTOS project to XIP on QSPI on the FRDM-K82 board and am having some difficulty.

 

I'm following the demo_apps_hello_world_qspi/doc/readme.txt reference as well as the "Kinetis Bootloader QuadSPI User's Guide" section "Creating application for QuadSPI memory.

 

According to these documents the following must occur:

1) the linker file for an application to be executed out of QSPI needs to be updated to point to the QSPI memory at location 0x68001000

2) the flash config FOPT bits need to be set to 0b10 -- "ROM -> QSPI Yes"
3) the preprocessor directive BOOTLOADER_CONFIG needs to be defined in the project properties
4) the NXP Kinetis Bootloader needs to be running on the chip, by pressing sw2/NMI during power-on
5) a valid QSPI config binary, such as the one included in "NXP_Kinetis_Bootloader_2_0_0/apps/QCBGenerator/binaries/qspi_config_block.bin" needs to be loaded into 0x68000000

6) a valid board file, such as the one located in "NXP_Kinetis_Bootloader_2_0_0/apps/demo_qspi/qspi_image_0000.bd" needs to be modified to point to your user application's .srec file and the qspi_config_block.bin from (5) above.
7) the user-application.axf file needs to be converted to motorola format, via a command like: 

arm-none-eabi-objcopy -v -O srec "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.srec" - this file needs to be in the same directory as the BD file and qspi_config_block.bin and the elftosb utility
8)  an SB file needs to be generated via the command ./elftosb.exe -V -c qspi_image_0000.bd -o user-application.sb
9) the sb file is loaded onto the QSPI by contacting the Kinetis bootloader with the 'blhost' utility: 

"./blhost.exe -u -- receive-sb-file user-application.sb"

 

However - when I run the blhost.exe 'receieve-sb-file' command - the sb file seemingly fails to flash the last 32 bytes:

 

blhost.exe -u -- receive-sb-file agent-poc.sb
Inject command 'receive-sb-file'
Preparing to send 23648 (0x5c60) bytes to the target.
Successful generic response to command 'receive-sb-file'
usb hid detected receiver data abort
Data phase write aborted by status 0x2712 kStatus_AbortDataPhase
Response status = 10004 (0x2714) No response packet from target device.
Wrote 23616 of 23648 bytes.


I have a sample program that should configure and manipulate the RGB LED on the board, and have confirmed this happens when I run out of on-board flash, but the bootloader does not seem to jump to or run this code in the QSPI-- or perhaps the code is not successfully flashed or perhaps the QSPI config is incorrect?

Let me know if anyone else has seen this issue and has a solution.  Or if there's an application note that describes how to configure MCUXpresso projects to run out of the QSPI

Find attached: screenshots of my memory configuration and FOPT settings, and my map file, qspi_config_block.bin, BD file and srec

Outcomes