From bf1007b3c11c14e549ea3cb62d2f20e867769a09 Mon Sep 17 00:00:00 2001 From: Jakob Krantz Date: Sat, 23 Sep 2023 12:06:00 +0200 Subject: [PATCH] WIP: Fix CI. --- .github/workflows/build.yml | 59 ++++++++++++++++--------------------- app/src/main.c | 2 +- app/src/zsw_flash.c | 6 ++-- 3 files changed, 29 insertions(+), 38 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2eb6c2cb..916c5845 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,44 +1,35 @@ -name: Build firmware -on: push +name: Build -env: - ZEPHYR_VERSION: 3.4.0 +on: + push: + #pull_request: + schedule: + - cron: "0 0 * * *" jobs: - NRF: - runs-on: ubuntu-20.04 + build: + runs-on: ubuntu-22.04 + container: ghcr.io/zephyrproject-rtos/ci:v0.26.2 strategy: matrix: - ncs_version: [2.4] - board: [zswatch_nrf5340_cpuapp@1,zswatch_nrf5340_cpuapp@2] + built_type: [debug, release] + board: [zswatch_nrf5340_cpuapp@1, zswatch_nrf5340_cpuapp@3, native_posix] + env: + CMAKE_PREFIX_PATH: /opt/toolchains steps: - - name: Clone repository - uses: actions/checkout@v2 + - name: Checkout + uses: actions/checkout@v3 with: - path: project + path: ZSWatch submodules: recursive - - name: Build ZSWatch Binaries - working-directory: project + + - name: Initialize + working-directory: ZSWatch run: | - docker run -v $PWD:/workdir/project nordicplayground/nrfconnect-sdk:v${{ matrix.ncs_version }}-branch \ - west build --board ${{ matrix.board }} /workdir/project/app + west init -l app + west update -o=--depth=1 -n - Posix: - name: Posix build - runs-on: ubuntu-20.04 - container: - image: ghcr.io/bcdevices/zephyr:v3.4.0-0 - options: --user root - steps: - - uses: actions/checkout@v3 - with: - submodules: recursive - - name: Install deps - run: | - dpkg --add-architecture i386 - apt-get -y update - apt-get install --no-install-recommends -y libsdl2-dev:i386 - - name: build - run: | - cd /usr/src/zephyr-3.4.0 - west build --board native_posix $GITHUB_WORKSPACE/app \ No newline at end of file + - name: Build firmware + working-directory: ZSWatch + run: | + west build app -p -b ${{ matrix.board }} -- -DOVERLAY_CONFIG=boards/${{ matrix.built_type }}.conf diff --git a/app/src/main.c b/app/src/main.c index 875ecc44..43aa8c77 100644 --- a/app/src/main.c +++ b/app/src/main.c @@ -145,7 +145,7 @@ void run_wdt_work(struct k_work *item) int main(void) { -#ifdef CONFIG_TASK_WDT +#if defined(CONFIG_TASK_WDT) && !defined(CONFIG_BOARD_NATIVE_POSIX) const struct device *hw_wdt_dev = DEVICE_DT_GET(DT_ALIAS(watchdog0)); if (!device_is_ready(hw_wdt_dev)) { printk("Hardware watchdog %s is not ready; ignoring it.\n", diff --git a/app/src/zsw_flash.c b/app/src/zsw_flash.c index 9d4eefe1..899f7787 100644 --- a/app/src/zsw_flash.c +++ b/app/src/zsw_flash.c @@ -77,10 +77,10 @@ static void single_sector_test(const struct device *flash_dev) static int zsw_flash_test(void) { - const struct device *flash_dev = DEVICE_DT_GET(DT_ALIAS(spi_flash0)); + const struct device *flash_dev = DEVICE_DT_GET_OR_NULL(DT_ALIAS(spi_flash0)); - if (!device_is_ready(flash_dev)) { - LOG_ERR("No external flash present: %s", flash_dev->name); + if (!flash_dev || !device_is_ready(flash_dev)) { + LOG_ERR("No external flash present: %s", flash_dev ? flash_dev->name: "spi_flash0"); return 0; }