mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-11-24 03:07:21 +03:00
[FL-1989] CI: bootloader & firmware JSON manifests (#786)
* [FL-1989] CI: bootloader & firmware JSON manifests * CI: reorder steps Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
parent
122e0a89ab
commit
f8542af653
43
.github/workflows/build.yml
vendored
43
.github/workflows/build.yml
vendored
@ -103,6 +103,32 @@ jobs:
|
||||
-o firmware/.obj/${TARGET}/full.hex -Intel
|
||||
done
|
||||
|
||||
- name: 'Generate full dfu file'
|
||||
if: ${{ !github.event.pull_request.head.repo.fork }}
|
||||
uses: ./.github/actions/docker
|
||||
with:
|
||||
run: |
|
||||
for TARGET in ${TARGETS}
|
||||
do
|
||||
hex2dfu \
|
||||
-i firmware/.obj/${TARGET}/full.hex \
|
||||
-o artifacts/flipper-z-${TARGET}-full-${{steps.names.outputs.suffix}}.dfu \
|
||||
-l "Flipper Zero $(echo $TARGET | tr a-z A-Z)"
|
||||
done
|
||||
|
||||
- name: 'Generate full json file'
|
||||
if: ${{ !github.event.pull_request.head.repo.fork }}
|
||||
uses: ./.github/actions/docker
|
||||
with:
|
||||
run: |
|
||||
for TARGET in ${TARGETS}
|
||||
do
|
||||
jq -s '.[0] * .[1]' \
|
||||
bootloader/.obj/${TARGET}/bootloader.json \
|
||||
firmware/.obj/${TARGET}/firmware.json \
|
||||
> artifacts/flipper-z-${TARGET}-full-${{steps.names.outputs.suffix}}.json
|
||||
done
|
||||
|
||||
- name: 'Move upload files'
|
||||
if: ${{ !github.event.pull_request.head.repo.fork }}
|
||||
uses: ./.github/actions/docker
|
||||
@ -116,25 +142,16 @@ jobs:
|
||||
artifacts/flipper-z-${TARGET}-bootloader-${{steps.names.outputs.suffix}}.bin
|
||||
mv bootloader/.obj/${TARGET}/bootloader.elf \
|
||||
artifacts/flipper-z-${TARGET}-bootloader-${{steps.names.outputs.suffix}}.elf
|
||||
mv bootloader/.obj/${TARGET}/bootloader.json \
|
||||
artifacts/flipper-z-${TARGET}-bootloader-${{steps.names.outputs.suffix}}.json
|
||||
mv firmware/.obj/${TARGET}/firmware.dfu \
|
||||
artifacts/flipper-z-${TARGET}-firmware-${{steps.names.outputs.suffix}}.dfu
|
||||
mv firmware/.obj/${TARGET}/firmware.bin \
|
||||
artifacts/flipper-z-${TARGET}-firmware-${{steps.names.outputs.suffix}}.bin
|
||||
mv firmware/.obj/${TARGET}/firmware.elf \
|
||||
artifacts/flipper-z-${TARGET}-firmware-${{steps.names.outputs.suffix}}.elf
|
||||
done
|
||||
|
||||
- name: 'Generate full dfu file'
|
||||
if: ${{ !github.event.pull_request.head.repo.fork }}
|
||||
uses: ./.github/actions/docker
|
||||
with:
|
||||
run: |
|
||||
for TARGET in ${TARGETS}
|
||||
do
|
||||
hex2dfu \
|
||||
-i firmware/.obj/${TARGET}/full.hex \
|
||||
-o artifacts/flipper-z-${TARGET}-full-${{steps.names.outputs.suffix}}.dfu \
|
||||
-l "Flipper Zero $(echo $TARGET | tr a-z A-Z)"
|
||||
mv firmware/.obj/${TARGET}/firmware.json \
|
||||
artifacts/flipper-z-${TARGET}-firmware-${{steps.names.outputs.suffix}}.json
|
||||
done
|
||||
|
||||
- name: 'Full flash asssembly: bootloader as base'
|
||||
|
@ -15,6 +15,7 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install --no-instal
|
||||
libxml2-dev \
|
||||
libxslt1-dev \
|
||||
zlib1g-dev \
|
||||
jq \
|
||||
wget && \
|
||||
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
||||
|
@ -32,7 +32,7 @@ CHECK_AND_REINIT_SUBMODULES_SHELL=\
|
||||
fi
|
||||
$(info $(shell $(CHECK_AND_REINIT_SUBMODULES_SHELL)))
|
||||
|
||||
all: $(OBJ_DIR)/$(PROJECT).elf $(OBJ_DIR)/$(PROJECT).hex $(OBJ_DIR)/$(PROJECT).bin $(OBJ_DIR)/$(PROJECT).dfu
|
||||
all: $(OBJ_DIR)/$(PROJECT).elf $(OBJ_DIR)/$(PROJECT).hex $(OBJ_DIR)/$(PROJECT).bin $(OBJ_DIR)/$(PROJECT).dfu $(OBJ_DIR)/$(PROJECT).json
|
||||
|
||||
$(OBJ_DIR)/$(PROJECT).elf: $(OBJECTS)
|
||||
@echo "\tLD\t" $@
|
||||
@ -54,6 +54,10 @@ $(OBJ_DIR)/$(PROJECT).dfu: $(OBJ_DIR)/$(PROJECT).hex
|
||||
-o $(OBJ_DIR)/$(PROJECT).dfu \
|
||||
-l "Flipper Zero $(shell echo $(TARGET) | tr a-z A-Z)" > /dev/null
|
||||
|
||||
$(OBJ_DIR)/$(PROJECT).json: $(OBJ_DIR)/$(PROJECT).dfu
|
||||
@echo "\tJSON\t" $@
|
||||
@python3 ../scripts/meta.py -p $(PROJECT) $(CFLAGS) > $(OBJ_DIR)/$(PROJECT).json
|
||||
|
||||
$(OBJ_DIR)/%.o: %.c $(OBJ_DIR)/BUILD_FLAGS
|
||||
@echo "\tCC\t" $< "->" $@
|
||||
@$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
32
scripts/meta.py
Normal file
32
scripts/meta.py
Normal file
@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
import json
|
||||
|
||||
|
||||
class Main:
|
||||
def __init__(self):
|
||||
# parse CFLAGS
|
||||
self.parser = argparse.ArgumentParser(allow_abbrev=False)
|
||||
self.parser.add_argument("-p", dest="project", required=True)
|
||||
self.parser.add_argument("-DBUILD_DATE", dest="build_date", required=True)
|
||||
self.parser.add_argument("-DGIT_COMMIT", dest="commit", required=True)
|
||||
self.parser.add_argument("-DGIT_BRANCH", dest="branch", required=True)
|
||||
self.parser.add_argument("-DTARGET", dest="target", type=int, required=True)
|
||||
|
||||
def __call__(self):
|
||||
self.args, _ = self.parser.parse_known_args()
|
||||
|
||||
meta = {}
|
||||
for k, v in vars(self.args).items():
|
||||
if k == "project":
|
||||
continue
|
||||
if isinstance(v, str):
|
||||
v = v.strip('"')
|
||||
meta[self.args.project + "_" + k] = v
|
||||
|
||||
print(json.dumps(meta, indent=4))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
Main()()
|
Loading…
Reference in New Issue
Block a user