Commit 6f19b9c0 authored by Damien George's avatar Damien George

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

Signed-off-by: default avatarDamien George <damien@micropython.org>
parent bac791c5
......@@ -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
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
----------------------
......@@ -76,4 +96,4 @@ To scan for BLE devices:
>>> ble.active(1)
>>> ble.gap_scan(2000, 625, 625)
Use help("modules") to see available built-in modules.
\ No newline at end of file
Use help("modules") to see available built-in modules.
......@@ -20,3 +20,26 @@ endif
# Bootloader settings
MBOOT_TEXT0_ADDR = 0x08008000
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)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment