Skip to content

Commit

Permalink
Merge pull request #1058 from Ralim/ralim/dfuse-header
Browse files Browse the repository at this point in the history
Generate .dfu files
  • Loading branch information
Ralim authored Sep 25, 2021
2 parents 0ea9ae1 + 5ff4a75 commit 714ef4b
Show file tree
Hide file tree
Showing 5 changed files with 363 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
name: ${{ matrix.model }}
path: |
source/Hexfile/${{ matrix.model }}_*.hex
source/Hexfile/${{ matrix.model }}_*.bin
source/Hexfile/${{ matrix.model }}_*.dfu
source/Hexfile/LICENSE
source/Hexfile/LICENSE_RELEASE.md
if-no-files-found: error
Expand Down Expand Up @@ -88,7 +88,7 @@ jobs:
name: ${{ matrix.model }}_multi-lang
path: |
source/Hexfile/${{ matrix.model }}_*.hex
source/Hexfile/${{ matrix.model }}_*.bin
source/Hexfile/${{ matrix.model }}_*.dfu
source/Hexfile/LICENSE
source/Hexfile/LICENSE_RELEASE.md
if-no-files-found: error
Expand Down
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ LABEL maintainer="Ben V. Brown <ralim@ralimtek.com>"
WORKDIR /build
# Add extra mirrors for options
RUN echo "deb mirror://mirrors.ubuntu.com/mirrors.txt focal main restricted universe multiverse" > /etc/apt/sources.list && \
echo "deb mirror://mirrors.ubuntu.com/mirrors.txt focal-updates main restricted universe multiverse" >> /etc/apt/sources.list && \
echo "deb mirror://mirrors.ubuntu.com/mirrors.txt focal-security main restricted universe multiverse" >> /etc/apt/sources.list && \
DEBIAN_FRONTEND=noninteractive apt-get update
echo "deb mirror://mirrors.ubuntu.com/mirrors.txt focal-updates main restricted universe multiverse" >> /etc/apt/sources.list && \
echo "deb mirror://mirrors.ubuntu.com/mirrors.txt focal-security main restricted universe multiverse" >> /etc/apt/sources.list && \
DEBIAN_FRONTEND=noninteractive apt-get update
# Install dependencies to build the firmware
RUN apt-get install -y \
make \
Expand All @@ -15,6 +15,7 @@ RUN apt-get install -y \
python3 \
python3-pip \
clang-format \
dfu-util \
wget --no-install-recommends && \
apt-get clean
RUN python3 -m pip install bdflib
Expand Down
2 changes: 1 addition & 1 deletion setup.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
set -e
# Setup shell file to setup the environment on an ubuntu machine
sudo apt-get update && sudo apt-get install -y make bzip2 git python3 python3-pip wget
sudo apt-get update && sudo apt-get install -y make bzip2 git python3 python3-pip wget dfu-util
python3 -m pip install bdflib black flake8
sudo mkdir -p /build
cd /build
Expand Down
8 changes: 7 additions & 1 deletion source/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ HOST_CC := gcc
endif
HOST_OUTPUT_DIR=Objects/host

DEVICE_DFU_ADDRESS=0x08000000

# Enumerate all of the include directories
APP_INC_DIR = ./Core/Inc
Expand Down Expand Up @@ -100,6 +101,7 @@ CPUFLAGS= -mcpu=cortex-m3 \
-mfloat-abi=soft
flash_size=64k
bootldr_size=0x4000
DEVICE_DFU_ADDRESS=0x08004000
endif

ifeq ($(model),$(filter $(model),$(ALL_MHP30_MODELS)))
Expand Down Expand Up @@ -128,6 +130,7 @@ CPUFLAGS= -mcpu=cortex-m3 \
-mfloat-abi=soft
flash_size=128k
bootldr_size=32k
DEVICE_DFU_ADDRESS=0x08008000
endif
ifeq ($(model),$(ALL_PINE_MODELS))
$(info Building for Pine64 )
Expand Down Expand Up @@ -336,7 +339,7 @@ OUT_OBJS_S=$(addprefix $(OUTPUT_DIR)/,$(OBJS_S))

default : firmware-EN

firmware-%: $(HEXFILE_DIR)/$(model)_%.hex $(HEXFILE_DIR)/$(model)_%.bin
firmware-%: $(HEXFILE_DIR)/$(model)_%.hex $(HEXFILE_DIR)/$(model)_%.bin $(HEXFILE_DIR)/$(model)_%.dfu
@true

ALL_FIRMWARE_TARGETS=$(addprefix firmware-,$(ALL_LANGUAGES))
Expand All @@ -354,6 +357,9 @@ all: $(ALL_FIRMWARE_TARGETS)
$(SIZE) --format=berkeley $<
$(OBJCOPY) $< -O binary $@

%.dfu : %.bin Makefile
python3 dfuse-pack.py -b $(DEVICE_DFU_ADDRESS)@0:$< -D 0x28E9:0x0189 $@

$(HEXFILE_DIR)/$(model)_%.elf : \
$(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \
$(OUTPUT_DIR)/Core/Gen/Translation.%.o \
Expand Down
Loading

0 comments on commit 714ef4b

Please sign in to comment.