From 94cd2ba563b236d8ba7eafdbced3e69d1bcfcfc6 Mon Sep 17 00:00:00 2001 From: Finlay Davidson Date: Tue, 10 May 2022 20:26:41 +0200 Subject: Update arm gcc toolchain to 11.2-2022.02 Updates the buildAndProgram doc and the docker image, which means GitHub Actions will also use the new toolchain. --- docker/build.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'docker/build.sh') diff --git a/docker/build.sh b/docker/build.sh index 878d9ec6..6137bbb8 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -12,18 +12,20 @@ export BUILD_DIR="${BUILD_DIR:=$SOURCES_DIR/build}" export OUTPUT_DIR="${OUTPUT_DIR:=$SOURCES_DIR/build/output}" export BUILD_TYPE=${BUILD_TYPE:=Release} -export GCC_ARM_VER=${GCC_ARM_VER:="gcc-arm-none-eabi-9-2020-q2-update"} +export GCC_ARM_VER=${GCC_ARM_VER:="11.2-2022.02"} export NRF_SDK_VER=${NRF_SDK_VER:="nRF5_SDK_15.3.0_59ac345"} MACHINE="$(uname -m)" [[ "$MACHINE" == "arm64" ]] && MACHINE="aarch64" +export GCC_ARM_PATH="gcc-arm-$GCC_ARM_VER-$MACHINE-arm-none-eabi" + main() { local target="$1" mkdir -p "$TOOLS_DIR" - [[ ! -d "$TOOLS_DIR/$GCC_ARM_VER" ]] && GetGcc + [[ ! -d "$TOOLS_DIR/$GCC_ARM_PATH" ]] && GetGcc [[ ! -d "$TOOLS_DIR/$NRF_SDK_VER" ]] && GetNrfSdk [[ ! -d "$TOOLS_DIR/mcuboot" ]] && GetMcuBoot @@ -38,8 +40,7 @@ main() { } GetGcc() { - GCC_SRC="$GCC_ARM_VER-$MACHINE-linux.tar.bz" - wget -q https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2020q2/$GCC_SRC -O - | tar -xj -C $TOOLS_DIR/ + wget -q https://developer.arm.com/-/media/Files/downloads/gnu/$GCC_ARM_VER/binrel/$GCC_ARM_PATH.tar.xz -O - | tar -xJ -C $TOOLS_DIR/ } GetMcuBoot() { @@ -59,7 +60,7 @@ CmakeGenerate() { -B "$BUILD_DIR" \ -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ -DUSE_OPENOCD=1 \ - -DARM_NONE_EABI_TOOLCHAIN_PATH="$TOOLS_DIR/$GCC_ARM_VER" \ + -DARM_NONE_EABI_TOOLCHAIN_PATH="$TOOLS_DIR/$GCC_ARM_PATH" \ -DNRF5_SDK_PATH="$TOOLS_DIR/$NRF_SDK_VER" \ -DBUILD_DFU=1 } @@ -72,4 +73,4 @@ CmakeBuild() { fi } -[[ $SOURCED == "false" ]] && main "$@" || echo "Sourced!" \ No newline at end of file +[[ $SOURCED == "false" ]] && main "$@" || echo "Sourced!" -- cgit v1.2.3-70-g09d2 From 4482078d84fb3a6963dd6912801fe62bad07257f Mon Sep 17 00:00:00 2001 From: Finlay Davidson Date: Sun, 26 Jun 2022 22:14:35 +0200 Subject: Downgrade GNU Arm Toolchain to 10.3-2021.10 This is because of this bug: https://community.arm.com/support-forums/f/compilers-and-libraries-forum/52623/gcc-11-2-arm-none-eabi-internal-compiler-error-illegal-instruction It is causing some of the GitHub Actions builds to fail. --- .vscode/launch.json | 2 +- doc/MemoryAnalysis.md | 4 ++-- doc/buildAndProgram.md | 4 ++-- doc/buildWithVScode.md | 2 +- docker/build.sh | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-) (limited to 'docker/build.sh') diff --git a/.vscode/launch.json b/.vscode/launch.json index 4b8b3cc7..a50270d2 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -52,7 +52,7 @@ "servertype": "openocd", "runToMain": true, // Only use armToolchainPath if your arm-none-eabi-gdb is not in your path (some GCC packages does not contain arm-none-eabi-gdb) - "armToolchainPath": "${workspaceRoot}/../gcc-arm-11.2-2022.02-x86_64-arm-none-eabi/bin", + "armToolchainPath": "${workspaceRoot}/../gcc-arm-none-eabi-10.3-2021.10/bin", "svdFile": "${workspaceRoot}/nrf52.svd", "configFiles": [ "interface/stlink.cfg", diff --git a/doc/MemoryAnalysis.md b/doc/MemoryAnalysis.md index 9a6e81c9..846d5079 100644 --- a/doc/MemoryAnalysis.md +++ b/doc/MemoryAnalysis.md @@ -51,9 +51,9 @@ Puncover is really easy to install: - `python -m virtualenv venv` - `source venv/bin/activate` - Install : `pip install .` - - Run : `puncover --gcc_tools_base=/path/to/gcc-arm-11.2-2022.02-x86_64-arm-none-eabi/bin/arm-none-eabi- --elf_file /path/to/build/directory/src/pinetime-app-1.1.0.out --src_root /path/to/sources --build_dir /path/to/build/directory` + - Run : `puncover --gcc_tools_base=/path/to/gcc-arm-none-eabi-10.3-2021.10/bin/arm-none-eabi- --elf_file /path/to/build/directory/src/pinetime-app-1.1.0.out --src_root /path/to/sources --build_dir /path/to/build/directory` - Replace - * `/path/to/gcc-arm-11.2-2022.02-x86_64-arm-none-eabi/bin` with the path to your gcc-arm-none-eabi toolchain + * `/path/to/gcc-arm-none-eabi-10.3-2021.10/bin` with the path to your gcc-arm-none-eabi toolchain * `/path/to/build/directory/src/pinetime-app-1.1.0.out` with the path to the binary generated by GCC (.out file) * `/path/to/sources` with the path to the root folder of the sources (checkout directory) * `/path/to/build/directory` with the path to the build directory diff --git a/doc/buildAndProgram.md b/doc/buildAndProgram.md index 42d6d390..a1961ee4 100644 --- a/doc/buildAndProgram.md +++ b/doc/buildAndProgram.md @@ -1,7 +1,7 @@ # Build ## Dependencies To build this project, you'll need: - - A cross-compiler : [ARM-GCC (arm-none-eabi 11.2-2022.02)](https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/downloads) + - A cross-compiler : [ARM-GCC (10.3-2021.10)](https://developer.arm.com/downloads/-/gnu-rm) - The NRF52 SDK 15.3.0 : [nRF-SDK v15.3.0](https://developer.nordicsemi.com/nRF5_SDK/nRF5_SDK_v15.x.x/nRF5_SDK_15.3.0_59ac345.zip) - The Python 3 modules `cbor`, `intelhex`, `click` and `cryptography` modules for the `mcuboot` tool (see [requirements.txt](../tools/mcuboot/requirements.txt)) - To keep the system clean, you can install python modules into a python virtual environment (`venv`) @@ -31,7 +31,7 @@ CMake configures the project according to variables you specify the command line Variable | Description | Example| ----------|-------------|--------| -**ARM_NONE_EABI_TOOLCHAIN_PATH**|path to the toolchain directory|`-DARM_NONE_EABI_TOOLCHAIN_PATH=/home/jf/nrf52/gcc-arm-11.2-2022.02-x86_64-arm-none-eabi/`| +**ARM_NONE_EABI_TOOLCHAIN_PATH**|path to the toolchain directory|`-DARM_NONE_EABI_TOOLCHAIN_PATH=/home/jf/nrf52/gcc-arm-none-eabi-10.3-2021.10/`| **NRF5_SDK_PATH**|path to the NRF52 SDK|`-DNRF5_SDK_PATH=/home/jf/nrf52/Pinetime/sdk`| **USE_JLINK, USE_GDB_CLIENT and USE_OPENOCD**|Enable *JLink* mode, *GDB Client* (Black Magic Probe) mode or *OpenOCD* mode (set the one you want to use to `1`)|`-DUSE_JLINK=1` **CMAKE_BUILD_TYPE (\*)**| Build type (Release or Debug). Release is applied by default if this variable is not specified.|`-DCMAKE_BUILD_TYPE=Debug` diff --git a/doc/buildWithVScode.md b/doc/buildWithVScode.md index c2dcde3c..48b8923f 100644 --- a/doc/buildWithVScode.md +++ b/doc/buildWithVScode.md @@ -8,7 +8,7 @@ To support as many setups as possible the VS Code configuration files expect the Variable | Description | Example ----------|-------------|-------- -**ARM_NONE_EABI_TOOLCHAIN_PATH**|path to the toolchain directory|`export ARM_NONE_EABI_TOOLCHAIN_PATH=/opt/gcc-arm-11.2-2022.02-x86_64-arm-none-eabi` +**ARM_NONE_EABI_TOOLCHAIN_PATH**|path to the toolchain directory|`export ARM_NONE_EABI_TOOLCHAIN_PATH=/opt/gcc-arm-none-eabi-10.3-2021.10` **NRF5_SDK_PATH**|path to the NRF52 SDK|`export NRF5_SDK_PATH=/opt/nRF5_SDK_15.3.0_59ac345` ## VS Code Extensions diff --git a/docker/build.sh b/docker/build.sh index 6137bbb8..663390c4 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -12,13 +12,13 @@ export BUILD_DIR="${BUILD_DIR:=$SOURCES_DIR/build}" export OUTPUT_DIR="${OUTPUT_DIR:=$SOURCES_DIR/build/output}" export BUILD_TYPE=${BUILD_TYPE:=Release} -export GCC_ARM_VER=${GCC_ARM_VER:="11.2-2022.02"} +export GCC_ARM_VER=${GCC_ARM_VER:="10.3-2021.10"} export NRF_SDK_VER=${NRF_SDK_VER:="nRF5_SDK_15.3.0_59ac345"} MACHINE="$(uname -m)" [[ "$MACHINE" == "arm64" ]] && MACHINE="aarch64" -export GCC_ARM_PATH="gcc-arm-$GCC_ARM_VER-$MACHINE-arm-none-eabi" +export GCC_ARM_PATH="gcc-arm-none-eabi-$GCC_ARM_VER" main() { local target="$1" @@ -40,7 +40,7 @@ main() { } GetGcc() { - wget -q https://developer.arm.com/-/media/Files/downloads/gnu/$GCC_ARM_VER/binrel/$GCC_ARM_PATH.tar.xz -O - | tar -xJ -C $TOOLS_DIR/ + wget -q https://developer.arm.com/-/media/Files/downloads/gnu-rm/$GCC_ARM_VER/$GCC_ARM_PATH-$MACHINE-linux.tar.bz2 -O - | tar -xj -C $TOOLS_DIR/ } GetMcuBoot() { -- cgit v1.2.3-70-g09d2 From e2a3d9f0c7a531d129501325e793fdd634babba8 Mon Sep 17 00:00:00 2001 From: Jean-François Milants Date: Sun, 11 Sep 2022 12:43:30 +0200 Subject: Small improvement in generate-fonts.py following code review. Add lv_img_conf in Docker image to build resources at build time. --- CMakeLists.txt | 9 +++++++++ docker/Dockerfile | 10 ++++++++++ docker/build.sh | 7 ++++++- docker/post_build.sh.in | 2 ++ src/CMakeLists.txt | 12 +++++++++++- src/resources/generate-fonts.py | 2 +- 6 files changed, 39 insertions(+), 3 deletions(-) (limited to 'docker/build.sh') diff --git a/CMakeLists.txt b/CMakeLists.txt index be8ef41f..1da460c4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,6 +54,10 @@ if(BUILD_DFU) set(BUILD_DFU true) endif() +if(BUILD_RESOURCES) + set(BUILD_RESOURCES true) +endif() + set(TARGET_DEVICE "PINETIME" CACHE STRING "Target device") set_property(CACHE TARGET_DEVICE PROPERTY STRINGS PINETIME MOY-TFK5 MOY-TIN5 MOY-TON5 MOY-UNK) @@ -98,6 +102,11 @@ if(BUILD_DFU) else() message(" * Build DFU (using adafruit-nrfutil) : Disabled") endif() +if(BUILD_RESOURCES) + message(" * Build resources : Enabled") +else() + message(" * Build resources : Disabled") +endif() set(VERSION_EDIT_WARNING "// Do not edit this file, it is automatically generated by CMAKE!") configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/Version.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/Version.h) diff --git a/docker/Dockerfile b/docker/Dockerfile index f2d187d0..927160db 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -22,6 +22,12 @@ RUN apt-get update -qq \ python3-dev \ git \ apt-utils \ + pkg-config \ + libpixman-1-dev \ + libcairo2-dev \ + libpango-1.0-0 \ + ibpango1.0-dev \ + libpangocairo-1.0-0 \ && curl -sL https://deb.nodesource.com/setup_18.x | bash - \ && apt-get install -y nodejs \ && rm -rf /var/cache/apt/* /var/lib/apt/lists/*; @@ -33,6 +39,10 @@ RUN pip3 install -Iv cryptography==3.3 RUN pip3 install cbor RUN npm i lv_font_conv@1.5.2 -g +RUN npm i ts-node@10.9.1 -g +RUN npm i @swc/core -g +RUN npm i lv_img_conv@0.3.0 -g + # build.sh knows how to compile COPY build.sh /opt/ diff --git a/docker/build.sh b/docker/build.sh index 663390c4..58dcccc1 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -11,6 +11,10 @@ export SOURCES_DIR="${SOURCES_DIR:=/sources}" export BUILD_DIR="${BUILD_DIR:=$SOURCES_DIR/build}" export OUTPUT_DIR="${OUTPUT_DIR:=$SOURCES_DIR/build/output}" +# Specify a folder with read/write access to NPM +export NPM_DIR="$BUILD_DIR/npm" +export npm_config_cache="${NPM_DIR}" + export BUILD_TYPE=${BUILD_TYPE:=Release} export GCC_ARM_VER=${GCC_ARM_VER:="10.3-2021.10"} export NRF_SDK_VER=${NRF_SDK_VER:="nRF5_SDK_15.3.0_59ac345"} @@ -62,7 +66,8 @@ CmakeGenerate() { -DUSE_OPENOCD=1 \ -DARM_NONE_EABI_TOOLCHAIN_PATH="$TOOLS_DIR/$GCC_ARM_PATH" \ -DNRF5_SDK_PATH="$TOOLS_DIR/$NRF_SDK_VER" \ - -DBUILD_DFU=1 + -DBUILD_DFU=1 \ + -DBUILD_RESOURCES=1 } CmakeBuild() { diff --git a/docker/post_build.sh.in b/docker/post_build.sh.in index 8c94471a..5d82f3be 100755 --- a/docker/post_build.sh.in +++ b/docker/post_build.sh.in @@ -15,6 +15,8 @@ cp "$BUILD_DIR/src/pinetime-mcuboot-app-dfu-$PROJECT_VERSION.zip" "$OUTPUT_DIR/p cp "$BUILD_DIR/src/pinetime-mcuboot-recovery-loader-image-$PROJECT_VERSION.bin" "$OUTPUT_DIR/pinetime-mcuboot-recovery-loader-image-$PROJECT_VERSION.bin" cp "$BUILD_DIR/src/pinetime-mcuboot-recovery-loader-dfu-$PROJECT_VERSION.zip" "$OUTPUT_DIR/pinetime-mcuboot-recovery-loader-dfu-$PROJECT_VERSION.zip" +cp "$BUILD_DIR/src/resources/infinitime-resources-$PROJECT_VERSION.zip" "$OUTPUT_DIR/infinitime-resources-$PROJECT_VERSION.zip" + mkdir -p "$OUTPUT_DIR/src" cp $BUILD_DIR/src/*.bin "$OUTPUT_DIR/src/" cp $BUILD_DIR/src/*.hex "$OUTPUT_DIR/src/" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f81e7026..92f309a1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -940,6 +940,10 @@ add_custom_command(TARGET ${EXECUTABLE_NAME} COMMAND ${CMAKE_OBJCOPY} -O ihex ${EXECUTABLE_FILE_NAME}.out "${EXECUTABLE_FILE_NAME}.hex" COMMENT "post build steps for ${EXECUTABLE_FILE_NAME}") +if(BUILD_RESOURCES) + add_dependencies(${EXECUTABLE_NAME} GenerateResources) +endif() + # Build binary intended to be used by bootloader set(EXECUTABLE_MCUBOOT_NAME "pinetime-mcuboot-app") set(EXECUTABLE_MCUBOOT_FILE_NAME ${EXECUTABLE_MCUBOOT_NAME}-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH}) @@ -973,6 +977,10 @@ add_custom_command(TARGET ${EXECUTABLE_MCUBOOT_NAME} COMMENT "post build steps for ${EXECUTABLE_MCUBOOT_FILE_NAME}" ) +if(BUILD_RESOURCES) + add_dependencies(${EXECUTABLE_MCUBOOT_NAME} GenerateResources) +endif() + if(BUILD_DFU) add_custom_command(TARGET ${EXECUTABLE_MCUBOOT_NAME} POST_BUILD @@ -1127,7 +1135,9 @@ if(BUILD_DFU) ) endif() -add_subdirectory(resources) +if(BUILD_RESOURCES) + add_subdirectory(resources) +endif() # FLASH diff --git a/src/resources/generate-fonts.py b/src/resources/generate-fonts.py index d6b47ab2..20408166 100755 --- a/src/resources/generate-fonts.py +++ b/src/resources/generate-fonts.py @@ -20,7 +20,7 @@ class Source(object): def gen_lvconv_line(lv_font_conv: str, dest: str, size: int, bpp: int, format: str, sources: typing.List[Source], compress:bool=False): if format != "lvgl" and format != "bin": - format = "lvgl" + format = "bin" if dest.lower().endswith(".bin") else "lvgl" args = [lv_font_conv, '--size', str(size), '--output', dest, '--bpp', str(bpp), '--format', format] if not compress: -- cgit v1.2.3-70-g09d2