Build fails with "No Error" from time to time

Hi,

I have recently started using nRF Connect with VSCode. 

Every once in a while, the build (and also the pristine build) will fail with this output:

[8/9] Building C object zephyr/CMakeFiles/zephyr_final.dir/dev_handles.c.obj
[9/9] Linking C executable zephyr\zephyr.elf
FAILED: zephyr/zephyr.elf zephyr/zephyr.map zephyr/zephyr.hex zephyr/zephyr.bin zephyr/zephyr.lst zephyr/zephyr.stat 
cmd.exe /C "cd . && C:\NordicSemi\v1.7.0\toolchain\opt\bin\arm-none-eabi-gcc.exe   zephyr/CMakeFiles/zephyr_final.dir/misc/empty_file.c.obj zephyr/CMakeFiles/zephyr_final.dir/isr_tables.c.obj zephyr/CMakeFiles/zephyr_final.dir/dev_handles.c.obj -o zephyr\zephyr.elf  -Wl,-T  zephyr/linker.cmd  -Wl,-Map=C:/NordicSemi/projects/ADC/build/zephyr/zephyr_final.map  -Wl,--whole-archive  app/libapp.a  zephyr/libzephyr.a  zephyr/arch/common/libarch__common.a  zephyr/arch/arch/arm/core/aarch32/libarch__arm__core__aarch32.a  zephyr/arch/arch/arm/core/aarch32/cortex_m/libarch__arm__core__aarch32__cortex_m.a  zephyr/arch/arch/arm/core/aarch32/mpu/libarch__arm__core__aarch32__mpu.a  zephyr/lib/libc/minimal/liblib__libc__minimal.a  zephyr/lib/posix/liblib__posix.a  zephyr/soc/arm/common/cortex_m/libsoc__arm__common__cortex_m.a  zephyr/soc/arm/nordic_nrf/nrf52/libsoc__arm__nordic_nrf__nrf52.a  zephyr/subsys/bluetooth/common/libsubsys__bluetooth__common.a  zephyr/subsys/bluetooth/host/libsubsys__bluetooth__host.a  zephyr/subsys/bluetooth/controller/libsubsys__bluetooth__controller.a  zephyr/subsys/net/libsubsys__net.a  zephyr/subsys/random/libsubsys__random.a  zephyr/drivers/adc/libdrivers__adc.a  zephyr/drivers/gpio/libdrivers__gpio.a  zephyr/drivers/serial/libdrivers__serial.a  zephyr/drivers/entropy/libdrivers__entropy.a  modules/nrf/lib/fatal_error/lib..__nrf__lib__fatal_error.a  modules/hal_nordic/nrfx/libmodules__hal_nordic__nrfx.a  modules/segger/libmodules__segger.a  -Wl,--no-whole-archive  zephyr/kernel/libkernel.a  zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj  -L"c:/nordicsemi/v1.7.0/toolchain/opt/bin/../lib/gcc/arm-none-eabi/9.2.1/thumb/v7e-m/nofp"  -LC:/NordicSemi/projects/ADC/build/zephyr  -lgcc  -Wl,--print-memory-usage  zephyr/arch/common/libisr_tables.a  -mcpu=cortex-m4  -mthumb  -mabi=aapcs  -Wl,--gc-sections  -Wl,--build-id=none  -Wl,--sort-common=descending  -Wl,--sort-section=alignment  -Wl,-u,_OffsetAbsSyms  -Wl,-u,_ConfigAbsSyms  -nostdlib  -static  -no-pie  -Wl,-X  -Wl,-N  -Wl,--orphan-handling=warn && cmd.exe /C "cd /D C:\NordicSemi\projects\ADC\build\zephyr && C:\NordicSemi\v1.7.0\toolchain\opt\bin\cmake.exe -E rename zephyr_final.map zephyr.map && C:\NordicSemi\v1.7.0\toolchain\opt\bin\arm-none-eabi-objcopy.exe --gap-fill 0xff --output-target=ihex --remove-section=.comment --remove-section=COMMON --remove-section=.eh_frame zephyr.elf zephyr.hex && C:\NordicSemi\v1.7.0\toolchain\opt\bin\arm-none-eabi-objcopy.exe --gap-fill 0xff --output-target=binary --remove-section=.comment --remove-section=COMMON --remove-section=.eh_frame zephyr.elf zephyr.bin && C:\NordicSemi\v1.7.0\toolchain\opt\bin\arm-none-eabi-objdump.exe -d -S zephyr.elf > zephyr.lst && C:\NordicSemi\v1.7.0\toolchain\opt\bin\arm-none-eabi-readelf.exe -e zephyr.elf > zephyr.stat""
Memory region         Used Size  Region Size  %age Used
           FLASH:       85428 B       512 KB     16.29%
            SRAM:       17224 B        64 KB     26.28%
        IDT_LIST:          0 GB         2 KB      0.00%
Error renaming from "zephyr_final.map" to "zephyr.map": No error
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: 'c:\NordicSemi\v1.7.0\toolchain\opt\bin\cmake.EXE' --build 'c:\NordicSemi\projects\ADC\build'
The terminal process terminated with exit code: 1.

To me it looks like the .map file might be locked (just guessing), but I haven't been able to solve it, although a restart of VSCode does the trick.

Best regards,

Erik

Related