stm32/boards/LEGO_HUB_NO6: Add make commands to backup/restore firmware.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George 2021-08-26 12:35:16 +10:00
parent bac791c5fd
commit 6f19b9c08d
2 changed files with 44 additions and 1 deletions

View File

@ -28,6 +28,26 @@ firmware at 0x08010000. When mboot is installed it can be entered programatical
via machine.bootloader(), or by holding down the left arrow button when powering via machine.bootloader(), or by holding down the left arrow button when powering
on the Hub and waiting until the display says "B" before releasing the button. on the Hub and waiting until the display says "B" before releasing the button.
Backing up original Hub firmware
--------------------------------
Before install MicroPython it is advised to backup the original LEGO firmware that
the Hub comes installed with. To do this, enter the built-in bootloader by holding
down the Bluetooth button for 5 seconds while powering up the Hub via USB. Then
run the following command from the root of this repository:
$ cd ports/stm32
$ make BOARD=LEGO_HUB_NO6 backup-hub-firmware
This will create a file called `lego_hub_firmware.dfu`. Put this file in a safe
location. To restore it, enter the built-in bootloader again and run:
$ make BOARD=LEGO_HUB_NO6 restore-hub-firmware
This will restore the original firmware but not the filesystem. To recreate the
original filesystem the Hub must be updated using the appropriate LEGO PC
application.
Installing MicroPython Installing MicroPython
---------------------- ----------------------

View File

@ -20,3 +20,26 @@ endif
# Bootloader settings # Bootloader settings
MBOOT_TEXT0_ADDR = 0x08008000 MBOOT_TEXT0_ADDR = 0x08008000
MBOOT_LD_FILES = ../boards/LEGO_HUB_NO6/mboot_memory.ld stm32_sections.ld MBOOT_LD_FILES = ../boards/LEGO_HUB_NO6/mboot_memory.ld stm32_sections.ld
# Backup/restore original Hub firmware
HUB_FIRMWARE = lego_hub_firmware.dfu
HUB_FIRMWARE_ADDR = $(MBOOT_TEXT0_ADDR)
HUB_FIRMWARE_SIZE = 0xf8000
backup-hub-firmware:
$(Q)$(DFU_UTIL) -a 0 \
-d $(BOOTLOADER_DFU_USB_VID):$(BOOTLOADER_DFU_USB_PID) \
-U $(HUB_FIRMWARE).bin \
-s $(HUB_FIRMWARE_ADDR):$(HUB_FIRMWARE_SIZE)
$(Q)$(PYTHON) $(DFU) \
-b $(HUB_FIRMWARE_ADDR):$(HUB_FIRMWARE).bin \
-D $(BOOTLOADER_DFU_USB_VID):$(BOOTLOADER_DFU_USB_PID) \
$(HUB_FIRMWARE)
$(Q)$(RM) $(HUB_FIRMWARE).bin
$(ECHO) "Backup created in $(HUB_FIRMWARE)"
restore-hub-firmware:
$(Q)$(DFU_UTIL) -a 0 \
-d $(BOOTLOADER_DFU_USB_VID):$(BOOTLOADER_DFU_USB_PID) \
-D $(HUB_FIRMWARE)