AnsweredAssumed Answered

FRDM-K82 QSPI XIP problem

Question asked by john hemmick on May 21, 2018
Latest reply on May 24, 2018 by john hemmick

Hello.  I am trying to load the 'led_demo_qspi_0000' project from: <NXP_Kinetis_Bootloader_2_0_0>/apps/demo_qspi/led_demo/targets/FRDM-K82F/kds/led_demo_qspi_0000
loaded onto the QSPI on the FRDM-K82 board and am running into the following issue:

1) I can write the QSPI config:

blhost.exe -p COM5 -- write-memory 0x20000000 qcb_MX25U3235F_parallel_mode.bin

...

Response status = 0 (0x0) Success.
blhost.exe -p COM5 -- configure-quadspi 1 0x20000000

...

Response status = 0 (0x0) Success.
blhost.exe -p COM5 -- write-memory 0x68000000 qcb_MX25U3235F_parallel_mode.bin

...

Response status = 0 (0x0) Success.

2) I can write an SB file, by using the board file 'qspi_image_0000.bd':

# The sources block assigns file names to identifiers sources
{ # SREC File path
  mySrecFile = "led_demo_qspi_0000.srec";
  # QCB file path
  qspiConfigBlock = "qcb_MX25U3235F_parallel_mode.bin";
}
# The section block specifies the sequence of boot commands to be written to
# the SB file
section (0)
{
  #1. Erase the vector table and flash config field.
  erase 0..0x800;
  # Step 2 and Step 3 are optional if the QuadSPI is configured at startup.
  #2. Load the QCB to RAM
  load qspiConfigBlock > 0x20000000;
  #3. Configure QuadSPI with the QCB above
  enable qspi 0x20000000;
  #4. Erase the QuadSPI memory region before programming.
  erase 0x68000000..0x68004000;
  #5.Load the QCB above to the start address of QuadSPI memory
  load qspiConfigBlock > 0x68000000;
  #6,7. Load all the RO data from srec file, including vector table, flash config field and codes.
  load mySrecFile;
  #8. Reset target.
  reset;
}

and using the command :

./elftosb.exe -V -c qspi_image_0000.bd -o qspi_image_0000.sb

3) But when I try and write the sb file using blhost I get an error:

blhost.exe -p COM5 -- receive-sb-file qspi_image_0000.sb
Ping responded in 1 attempt(s)
Inject command 'receive-sb-file'
Preparing to send 3904 (0xf40) bytes to the target.
Successful generic response to command 'receive-sb-file'
Data phase write aborted by status 0x2712 kStatus_AbortDataPhase
Response status = 10200 (0x27d8) kStatusMemoryRangeInvalid
Wrote 128 of 3904 bytes.

Additionally -- if I try and go through the steps in the sb file manually:

blhost.exe -p COM5 -- flash-erase-region 0x000 2048
Ping responded in 1 attempt(s)
Inject command 'flash-erase-region'
Response status = 10200 (0x27d8) kStatusMemoryRangeInvalid

So I suspect that the initial step in the SB file 'erase 0 ... 0x800' is failing.

 

Is there a write protect step I should be disabling? I don't think that I have a key for this image:

blhost -p COM5 -- read-memory 0x400 12
Ping responded in 1 attempt(s)
Inject command 'read-memory'
Successful response to command 'read-memory'
ff ff ff ff ff ff ff ff ff ff ff ff
Successful generic response to command 'read-memory'
Response status = 0 (0x0) Success.
Response word 1 = 12 (0xc)
Read 12 of 12 bytes.

 

Find attached: the map and linker files for this project:
MK82FN256xxx15_qspi_0000.ld = linker file for led_demo_qspi_0000
led_demo_qspi_0000.map = map file for led_demo_qspi_0000
MK82FN256xxx15_application_0x0000.ld = linker for freedom k82 bootloader
freedom_bootloader.map = map file for freedom k82 bootloader

 

What I want is for the freedom bootloader to execute in flash, initialize the QSPI in parallel mode, then jump to 0x68001000 and start execution of the led_demo_qspi housed there.

 

Please let me know what I have done wrong.

Outcomes