From 084c51b41b40814a351da363d1bd378447bc18c4 Mon Sep 17 00:00:00 2001 From: Laurens Valk Date: Fri, 1 Nov 2024 10:58:34 +0100 Subject: [PATCH] bricks/ev3rt: Make bootable firmware.zip. This can be deployed with Pybricksdev. --- bricks/ev3rt/Makefile | 33 +++++++++++++++++++++++++++------ bricks/ev3rt/ReadMe_OSS.txt | 0 tools/metadata.py | 2 +- 3 files changed, 28 insertions(+), 7 deletions(-) create mode 100644 bricks/ev3rt/ReadMe_OSS.txt diff --git a/bricks/ev3rt/Makefile b/bricks/ev3rt/Makefile index 945a78e8b..9c79d97ac 100644 --- a/bricks/ev3rt/Makefile +++ b/bricks/ev3rt/Makefile @@ -64,6 +64,9 @@ INC += -I$(PBTOP) INC += -I$(BUILD) GIT = git +ZIP = zip +PYBRICKSDEV = pybricksdev +METADATA = $(PBTOP)/tools/metadata.py CFLAGS_MCU = CFLAGS_WARN = -Wall -Werror -Wextra -Wno-unused-parameter -Wno-maybe-uninitialized @@ -165,13 +168,9 @@ export EV3RT_BRICK_DIR export EV3RT_LIB_DIR export APPLDIRS -all: uImage firmware.bin +all: uImage firmware -#TODO: Build our own u-boot image. Use any official firmware for now. u-boot will be extracted from it. -UBOOT_FILE = $(EV3RT_BRICK_DIR)/officialfw.bin - -firmware.bin: uImage - python $(EV3RT_BRICK_DIR)/make_bootable_image.py $(UBOOT_FILE) $(BUILD)/uImage $(BUILD)/firmware.bin +firmware: $(BUILD)/firmware.zip ev3rt-config: $(EV3RT_BRICK_DIR) $(BUILD)/libkernel.a prepare-obj-folder make -C $(BUILD) offset.h kernel_cfg.h @@ -196,3 +195,25 @@ prepare-obj-folder: mkdir -p $(EV3RT_BRICK_DIR)/build mkdir -p $(EV3RT_BRICK_DIR)/build/objs cp $(EV3RT_BRICK_DIR)/ev3rt.mk $(EV3RT_BRICK_DIR)/build/Makefile + +#TODO: Build our own u-boot image. Use any official firmware for now. u-boot will be extracted from it. +UBOOT_FILE = $(EV3RT_BRICK_DIR)/officialfw.bin + +$(BUILD)/firmware-base.bin: uImage + python $(EV3RT_BRICK_DIR)/make_bootable_image.py $(UBOOT_FILE) $(BUILD)/uImage $(BUILD)/firmware-base.bin + +$(BUILD)/firmware.metadata.json: $(BUILD)/firmware-base.bin $(METADATA) + $(ECHO) "META creating firmware metadata" + $(Q)$(METADATA) $(FW_VERSION) $(PBIO_PLATFORM) $< $@ + +ZIP_FILES := \ + $(BUILD)/firmware-base.bin \ + $(BUILD)/firmware.metadata.json \ + ReadMe_OSS.txt \ + +$(BUILD)/firmware.zip: $(ZIP_FILES) + $(ECHO) "ZIP creating firmware package" + $(Q)$(ZIP) -j $@ $^ + +deploy: $(BUILD)/firmware.zip + $(Q)$(PYBRICKSDEV) flash $< diff --git a/bricks/ev3rt/ReadMe_OSS.txt b/bricks/ev3rt/ReadMe_OSS.txt new file mode 100644 index 000000000..e69de29bb diff --git a/tools/metadata.py b/tools/metadata.py index e024be594..2baf4d09b 100755 --- a/tools/metadata.py +++ b/tools/metadata.py @@ -52,7 +52,7 @@ "essential_hub": {"device-id": 0x83, "checksum-type": "crc32"}, "rcx": {"device-id": 0xE0, "checksum-type": "none"}, "nxt": {"device-id": 0xE1, "checksum-type": "none"}, - "ev3": {"device-id": 0xE2, "checksum-type": "none"}, + "ev3rt": {"device-id": 0xE2, "checksum-type": "none"}, }