Program i.MX RT685EVK using SPSDK

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

Program i.MX RT685EVK using SPSDK

1,632 Views
IvoBCD
Contributor III

I'm trying to use SPSDK to program a firmware image onto the i.MX RT685EVK, but `blhost flash-image` fails with:

Response status = 10200 (0x27d8) Memory Range Invalid.

I must have missed something, should I maybe use nxpdebugmbox directly to program the on-board flash  ?

+ isp_mode=0
+ sdp_port=/dev/ttyAMA0
+ mboot_port=/dev/ttyACM0
+ usb_pidvid=0x1fc9:0x0020
+ spsdk_target=rt6xx
+ blhost_connection='-p /dev/ttyACM0'
+ sdphost_connection='-p /dev/ttyAMA0'
+ elf_path=build/nxp-MIMXRT685EVK-mcuboot-2.13.0-debug.elf
+ bin_path=build/nxp-MIMXRT685EVK-mcuboot-2.13.0-debug.bin
+ image_path=build/nxp-MIMXRT685EVK-mcuboot-2.13.0-debug_mbi.bin
+ readelf.py -l build/nxp-MIMXRT685EVK-mcuboot-2.13.0-debug.elf

Elf file type is EXEC (Executable file)
Entry point is 0x80011ad
There are 4 program headers, starting at offset 52

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x000000 0x08000000 0x08000000 0x00600 0x00600 R   0x1000
  LOAD           0x001000 0x08001000 0x08001000 0x00130 0x00130 R   0x1000
  LOAD           0x001130 0x08001130 0x08001130 0x0c680 0x0c680 RWE 0x1000
  LOAD           0x00e000 0x20080000 0x0800d7b0 0x02658 0x100c8 RWE 0x1000

 Section to Segment mapping:
  Segment Sections...
   00     .flash_config 
   01     .interrupts 
   02     .text .ARM .init_array .fini_array 
   03     .data .bss .heap .stack 
+ nxpimage -v utils binary-image convert -i build/nxp-MIMXRT685EVK-mcuboot-2.13.0-debug.elf -f BIN build/nxp-MIMXRT685EVK-mcuboot-2.13.0-debug.bin
WARNING:spsdk.utils.images:Elf file support is experimental. Take that with care. (6647ms since start, images.py:531)
INFO:spsdk.apps.nxpimage:
+==0x0800_0400= nxp-MIMXRT685EVK-mcuboot-2.13.0-debug.elf ==+
|                       Size: 64.0 kB                       |
|     The image loaded from: /home/root/nxp/build/nxp-      |
|          MIMXRT685EVK-mcuboot-2.13.0-debug.elf .          |
|+==0x0800_0400= Segment 0 ================================+|
||                       Size: 512 B                       ||
|+==0x0800_05ff============================================+|
|                        Gap: 2.6 kB                        |
|+==0x0800_1000= Segment 1 ================================+|
||                      Size: 60.9 kB                      ||
|+==0x0800_fe07============================================+|
+==0x0800_fe07==============================================+

Success. (Converted file: /home/root/nxp/build/nxp-MIMXRT685EVK-mcuboot-2.13.0-debug.bin created.)
+ cat mcuboot-mbi.yaml
family: rt6xx
outputImageExecutionAddress: 0x80011ad
outputImageExecutionTarget: RAM
outputImageAuthenticationType: Plain
masterBootOutputFile: build/nxp-MIMXRT685EVK-mcuboot-2.13.0-debug_mbi.bin
inputImageFile: build/nxp-MIMXRT685EVK-mcuboot-2.13.0-debug.bin
enableHwUserModeKeys: false
enableTrustZone: false
+ nxpimage -v mbi export mcuboot-mbi.yaml
Success. (Master Boot Image: /home/root/nxp/build/nxp-MIMXRT685EVK-mcuboot-2.13.0-debug_mbi.bin created.)
+ nxpdebugmbox -i pyocd -v ispmode -m 0
  #   Interface   Id         Description                                    
----------------------------------------------------------------------------
  0   PyOCD       NRAQBQHR   NXP Semiconductors LPC-LINK2 CMSIS-DAP V5.361  
INFO:spsdk.debuggers.debug_probe_pyocd:PyOCD connected via LPC-LINK2 CMSIS-DAP V5.361 probe.
Entering into ISP mode succeeded
+ sleep 1
+ lsusb -d 1fc9:
Bus 001 Device 003: ID 1fc9:0090 NXP Semiconductors LPC-LINK2 CMSIS-DAP V5.361
+ nxpdevscan -v
INFO:libusbsio:Loading SIO library: /usr/lib/python3.11/site-packages/libusbsio/bin/linux_aarch64/libusbsio.so
INFO:libusbsio:HID enumeration[368525893056]: initialized
INFO:libusbsio:HID enumeration[368525893056]: finished, total 5 devices
-------- Connected NXP USB Devices --------

LPC-LINK2 CMSIS-DAP V5.361 - NXP Semiconductors
Vendor ID: 0x1fc9
Product ID: 0x0090
Path: /dev/hidraw0
Path Hash: b3f395f0
Name: 
Serial number: NRAQBQHR

LPCSIO - NXP Semiconductors
Vendor ID: 0x1fc9
Product ID: 0x0090
Path: /dev/hidraw2
Path Hash: d068573e
Name: 
Serial number: NRAQBQHR

LPC-LINK2 DATA PORT - NXP Semiconductors
Vendor ID: 0x1fc9
Product ID: 0x0090
Path: /dev/hidraw1
Path Hash: 7e1d2ff4
Name: 
Serial number: NRAQBQHR

INFO:spsdk.sdp.sdp:TX-CMD: ReadStatus
INFO:spsdk.sdp.sdp:RX-PACKET: Response: 0x04100100
INFO:spsdk.sdp.sdp:RX-PACKET: Response: 0x04100100
-------- Connected NXP UART Devices --------

Port: /dev/ttyACM0
Type: mboot device

Port: /dev/ttyAMA0
Type: SDP device

-------- Connected NXP SIO Devices --------

LIBUSBSIO - NXP Semiconductors, LPCSIO
Vendor ID: 0x1fc9
Product ID: 0x0090
Path: /dev/hidraw2
Path Hash: d068573e
Serial number: NRAQBQHR
Interface number: 3
Release number: 256

+ blhost -p /dev/ttyACM0 -v get-property current-version
INFO:spsdk.mboot.mcuboot:Connect: /dev/ttyACM0
INFO:spsdk.mboot.mcuboot:CMD: GetProperty('CurrentVersion', index=0)
Response status = 0 (0x0) Success.
Response word 1 = 1258487808 (0x4b030000)
Current Version = K3.0.0
INFO:spsdk.mboot.mcuboot:Closing: /dev/ttyACM0
+ blhost -p /dev/ttyACM0 -v list-memory
INFO:spsdk.mboot.mcuboot:Connect: /dev/ttyACM0
Internal Flash:
INFO:spsdk.mboot.mcuboot:CMD: GetProperty('FlashStartAddress', index=0)
Internal RAM:
INFO:spsdk.mboot.mcuboot:CMD: GetProperty('RamStartAddress', index=0)
INFO:spsdk.mboot.mcuboot:CMD: GetProperty('RamSize', index=0)
INFO:spsdk.mboot.mcuboot:CMD: GetProperty('RamStartAddress', index=1)
INFO:spsdk.mboot.mcuboot:CMD: GetProperty('RamSize', index=1)
INFO:spsdk.mboot.mcuboot:CMD: GetProperty('RamStartAddress', index=2)
INFO:spsdk.mboot.mcuboot:CMD: GetProperty('RamSize', index=2)
INFO:spsdk.mboot.mcuboot:CMD: GetProperty('RamStartAddress', index=3)
INFO:spsdk.mboot.mcuboot:CMD: GetProperty('RamSize', index=3)
INFO:spsdk.mboot.mcuboot:CMD: GetProperty('RamStartAddress', index=4)
    Region 0: 0x10000000 - 0x1047FFFF; Total Size: 4.5 MiB
    Region 1: 0x00000000 - 0x0047FFFF; Total Size: 4.5 MiB
    Region 2: 0x20000000 - 0x2047FFFF; Total Size: 4.5 MiB
    Region 3: 0x30000000 - 0x3047FFFF; Total Size: 4.5 MiB
External Memories:
INFO:spsdk.mboot.mcuboot:CMD: GetProperty('CurrentVersion', index=0)
INFO:spsdk.mboot.mcuboot:CMD: GetProperty('ExternalMemoryAttributes', index=1)
INFO:spsdk.mboot.mcuboot:CMD: GetProperty('ExternalMemoryAttributes', index=4)
INFO:spsdk.mboot.mcuboot:CMD: GetProperty('ExternalMemoryAttributes', index=4)
INFO:spsdk.mboot.mcuboot:CMD: GetProperty('ExternalMemoryAttributes', index=8)
INFO:spsdk.mboot.mcuboot:CMD: GetProperty('ExternalMemoryAttributes', index=9)
INFO:spsdk.mboot.mcuboot:CMD: GetProperty('ExternalMemoryAttributes', index=10)
INFO:spsdk.mboot.mcuboot:CMD: GetProperty('ExternalMemoryAttributes', index=16)
INFO:spsdk.mboot.mcuboot:CMD: GetProperty('ExternalMemoryAttributes', index=256)
INFO:spsdk.mboot.mcuboot:CMD: GetProperty('ExternalMemoryAttributes', index=257)
INFO:spsdk.mboot.mcuboot:CMD: GetProperty('ExternalMemoryAttributes', index=272)
INFO:spsdk.mboot.mcuboot:CMD: GetProperty('ExternalMemoryAttributes', index=273)
INFO:spsdk.mboot.mcuboot:CMD: GetProperty('ExternalMemoryAttributes', index=288)
INFO:spsdk.mboot.mcuboot:CMD: GetProperty('ExternalMemoryAttributes', index=289)
FLEX-SPI-NOR:
  Not Configured
SPI-MEM:
  Not Configured
SD:
  Not Configured
MMC:
  Not Configured
INFO:spsdk.mboot.mcuboot:Closing: /dev/ttyACM0
+ blhost -p /dev/ttyACM0 -v flash-image build/nxp-MIMXRT685EVK-mcuboot-2.13.0-debug_mbi.bin
INFO:spsdk.mboot.mcuboot:Connect: /dev/ttyACM0
INFO:spsdk.mboot.mcuboot:CMD: WriteMemory(address=0x00000000, length=64008, mem_id=0)
INFO:spsdk.mboot.mcuboot:CMD: GetProperty('MaxPacketSize', index=0)
INFO:spsdk.mboot.mcuboot:CMD: Max Packet Size = 512
ERROR:spsdk.mboot.mcuboot:RX: Mboot: Data aborted by sender (1644ms since start, mcuboot.py:230)
Response status = 10200 (0x27d8) Memory Range Invalid.
INFO:spsdk.mboot.mcuboot:Closing: /dev/ttyACM0

 

Labels (1)
Tags (2)
0 Kudos
8 Replies

1,329 Views
marek-trmac
NXP Employee
NXP Employee

Hi Ivo,

I do not know if this issue was resolved. I'm trying MCUxpresso Secure Provisioning tool v6 with MIMXRT685-EVK board. I have selected "Flex SPI NOR/MX25UM51345G" (same configuration as Marek Vitula above) and I do not find any problem. I can program the plain image both using UART and also USB.

### Check connection ###
blhost -t 2000 -p COM38,115200 -j -- get-property 1 0
{
"command": "get-property",
"response": [
1258487808
],
"status": {
"description": "0 (0x0) Success.",
"value": 0
}
}
blhost succeeded
### Erase flash - only if the memory is already configured ###
blhost -t 50252 -p COM38,115200 -j -- flash-erase-region 0x08000000 25296 9
WARNING:spsdk.mboot.mcuboot:Note: memoryId is not required when accessing mapped external memory (301ms since start, mcuboot.py:1414)
{
"command": "flash-erase-region",
"response": [],
"status": {
"description": "10205 (0x27dd) Memory Not Configured.",
"value": 10205
}
}
blhost failed
### Configure FlexSPI NOR memory using options on address 0x0010C000 ###
blhost -t 5000 -p COM38,115200 -j -- fill-memory 0x0010C000 4 0xC1503057 word
{
"command": "fill-memory",
"response": [],
"status": {
"description": "0 (0x0) Success.",
"value": 0
}
}
blhost succeeded
blhost -t 5000 -p COM38,115200 -j -- fill-memory 0x0010C004 4 0x20000000 word
{
"command": "fill-memory",
"response": [],
"status": {
"description": "0 (0x0) Success.",
"value": 0
}
}
blhost succeeded
blhost -t 5000 -p COM38,115200 -j -- configure-memory 9 0x0010C000
{
"command": "configure-memory",
"response": [],
"status": {
"description": "0 (0x0) Success.",
"value": 0
}
}
blhost succeeded
### Erase flash ###
blhost -t 50252 -p COM38,115200 -j -- flash-erase-region 0x08000000 25296 9
WARNING:spsdk.mboot.mcuboot:Note: memoryId is not required when accessing mapped external memory (337ms since start, mcuboot.py:1414)
{
"command": "flash-erase-region",
"response": [],
"status": {
"description": "0 (0x0) Success.",
"value": 0
}
}
blhost succeeded
### Configure target memory ###
blhost -t 5000 -p COM38,115200 -j -- fill-memory 0x10c000 4 0xF000000F
{
"command": "fill-memory",
"response": [],
"status": {
"description": "0 (0x0) Success.",
"value": 0
}
}
blhost succeeded
blhost -t 5000 -p COM38,115200 -j -- configure-memory 0x9 0x10c000
{
"command": "configure-memory",
"response": [],
"status": {
"description": "0 (0x0) Success.",
"value": 0
}
}
blhost succeeded

 There might be problem to configure the memory twice, try to reset the board before each programming cycle.

Note: MCUxpresso Secure Provisioning tool internally uses SPSDK applications (blhost) to communicate with the processor.

Regards,
Marek
0 Kudos

1,481 Views
nxf46245
NXP Employee
NXP Employee

Hello Ivo,

I see a problem with your script. The Macronix Octal SDR memory you are trying to use is connected to port B on evaluation board. It means that you have to specify the second configuration word.

nxf46245_0-1683725913115.png

 

(venv) PS C:\Users\nxf46245\spsdk> blhost -t 5000 -u 0x1FC9,0x0020 -j -- fill-memory 0x0010C000 4 0xC1503057 word
{
   "command": "fill-memory",
   "response": [],
   "status": {
      "description": "0 (0x0) Success.",
      "value": 0
   }
}
(venv) PS C:\Users\nxf46245\spsdk> blhost -t 5000 -u 0x1FC9,0x0020 -j -- fill-memory 0x0010C004 4 0x20000000 word
{
   "command": "fill-memory",
   "response": [],
   "status": {
      "description": "0 (0x0) Success.",
      "value": 0
   }
}
(venv) PS C:\Users\nxf46245\spsdk> blhost -t 5000 -u 0x1FC9,0x0020 -j -- configure-memory 9 0x0010C000
{
   "command": "configure-memory",
   "response": [],
   "status": {
      "description": "0 (0x0) Success.",
      "value": 0
   }
}
(venv) PS C:\Users\nxf46245\spsdk> blhost -u 0x1fc9:0x0020 -j -- fill-memory 0x10c000 4 0xF000000F
{
   "command": "fill-memory",
   "response": [],
   "status": {
      "description": "0 (0x0) Success.",
      "value": 0
   }
}

 

In case you encounter a memory cumulative write error, it means that flash was already programmed. You have to erase it first using the blhost flash-erase-region command.

Marek Vitula

0 Kudos

1,471 Views
IvoBCD
Contributor III

Thanks, that does get me a step further, although programming the FCB or erasing then still fails.

 

Entering into ISP mode succeeded
+ lsusb -d 1fc9:
Bus 001 Device 020: ID 1fc9:0020 NXP Semiconductors USB COMPOSITE DEVICE
+ blhost -t 2000 -u 0x1fc9:0x0020 -v get-property current-version
INFO:libusbsio:Loading SIO library: /usr/lib/python3.11/site-packages/libusbsio/bin/linux_aarch64/libusbsio.so
INFO:libusbsio:HID enumeration[368593028128]: initialized
INFO:libusbsio:HID enumeration[368593028128]: finished, total 3 devices
INFO:spsdk.mboot.mcuboot:Connect: MCU DFU AND HID GENERIC DEVICE (0x1FC9, 0x0020) path=b'/dev/hidraw0'
INFO:libusbsio.hidapi.dev:Opening HID device at path: 'b'/dev/hidraw0''
INFO:libusbsio.hidapi.dev:HID device 368593170448 is now open
INFO:spsdk.mboot.mcuboot:CMD: GetProperty('CurrentVersion', index=0)
INFO:spsdk.mboot.mcuboot:Closing: MCU DFU AND HID GENERIC DEVICE (0x1FC9, 0x0020) path=b'/dev/hidraw0'
INFO:libusbsio.hidapi.dev:HID device 368593170448 closed
Response status = 0 (0x0) Success.
Response word 1 = 1258487808 (0x4b030000)
Current Version = K3.0.0
+ blhost -t 5000 -u 0x1fc9:0x0020 -j -- fill-memory 0x10c000 4 0xc1503057 word
{
   "command": "fill-memory",
   "response": [],
   "status": {
      "description": "0 (0x0) Success.",
      "value": 0
   }
}
+ blhost -t 5000 -u 0x1FC9,0x0020 -j -- fill-memory 0x0010C004 4 0x20000000 word
{
   "command": "fill-memory",
   "response": [],
   "status": {
      "description": "0 (0x0) Success.",
      "value": 0
   }
}
+ blhost -t 5000 -u 0x1fc9:0x0020 -j -- configure-memory 9 0x10c000
{
   "command": "configure-memory",
   "response": [],
   "status": {
      "description": "0 (0x0) Success.",
      "value": 0
   }
}
+ blhost -t 5000 -u 0x1fc9:0x0020 -j -- fill-memory 0x10c000 4 0xF000000F word
{
   "command": "fill-memory",
   "response": [],
   "status": {
      "description": "0 (0x0) Success.",
      "value": 0
   }
}
+ blhost -t 5000 -u 0x1fc9:0x0020 -j -- configure-memory 9 0x10c000
ERROR:spsdk.mboot.interfaces.usb:Cannot read from HID device, error=0 (6263ms since start, usb.py:243)
{
   "command": "configure-memory",
   "response": [],
   "status": {
      "description": "10004 (0x2714) No response packet from target device.",
      "value": 10004
   }
}


Trying to erase first with flash-erase-all just times out, and flash-erase-region returns "Invalid Argument":


+ blhost -t 5000 -u 0x1fc9:0x0020 -j -- fill-memory 0x10c000 4 0xc1503057 word
{
"command": "fill-memory",
"response": [],
"status": {
"description": "0 (0x0) Success.",
"value": 0
}
}
+ blhost -t 5000 -u 0x1FC9,0x0020 -j -- fill-memory 0x0010C004 4 0x20000000 word
{
"command": "fill-memory",
"response": [],
"status": {
"description": "0 (0x0) Success.",
"value": 0
}
}
+ blhost -t 5000 -u 0x1fc9:0x0020 -j -- configure-memory 9 0x10c000
{
"command": "configure-memory",
"response": [],
"status": {
"description": "0 (0x0) Success.",
"value": 0
}
}
+ blhost -t 50000 -u 0x1fc9:0x0020 -j flash-erase-region 0x08000000 36440 9
WARNING:spsdk.mboot.mcuboot:Note: memoryId is not required when accessing mapped external memory (1235ms since start, mcuboot.py:1443)
{
"command": "flash-erase-region",
"response": [],
"status": {
"description": "4 (0x4) Invalid Argument Error.",
"value": 4
}
}

 

0 Kudos

1,534 Views
nxf46245
NXP Employee
NXP Employee
Hello Ivo,

Regarding the first problem you have encountered. The first part of SRAM is reserved by ISP, that's why the command ended with "Memory range invalid" error. The SRAM should be accessible from address 0x0001c000. You should use the write-memory command instead and specify the address.

Regarding the external memories configuration. To use an external memory device correctly, the device must be enabled with the corresponding configuration profile. If the external memory device is not enabled, then it cannot be accessed by the ROM ISP command. The boot ROM enables specific external memory devices using a preassigned memory identifier.

FlexSPI NOR memories can be configured by 32 bit configuration word.

1. First step is to write the configuration word to SRAM using the blhost fill memory command. Refer to the table "FlexSPI NOR Configuration Option Block" 1069 in the RT6xx User Manual.
blhost -u 0x1FC9,0x0020 -j -- fill-memory 0x10c000 4 <configuration word>

2. Call the configure-memory commmand that tells the boot ROM to generate the whole FCB (512 B flash configuration block) and configure the FlexSPI.
blhost -u 0x1FC9,0x0020 -j -- configure-memory 9 0x10c000

3. The ROM also supports programming the generated FCB to the start of the flash memory using a specific option "0xF000000F"

blhost -u 0x1FC9,0x0020 -j -- fill-memory 0x10c000 4 0xF000000F
blhost -u 0x1FC9,0x0020 -j -- configure-memory 9 0x10c000
(program FCB to the offset 0x400)

The second step is missing in the attached script, that's why it failed with "Invalid argument errror". Because no memory was configured, so the FCB block could not be programmed.

1,497 Views
IvoBCD
Contributor III

Thanks nxf46245, those pointers were very enlightening.  I missed the "ext_memory_setup.sh" script generated by the SEC tool.

However, I still have trouble replicating the commands generated by the SEC tool, with the command line tools from the SPSDK instead:

 

+ nxpdebugmbox -i pyocd -v ispmode -m 0
  #   Interface   Id                 Description                       
-----------------------------------------------------------------------
  0   PyOCD       E6609CB2D36A7B29   Raspberry Pi Picoprobe CMSIS-DAP  
INFO:spsdk.debuggers.debug_probe_pyocd:PyOCD connected via Picoprobe CMSIS-DAP probe.
Entering into ISP mode succeeded
+ lsusb -d 1fc9:
Bus 001 Device 010: ID 1fc9:0020 NXP Semiconductors USB COMPOSITE DEVICE
+ blhost -u 0x1fc9:0x0020 -v get-property current-version
INFO:libusbsio:Loading SIO library: /usr/lib/python3.11/site-packages/libusbsio/bin/linux_aarch64/libusbsio.so
INFO:libusbsio:HID enumeration[368257244688]: initialized
INFO:libusbsio:HID enumeration[368257244688]: finished, total 3 devices
INFO:spsdk.mboot.mcuboot:Connect: MCU DFU AND HID GENERIC DEVICE (0x1FC9, 0x0020) path=b'/dev/hidraw0'
INFO:libusbsio.hidapi.dev:Opening HID device at path: 'b'/dev/hidraw0''
INFO:libusbsio.hidapi.dev:HID device 368257726224 is now open
INFO:spsdk.mboot.mcuboot:CMD: GetProperty('CurrentVersion', index=0)
Response status = 0 (0x0) Success.
Response word 1 = 1258487808 (0x4b030000)
Current Version = K3.0.0
INFO:spsdk.mboot.mcuboot:Closing: MCU DFU AND HID GENERIC DEVICE (0x1FC9, 0x0020) path=b'/dev/hidraw0'
INFO:libusbsio.hidapi.dev:HID device 368257726224 closed
+ blhost -u 0x1fc9:0x0020 -j -- fill-memory 0x10c000 4 0xc1503057
{
   "command": "fill-memory",
   "response": [],
   "status": {
      "description": "0 (0x0) Success.",
      "value": 0
   }
}
+ blhost -u 0x1fc9:0x0020 -j -- configure-memory 9 0x10c000
{
   "command": "configure-memory",
   "response": [],
   "status": {
      "description": "0 (0x0) Success.",
      "value": 0
   }
}
+ blhost -u 0x1fc9:0x0020 -j -- fill-memory 0x10c000 4 0xF000000F
{
   "command": "fill-memory",
   "response": [],
   "status": {
      "description": "0 (0x0) Success.",
      "value": 0
   }
}
+ blhost -u 0x1fc9:0x0020 -j -- configure-memory 9 0x10c000
ERROR:spsdk.mboot.interfaces.usb:Cannot read from HID device, error=0 (6241ms since start, usb.py:243)
{
   "command": "configure-memory",
   "response": [],
   "status": {
      "description": "10004 (0x2714) No response packet from target device.",
      "value": 10004
   }
}
0 Kudos

1,599 Views
brendonslade
NXP TechSupport
NXP TechSupport

Hi Ivo,

If you are trying to program OTP or connected flash devices then you need to be working via a serial interface that is supported by the i.MX RT685 ISP modes. At this point we support UART, USB-HID, SPI or I2C for this device. You cant use SWD for this because debug can be (optionally) disabled for security reasons, plus not all device configuration is available through SWD. If you are using an NXP EVK then you can access these directly, or if you are using your own target then you'll need to make sure you have one of these ports available. See Chapter 42 of the RT600 User manual for more info on the ISP modes.

The debug mailbox is used (via SWD) to perform various debug actions, including mass erase and configuration of debug authentication. Seems like you probably arent trying to do this, but you can find out more about the mailbox in Chapter 48 of the RT600 user manual.
 

You might find it helpful to start with the MCUXpresso SEC tool in order to get more familiar with the device programming on this platform. It also generates command line calls to the various utilities in the SP SDK.

0 Kudos

1,574 Views
IvoBCD
Contributor III

Programming with MCUXpresso SEC's Flash programmer and manufacturing tool (over USB-HID), works for me.

However, while I'm able to program the MIMXRT685EVK from MCUXpresso SEC Flash programmer
and/or manufacturing tool, executing the commands from the generated `write_image_lnx.sh` with SPSDK fails.

During reconfiguring memory after erasing the flash, I get "4 (0x4) Invalid Argument Error.", for the
"blhost -u 0x1FC9,0x0020 -j -- configure-memory 9 0x10c000" command.

(using SPSDK v1.10.1)

+ export 'blhost_connect=-u 0x1FC9,0x0020'
+ blhost_connect='-u 0x1FC9,0x0020'
+ export manufacturing_task_no=
+ manufacturing_task_no=
+ echo '### Parse input arguments ###'
### Parse input arguments ###
+ i=1
+ ((  i<=0 ))
+ blhost -u 0x1FC9,0x0020 -j -- get-property 1 0
+ echo '### Check connection ###'
### Check connection ###
+ blhost -u 0x1FC9,0x0020 -j -- get-property 1 0
{
   "command": "get-property",
   "response": [
      1258487808
   ],
   "status": {
      "description": "0 (0x0) Success.",
      "value": 0
   }
}
+ '[' 0 -ge 2 ']'
+ '[' '' = 1 ']'
+ echo '### Erase flash - only if the memory is already configured ###'
### Erase flash - only if the memory is already configured ###
+ blhost -u 0x1FC9,0x0020 -j -- flash-erase-region 0x08000000 36440 9
WARNING:spsdk.mboot.mcuboot:Note: memoryId is not required when accessing mapped external memory (1226ms since start, mcuboot.py:1443)
{
   "command": "flash-erase-region",
   "response": [],
   "status": {
      "description": "10205 (0x27dd) Memory Not Configured.",
      "value": 10205
   }
}
+ '[' 1 -ge 2 ']'
+ echo '### Configure target memory ###'
### Configure target memory ###
+ blhost -u 0x1FC9,0x0020 -j -- fill-memory 0x10c000 4 0xF000000F
{
   "command": "fill-memory",
   "response": [],
   "status": {
      "description": "0 (0x0) Success.",
      "value": 0
   }
}
+ '[' 0 -ge 2 ']'
+ blhost -u 0x1FC9,0x0020 -j -- configure-memory 9 0x10c000
{
   "command": "configure-memory",
   "response": [],
   "status": {
      "description": "4 (0x4) Invalid Argument Error.",
      "value": 4
   }
}
+ '[' 1 -ge 2 ']'
+ echo '### Write image version for dual boot image 0 ###'
### Write image version for dual boot image 0 ###
+ blhost -u 0x1FC9,0x0020 -j -- write-memory 0x08000600 /home/root/nxp/nxp-MIMXRT685EVK-shell-2.13.0-mfg/gen_sb/image_version.bin 0
{
   "command": "write-memory",
   "response": [],
   "status": {
      "description": "10205 (0x27dd) Memory Not Configured.",
      "value": 10205
   }
}
+ '[' 1 -ge 1 ']'
+ exit 2




Tags (1)
0 Kudos

1,587 Views
IvoBCD
Contributor III

Thanks Brandon,

 

I'm actually just using SWD to enter ISP mode, and using **blhost** to communicate over UART, but that is failing with "Memory range invalid", even though 0x0 is supposed to be mapped to RAM (as reported by "list-memory")

+ blhost -p /dev/ttyACM0 -v flash-image build/nxp-MIMXRT685EVK-mcuboot-2.13.0-debug_mbi.bin
INFO:spsdk.mboot.mcuboot:Connect: /dev/ttyACM0
INFO:spsdk.mboot.mcuboot:CMD: WriteMemory(address=0x00000000, length=64008, mem_id=0)
INFO:spsdk.mboot.mcuboot:CMD: GetProperty('MaxPacketSize', index=0)
INFO:spsdk.mboot.mcuboot:CMD: Max Packet Size = 512
ERROR:spsdk.mboot.mcuboot:RX: Mboot: Data aborted by sender (1644ms since start, mcuboot.py:230)
Response status = 10200 (0x27d8) Memory Range Invalid.

 

I tried with SEC tool initially, but couldn't get it to import the .elf file, will retry with .hex files.

0 Kudos