- 
                Notifications
    You must be signed in to change notification settings 
- Fork 131
WIP CMake Improvements #598
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
          
     Draft
      
      
            gojimmypi
  wants to merge
  11
  commits into
  wolfSSL:master
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
gojimmypi:pr-cmake-improvements
  
      
      
   
  
    
  
  
  
 
  
      
    base: master
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          
  
     Draft
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            11 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      1abf736
              
                CMake Improvements
              
              
                gojimmypi c89b858
              
                Cleanup, revert some Makefile edits
              
              
                gojimmypi b28fcb0
              
                Do not assume .config or CMakePresets
              
              
                gojimmypi e6595fa
              
                Merge branch 'master' of https://github.com/wolfSSL/wolfBoot into pr-…
              
              
                gojimmypi 84fbf0f
              
                Latest WIP dev
              
              
                gojimmypi a1ca06c
              
                flag as executable
              
              
                gojimmypi c35f117
              
                update from dev
              
              
                gojimmypi 59f0a26
              
                Merge branch 'master' of https://github.com/wolfSSL/wolfBoot into pr-…
              
              
                gojimmypi 32e46e6
              
                update from dev branch
              
              
                gojimmypi 183bfde
              
                wolfboot_build cmake script
              
              
                gojimmypi b13b819
              
                special char cleanup
              
              
                gojimmypi File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| root = true | ||
|  | ||
| [*] | ||
| charset = utf-8 | ||
| end_of_line = lf | ||
| insert_final_newline = true | ||
|  | ||
| [*.md] | ||
| charset = utf-8-bom | ||
| end_of_line = lf | ||
| insert_final_newline = true | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| name: wolfboot CMake (.config) | ||
| on: | ||
| push: | ||
| branches: [ '*' ] | ||
| pull_request: | ||
| branches: [ '*' ] | ||
| jobs: | ||
| wolfboot_dot_config_test: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 15 | ||
|  | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| submodules: true | ||
|  | ||
| - name: Workaround for sources.list | ||
| run: | | ||
| # Replace sources | ||
|  | ||
| set -euxo pipefail | ||
|  | ||
| # Peek (what repos are active now) | ||
| apt-cache policy | ||
| grep -RInE '^(deb|Types|URIs)' /etc/apt || true | ||
|  | ||
| # Enable nullglob so *.list/*.sources that don't exist don't break sed | ||
| shopt -s nullglob | ||
|  | ||
| echo "Replace sources.list (legacy)" | ||
| sudo sed -i \ | ||
| -e "s|https\?://azure\.archive\.ubuntu\.com/ubuntu/?|http://mirror.arizona.edu/ubuntu/|g" \ | ||
| /etc/apt/sources.list || true | ||
|  | ||
| echo "Replace sources.list.d/*.list (legacy)" | ||
| for f in /etc/apt/sources.list.d/*.list; do | ||
| sudo sed -i \ | ||
| -e "s|https\?://azure\.archive\.ubuntu\.com/ubuntu/?|http://mirror.arizona.edu/ubuntu/|g" \ | ||
| "$f" | ||
| done | ||
|  | ||
| echo "Replace sources.list.d/*.sources (deb822)" | ||
| for f in /etc/apt/sources.list.d/*.sources; do | ||
| sudo sed -i \ | ||
| -e "s|https\?://azure\.archive\.ubuntu\.com/ubuntu/?|http://mirror.arizona.edu/ubuntu/|g" \ | ||
| -e "s|https\?://azure\.archive\.ubuntu\.com|http://mirror.arizona.edu|g" \ | ||
| "$f" | ||
| done | ||
|  | ||
| echo "Fix /etc/apt/apt-mirrors.txt (used by URIs: mirror+file:...)" | ||
| if grep -qE '^[[:space:]]*https?://azure\.archive\.ubuntu\.com/ubuntu/?' /etc/apt/apt-mirrors.txt; then | ||
| # Replace azure with our mirror (idempotent) | ||
| sudo sed -i 's|https\?://azure\.archive\.ubuntu\.com/ubuntu/|http://mirror.arizona.edu/ubuntu/|g' /etc/apt/apt-mirrors.txt | ||
| fi | ||
|  | ||
| # Peek (verify changes) | ||
| grep -RIn "azure.archive.ubuntu.com" /etc/apt || true | ||
| grep -RInE '^(deb|Types|URIs)' /etc/apt || true | ||
| echo "--- apt-mirrors.txt ---" | ||
| cat /etc/apt/apt-mirrors.txt || true | ||
|  | ||
|  | ||
| - name: Install requirements | ||
| run: | | ||
| # Run system updates and install toolchain | ||
| sudo apt-get update | ||
| sudo apt-get install -y gcc-arm-none-eabi gcc-powerpc-linux-gnu cmake | ||
|  | ||
| - name: Run dot-config examples | ||
| run: | | ||
| # Sample .config cmake test | ||
|  | ||
| set -euo pipefail | ||
|  | ||
| LOG_FILE="run.log" | ||
| KEYWORD="Config mode: dot" | ||
| echo "Saving output to $LOG_FILE" | ||
|  | ||
| echo "Fetch stm32h7 example .config" | ||
| cp ./config/examples/stm32h7.config ./.config | ||
| ls .config | ||
| cat .config | ||
| echo "" | ||
|  | ||
| echo "Clean" | ||
| rm -rf ./build-stm32h7 | ||
|  | ||
| # Here we should see the .config file values read and displayed: | ||
| cmake -S . -B build-stm32h7 \ | ||
| -DUSE_DOT_CONFIG=ON \ | ||
| -DWOLFBOOT_TARGET=stm32h7 2>&1 | tee "$LOG_FILE" | ||
|  | ||
| # Config dot-config mode | ||
| if grep -q -- "$KEYWORD" "$LOG_FILE"; then | ||
| echo "Keyword found: $KEYWORD" | ||
| else | ||
| echo "Keyword not found: $KEYWORD" >&2 | ||
| exit 1 | ||
| fi | ||
|  | ||
| # Sample build | ||
| cmake --build build-stm32h7 -j | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| name: WolfBoot CMake Build (macOS) | ||
|  | ||
| on: | ||
| push: | ||
| branches: [ "*" ] | ||
| pull_request: | ||
| branches: [ "*" ] | ||
|  | ||
| jobs: | ||
| macos-cmake: | ||
| name: Build on macOS (CMake + Ninja) | ||
| runs-on: macos-14 | ||
| timeout-minutes: 20 | ||
|  | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| target: [stm32l4, stm32h7, stm32c0, stm32g0] | ||
|  | ||
| env: | ||
| HOMEBREW_NO_AUTO_UPDATE: "1" # avoid updating taps during install | ||
| HOMEBREW_NO_ANALYTICS: "1" | ||
| HOMEBREW_CURL_RETRIES: "6" # ask curl inside brew to retry | ||
|  | ||
| steps: | ||
| - name: Checkout (with submodules) | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| submodules: true | ||
|  | ||
| - name: Cache Homebrew bottles # downloads (so retries don't redownload) | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| ~/Library/Caches/Homebrew | ||
| /Users/runner/Library/Caches/Homebrew | ||
| key: homebrew-${{ runner.os }}-mac14-cmake-gcc-newlib | ||
| restore-keys: | | ||
| homebrew-${{ runner.os }}- | ||
|  | ||
| - name: Install toolchain and build tools | ||
| run: | | ||
| # Install with step throttle to hopefully avoid stuck jobs | ||
|  | ||
| set -euxo pipefail | ||
|  | ||
| throttle_delay=5 | ||
| brew update | ||
|  | ||
| sleep "$throttle_delay" | ||
| brew install --force-bottle cmake | ||
|  | ||
| sleep "$throttle_delay" | ||
| brew install --force-bottle ninja | ||
|  | ||
| # Use cask to include headers such as <stdlib.h> | ||
| sleep "$throttle_delay" | ||
| brew install --cask gcc-arm-embedded | ||
|  | ||
| - name: Probe ARM GCC (paths + smoke build) | ||
| run: | | ||
| set -euxo pipefail | ||
|  | ||
| which arm-none-eabi-gcc | ||
| arm-none-eabi-gcc --version | ||
|  | ||
| echo "=== GCC search dirs ===" | ||
| arm-none-eabi-gcc -print-search-dirs | ||
|  | ||
| echo "=== GCC verbose include paths (preprocess only) ===" | ||
| # This prints the built-in include search order; harmless with empty stdin. | ||
| arm-none-eabi-gcc -x c -E -v - < /dev/null || true | ||
|  | ||
| echo "=== Compile a freestanding object (no stdlib headers needed) ===" | ||
| cat > hello.c <<'EOF' | ||
| int main(void) { return 0; } | ||
| EOF | ||
| arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -ffreestanding -nostdlib -c hello.c -o hello.o | ||
| ls -l hello.o | ||
|  | ||
| - name: Configure (STM32L4) | ||
| run: | | ||
| echo "Disabled, missing params" | ||
| # rm -rf build | ||
| # cmake -B build -G Ninja \ | ||
| # -DWOLFBOOT_CONFIG_MODE=preset \ | ||
| # -DWOLFBOOT_TARGET=stm32l4 \ | ||
| # -DBUILD_TEST_APPS=ON \ | ||
| # -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain_arm-none-eabi.cmake | ||
|  | ||
| - name: Cmake Configure & Build Preset (${{ matrix.target }}) | ||
| run: | | ||
| rm -rf ./build-${{ matrix.target }} | ||
|  | ||
| cmake --preset ${{ matrix.target }} | ||
| cmake --build --preset ${{ matrix.target }} | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| name: wolfboot CMake Script | ||
| on: | ||
| push: | ||
| branches: [ '*' ] | ||
| pull_request: | ||
| branches: [ '*' ] | ||
| jobs: | ||
| wolfboot_build_script_test: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 15 | ||
|  | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| submodules: true | ||
|  | ||
| - name: Workaround for sources.list | ||
| run: | | ||
| # Replace sources | ||
|  | ||
| set -euxo pipefail | ||
|  | ||
| # Peek (what repos are active now) | ||
| apt-cache policy | ||
| grep -RInE '^(deb|Types|URIs)' /etc/apt || true | ||
|  | ||
| # Enable nullglob so *.list/*.sources that don't exist don't break sed | ||
| shopt -s nullglob | ||
|  | ||
| echo "Replace sources.list (legacy)" | ||
| sudo sed -i \ | ||
| -e "s|https\?://azure\.archive\.ubuntu\.com/ubuntu/?|http://mirror.arizona.edu/ubuntu/|g" \ | ||
| /etc/apt/sources.list || true | ||
|  | ||
| echo "Replace sources.list.d/*.list (legacy)" | ||
| for f in /etc/apt/sources.list.d/*.list; do | ||
| sudo sed -i \ | ||
| -e "s|https\?://azure\.archive\.ubuntu\.com/ubuntu/?|http://mirror.arizona.edu/ubuntu/|g" \ | ||
| "$f" | ||
| done | ||
|  | ||
| echo "Replace sources.list.d/*.sources (deb822)" | ||
| for f in /etc/apt/sources.list.d/*.sources; do | ||
| sudo sed -i \ | ||
| -e "s|https\?://azure\.archive\.ubuntu\.com/ubuntu/?|http://mirror.arizona.edu/ubuntu/|g" \ | ||
| -e "s|https\?://azure\.archive\.ubuntu\.com|http://mirror.arizona.edu|g" \ | ||
| "$f" | ||
| done | ||
|  | ||
| echo "Fix /etc/apt/apt-mirrors.txt (used by URIs: mirror+file:...)" | ||
| if grep -qE '^[[:space:]]*https?://azure\.archive\.ubuntu\.com/ubuntu/?' /etc/apt/apt-mirrors.txt; then | ||
| # Replace azure with our mirror (idempotent) | ||
| sudo sed -i 's|https\?://azure\.archive\.ubuntu\.com/ubuntu/|http://mirror.arizona.edu/ubuntu/|g' /etc/apt/apt-mirrors.txt | ||
| fi | ||
|  | ||
| # Peek (verify changes) | ||
| grep -RIn "azure.archive.ubuntu.com" /etc/apt || true | ||
| grep -RInE '^(deb|Types|URIs)' /etc/apt || true | ||
| echo "--- apt-mirrors.txt ---" | ||
| cat /etc/apt/apt-mirrors.txt || true | ||
|  | ||
|  | ||
| - name: Install requirements | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y gcc-arm-none-eabi gcc-powerpc-linux-gnu cmake | ||
|  | ||
| - name: Run wolfboot_build script | ||
| run: | | ||
| rm -rf ./build | ||
|  | ||
| ./tools/scripts/wolfboot_build.sh --CLEAN "stm32l4" | ||
| ./tools/scripts/wolfboot_build.sh --target "stm32l4" | ||
|  | ||
| ./tools/scripts/wolfboot_build.sh --CLEAN "stm32g0" | ||
| ./tools/scripts/wolfboot_build.sh --target "stm32g0" | 
      
      Oops, something went wrong.
        
    
  
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this file supposed to be here? It seems like your editor configuration. Please remove (and add to .gitignore)