Ninja build not working

Hi,
I wanted to start new project and noticed you migrated from classic make to cmake+ninja. I’m using linux CLI for build, but even after freshly cloning twr-skeleton and following instructions on Development With Command Line Tools | HARDWARIO Documentation, build failed with error ld: cannot open map file <full path>/firmware.map.

Did I do something wrong?

Full console output is here:
mixi@alfons:~/pg/tmp$ git clone https://github.com/hardwario/twr-skeleton.git --recursive
Cloning into 'twr-skeleton'...
remote: Enumerating objects: 111, done.
remote: Counting objects: 100% (111/111), done.
remote: Compressing objects: 100% (68/68), done.
remote: Total 111 (delta 42), reused 86 (delta 25), pack-reused 0
Receiving objects: 100% (111/111), 18.08 KiB | 9.04 MiB/s, done.
Resolving deltas: 100% (42/42), done.
Submodule 'sdk' (https://github.com/hardwario/twr-sdk.git) registered for path 'sdk'
Cloning into '/home/mixi/pg/tmp/twr-skeleton/sdk'...
remote: Enumerating objects: 13820, done.        
remote: Counting objects: 100% (3640/3640), done.        
remote: Compressing objects: 100% (1624/1624), done.        
remote: Total 13820 (delta 1506), reused 3191 (delta 1335), pack-reused 10180        
Receiving objects: 100% (13820/13820), 66.19 MiB | 12.27 MiB/s, done.
Resolving deltas: 100% (6819/6819), done.
Submodule path 'sdk': checked out '9b9bd879a161457fd3d3b197433e672299f3077f'

mixi@alfons:~/pg/tmp$ cd twr-skeleton/

mixi@alfons:~/pg/tmp/twr-skeleton$ cmake -B obj/debug . -G Ninja -DCMAKE_TOOLCHAIN_FILE=sdk/toolchain/toolchain.cmake
-- The C compiler identification is GNU 10.3.1
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/arm-none-eabi-gcc
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/arm-none-eabi-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/mixi/pg/tmp/twr-skeleton/obj/debug

mixi@alfons:~/pg/tmp/twr-skeleton$ ninja -C obj/debug
ninja: Entering directory `obj/debug'
[35/194] Building C object sdk/CMakeFiles/firmware.dir/twr/src/twr_cmwx1zzabz.c.obj
/home/mixi/pg/tmp/twr-skeleton/sdk/twr/src/twr_cmwx1zzabz.c: In function '_twr_cmwx1zzabz_task':
/home/mixi/pg/tmp/twr-skeleton/sdk/twr/src/twr_cmwx1zzabz.c:1041:58: warning: ordered comparison of pointer with integer zero [-Wpedantic]
 1041 |                 if (strstr(self->_response, "+EVENT=2,") > 0)
      |                                                          ^
/home/mixi/pg/tmp/twr-skeleton/sdk/twr/src/twr_cmwx1zzabz.c:396:30: warning: this statement may fall through [-Wimplicit-fallthrough=]
  396 |                 self->_state = TWR_CMWX1ZZABZ_STATE_RECOVER_BAUDRATE_UART;
      |                 ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mixi/pg/tmp/twr-skeleton/sdk/twr/src/twr_cmwx1zzabz.c:399:13: note: here
  399 |             case TWR_CMWX1ZZABZ_STATE_RECOVER_BAUDRATE_UART:
      |             ^~~~
[194/194] Linking C executable /home/mixi/pg/tmp/twr-skeleton/out/firmware.elf
FAILED: /home/mixi/pg/tmp/twr-skeleton/out/firmware.elf 
: && /usr/bin/arm-none-eabi-gcc --sysroot=/usr/bin/../arm-none-eabi  -T/home/mixi/pg/tmp/twr-skeleton/sdk/sys/lkr/stm32l083cz.ld -Wl,-Map=/home/mixi/pg/tmp/twr-skeleton/out/debug/firmware.map -mcpu=cortex-m0plus -mthumb -mlittle-endian -Wl,-lc -Wl,-lm -static -Wl,--gc-sections -Wl,--print-memory-usage -Wl,-u,__errno --specs=nosys.specs sdk/CMakeFiles/firmware.dir/twr/src/main.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_adc.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_aes.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_analog_sensor.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_atci.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_atsha204.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_at_lora.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_base64.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_button.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_chester_a.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_cmwx1zzabz.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_config.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_cp201t.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_crc.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_cy8cmbr3102.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_dac.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_data_stream.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_delay.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_device_id.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_dfu.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_dice.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_dma.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_ds18b20.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_ds2484.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_ds28e17.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_eeprom.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_error.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_esp8266.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_exti.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_fifo.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_flood_detector.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_font_ubuntu_11.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_font_ubuntu_13.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_font_ubuntu_15.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_font_ubuntu_24.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_font_ubuntu_28.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_font_ubuntu_33.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_gfx.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_gpio.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_hc_sr04.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_hdc2080.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_hts221.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_i2c.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_info.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_irq.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_ir_rx.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_led.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_led_strip.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_lis2dh12.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_log.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_lp8.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_ls013b7dh03.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_module_battery.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_module_climate.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_module_co2.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_module_encoder.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_module_gps.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_module_infra_grid.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_module_lcd.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_module_pir.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_module_power.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_module_relay.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_module_rs485.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_module_sensor.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_module_sigfox.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_module_x1.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_mpl3115a2.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_onewire.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_onewire_ds2484.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_onewire_gpio.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_onewire_relay.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_opt3001.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_pulse_counter.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_pwm.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_pyq1648.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_queue.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_radio.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_radio_node.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_radio_pub.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_ramp.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_rf_ook.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_rtc.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_sam_m8q.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_sc16is740.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_scheduler.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_servo.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_sgp30.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_sgpc3.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_sha256.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_sht20.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_sht30.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_sleep.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_soil_sensor.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_spi.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_spirit1.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_sps30.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_ssd1306.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_switch.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_system.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_tag_barometer.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_tag_humidity.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_tag_lux_meter.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_tag_nfc.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_tag_temperature.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_tag_voc.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_tag_voc_lp.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_tca9534a.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_td1207r.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_tick.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_timer.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_tmp112.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_uart.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_usb_cdc.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_watchdog.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_ws2812b.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_wssfm10r1at.c.obj sdk/CMakeFiles/firmware.dir/twr/src/twr_zssc3123.c.obj sdk/CMakeFiles/firmware.dir/twr/stm/src/stm32l0xx_it.c.obj sdk/CMakeFiles/firmware.dir/twr/stm/src/usbd_cdc_if.c.obj sdk/CMakeFiles/firmware.dir/twr/stm/src/usbd_conf.c.obj sdk/CMakeFiles/firmware.dir/twr/stm/src/usbd_desc.c.obj sdk/CMakeFiles/firmware.dir/stm/hal/src/stm32l0xx_hal.c.obj sdk/CMakeFiles/firmware.dir/stm/hal/src/stm32l0xx_hal_adc.c.obj sdk/CMakeFiles/firmware.dir/stm/hal/src/stm32l0xx_hal_adc_ex.c.obj sdk/CMakeFiles/firmware.dir/stm/hal/src/stm32l0xx_hal_comp.c.obj sdk/CMakeFiles/firmware.dir/stm/hal/src/stm32l0xx_hal_comp_ex.c.obj sdk/CMakeFiles/firmware.dir/stm/hal/src/stm32l0xx_hal_cortex.c.obj sdk/CMakeFiles/firmware.dir/stm/hal/src/stm32l0xx_hal_crc.c.obj sdk/CMakeFiles/firmware.dir/stm/hal/src/stm32l0xx_hal_crc_ex.c.obj sdk/CMakeFiles/firmware.dir/stm/hal/src/stm32l0xx_hal_cryp.c.obj sdk/CMakeFiles/firmware.dir/stm/hal/src/stm32l0xx_hal_cryp_ex.c.obj sdk/CMakeFiles/firmware.dir/stm/hal/src/stm32l0xx_hal_dac.c.obj sdk/CMakeFiles/firmware.dir/stm/hal/src/stm32l0xx_hal_dac_ex.c.obj sdk/CMakeFiles/firmware.dir/stm/hal/src/stm32l0xx_hal_dma.c.obj sdk/CMakeFiles/firmware.dir/stm/hal/src/stm32l0xx_hal_firewall.c.obj sdk/CMakeFiles/firmware.dir/stm/hal/src/stm32l0xx_hal_flash.c.obj sdk/CMakeFiles/firmware.dir/stm/hal/src/stm32l0xx_hal_flash_ex.c.obj sdk/CMakeFiles/firmware.dir/stm/hal/src/stm32l0xx_hal_flash_ramfunc.c.obj sdk/CMakeFiles/firmware.dir/stm/hal/src/stm32l0xx_hal_gpio.c.obj sdk/CMakeFiles/firmware.dir/stm/hal/src/stm32l0xx_hal_i2c.c.obj sdk/CMakeFiles/firmware.dir/stm/hal/src/stm32l0xx_hal_i2c_ex.c.obj sdk/CMakeFiles/firmware.dir/stm/hal/src/stm32l0xx_hal_i2s.c.obj sdk/CMakeFiles/firmware.dir/stm/hal/src/stm32l0xx_hal_irda.c.obj sdk/CMakeFiles/firmware.dir/stm/hal/src/stm32l0xx_hal_iwdg.c.obj sdk/CMakeFiles/firmware.dir/stm/hal/src/stm32l0xx_hal_lcd.c.obj sdk/CMakeFiles/firmware.dir/stm/hal/src/stm32l0xx_hal_lptim.c.obj sdk/CMakeFiles/firmware.dir/stm/hal/src/stm32l0xx_hal_pcd.c.obj sdk/CMakeFiles/firmware.dir/stm/hal/src/stm32l0xx_hal_pcd_ex.c.obj sdk/CMakeFiles/firmware.dir/stm/hal/src/stm32l0xx_hal_pwr.c.obj sdk/CMakeFiles/firmware.dir/stm/hal/src/stm32l0xx_hal_pwr_ex.c.obj sdk/CMakeFiles/firmware.dir/stm/hal/src/stm32l0xx_hal_rcc.c.obj sdk/CMakeFiles/firmware.dir/stm/hal/src/stm32l0xx_hal_rcc_ex.c.obj sdk/CMakeFiles/firmware.dir/stm/hal/src/stm32l0xx_hal_rng.c.obj sdk/CMakeFiles/firmware.dir/stm/hal/src/stm32l0xx_hal_rtc.c.obj sdk/CMakeFiles/firmware.dir/stm/hal/src/stm32l0xx_hal_rtc_ex.c.obj sdk/CMakeFiles/firmware.dir/stm/hal/src/stm32l0xx_hal_smartcard.c.obj sdk/CMakeFiles/firmware.dir/stm/hal/src/stm32l0xx_hal_smartcard_ex.c.obj sdk/CMakeFiles/firmware.dir/stm/hal/src/stm32l0xx_hal_smbus.c.obj sdk/CMakeFiles/firmware.dir/stm/hal/src/stm32l0xx_hal_spi.c.obj sdk/CMakeFiles/firmware.dir/stm/hal/src/stm32l0xx_hal_tim.c.obj sdk/CMakeFiles/firmware.dir/stm/hal/src/stm32l0xx_hal_tim_ex.c.obj sdk/CMakeFiles/firmware.dir/stm/hal/src/stm32l0xx_hal_tsc.c.obj sdk/CMakeFiles/firmware.dir/stm/hal/src/stm32l0xx_hal_uart.c.obj sdk/CMakeFiles/firmware.dir/stm/hal/src/stm32l0xx_hal_uart_ex.c.obj sdk/CMakeFiles/firmware.dir/stm/hal/src/stm32l0xx_hal_usart.c.obj sdk/CMakeFiles/firmware.dir/stm/hal/src/stm32l0xx_hal_wwdg.c.obj sdk/CMakeFiles/firmware.dir/stm/spirit1/src/SPIRIT_Aes.c.obj sdk/CMakeFiles/firmware.dir/stm/spirit1/src/SPIRIT_Calibration.c.obj sdk/CMakeFiles/firmware.dir/stm/spirit1/src/SPIRIT_Commands.c.obj sdk/CMakeFiles/firmware.dir/stm/spirit1/src/SPIRIT_Csma.c.obj sdk/CMakeFiles/firmware.dir/stm/spirit1/src/SPIRIT_DirectRF.c.obj sdk/CMakeFiles/firmware.dir/stm/spirit1/src/SPIRIT_General.c.obj sdk/CMakeFiles/firmware.dir/stm/spirit1/src/SPIRIT_Gpio.c.obj sdk/CMakeFiles/firmware.dir/stm/spirit1/src/SPIRIT_Irq.c.obj sdk/CMakeFiles/firmware.dir/stm/spirit1/src/SPIRIT_LinearFifo.c.obj sdk/CMakeFiles/firmware.dir/stm/spirit1/src/SPIRIT_Management.c.obj sdk/CMakeFiles/firmware.dir/stm/spirit1/src/SPIRIT_PktBasic.c.obj sdk/CMakeFiles/firmware.dir/stm/spirit1/src/SPIRIT_PktCommon.c.obj sdk/CMakeFiles/firmware.dir/stm/spirit1/src/SPIRIT_PktMbus.c.obj sdk/CMakeFiles/firmware.dir/stm/spirit1/src/SPIRIT_PktStack.c.obj sdk/CMakeFiles/firmware.dir/stm/spirit1/src/SPIRIT_Qi.c.obj sdk/CMakeFiles/firmware.dir/stm/spirit1/src/SPIRIT_Radio.c.obj sdk/CMakeFiles/firmware.dir/stm/spirit1/src/SPIRIT_Timer.c.obj sdk/CMakeFiles/firmware.dir/stm/spirit1/src/SPIRIT_Types.c.obj sdk/CMakeFiles/firmware.dir/stm/usb/src/usbd_cdc.c.obj sdk/CMakeFiles/firmware.dir/stm/usb/src/usbd_core.c.obj sdk/CMakeFiles/firmware.dir/stm/usb/src/usbd_ctlreq.c.obj sdk/CMakeFiles/firmware.dir/stm/usb/src/usbd_ioreq.c.obj sdk/CMakeFiles/firmware.dir/lib/jsmn/jsmn.c.obj sdk/CMakeFiles/firmware.dir/lib/minmea/minmea.c.obj sdk/CMakeFiles/firmware.dir/sys/src/startup_stm32l083xx.s.obj sdk/CMakeFiles/firmware.dir/sys/src/system_stm32l0xx.c.obj sdk/CMakeFiles/firmware.dir/__/src/application.c.obj -o /home/mixi/pg/tmp/twr-skeleton/out/firmware.elf   && cd /home/mixi/pg/tmp/twr-skeleton/obj/debug/sdk && echo Creating\ out/debug/firmware.bin\ from\ out/debug/firmware.elf... && /usr/bin/arm-none-eabi-objcopy -O binary /home/mixi/pg/tmp/twr-skeleton/out///firmware.elf /home/mixi/pg/tmp/twr-skeleton/out/debug/firmware.bin && /usr/bin/arm-none-eabi-objcopy -O binary /home/mixi/pg/tmp/twr-skeleton/out///firmware.elf /home/mixi/pg/tmp/twr-skeleton/firmware.bin
/usr/lib/gcc/arm-none-eabi/10.3.1/../../../arm-none-eabi/bin/ld: cannot open map file /home/mixi/pg/tmp/twr-skeleton/out/debug/firmware.map: Adresář nebo soubor neexistuje
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

Tool versions:

  • arm-none-eabi-gcc 10.3.1 20210621
  • cmake 3.24.2
  • ninja 1.11.1

Thanks for help.
Mixi

Hello and thanks for noticing.

There was a definition missing in the CMake command -DTYPE=debug to be specific. It should be fixed in the documentation by now.

The new CMake command should look like this: cmake -B obj/debug . -G Ninja -DTYPE=debug -DCMAKE_TOOLCHAIN_FILE=sdk/toolchain/toolchain.cmake

I am sorry for the inconvenience as we are migrating to the new documentation as well as the new build system.

There should be no more errors

Wish you luck with the development

Have a nice day

Jakub

1 Like

Thanks a lot, now it works fine :slight_smile:
Mixi

1 Like