Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions firmware/mgmt/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ CUBE_PROGRAMMER_USART_ARGS = -c port=${port} br=${BAUD} P=even db=8 -w ${BUILD_D

DOCKER_IMAGE = build-hactar-mgmt
mft=compile
CHECK_FILE = $(BUILD_DIR)/$(TARGET)_who.txt
WHO = local

ifeq (${PROGRAMMER}, CUBE)
ifeq (${OS}, WINDOWS_NT)
Expand Down Expand Up @@ -241,14 +243,19 @@ upload_cube_swd: compile
docker:
@if ! docker image inspect ${DOCKER_IMAGE} > /dev/null 2>&1; then \
docker build -t ${DOCKER_IMAGE} .; \
else
echo "Docker image already built - skipping"
fi

@docker run --rm -e target=${mft} --privileged \
-v ${PWD}/..:/project \
-v /dev:/dev \
-it ${DOCKER_IMAGE}
@if [ "$(shell uname -s)" = "Darwin" ]; then \
docker run --rm -e target=${mft} --privileged \
-v ${PWD}/..:/project \
-v /dev:/dev \
-it ${DOCKER_IMAGE}; \
else \
docker run --user $(shell id -u):$(shell id -g) --rm -e target=${mft} --privileged \
-v ${PWD}/..:/project \
-v /dev:/dev \
-it ${DOCKER_IMAGE}; \
fi

monitor:
python3 ../../software/hactar-cli/main.py monitor --port=${port}
Expand Down
2 changes: 1 addition & 1 deletion firmware/net/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ WORKDIR /project/net

ENV target=compile

CMD ["sh", "-c", "make -j $target"]
CMD ["sh", "-c", "make -j $target WHO=docker"]
40 changes: 32 additions & 8 deletions firmware/net/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@ PROG_ADDR = 0x10000
DOCKER_IMAGE = build-hactar-net
mft = compile

CHECK_FILE = $(BUILD_PATH)/$(TARGET)_who.txt
WHO = local

ESP_TOOL_ARGS = --trace --no-stub --port=${port} --baud=${BAUD} write_flash --no-compress \
${BOOTLOADER_ADDR} ${BUILD_PATH}/bootloader/bootloader.bin \
${PARITIONS_ADDR} ${BUILD_PATH}/partition_table/partition-table.bin \
${PROG_ADDR} ${BUILD_PATH}/${TARGET}.bin

all: compile

compile:
compile: check_who_compiled
idf.py -B $(BUILD_PATH) build -DCMAKE_POLICY_VERSION_MINIMUM=3.5

upload: compile
Expand All @@ -35,17 +38,22 @@ upload_esptool:
python3 ../../software/hactar-cli/main.py flash --port=${port} --chip="net" --use_external_flasher=true
esptool.py ${ESP_TOOL_ARGS}

docker: docker-build
docker:
@if ! docker image inspect ${DOCKER_IMAGE} > /dev/null 2>&1; then \
docker build -t ${DOCKER_IMAGE} .; \
else
echo "Docker image already built - skipping"
fi

@docker run --rm -e target=${mft} --privileged \
-v ${PWD}/..:/project \
-v /dev:/dev \
-it ${DOCKER_IMAGE}
@if [ "$(shell uname -s)" = "Darwin" ]; then \
docker run --rm -e target=${mft} --privileged \
-v ${PWD}/..:/project \
-v /dev:/dev \
-it ${DOCKER_IMAGE}; \
else \
docker run --user $(shell id -u):$(shell id -g) --rm -e target=${mft} --privileged \
-v ${PWD}/..:/project \
-v /dev:/dev \
-it ${DOCKER_IMAGE}; \
fi

burn_jtag_efuse:
python3 ../../software/hactar-cli/main.py flash --port=${port} --chip="net" --use_external_flasher=true
Expand All @@ -66,6 +74,22 @@ format:
find ../shared -iname "*.c" -or -iname "*.cc" | xargs clang-format -i
find ../shared_inc -iname "*.h" -or -iname "*.hh" | xargs clang-format -i

check_who_compiled:
@if [ -f "${CHECK_FILE}" ]; then \
who=$$(head -n 1 ${CHECK_FILE}); \
if [ "$$who" != ${WHO} ]; then \
rm -rf ${BUILD_PATH}; \
mkdir -p ${BUILD_PATH}; \
touch ${CHECK_FILE}; \
echo ${WHO} > ${CHECK_FILE}; \
fi \
else \
rm -rf ${BUILD_PATH}; \
mkdir -p ${BUILD_PATH}; \
touch ${CHECK_FILE}; \
echo ${WHO} > ${CHECK_FILE}; \
fi

clean:
rm -rf ${BUILD_PATH}

Expand Down
6 changes: 3 additions & 3 deletions firmware/ui/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ FROM ubuntu:22.04
LABEL description="Docker image for ui"

RUN apt-get update
RUN apt-get install -y build-essential git gcc-arm-none-eabi binutils-arm-none-eabi \
RUN apt-get install -y cmake build-essential git gcc-arm-none-eabi binutils-arm-none-eabi \
libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib stlink-tools python3 pip

RUN pip install pyserial
Expand All @@ -14,8 +14,8 @@ RUN addgroup --gid 1000 compile_user && \

USER compile_user

WORKDIR /src/ui
WORKDIR /project/ui

ENV target=compile

CMD ["sh", "-c", "make -j $target"]
CMD ["sh", "-c", "make -j $target WHO=docker"]
37 changes: 30 additions & 7 deletions firmware/ui/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ CUBE_PROGRAMMER_ARGS = -c port=${port} br=${BAUD} P=even db=8 -w ${BUILD_DIR}/${

DOCKER_IMAGE = build-hactar-ui
mft=compile
CHECK_FILE = $(BUILD_DIR)/$(TARGET)_who.txt
WHO = local

OCD_DIR = /usr/share/openocd/scripts
OCDFLAGS = -f interface/stlink.cfg -f target/stm32f4x.cfg
Expand All @@ -53,7 +55,7 @@ OCDFLAGS = -f interface/stlink.cfg -f target/stm32f4x.cfg
# default action: build all
all: info compile

compile: CMakeLists.txt
compile: check_who_compiled CMakeLists.txt
cmake -B $(BUILD_DIR)
cmake --build $(BUILD_DIR) -j

Expand All @@ -75,14 +77,35 @@ upload_cube_swd: compile
docker:
@if ! docker image inspect ${DOCKER_IMAGE} > /dev/null 2>&1; then \
docker build -t ${DOCKER_IMAGE} .; \
else
echo "Docker image already built - skipping"
fi

@docker run --rm -e target=${mft} --privileged \
-v ${PWD}/..:/src \
-v /dev:/dev \
-it ${DOCKER_IMAGE}
@if [ "$(shell uname -s)" = "Darwin" ]; then \
docker run --rm -e target=${mft} --privileged \
-v ${PWD}/..:/project \
-v /dev:/dev \
-it ${DOCKER_IMAGE}; \
else \
docker run --user $(shell id -u):$(shell id -g) --rm -e target=${mft} --privileged \
-v ${PWD}/..:/project \
-v /dev:/dev \
-it ${DOCKER_IMAGE}; \
fi

check_who_compiled:
@if [ -f "${CHECK_FILE}" ]; then \
who=$$(head -n 1 ${CHECK_FILE}); \
if [ "$$who" != ${WHO} ]; then \
rm -rf ${BUILD_DIR}; \
mkdir -p ${BUILD_DIR}; \
touch ${CHECK_FILE}; \
echo ${WHO} > ${CHECK_FILE}; \
fi \
else \
rm -rf ${BUILD_DIR}; \
mkdir -p ${BUILD_DIR}; \
touch ${CHECK_FILE}; \
echo ${WHO} > ${CHECK_FILE}; \
fi

dirs: ${BUILD_DIR}
${BUILD_DIR}:
Expand Down