Hello @diego_charles,
So I think I understand why, now I am trying to figure out how to fix this. So, a standard build will create an image for the entire space - this includes the space reserved for the fcb (offset at 0x400) as well as the version (offset 0x600). The image itself is stored in flash at offset 0x1000. I was writing to 0x1000. I am not using the image which is generated via the flash_release script which starts at an offset of 0x400 (the image will include the fcb). However, when I try to write this image via the write_memory command, I get the error "WriteMemory interrupted -> Memory Cumulative Write". I am obviously missing something. My script for this is:
from spsdk.mboot.interfaces.uart import MbootUARTInterface
from spsdk.mboot.mcuboot import McuBoot, McuBootCommandError, StatusCode
# Bootloader ROM uses FC0 pins 0_1 (Tx) and 0_2 (Rx) for UART
interfaces = MbootUARTInterface.scan(port="/dev/ttyACM0", baudrate=921600)
# Assumes only one interface really...
for interface in interfaces:
# Raise an exception when there is an McuBootCommandError
with McuBoot(interface, True) as mb:
# 22444
try:
# If memory is unconfigured, we will not be able to be erase and
# an exceptionwill be thrown
mb.flash_erase_region(0x08000000, 32000, 9)
except McuBootCommandError as e:
mb.fill_memory(0x0010C000, 4, 0xC1503057)
mb.fill_memory(0x0010C004, 4, 0x20000000)
mb.configure_memory(0x10c000, 9)
mb.flash_erase_region(0x08000000, 32000, 9)
mb.fill_memory(0x0010C000, 4, 0xF000000F)
mb.configure_memory(0x10c000, 9)
fcb = mb.read_memory(0x08000400, 0x200, )
for i in range(0, len(fcb), 16):
line = fcb[i:i+16]
hex_line = ' '.join(f'{byte:02X}' for byte in line)
print(hex_line)
try:
# with open(f"/home/mrichardson/secure_provisioning/gen_sb/image_version.bin", "rb") as f:
# # Version here is just
# img_version = f.read()
# works = mb.write_memory(0x08000600, img_version, 0)
# with open(f"evkmimxrt685_led_blinky_ext_flash.bin", "rb") as f:
with open(f"gpio_led_output.bin", "rb") as f:
img = f.read()
mb.write_memory(0x08000400, img, 0)
# Reset MCU
mb.reset(reopen=False)
except McuBootCommandError as e:
print(e)
and I am attaching my binary along with the srec.
Cheers, m