Skip to content

Add Imxrt erase firmware#102

Merged
hathach merged 9 commits into
masterfrom
imxrt-erase-firmware
Mar 23, 2021
Merged

Add Imxrt erase firmware#102
hathach merged 9 commits into
masterfrom
imxrt-erase-firmware

Conversation

@hathach
Copy link
Copy Markdown
Member

@hathach hathach commented Mar 22, 2021

This PR fix #95

  • ground work for erase_firmware-BOARD.uf2 for all ports
  • new board API: board_reset() and board_flash_erase_app()
  • add erase_firmware as std application that reset board with MAGIC ERASE_APP
  • IMXRT implement board_flash_erase_app() add makefile to support erase_firmware. For iMXRT it is much quicker to perform chip erase and re-write bootloader from sram to flash. (sector/block erase probably takes longer).
  • erase_firmware-BOARD.uf2 is also uploaded as ci artifact/release if available.
  • Also update tinyusb to latest as well (why not).

Comment thread ports/mimxrt10xx/Makefile
# TODO write-register doesn't work
erase-app: $(BUILD)/$(OUTNAME).bin
@:$(call check_defined, SDPHOST, not found for this machine)
$(SDPHOST) -u 0x1fc9,$(SDP_$(MCU)_PID) -- write-register $(DBL_TAP_REG_ADDR) 32 $(DBL_TAP_MAGIC_ERASE_APP)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nxf58843 somehow I couldn't get the write-register to work, it always get no response from device. Though this is not important, most user should use the erase-firmware.uf2 . I just wonder if I made any mistakes. Else we could just remove this together.

sdphost -u 0x1fc9,0x0145 -- write-register 0x400D410C 32 0xf5e80ab4
getStatusResponse.readPacket error 5.
Status (HAB mode) = 10004 (0x2714) No response from device.

read-register doesn't work as well

sdphost -u 0x1fc9,0x0145 -- read-register 0x400D410C
getStatusResponse.readPacket error 5.
Status (HAB mode) = 10004 (0x2714) No response from device.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me look into this.
Have you tried reading an address from OCRAM?
I need to see if that address is accessible or needs to be enabled.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have just tried to read from dtcm and ocram but it doesn't response either. No problems at all, I am just curious, using uf2 is more preferable. I will merge it now, you don't have to "fix" it at all 😃

$ sdphost -u 0x1fc9,0x0145 -- read-register 0x20200000
getStatusResponse.readPacket error 5.
Status (HAB mode) = 10004 (0x2714) No response from device.

$ sdphost -u 0x1fc9,0x0145 -- read-register 0x20000000
getStatusResponse.readPacket error 5.
Status (HAB mode) = 10004 (0x2714) No response from device.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Glad you can move forward with the uf2 implementation.
It looks like the read/write register commands were dropped from the RT1010 due to ROM size limitation.
You could write a single word using write-file, but adding another file is not much better than separate binaries.
I may try setting the magic numbers with different jump addresses when I can find time.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah thanks for confirmation, I will just remove the make target. uf2 will be the standard way for erase_firmware (factory reset) for tinyuf2. Don't worry about having other register for erase_firmware. I don't see any issue with packing to the double tap reg. May only need to rename these variable a bit to be more generic than just double tap

@hathach hathach merged commit 60dfca4 into master Mar 23, 2021
@hathach hathach deleted the imxrt-erase-firmware branch March 23, 2021 05:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mimxrt: Add nuke.bin (and .uf2?)

2 participants