From 016719c8bc85a6694918251a2549f4869629c133 Mon Sep 17 00:00:00 2001 From: itzandroidtab Date: Sat, 18 Oct 2025 20:53:42 +0200 Subject: [PATCH 1/5] added a new job to build every header individually to prevent include errors --- .github/workflows/build.yml | 66 ++++++++++++++++++++++++++++++++++--- 1 file changed, 62 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5664ab06..dc0bf629 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,9 +12,6 @@ env: jobs: build: - # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. - # You can convert this to a matrix build if you need cross-platform coverage. - # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix runs-on: ubuntu-latest strategy: @@ -98,4 +95,65 @@ jobs: ${{github.workspace}}/build/project/klib.memory ${{github.workspace}}/build/project/klib.hex ${{github.workspace}}/build/project/klib.bin - ${{github.workspace}}/targets/chip/${{matrix.cpu}}/${{matrix.cpu}}.h \ No newline at end of file + ${{github.workspace}}/targets/chip/${{matrix.cpu}}/${{matrix.cpu}}.h + + individual-header-build: + name: Build each header in its own main.cpp + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: arm-none-eabi-gcc install + uses: carlosperate/arm-none-eabi-gcc-action@v1.10.1 + with: + release: '13.2.Rel1' + + - name: arm-none-eabi-gcc version + run: arm-none-eabi-gcc --version + + - name: getting arm headers + uses: actions/checkout@v4 + with: + repository: ARM-software/CMSIS_5 + ref: 'develop' + fetch-depth: '1' + path: './CMSIS' + + - name: moving arm headers + run: | + cp ${{github.workspace}}/CMSIS/CMSIS/Core/Include/* ${{github.workspace}}/targets/arm/ + + - name: generating header + run: | + mkdir -p ${{github.workspace}}/targets/chip/lpc1756/docs + wget -q -O ${{github.workspace}}/targets/chip/lpc1756/docs/lpc1756.svd https://raw.githubusercontent.com/itzandroidtab/klib-svd/master/lpc1756.svd + wget -q -O ${{github.workspace}}/svdconv.tbz2 https://github.com/Open-CMSIS-Pack/devtools/releases/download/tools%2Fsvdconv%2F3.3.44/svdconv-3.3.44-linux64-amd64.tbz2 + tar -xf ${{github.workspace}}/svdconv.tbz2 + chmod +x ${{github.workspace}}/svdconv + + ${{github.workspace}}/svdconv ${{github.workspace}}/targets/chip/lpc1756/docs/lpc1756.svd --suppress-warnings --generate=header -o ${{github.workspace}}/targets/chip/lpc1756/ || true + sed -i '/#include "system_/d' ${{github.workspace}}/targets/chip/lpc1756/lpc1756.h + + - name: Find all header files and build individually + run: | + mkdir -p ${{github.workspace}}/project + HEADER_DIR="${{github.workspace}}/klib/" + BUILD_DIR="${{github.workspace}}/build" + + # Find all header files (.hpp and .h) + find "$HEADER_DIR" -type f \( -name "*.hpp" -o -name "*.h" \) | while read header_file; do + # Get a safe name for the build (basename + replace / with _) + header_name=$(basename "$header_file") + safe_name=$(echo "$header_file" | sed 's/[^a-zA-Z0-9]/_/g') + + # Create a main.cpp that only includes this header + echo "#include \"${header_file#$HEADER_DIR/}\"" > ${{github.workspace}}/project/main.cpp + echo "int main() { return 0; }" >> ${{github.workspace}}/project/main.cpp + + # Optionally: show which header we're building + echo "Building for header: $header_file" + + # Configure and build + CC=arm-none-eabi-gcc CXX=arm-none-eabi-g++ cmake -B "$BUILD_DIR/$safe_name" -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -S ${{github.workspace}} + cmake --build "$BUILD_DIR/$safe_name" --config ${{env.BUILD_TYPE}} + done \ No newline at end of file From 1d894803800fbd2a5392727999c0824120621c76 Mon Sep 17 00:00:00 2001 From: itzandroidtab Date: Sat, 18 Oct 2025 20:57:55 +0200 Subject: [PATCH 2/5] added missing target cpu --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dc0bf629..f0a9b9f6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -154,6 +154,6 @@ jobs: echo "Building for header: $header_file" # Configure and build - CC=arm-none-eabi-gcc CXX=arm-none-eabi-g++ cmake -B "$BUILD_DIR/$safe_name" -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -S ${{github.workspace}} + CC=arm-none-eabi-gcc CXX=arm-none-eabi-g++ cmake -B "$BUILD_DIR/$safe_name" -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DTARGET_CPU=lpc1756 cmake --build "$BUILD_DIR/$safe_name" --config ${{env.BUILD_TYPE}} done \ No newline at end of file From 352fabafd2306f0c55341c17f7628ab4c96379d1 Mon Sep 17 00:00:00 2001 From: itzandroidtab Date: Sat, 18 Oct 2025 21:02:03 +0200 Subject: [PATCH 3/5] added print of the main.cpp --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f0a9b9f6..d3bb2614 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -149,6 +149,7 @@ jobs: # Create a main.cpp that only includes this header echo "#include \"${header_file#$HEADER_DIR/}\"" > ${{github.workspace}}/project/main.cpp echo "int main() { return 0; }" >> ${{github.workspace}}/project/main.cpp + cat ${{github.workspace}}/project/main.cpp # Optionally: show which header we're building echo "Building for header: $header_file" From bcf077f7d821c90888c7cf83c84f5ed80bfbaa73 Mon Sep 17 00:00:00 2001 From: itzandroidtab Date: Sat, 18 Oct 2025 21:02:13 +0200 Subject: [PATCH 4/5] added suppressing dev warning --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d3bb2614..e28dc479 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -77,7 +77,7 @@ jobs: - name: Configure CMake # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type - run: CC=arm-none-eabi-gcc CXX=arm-none-eabi-g++ cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DTARGET_CPU=${{matrix.cpu}} + run: CC=arm-none-eabi-gcc CXX=arm-none-eabi-g++ cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DTARGET_CPU=${{matrix.cpu}} -Wno-dev - name: Build # Build your program with the given configuration @@ -155,6 +155,6 @@ jobs: echo "Building for header: $header_file" # Configure and build - CC=arm-none-eabi-gcc CXX=arm-none-eabi-g++ cmake -B "$BUILD_DIR/$safe_name" -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DTARGET_CPU=lpc1756 + CC=arm-none-eabi-gcc CXX=arm-none-eabi-g++ cmake -B "$BUILD_DIR/$safe_name" -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DTARGET_CPU=lpc1756 -Wno-dev cmake --build "$BUILD_DIR/$safe_name" --config ${{env.BUILD_TYPE}} done \ No newline at end of file From cfba8c5b3abae3751335d1eb78c76a80fff6f5cd Mon Sep 17 00:00:00 2001 From: itzandroidtab Date: Sat, 18 Oct 2025 21:03:38 +0200 Subject: [PATCH 5/5] updated name for new job --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e28dc479..6a163c6c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -98,7 +98,7 @@ jobs: ${{github.workspace}}/targets/chip/${{matrix.cpu}}/${{matrix.cpu}}.h individual-header-build: - name: Build each header in its own main.cpp + name: Build each header individually runs-on: ubuntu-latest steps: - uses: actions/checkout@v4