Skip to content

Commit

Permalink
bricks/ev3rt: Make bootable firmware.zip.
Browse files Browse the repository at this point in the history
This can be deployed with Pybricksdev.
  • Loading branch information
laurensvalk committed Nov 1, 2024
1 parent 5c7c5ad commit 084c51b
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 7 deletions.
33 changes: 27 additions & 6 deletions bricks/ev3rt/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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 $<
Empty file added bricks/ev3rt/ReadMe_OSS.txt
Empty file.
2 changes: 1 addition & 1 deletion tools/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
}


Expand Down

0 comments on commit 084c51b

Please sign in to comment.