FreeTRX/docker/build.sh
Marcus Kida 0d8a293199 Dockerize build fixes: GCC 14 toolchain, clean build, flash helper
Bring the headless Docker build closer to the official OpenGD77 build and
add a flashing helper.

docker/Dockerfile
  - Replace Ubuntu's stock gcc-arm-none-eabi (GCC 10.3.1) with the Arm GNU
    Toolchain 14.2.rel1 (GCC 14). The official firmware is built with GCC 14
    (gnu-tools-for-stm32 14.3); GCC 10 produced a firmware that hard-faults on
    the DMR path. Guard the image build to fail if the compiler is not GCC 14.
  - git config --system safe.directory '*' so the build stamps a real GitID
    instead of #UNKNOWN.

docker/build.sh
  - rm -rf build before compiling. obj/ lives on the host mount and was being
    reused across toolchain changes, silently relinking stale .o files (an
    earlier rebuild produced a byte-identical GCC-10 image because of this).

docker/firmware.mk
  - Add -DNDEBUG to exactly mirror the STM32CubeIDE "MDUV380_FW" release config
    (which defines both NDEBUG and DEBUG).

flash.sh
  - Helper to flash via opengd77_stm32_firmware_loader.py with model, secondary
    language (auto-builds the .gla files) and the DMR codec donor.

.gitignore
  - Ignore generated *.gla files and the host-side languages_builder binary.

Note: the GCC 14 rebuild did NOT resolve the DMR-receive hang; that fault is in
the firmware source revision (this tree is a snapshot; the known-good build is
commit ebd7100, not present here) and is out of scope of these build changes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-06 10:29:48 +02:00

24 lines
803 B
Bash
Executable file

#!/usr/bin/env bash
#
# In-container build script. Runs inside the toolchain image with the repo
# mounted at /work. Produces MDUV380_firmware/build/OpenMDUV380.bin
# (the flashable OpenGD77 image for the MD-UV380 / Retevis RT-3S).
set -euo pipefail
cd /work/MDUV380_firmware
echo "==> Preparing codec section (codec_cleaner -C)"
chmod +x tools/codec_cleaner.Linux
( cd application/source/linkerdata && ../../../tools/codec_cleaner.Linux -C )
echo "==> Building firmware"
# Clean build: obj/ lives on the host mount and would otherwise be reused across
# toolchain changes, silently relinking stale .o files (e.g. an old GCC build).
rm -rf build
mkdir -p build
cd build
make -f /work/docker/firmware.mk -j"$(nproc)"
echo
echo "==> Build complete:"
ls -l /work/MDUV380_firmware/build/OpenMDUV380.bin