Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework toolchain file and build libraries in MinSizeRel mode #75

Merged
merged 6 commits into from
Dec 11, 2024
Merged
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
5 changes: 2 additions & 3 deletions .github/workflows/ci-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,19 @@ on:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3

- name: Copy scripts to linux-x86 build context
run: cp install.sh ./linux-x86/. && cp libraries.txt ./linux-x86/.

- name: Copy scripts to full build contexts
- name: Copy scripts to full build contexts
run: cp install.sh ./full/. && cp libraries.txt ./full/.

- name: Build the linux Docker image
run: docker build ./linux-x86 -t tuwienspaceteam/sts1-cobc:latest-linux-x86

- name: Build the full Docker image
run: docker build ./full

6 changes: 3 additions & 3 deletions .github/workflows/ci-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
docker-linux-x86:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04

steps:
- name: Checkout
Expand Down Expand Up @@ -45,13 +45,13 @@ jobs:
docker-full:
needs: docker-linux-x86

runs-on: ubuntu-latest
runs-on: ubuntu-22.04

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Copy scripts to full build contexts
- name: Copy scripts to full build contexts
run: cp install.sh ./full/. && cp libraries.txt ./full/.

- name: Docker meta
Expand Down
12 changes: 11 additions & 1 deletion full/stm32f411.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,20 @@ message("HSE value used: ${HSE_VALUE}")
add_compile_definitions(HSE_VALUE=${HSE_VALUE} HSE_STARTUP_TIMEOUT=10000000)
add_compile_definitions(USE_STDPERIPH_DRIVER STM32F411xE)

# The Ninja Multi-Config generator does not support the MinSizeRel configuration by default so we
# add it here.
set(CMAKE_CONFIGURATION_TYPES "Debug;Release;RelWithDebInfo;MinSizeRel")
# I thought setting the default flags for the configurations is done with the *_INIT variables but
# that appends to the existing default flags instead of replacing them.
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3 -gdwarf-2")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g3 -gdwarf-2 -DNDEBUG")
set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG")

set(compile_and_link_options -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp)

add_compile_options(${compile_and_link_options})
add_compile_options(-gdwarf-2 -mthumb -g3)
add_compile_options(-mthumb -ffunction-sections -fdata-sections)

# Definitions for Experimental Outcome
add_compile_definitions(SYSTEM_ERROR2_NOT_POSIX)
Expand Down
8 changes: 4 additions & 4 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ cd rodos
# We will need it later, so just copy it to the top-level directory
find . -name linux-x86.cmake | xargs cp -t ../ -v
if [[ $1 == "linux" ]]; then
cmake --toolchain cmake/port/linux-x86.cmake -S . -B build/linux-x86
cmake --toolchain cmake/port/linux-x86.cmake -DCMAKE_BUILD_TYPE=MinSizeRel -S . -B build/linux-x86
cmake --build build/linux-x86
sudo cmake --install build/linux-x86
else
cmake --toolchain cmake/port/cobc.cmake -S . -B build/cobc
cmake --toolchain cmake/port/cobc.cmake -DCMAKE_BUILD_TYPE=MinSizeRel -S . -B build/cobc
cmake --build build/cobc
sudo cmake --install build/cobc --prefix "$2"
fi
Expand All @@ -66,11 +66,11 @@ fi

cd littlefs
if [[ $1 == "linux" ]]; then
cmake --toolchain ../linux-x86.cmake -DLFS_THREADSAFE=ON -DLFS_NO_MALLOC=OFF -S . -B build/linux-x86
cmake --toolchain ../linux-x86.cmake -DLFS_THREADSAFE=ON -DLFS_NO_MALLOC=OFF -DCMAKE_BUILD_TYPE=MinSizeRel -S . -B build/linux-x86
cmake --build build/linux-x86
sudo cmake --install build/linux-x86
else
cmake --toolchain ../stm32f411.cmake -DLFS_THREADSAFE=ON -DLFS_NO_MALLOC=OFF -S . -B build/cobc
cmake --toolchain ../stm32f411.cmake -DLFS_THREADSAFE=ON -DLFS_NO_MALLOC=OFF -DCMAKE_BUILD_TYPE=MinSizeRel -S . -B build/cobc
cmake --build ./build/cobc
sudo cmake --install build/cobc --prefix "$2"
fi
Expand Down
2 changes: 1 addition & 1 deletion libraries.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
rodos,d0fbbffafcd248b27f8c29fe773bebcab4bcd784,https://github.com/SpaceTeam/rodos.git
rodos,a76e5ac33397273c08ac9e247a7ea2308e160801,https://github.com/SpaceTeam/rodos.git
etl,cceb5038664a4fa363e79709bc08bd0bb356ae50,https://github.com/ETLCPP/etl.git
Catch2,v3.1.0,https://github.com/catchorg/Catch2.git
littlefs,8e53bfeda7716ed7056a2b519bba45f40dea7df0,https://github.com/SpaceTeam/littlefs.git
Expand Down
13 changes: 7 additions & 6 deletions linux-x86/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:23.04
FROM ubuntu:24.04

ENV HOME="/"

Expand Down Expand Up @@ -30,11 +30,12 @@ RUN dpkg --add-architecture i386 && apt-get update -qq && apt-get install -y -qq
&& rm -rf /var/lib/apt/lists/*

# Setup tools versions
RUN update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-15 15
RUN update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-15 15
RUN update-alternatives --install /usr/bin/clangd clangd /usr/bin/clangd-15 15
RUN update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 12
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 12
RUN update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-15 99
RUN update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-15 99
RUN update-alternatives --install /usr/bin/clangd clangd /usr/bin/clangd-15 99
RUN update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 99
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 99
RUN update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-12 99

# Install CMake 3.22
RUN wget https://github.com/Kitware/CMake/releases/download/v3.22.0/cmake-3.22.0-linux-x86_64.tar.gz -q
Expand Down