I'm trying to build my projects using a Github actions workflow using github.com/.../nrf-docker. I can build the project fine locally but it seems like the docker container has some incompatibility with the DFU configuration.
I've recreated the issue in a minimal way using the the zephyr peripheral ibs example. you can see the repository here: https://github.com/Robert-PillConnect/peripheral/
I've made the following changes compared to the original sample:
1) prj.confg has additional lines for enabling dfu
# Enable mcumgr. CONFIG_MCUMGR=y # Some command handlers require a large stack. CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048 # Ensure an MCUboot-compatible binary is generated. CONFIG_BOOTLOADER_MCUBOOT=y # Enable flash operations. CONFIG_FLASH=y # Required by the `taskstat` command. CONFIG_THREAD_MONITOR=y # Enable statistics and statistic names. CONFIG_STATS=y CONFIG_STATS_NAMES=y # Enable most core commands. CONFIG_MCUMGR_CMD_IMG_MGMT=y CONFIG_MCUMGR_CMD_OS_MGMT=y CONFIG_MCUMGR_CMD_STAT_MGMT=y # Allow for large Bluetooth data packets. CONFIG_BT_L2CAP_TX_MTU=252 CONFIG_BT_BUF_ACL_RX_SIZE=256 # Enable the Bluetooth (unauthenticated) and shell mcumgr transports. CONFIG_MCUMGR_SMP_BT=y CONFIG_MCUMGR_SMP_BT_AUTHEN=n CONFIG_MCUMGR_SMP_SHELL=y # Add 256 bytes to accommodate upload command (lfs_stat overflows) CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2304
2) main has been updated to include a call to smp_bt_register()
void main(void)
{
struct bt_gatt_attr *vnd_ind_attr;
char str[BT_UUID_STR_LEN];
int err;
err = bt_enable(NULL);
if (err) {
printk("Bluetooth init failed (err %d)\n", err);
return;
}
bt_ready();
bt_gatt_cb_register(&gatt_callbacks);
bt_conn_auth_cb_register(&auth_cb_display);
err = smp_bt_register();
if (err)
{
printk("SMP BT register failed (err: %d)", err);
}
vnd_ind_attr = bt_gatt_find_by_uuid(vnd_svc.attrs, vnd_svc.attr_count,
&vnd_enc_uuid.uuid);
bt_uuid_to_str(&vnd_enc_uuid.uuid, str, sizeof(str));
printk("Indicate VND attr %p (UUID %s)\n", vnd_ind_attr, str);
/* Implement notification. At the moment there is no suitable way
* of starting delayed work so we do it here
*/
while (1) {
k_sleep(K_SECONDS(1));
/* Current Time Service updates only when time is changed */
cts_notify();
/* Heartrate measurements simulation */
hrs_notify();
/* Battery level simulation */
bas_notify();
/* Vendor indication simulation */
if (simulate_vnd && vnd_ind_attr) {
if (indicating) {
continue;
}
ind_params.attr = vnd_ind_attr;
ind_params.func = indicate_cb;
ind_params.destroy = indicate_destroy;
ind_params.data = &indicating;
ind_params.len = sizeof(indicating);
if (bt_gatt_indicate(NULL, &ind_params) == 0) {
indicating = 1U;
}
}
}
}
The github workflow is below:
name: Build and Release
on:
push:
paths:
- "**.c"
- "**.h"
- "**.feature"
- "Kconfig"
- ".github/workflows/build-and-release.yaml"
- "west.yml"
- "*.conf"
repository_dispatch:
types:
- source-update
workflow_dispatch:
permissions:
id-token: write
contents: write
issues: write
jobs:
build:
runs-on: ubuntu-22.04
environment:
name: production
strategy:
matrix:
board: [nrf52840dk_nrf52840]
loglevel: [debug]
steps:
- uses: actions/checkout@v3
with:
path: firmware
- name: Build with debug enabled
working-directory: firmware
if: matrix.loglevel == 'debug'
run: |
docker run --rm -v ${PWD}:/workdir/project nordicplayground/nrfconnect-sdk:main west build -p always -b ${{ matrix.board }} --build-dir /workdir/project/build
- name: Copy firmware
working-directory: firmware
run: |
cp build/zephyr/merged.hex ../
cp build/zephyr/app_signed.hex ../
cp build/zephyr/app_update.bin ../
cp firmware.conf ../
- uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name:
${{ matrix.board }}-${{ matrix.loglevel }}-${{
needs.date-string.outputs.dateAsString }}-${{ github.sha }}
path: |
merged.hex
app_signed.hex
app_update.bin
firmware.conf
I also committed a copy with the DFU disabled so you can see that it builds fine without DFU and fails with:
without DFU: https://github.com/Robert-PillConnect/peripheral/actions/runs/4730783013/jobs/8394934571 (note there's an error it can't find the output file but the build runs fine)
With DFU: https://github.com/Robert-PillConnect/peripheral/actions/runs/4730759754/jobs/8394868103
Here's the log from the failed docker build:
Run docker run --rm -v ${PWD}:/workdir/project nordicplayground/nrfconnect-sdk:main west build -p always -b nrf52840dk_nrf52840 --build-dir /workdir/project/build
Unable to find image 'nordicplayground/nrfconnect-sdk:main' locally
main: Pulling from nordicplayground/nrfconnect-sdk
2ab09b027e7f: Already exists
521a4cda3a3c: Pulling fs layer
15a79ec269fc: Pulling fs layer
9ef436cfd470: Pulling fs layer
7da6860ce4d6: Pulling fs layer
7da6860ce4d6: Waiting
521a4cda3a3c: Download complete
521a4cda3a3c: Pull complete
7da6860ce4d6: Verifying Checksum
7da6860ce4d6: Download complete
15a79ec269fc: Verifying Checksum
15a79ec269fc: Download complete
9ef436cfd470: Verifying Checksum
9ef436cfd470: Download complete
15a79ec269fc: Pull complete
9ef436cfd470: Pull complete
7da6860ce4d6: Pull complete
Digest: sha256:d35dccc25d809552ea5dc81ad4a2a8dfd7950415ca84220615050dfadcccce1b
Status: Downloaded newer image for nordicplayground/nrfconnect-sdk:main
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: /workdir/project
-- CMake version: 3.26.3
-- Found Python3: /usr/bin/python3.10 (found suitable exact version "3.10.6") found components: Interpreter
-- Cache files will be written to: /workdir/.cache//zephyr
-- Zephyr version: 3.3.99 (/workdir/zephyr)
-- Found west (found suitable version "1.0.0", minimum required is "0.7.1")
-- Board: nrf52840dk_nrf52840
-- Found host-tools: zephyr 0.15.2 (/workdir/zephyr-sdk)
-- Found toolchain: zephyr 0.15.2 (/workdir/zephyr-sdk)
-- Found Dtc: /usr/bin/dtc (found suitable version "1.6.1", minimum required is "1.4.6")
-- Found BOARD.dts: /workdir/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts
-- Generated zephyr.dts: /workdir/project/build/zephyr/zephyr.dts
-- Generated devicetree_generated.h: /workdir/project/build/zephyr/include/generated/devicetree_generated.h
-- Including generated dts.cmake file: /workdir/project/build/zephyr/dts.cmake
warning: MCUMGR (defined at subsys/mgmt/mcumgr/Kconfig:5) was assigned the value 'y' but got the
value 'n'. Check these unsatisfied dependencies: ZCBOR (=n). See
http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_MCUMGR and/or look up MCUMGR in the
menuconfig/guiconfig interface. The Application Development Primer, Setting Configuration Values,
and Kconfig - Tips and Best Practices sections of the manual might be helpful too.
warning: Experimental symbol BT_IAS is enabled.
Parsing /workdir/zephyr/Kconfig
/workdir/project/prj.conf:48: warning: attempt to assign the value 'y' to the undefined symbol MCUMGR_CMD_IMG_MGMT
Loaded configuration '/workdir/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840_defconfig'
Merged configuration '/workdir/project/prj.conf'
/workdir/project/prj.conf:49: warning: attempt to assign the value 'y' to the undefined symbol MCUMGR_CMD_OS_MGMT
/workdir/project/prj.conf:50: warning: attempt to assign the value 'y' to the undefined symbol MCUMGR_CMD_STAT_MGMT
/workdir/project/prj.conf:57: warning: attempt to assign the value 'y' to the undefined symbol MCUMGR_SMP_BT
/workdir/project/prj.conf:58: warning: attempt to assign the value 'n' to the undefined symbol MCUMGR_SMP_BT_AUTHEN
/workdir/project/prj.conf:59: warning: attempt to assign the value 'y' to the undefined symbol MCUMGR_SMP_SHELL
error: Aborting due to Kconfig warnings
CMake Error at /workdir/zephyr/cmake/modules/kconfig.cmake:329 (message):
command failed with return code: 1
Call Stack (most recent call first):
/workdir/nrf/cmake/modules/kconfig.cmake:29 (include)
/workdir/zephyr/cmake/modules/zephyr_default.cmake:113 (include)
/workdir/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
/workdir/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
CMakeLists.txt:4 (find_package)
-- Configuring incomplete, errors occurred!
FATAL ERROR: command exited with status 1: /usr/local/bin/cmake -DWEST_PYTHON=/usr/bin/python3 -B/workdir/project/build -GNinja -DBOARD=nrf52840dk_nrf52840 -S/workdir/project
Error: Process completed with exit code 1.
Any idea why this is failing?