From 10ba0f30694629aabc27ca7f1c0225dc036c8beb Mon Sep 17 00:00:00 2001 From: Maximilian Gerhardt <maximilian.gerhardt@rub.de> Date: Mon, 29 May 2023 02:08:34 +0200 Subject: [PATCH] PlatformIO build fixes and improvements (#134) * Fix caching * Create requirements.txt * Fix PlatformIO build for Wiring examples, use cache properly * Remove uneeded file * Add slightly more into PlatformIO ini --- .github/workflows/build.yml | 31 +++++++++++-------------------- platformio.ini | 12 ++++++++++++ 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b088f28..fe3796b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,25 +35,16 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 - - name: Cache pip - uses: actions/cache@v3 + - uses: actions/cache@v3 with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip- - - name: Cache PlatformIO - uses: actions/cache@v3 + path: | + ~/.cache/pip + ~/.platformio/.cache + key: ${{ runner.os }}-pio + - uses: actions/setup-python@v4 with: - path: ~/.platformio - key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.9" - - name: Install PlatformIO - run: | - python -m pip install --upgrade pip - pip install --upgrade platformio - - name: Run PlatformIO - run: pio run + python-version: '3.9' + - name: Install PlatformIO Core + run: pip install --upgrade platformio + - name: Build PlatformIO Project + run: pio run \ No newline at end of file diff --git a/platformio.ini b/platformio.ini index b1626df..263b6ac 100644 --- a/platformio.ini +++ b/platformio.ini @@ -17,7 +17,13 @@ extends = fun_base board_build.ldscript = ch32v003fun/ch32v003fun.ld build_flags = -flto -Ich32v003fun -I/usr/include/newlib -DTINYVECTOR -lgcc -Iextralibs build_src_filter = +<ch32v003fun> +extra_libs_srcs = +<extralibs> +; If creating a new example: +; 1. Add new [env:name] +; 2. Add build_src_filter with fun base files + example folder (+ extra libraries if used) for source files +; 3. Add additional build flags as needed (see uartdemo) +; 4. Switch to new environment in VSCode bottom taskbar (https://docs.platformio.org/en/latest/integration/ide/vscode.html#project-tasks) [env:blink] build_src_filter = ${fun_base.build_src_filter} +<examples/blink> @@ -30,6 +36,12 @@ build_src_filter = ${fun_base.build_src_filter} +<examples/debugprintfdemo> [env:external_crystal] build_src_filter = ${fun_base.build_src_filter} +<examples/external_crystal> +[env:GPIO] +build_src_filter = ${fun_base.build_src_filter} ${fun_base.extra_libs_srcs} +<examples/GPIO> + +[env:GPIO_analogRead] +build_src_filter = ${fun_base.build_src_filter} ${fun_base.extra_libs_srcs} +<examples/GPIO_analogRead> + [env:optionbytes] build_src_filter = ${fun_base.build_src_filter} +<examples/optionbytes> -- GitLab