diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c8f27a4ae..6342fd25e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -93,7 +93,7 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Install cross-compiler - run: sudo apt-get update && sudo apt-get install --yes gcc-arm-none-eabi u-boot-tools + run: sudo apt-get update && sudo apt-get install --yes gcc-arm-none-eabi - name: Checkout repo uses: actions/checkout@v4 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 33380d842..8070672b8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Install cross-compiler - run: sudo apt-get update && sudo apt-get install --yes gcc-arm-none-eabi u-boot-tools + run: sudo apt-get update && sudo apt-get install --yes gcc-arm-none-eabi - name: Checkout code uses: actions/checkout@v4 with: diff --git a/.github/workflows/stats.yml b/.github/workflows/stats.yml index 47206ffeb..cb2738cb1 100644 --- a/.github/workflows/stats.yml +++ b/.github/workflows/stats.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Install cross-compiler - run: sudo apt-get update && sudo apt-get install --yes gcc-arm-none-eabi u-boot-tools + run: sudo apt-get update && sudo apt-get install --yes gcc-arm-none-eabi - name: Checkout code uses: actions/checkout@v4 with: diff --git a/bricks/_common/arm_none_eabi.mk b/bricks/_common/arm_none_eabi.mk index 3361facb9..e698d5df1 100644 --- a/bricks/_common/arm_none_eabi.mk +++ b/bricks/_common/arm_none_eabi.mk @@ -160,7 +160,7 @@ ifeq ($(PB_MCU_FAMILY),AT91SAM7) CFLAGS_MCU = -mthumb -mthumb-interwork -mtune=arm7tdmi -mcpu=arm7tdmi -msoft-float else ifeq ($(PB_MCU_FAMILY),TIAM1808) -CFLAGS_MCU = -mcpu=arm926ej-s -Dgcc -Dam1808 # -c -g -fdata-sections -ffunction-sections -Wall -Dgcc -Dam1808 -O0 +CFLAGS_MCU = -mcpu=arm926ej-s -Dgcc -Dam1808 else $(error unsupported PB_MCU_FAMILY) endif @@ -196,8 +196,13 @@ else ifeq ($(DEBUG), 2) CFLAGS += -Os -DNDEBUG -flto=auto else CFLAGS += -Os -DNDEBUG -flto=auto +ifneq ($(PB_MCU_FAMILY),TIAM1808) +# This is used for trimming unused code on smaller platforms, but on EV3 we +# don't want to enable these flags in order to keep the size of the .elf file +# small by avoiding huge tables of section names. CFLAGS += -fdata-sections -ffunction-sections endif +endif ifeq ($(PB_MCU_FAMILY),STM32) # Required for STM32 library @@ -623,6 +628,10 @@ $(BUILD)/firmware.elf: $(LD_FILES) $(OBJ) $(Q)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJ) $(LIBS) $(Q)$(SIZE) -A $@ +$(BUILD)/firmware.stripped.elf: $(BUILD)/firmware.elf + $(ECHO) "STRIP $@" + $(Q)$(STRIP) $< -o $@ + # firmware blob without checksum $(BUILD)/firmware-obj.bin: $(BUILD)/firmware.elf $(ECHO) "BIN creating firmware base file" @@ -635,13 +644,13 @@ ifeq ($(PB_MCU_FAMILY),TIAM1808) $(BUILD)/u-boot.bin: $(ECHO) "Downloading u-boot.bin" $(Q)mkdir -p $(dir $@) - $(Q)curl -sL -o $@ https://github.com/pybricks/u-boot/releases/download/pybricks/v1.0.2/u-boot.bin - $(Q)echo "62fe9df8138a4676d61b72c6844f9e7c3cbfd85470b9cea1418abec4f79228ac $@" | sha256sum -c --strict + $(Q)curl -sL -o $@ https://github.com/pybricks/u-boot/releases/download/pybricks/v2.0.0/u-boot.bin + $(Q)echo "570e079870ddc1deb2ce40d7a4d6785c151883a65e273ce6e33643152df90efb $@" | sha256sum -c --strict MAKE_BOOTABLE_IMAGE = $(PBTOP)/bricks/ev3/make_bootable_image.py # For EV3, merge firmware blob with u-boot to create a bootable image. -$(BUILD)/firmware-base.bin: $(MAKE_BOOTABLE_IMAGE) $(BUILD)/u-boot.bin $(BUILD)/uImage +$(BUILD)/firmware-base.bin: $(MAKE_BOOTABLE_IMAGE) $(BUILD)/u-boot.bin $(BUILD)/firmware.stripped.elf $(Q)$^ $@ else @@ -664,12 +673,6 @@ $(BUILD)/firmware.zip: $(ZIP_FILES) $(ECHO) "ZIP creating firmware package" $(Q)$(ZIP) -j $@ $^ -# firmware in uImage format (for EV3) -$(BUILD)/uImage: $(BUILD)/firmware-obj.bin $(BUILD)/firmware.elf - $(eval LOAD_ADDR := $(shell $(CROSS_COMPILE)readelf -l $(BUILD)/firmware.elf | grep "LOAD" | awk '{print $$4}')) - $(eval ENTRY_POINT := $(shell $(CROSS_COMPILE)readelf -h $(BUILD)/firmware.elf | grep "Entry point" | cut -d: -f2)) - mkimage -C none -A arm -T standalone -O u-boot -a $(LOAD_ADDR) -e $(ENTRY_POINT) -d $< $@ - # PRU firmware $(BUILD)/pru_suart.bin.o: $(PBTOP)/lib/pbio/drv/uart/uart_ev3_pru_lib/pru_suart.bin $(Q)$(OBJCOPY) -I binary -O elf32-littlearm -B arm \ diff --git a/bricks/ev3/README.md b/bricks/ev3/README.md index a49e38786..29ec49282 100644 --- a/bricks/ev3/README.md +++ b/bricks/ev3/README.md @@ -24,12 +24,6 @@ firmware for one of the other targets, such as the SPIKE Prime Hub, as explained [here](../../CONTRIBUTING.md). Make sure that `pybricksdev` is installed. -Install the following additional tools: - -``` -sudo apt install u-boot-tools -``` - Unlike most other alternative EV3 firmware solutions, Pybricks does not require using a microSD card. Instead, Pybricks is installed as a firmware update.