Skip to content

Commit f002bce

Browse files
committed
Enabled LTO and various whitespace fixes
1 parent bccd77d commit f002bce

File tree

19 files changed

+135
-116
lines changed

19 files changed

+135
-116
lines changed

.devcontainer/Dockerfile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ RUN apt-get update -qq \
1313
python3-pip \
1414
tar \
1515
unzip \
16-
wget \
16+
wget \
1717
curl \
1818
dos2unix \
1919
clang-format-12 \
@@ -23,15 +23,15 @@ RUN apt-get update -qq \
2323
# aarch64 packages
2424
libffi-dev \
2525
libssl-dev \
26-
python3-dev \
26+
python3-dev \
2727
rustc \
2828
&& rm -rf /var/cache/apt/* /var/lib/apt/lists/*;
29-
30-
#SET LOCALE
29+
30+
#SET LOCALE
3131
RUN locale-gen en_US.UTF-8
3232
ENV LANG en_US.UTF-8
3333
ENV LANGUAGE en_US:en
34-
ENV LC_ALL en_US.UTF-8
34+
ENV LC_ALL en_US.UTF-8
3535

3636
RUN pip3 install adafruit-nrfutil
3737
# required for McuBoot
@@ -47,7 +47,7 @@ RUN chmod +x create_build_openocd.sh
4747
# Lets get each in a separate docker layer for better downloads
4848
# GCC
4949
# RUN bash -c "source /opt/build.sh; GetGcc;"
50-
RUN wget https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2020q2/gcc-arm-none-eabi-9-2020-q2-update-x86_64-linux.tar.bz2 -O - | tar -xj -C /opt
50+
RUN wget https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2020q2/gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2 -O - | tar -xj -C /opt
5151
# NrfSdk
5252
# RUN bash -c "source /opt/build.sh; GetNrfSdk;"
5353
RUN wget -q "https://developer.nordicsemi.com/nRF5_SDK/nRF5_SDK_v15.x.x/nRF5_SDK_15.3.0_59ac345.zip" -O /tmp/nRF5_SDK_15.3.0_59ac345
@@ -61,5 +61,5 @@ RUN pip3 install -r ./mcuboot/scripts/requirements.txt
6161
RUN adduser infinitime
6262

6363
ENV NRF5_SDK_PATH /opt/nRF5_SDK_15.3.0_59ac345
64-
ENV ARM_NONE_EABI_TOOLCHAIN_PATH /opt/gcc-arm-none-eabi-9-2020-q2-update
64+
ENV ARM_NONE_EABI_TOOLCHAIN_PATH /opt/gcc-arm-none-eabi-10.3-2021.10
6565
ENV SOURCES_DIR /workspaces/InfiniTime

.devcontainer/build.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export BUILD_DIR="${BUILD_DIR:=$SOURCES_DIR/build}"
1212
export OUTPUT_DIR="${OUTPUT_DIR:=$BUILD_DIR/output}"
1313

1414
export BUILD_TYPE=${BUILD_TYPE:=Release}
15-
export GCC_ARM_VER=${GCC_ARM_VER:="gcc-arm-none-eabi-9-2020-q2-update"}
15+
export GCC_ARM_VER=${GCC_ARM_VER:="gcc-arm-none-eabi-10.3-2021.10"}
1616
export NRF_SDK_VER=${NRF_SDK_VER:="nRF5_SDK_15.3.0_59ac345"}
1717

1818
MACHINE="$(uname -m)"
@@ -22,7 +22,7 @@ main() {
2222
local target="$1"
2323

2424
mkdir -p "$TOOLS_DIR"
25-
25+
2626
[[ ! -d "$TOOLS_DIR/$GCC_ARM_VER" ]] && GetGcc
2727
[[ ! -d "$TOOLS_DIR/$NRF_SDK_VER" ]] && GetNrfSdk
2828
[[ ! -d "$TOOLS_DIR/mcuboot" ]] && GetMcuBoot
@@ -31,7 +31,7 @@ main() {
3131

3232
CmakeGenerate
3333
CmakeBuild $target
34-
BUILD_RESULT=$?
34+
BUILD_RESULT=$?
3535
if [ "$DISABLE_POSTBUILD" != "true" -a "$BUILD_RESULT" == 0 ]; then
3636
source "$BUILD_DIR/post_build.sh"
3737
fi
@@ -71,8 +71,8 @@ CmakeBuild() {
7171
local target="$1"
7272
[[ -n "$target" ]] && target="--target $target"
7373
if cmake --build "$BUILD_DIR" --config $BUILD_TYPE $target -- -j$(nproc)
74-
then return 0; else return 1;
74+
then return 0; else return 1;
7575
fi
7676
}
7777

78-
[[ $SOURCED == "false" ]] && main "$@" || echo "Sourced!"
78+
[[ $SOURCED == "false" ]] && main "$@" || echo "Sourced!"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/bash
22
rm -rf build/
3-
cmake -G 'Unix Makefiles' -DCMAKE_BUILD_TYPE=Release -DUSE_OPENOCD=1 -DARM_NONE_EABI_TOOLCHAIN_PATH=/opt/gcc-arm-none-eabi-9-2020-q2-update -DNRF5_SDK_PATH=/opt/nRF5_SDK_15.3.0_59ac345 -S . -Bbuild
3+
cmake -G 'Unix Makefiles' -DCMAKE_BUILD_TYPE=Release -DUSE_OPENOCD=1 -DARM_NONE_EABI_TOOLCHAIN_PATH=/opt/gcc-arm-none-eabi-10.3-2021.10 -DNRF5_SDK_PATH=/opt/nRF5_SDK_15.3.0_59ac345 -S . -Bbuild

.devcontainer/make_build_dir.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#!/bin/bash
2-
cmake -G 'Unix Makefiles' -DCMAKE_BUILD_TYPE=Release -DUSE_OPENOCD=1 -DARM_NONE_EABI_TOOLCHAIN_PATH=/opt/gcc-arm-none-eabi-9-2020-q2-update -DNRF5_SDK_PATH=/opt/nRF5_SDK_15.3.0_59ac345 ${SOURCES_DIR}
2+
cmake -G 'Unix Makefiles' -DCMAKE_BUILD_TYPE=Release -DUSE_OPENOCD=1 -DARM_NONE_EABI_TOOLCHAIN_PATH=/opt/gcc-arm-none-eabi-10.3-2021.10 -DNRF5_SDK_PATH=/opt/nRF5_SDK_15.3.0_59ac345 ${SOURCES_DIR}

.github/workflows/main.yml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -32,24 +32,24 @@ jobs:
3232
- name: Install cmake
3333
uses: lukka/[email protected]
3434

35-
- name: Check cache for Embedded Arm Toolchain arm-none-eabi-gcc
36-
id: cache-toolchain
37-
uses: actions/cache@v2
38-
env:
39-
cache-name: cache-toolchain-9-2020-q2
40-
with:
41-
path: ${{ runner.temp }}/arm-none-eabi
42-
key: ${{ runner.os }}-build-${{ env.cache-name }}
43-
restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}
44-
45-
- name: Install Embedded Arm Toolchain arm-none-eabi-gcc
46-
if: steps.cache-toolchain.outputs.cache-hit != 'true' # Install toolchain if not found in cache
47-
uses: fiam/arm-none-eabi-gcc@v1.0.4
35+
#- name: Check cache for Embedded Arm Toolchain arm-none-eabi-gcc
36+
# id: cache-toolchain
37+
# uses: actions/cache@v2
38+
# env:
39+
# cache-name: cache-toolchain-10.3-2021.10
40+
# with:
41+
# path: ${{ runner.temp }}/arm-none-eabi
42+
# key: ${{ runner.os }}-build-${{ env.cache-name }}
43+
# restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}
44+
45+
- name: Install Embedded ARM Toolchain arm-none-eabi-gcc
46+
if: steps.cache-toolchain.outputs.cache-hit != 'true' # Install toolchain if not found in cache
47+
uses: carlosperate/arm-none-eabi-gcc-action@v1.3.0
4848
with:
49-
# GNU Embedded Toolchain for Arm release name, in the V-YYYY-qZ format (e.g. "9-2019-q4")
50-
release: 9-2020-q2
51-
# Directory to unpack GCC to. Defaults to a temporary directory.
52-
directory: ${{ runner.temp }}/arm-none-eabi
49+
# GNU Embedded Toolchain for ARM release name, in the V-YYYY-qZ format (e.g. "9-2019-q4")
50+
release: 10.3-2021.10
51+
# Enviroment variable where to store the toolchain's path
52+
path-env-var: ARM_NONE_EABI_GCC_PATH
5353

5454
- name: Check cache for nRF5 SDK
5555
id: cache-nrf5sdk
@@ -113,7 +113,7 @@ jobs:
113113
run: |
114114
mkdir -p build
115115
cd build
116-
cmake -DARM_NONE_EABI_TOOLCHAIN_PATH=${{ runner.temp }}/arm-none-eabi -DNRF5_SDK_PATH=${{ runner.temp }}/nrf5_sdk -DUSE_OPENOCD=1 -DBUILD_DFU=1 ../
116+
cmake -DARM_NONE_EABI_TOOLCHAIN_PATH=$(dirname "$ARM_NONE_EABI_GCC_PATH") -DNRF5_SDK_PATH=${{ runner.temp }}/nrf5_sdk -DUSE_OPENOCD=1 -DBUILD_DFU=1 ../
117117
118118
#########################################################################################
119119
# Make and Upload DFU Package

.vscode/launch.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,12 @@
5252
"servertype": "openocd",
5353
"runToMain": true,
5454
// Only use armToolchainPath if your arm-none-eabi-gdb is not in your path (some GCC packages does not contain arm-none-eabi-gdb)
55-
"armToolchainPath": "${workspaceRoot}/../gcc-arm-none-eabi-9-2020-q2-update/bin",
55+
"armToolchainPath": "${workspaceRoot}/../gcc-arm-none-eabi-10.3-2021.10/bin",
5656
"svdFile": "${workspaceRoot}/nrf52.svd",
5757
"configFiles": [
5858
"interface/stlink.cfg",
5959
"target/nrf52.cfg"
60-
],
60+
]
6161
}
62-
6362
]
6463
}

doc/MemoryAnalysis.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ Puncover is really easy to install:
5151
- `python -m virtualenv venv`
5252
- `source venv/bin/activate`
5353
- Install : `pip install .`
54-
- Run : `puncover --gcc_tools_base=/path/to/gcc-arm-none-eabi-9-2020-q2-update/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`
54+
- 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`
5555
- Replace
56-
* `/path/to/gcc-arm-none-eabi-9-2020-q2-update/bin` with the path to your gcc-arm-none-eabi toolchain
56+
* `/path/to/gcc-arm-none-eabi-10.3-2021.10/bin` with the path to your gcc-arm-none-eabi toolchain
5757
* `/path/to/build/directory/src/pinetime-app-1.1.0.out` with the path to the binary generated by GCC (.out file)
5858
* `/path/to/sources` with the path to the root folder of the sources (checkout directory)
59-
* `/path/to/build/directory` with the path to the build directory
59+
* `/path/to/build/directory` with the path to the build directory
6060
- Launch a browser at http://localhost:5000/
6161

6262
### Analysis
@@ -285,5 +285,3 @@ auto nb = uxTaskGetSystemState(tasksStatus, 10, NULL);
285285
for (int i = 0; i < nb; i++) {
286286
NRF_LOG_INFO("Task [%s] - %d", tasksStatus[i].pcTaskName, tasksStatus[i].usStackHighWaterMark);
287287
```
288-
289-

doc/buildAndProgram.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ CMake configures the project according to variables you specify the command line
2727
2828
Variable | Description | Example|
2929
----------|-------------|--------|
30-
**ARM_NONE_EABI_TOOLCHAIN_PATH**|path to the toolchain directory|`-DARM_NONE_EABI_TOOLCHAIN_PATH=/home/jf/nrf52/gcc-arm-none-eabi-9-2020-q2-update/`|
30+
**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/`|
3131
**NRF5_SDK_PATH**|path to the NRF52 SDK|`-DNRF5_SDK_PATH=/home/jf/nrf52/Pinetime/sdk`|
3232
**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`
3333
**CMAKE_BUILD_TYPE (\*)**| Build type (Release or Debug). Release is applied by default if this variable is not specified.|`-DCMAKE_BUILD_TYPE=Debug`
3434
**NRFJPROG**|Path to the NRFJProg executable. Used only if `USE_JLINK` is 1.|`-DNRFJPROG=/opt/nrfjprog/nrfjprog`
35-
**GDB_CLIENT_BIN_PATH**|Path to arm-none-eabi-gdb executable. Used only if `USE_GDB_CLIENT` is 1.|`-DGDB_CLIENT_BIN_PATH=/home/jf/nrf52/gcc-arm-none-eabi-9-2019-q4-major/bin/arm-none-eabi-gdb`
35+
**GDB_CLIENT_BIN_PATH**|Path to arm-none-eabi-gdb executable. Used only if `USE_GDB_CLIENT` is 1.|`-DGDB_CLIENT_BIN_PATH=/home/jf/nrf52/gcc-arm-none-eabi-10.3-2021.10/bin/arm-none-eabi-gdb`
3636
**GDB_CLIENT_TARGET_REMOTE**|Target remote connection string. Used only if `USE_GDB_CLIENT` is 1.|`-DGDB_CLIENT_TARGET_REMOTE=/dev/ttyACM0`
3737
**BUILD_DFU (\*\*)**|Build DFU files while building (needs [adafruit-nrfutil](https://github.com/adafruit/Adafruit_nRF52_nrfutil)).|`-DBUILD_DFU=1`
3838
**WATCH_COLMI_P8**|Use pin configuration for Colmi P8 watch|`-DWATCH_COLMI_P8=1`

doc/buildWithVScode.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ The .VS Code folder contains configuration files for developing InfiniTime with
66

77
To support as many setups as possible the VS Code configuration files expect there to be certain environment variables to be set.
88

9-
Variable | Description | Example
9+
Variable | Description | Example
1010
----------|-------------|--------
11-
**ARM_NONE_EABI_TOOLCHAIN_PATH**|path to the toolchain directory|`export ARM_NONE_EABI_TOOLCHAIN_PATH=/opt/gcc-arm-none-eabi-9-2020-q2-update`
11+
**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`
1212
**NRF5_SDK_PATH**|path to the NRF52 SDK|`export NRF5_SDK_PATH=/opt/nRF5_SDK_15.3.0_59ac345`
1313

1414
## VS Code Extensions
@@ -47,6 +47,3 @@ To use the DevContainer configuration on Ubuntu based systems two changes need t
4747
3. To start debugging launch openocd on your host system with the appropriate configuration, for example with a stlink-v2 the command is:
4848
``openocd -f interface/stlink.cfg -f target/nrf52.cfg``. This launches openocd with the default ports ``3333``, ``4444`` and ``6666``.
4949
4. In VsCode go to the Debug pane on the left of the screen and select the configuration ``Debug - Openocd docker Remote`` and hit the play button on the left.
50-
51-
52-

docker/build.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export BUILD_DIR="${BUILD_DIR:=$SOURCES_DIR/build}"
1212
export OUTPUT_DIR="${OUTPUT_DIR:=$BUILD_DIR/output}"
1313

1414
export BUILD_TYPE=${BUILD_TYPE:=Release}
15-
export GCC_ARM_VER=${GCC_ARM_VER:="gcc-arm-none-eabi-9-2020-q2-update"}
15+
export GCC_ARM_VER=${GCC_ARM_VER:="gcc-arm-none-eabi-10.3-2021.10"}
1616
export NRF_SDK_VER=${NRF_SDK_VER:="nRF5_SDK_15.3.0_59ac345"}
1717

1818
MACHINE="$(uname -m)"
@@ -22,7 +22,7 @@ main() {
2222
local target="$1"
2323

2424
mkdir -p "$TOOLS_DIR"
25-
25+
2626
[[ ! -d "$TOOLS_DIR/$GCC_ARM_VER" ]] && GetGcc
2727
[[ ! -d "$TOOLS_DIR/$NRF_SDK_VER" ]] && GetNrfSdk
2828
[[ ! -d "$TOOLS_DIR/mcuboot" ]] && GetMcuBoot
@@ -31,7 +31,7 @@ main() {
3131

3232
CmakeGenerate
3333
CmakeBuild $target
34-
BUILD_RESULT=$?
34+
BUILD_RESULT=$?
3535
if [ "$DISABLE_POSTBUILD" != "true" -a "$BUILD_RESULT" == 0 ]; then
3636
source "$BUILD_DIR/post_build.sh"
3737
fi
@@ -72,8 +72,8 @@ CmakeBuild() {
7272
local target="$1"
7373
[[ -n "$target" ]] && target="--target $target"
7474
if cmake --build "$BUILD_DIR" --config $BUILD_TYPE $target -- -j$(nproc)
75-
then return 0; else return 1;
75+
then return 0; else return 1;
7676
fi
7777
}
7878

79-
[[ $SOURCED == "false" ]] && main "$@" || echo "Sourced!"
79+
[[ $SOURCED == "false" ]] && main "$@" || echo "Sourced!"

0 commit comments

Comments
 (0)