This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

west build (intermitently) fails when OTA enabled (CONFIG_ZIGBEE_FOTA) and imgtool.py misbehaving... why?

Have a NCS/ZBoss-based Zigbee app running and I want to enable FOTA, and it was failing with missing app_update.bin file.

Thinking it might be something with my own code, I enabled FOTA for the light_switch sample and built it, that's when things got strange. 

The end of the process is (sometimes??):

Fullscreen
1
2
3
4
5
6
7
8
9
10
[393/409] Linking C executable zephyr/zephyr.elf
Memory region Used Size Region Size %age Used
FLASH: 308064 B 474624 B 64.91%
SRAM: 68116 B 440 KB 15.12%
IDT_LIST: 0 GB 2 KB 0.00%
[403/409] Generating ../../zephyr/net_core_app_test_update.hex
Zigbee update created at 127F-FFFF-01020003-light_switch.zigbee
[406/409] Generating ../../zephyr/app_test_update.hex
Zigbee update created at 127F-FFFF-01020003-light_switch.zigbee
[409/409] Generating zephyr/merged_domains.hex
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Looks good.  But when I ran it again:

[Errno 2] No such file or directory: '/path/to/dev/nrf/build/zephyr/app_update.bin'

Odd... So, running west build in a loop (with -p always) and piping output to log files, I find that 11 runs out of 30 produce the update image, and the rest fail.  Same command, pristine builds, different results.  It's almost every second run for a while, but not really.

Successes:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
$ grep 'Zigbee update created' lightsw* | sort -n | uniq
lightsw01.txt:Zigbee update created at 127F-FFFF-01020003-light_switch.zigbee
lightsw08.txt:Zigbee update created at 127F-FFFF-01020003-light_switch.zigbee
lightsw12.txt:Zigbee update created at 127F-FFFF-01020003-light_switch.zigbee
lightsw14.txt:Zigbee update created at 127F-FFFF-01020003-light_switch.zigbee
lightsw16.txt:Zigbee update created at 127F-FFFF-01020003-light_switch.zigbee
lightsw18.txt:Zigbee update created at 127F-FFFF-01020003-light_switch.zigbee
lightsw22.txt:Zigbee update created at 127F-FFFF-01020003-light_switch.zigbee
lightsw24.txt:Zigbee update createdat 127F-FFFF-01020003-light_switch.zigbee
lightsw25.txt:Zigbee update created at 127F-FFFF-01020003-light_switch.zigbee
lightsw26.txt:Zigbee update created at 127F-FFFF-01020003-light_switch.zigbee
lightsw27.txt:Zigbee update created at 127F-FFFF-01020003-light_switch.zigbee
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Failures:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
$ grep 'Errno 2' lightsw* | sort -n
lightsw02.txt:[Errno 2] No such file or directory: '/storage/pat/dev/nrf/build/zephyr/app_update.bin'
lightsw03.txt:[Errno 2] No such file or directory: '/storage/pat/dev/nrf/build/zephyr/app_update.bin'
lightsw04.txt:[Errno 2] No such file or directory: '/storage/pat/dev/nrf/build/zephyr/app_update.bin'
lightsw05.txt:[Errno 2] No such file or directory: '/storage/pat/dev/nrf/build/zephyr/app_update.bin'
lightsw06.txt:[Errno 2] No such file or directory: '/storage/pat/dev/nrf/build/zephyr/app_update.bin'
lightsw09.txt:[Errno 2] No such file or directory: '/storage/pat/dev/nrf/build/zephyr/app_update.bin'
lightsw10.txt:[Errno 2] No such file or directory: '/storage/pat/dev/nrf/build/zephyr/app_update.bin'
lightsw11.txt:[Errno 2] No such file or directory: '/storage/pat/dev/nrf/build/zephyr/app_update.bin'
lightsw13.txt:[Errno 2] No such file or directory: '/storage/pat/dev/nrf/build/zephyr/app_update.bin'
lightsw15.txt:[Errno 2] No such file or directory: '/storage/pat/dev/nrf/build/zephyr/app_update.bin'
lightsw17.txt:[Errno 2] No such file or directory: '/storage/pat/dev/nrf/build/zephyr/app_update.bin'
lightsw19.txt:[Errno 2] No such file or directory: '/storage/pat/dev/nrf/build/zephyr/app_update.bin'
lightsw20.txt:[Errno 2] No such file or directory: '/storage/pat/dev/nrf/build/zephyr/app_update.bin'
lightsw21.txt:[Errno 2] No such file or directory: '/storage/pat/dev/nrf/build/zephyr/app_update.bin'
lightsw23.txt:[Errno 2] No such file or directory: '/storage/pat/dev/nrf/build/zephyr/app_update.bin'
lightsw28.txt:[Errno 2] No such file or directory: '/storage/pat/dev/nrf/build/zephyr/app_update.bin'
lightsw29.txt:[Errno 2] No such file or directory: '/storage/pat/dev/nrf/build/zephyr/app_update.bin'
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

and it never succeeds with my own code.

The questions are basically what is causing this, or how can I get the system to at least tell me what's wrong when it's ending with:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
[257/263] Generating linker.cmd
[258/263] Generating isr_tables.c, isrList.bin
[259/263] Generating dev_handles.c
[260/263] Building C object zephyr/CMakeFiles/zephyr_final.dir/misc/empty_file.c.obj
[261/263] Building C object zephyr/CMakeFiles/zephyr_final.dir/isr_tables.c.obj
[262/263] Building C object zephyr/CMakeFiles/zephyr_final.dir/dev_handles.c.obj
[263/263] Linking C executable zephyr/zephyr.elf
Memory region Used Size Region Size %age Used
FLASH: 36276 B 48 KB 73.80%
SRAM: 22712 B 440 KB 5.04%
IDT_LIST: 0 GB 2 KB 0.00%
[394/409] Linking C executable zephyr/zephyr.elf
Memory region Used Size Region Size %age Used
FLASH: 308064 B 474624 B 64.91%
SRAM: 68116 B 440 KB 15.12%
IDT_LIST: 0 GB 2 KB 0.00%
[396/409] Generating ../../zephyr/net_core_app_test_update.hex
FAILED: zephyr/net_core_app_test_update.hex /storage/pat/dev/nrf/build/zephyr/net_core_app_test_update.hex
cd /storage/pat/dev/nrf/build/modules/mcuboot && /usr/bin/python3.9 /storage/pat/dev/nrf/bootloader/mcuboot/scripts/imgtool.py sign --key /storage/pat/dev/nrf/bootloader/mcuboot/root-rsa-2048.pem --header-size 0x200 --align 4 --version 1.2.3 --pad-header --slot-size 0x74000 --pad /storage/pat/dev/nrf/build/multiprotocol_rpmsg/zephyr/signed_by_b0_app.hex /storage/pat/dev/nrf/build/zephyr/net_core_app_test_update.hex && /usr/bin/python3.9 /storage/pat/dev/nrf/nrf/scripts/bootloader/zb_add_ota_header.py --application /storage/pat/dev/nrf/build/zephyr/app_update.bin --application-version-string 1.2.3 --zigbee-manufacturer-id 0x127F --zigbee-image-type 0xFFFF --zigbee-comment light_switch --zigbee-ota-min-hw-version --zigbee-ota-max-hw-version --out-directory /storage/pat/dev/nrf/build/zephyr
[Errno 2] No such file or directory: '/storage/pat/dev/nrf/build/zephyr/app_update.bin'
[398/409] Generating zephyr/mcuboot_primary_app.hex
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX