Skip to content

Commit 14b9152

Browse files
committed
Make bootloader splash screen selectable between light and dark colorways
1 parent dee5023 commit 14b9152

File tree

12 files changed

+8714
-631
lines changed

12 files changed

+8714
-631
lines changed

.github/workflows/build.yaml

+5-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ jobs:
1515
build:
1616
[
1717
{ screen: 'mono', suffix: '-founders-passport', hash_suffix: '-founders'},
18-
{ screen: 'color', suffix: '-passport', hash_suffix: ''},
18+
{ screen: 'color', colorway: 'light', suffix: '-passport-light', hash_suffix: '-light'},
19+
{ screen: 'color', colorway: 'dark', suffix: '-passport-dark', hash_suffix: '-dark'},
1920
]
2021

2122
services:
@@ -131,15 +132,16 @@ jobs:
131132
- run: |
132133
echo "DOCKER_IMAGE=localhost:5000/foundation-devices/passport2:latest" >> $GITHUB_ENV
133134
echo "SCREEN_MODE=$(echo ${{ matrix.screen }} | tr a-z A-Z)" >> $GITHUB_ENV
135+
echo "COLORWAY"=$(echo ${{ matrix.colorway }} | tr a-z A-Z)" >> $GITHUB_ENV
134136
135137
- name: Build
136138
run: just build-bootloader ${{ matrix.screen }}
137139

138140
- name: Upload bootloader
139141
uses: actions/upload-artifact@v4
140142
with:
141-
name: bootloader-${{ env.SCREEN_MODE }}.bin
142-
path: ports/stm32/boards/Passport/bootloader/arm/release/bootloader-${{ env.SCREEN_MODE }}.bin
143+
name: bootloader-${{ env.SCREEN_MODE }}-${{ env.COLORWAY }}.bin
144+
path: ports/stm32/boards/Passport/bootloader/arm/release/bootloader-${{ env.SCREEN_MODE }}-${{ env.COLORWAY }}.bin
143145

144146
simulator:
145147
name: Simulator

ports/stm32/boards/Passport/bootloader/Justfile

+15-18
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,23 @@ openocd_cfg := join(contribdir, "openocd.cfg")
1111

1212
# Build the bootloader (debug, release, locked or production)
1313
# NOTE: Pass "factory_test" for factory_test to enable it.
14-
build screen="mono" rel="release" factory_test="": clean
14+
build screen="mono" colorway="light" rel="release" factory_test="": clean
1515
#!/usr/bin/env bash
1616
set -e
1717
echo -e "\nBuilding Bootloader..."
1818

19-
echo {{ if screen == "mono" { "Building with SCREEN_MODE=MONO" } else if screen == "color" { "Building with SCREEN_MODE=COLOR" } else { error("Unsupported screen type. Use 'mono' or 'color'") } }}
20-
21-
make {{rel}} SCREEN_MODE={{uppercase(screen)}} FACTORY_TEST={{factory_test}}
19+
echo {{ if screen == "mono" { "Building for MONO screen" } else if screen == "color" { "Building for COLOR screen" } else { error("Invalid screen type '" + screen + "'. Must be 'mono' or 'color'") } }}
20+
if [[ "{{screen}}" == "color" ]]; then
21+
echo {{ if colorway == "light" { "Building LIGHT colorway" } else if colorway == "dark" { "Building DARK colorway" } else { error("Invalid colorway type '" + colorway + "'. Must be 'light' or 'dark'") } }}
22+
fi
23+
make {{rel}} SCREEN_MODE={{uppercase(screen)}} COLORWAY={{uppercase(colorway)}} FACTORY_TEST={{factory_test}}
2224

2325
if [[ "{{rel}}" == "debug" ]]; then
2426
FOLDER=debug
2527
else
2628
FOLDER=release
2729
fi
2830

29-
# if test -f "secrets"; then
30-
# echo -e "\nAppending secrets to the end..."
31-
# add-secrets -b arm/${FOLDER}/bootloader-{{uppercase(screen)}}.bin -s secrets
32-
# fi
33-
3431
echo -e "\nBootloader Build Complete"
3532

3633
# Clean the bootloader build
@@ -41,7 +38,7 @@ clean:
4138

4239
# Build and flash the bootloader, appending the existing secrets, if any.
4340
# If no secrets are present in the device, then just flash the raw bootloader.
44-
flash screen="mono" rel="release" factory_test="": (build screen rel factory_test) && (reset)
41+
flash screen="mono" colorway="light" rel="release" factory_test="": (build screen rel factory_test) && (reset)
4542
#!/usr/bin/env bash
4643
set -euo pipefail
4744

@@ -54,13 +51,13 @@ flash screen="mono" rel="release" factory_test="": (build screen rel factory_tes
5451
if cmp -s ${DEVICE_SECRETS_BIN} ${EMPTY_SECRETS_BIN};
5552
then
5653
echo "Board doesn't have secrets, flashing raw firmware"
57-
just run-ocd-command "flash write_image erase arm/{{rel}}/bootloader-{{uppercase(screen)}}.bin 0x8000000"
54+
just run-ocd-command "flash write_image erase arm/{{rel}}/bootloader-{{uppercase(screen)}}-{{uppercase(colorway)}}.bin 0x8000000"
5855
else
5956
echo "Appending existing secrets to the bootloader"
60-
add-secrets -b "arm/{{rel}}/bootloader-{{uppercase(screen)}}.bin" -s ${DEVICE_SECRETS_BIN}
57+
add-secrets -b "arm/{{rel}}/bootloader-{{uppercase(screen)}}-{{uppercase(colorway)}}.bin" -s ${DEVICE_SECRETS_BIN}
6158

6259
echo "Flashing bootloader with secrets"
63-
just run-ocd-command "flash write_image erase arm/{{rel}}/bootloader-{{uppercase(screen)}}-secrets.bin 0x8000000"
60+
just run-ocd-command "flash write_image erase arm/{{rel}}/bootloader-{{uppercase(screen)}}-{{uppercase(colorway)}}-secrets.bin 0x8000000"
6461
fi
6562

6663
# Remove the tmp files
@@ -69,13 +66,13 @@ flash screen="mono" rel="release" factory_test="": (build screen rel factory_tes
6966

7067

7168
# Build and flash the bootloader with no secrets (use to setup a new Secure Element)
72-
flash-only screen="mono" rel="release": && (reset)
73-
just run-ocd-command "flash write_image erase arm/{{rel}}/bootloader-{{uppercase(screen)}}.bin 0x8000000"
69+
flash-only screen="mono" colorway="light" rel="release": && (reset)
70+
just run-ocd-command "flash write_image erase arm/{{rel}}/bootloader-{{uppercase(screen)}}-{{uppercase(colorway)}}.bin 0x8000000"
7471

7572
# Build and flash the bootloader with saved secrets (use to restore the bootloader of a bricked device)
76-
flash-with-secrets screen="mono" rel="release": && (reset)
77-
add-secrets -b "arm/{{rel}}/bootloader-{{uppercase(screen)}}.bin" -s secrets
78-
just run-ocd-command "flash write_image erase arm/{{rel}}/bootloader-{{uppercase(screen)}}-secrets.bin 0x8000000"
73+
flash-with-secrets screen="mono" colorway="light" rel="release": && (reset)
74+
add-secrets -b "arm/{{rel}}/bootloader-{{uppercase(screen)}}-{{uppercase(colorway)}}.bin" -s secrets
75+
just run-ocd-command "flash write_image erase arm/{{rel}}/bootloader-{{uppercase(screen)}}-{{uppercase(colorway)}}-secrets.bin 0x8000000"
7976

8077
# Reset the Passport
8178
reset: (run-ocd-command "reset")

ports/stm32/boards/Passport/bootloader/Makefile

+12-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
include constants.mk
1616

17-
BOOTLOADER_VERSION = 2.1
17+
BOOTLOADER_VERSION = 2.2
1818

1919
# Toolchain
2020
TOOLCHAIN = arm-none-eabi-
@@ -43,7 +43,7 @@ VPATH += $(PASSPORT_PATH)/common/micro-ecc
4343
VPATH += $(CURDIR)/images/$(shell echo $(SCREEN_MODE) | tr A-Z a-z)
4444

4545
# Basename of all targets
46-
TARGET_NAME = bootloader-$(SCREEN_MODE)
46+
TARGET_NAME = bootloader-$(SCREEN_MODE)-$(COLORWAY)
4747
TARGETDIR = arm
4848

4949
# Source files. Important: Add them also to link-script.ld to control placement.
@@ -63,7 +63,11 @@ SOURCES += printf.c
6363
SOURCES += passport_fonts.c
6464

6565
# Graphics
66-
SOURCES += SPLASH.c
66+
ifeq ($(COLORWAY),LIGHT)
67+
SOURCES += SPLASH_LIGHT.c
68+
else
69+
SOURCES += SPLASH_DARK.c
70+
endif
6771
SOURCES += BACKGROUND.c
6872
SOURCES += ICON_ABOUT.c
6973
SOURCES += ICON_BACK.c
@@ -155,6 +159,11 @@ CFLAGS += -mtune=cortex-m7 -mcpu=cortex-m7 -DSTM32H753xx
155159
CFLAGS += -I. -I$(PASSPORT_PATH)/include -I$(PASSPORT_PATH)/common/micro-ecc -I$(CURDIR)/images
156160
CFLAGS += -DPASSPORT_BOOTLOADER
157161
CFLAGS += -DSCREEN_MODE_$(SCREEN_MODE)=1
162+
ifeq ($(COLORWAY),LIGHT)
163+
CFLAGS += -DCOLORWAY_LIGHT=1
164+
else
165+
CFLAGS += -DCOLORWAY_DARK=1
166+
endif
158167
CFLAGS += -DLV_LVGL_H_INCLUDE_SIMPLE
159168
ifeq ($(findstring production,$(MAKECMDGOALS)),production)
160169
CFLAGS += -DPRODUCTION_BUILD

0 commit comments

Comments
 (0)