error: 'PM_mcuboot_primary_ID' undeclared (first use in this function) after migrating to HW v2

11 -MD -MT zephyr/subsys/dfu/boot/CMakeFiles/subsys__dfu__boot.dir/mcuboot.c.obj -MF zephyr/subsys/dfu/boot/CMakeFiles/subsys__dfu__boot.dir/mcuboot.c.obj.d -o zephyr/subsys/dfu/boot/CMakeFiles/subsys__dfu__boot.dir/mcuboot.c.obj -c /opt/nordic/ncs/v2.9.2/zephyr/subsys/dfu/boot/mcuboot.c
In file included from /opt/nordic/ncs/v2.9.2/zephyr/include/zephyr/storage/flash_map.h:300,
                 from /opt/nordic/ncs/v2.9.2/zephyr/subsys/dfu/boot/mcuboot.c:12:
/opt/nordic/ncs/v2.9.2/zephyr/subsys/dfu/boot/mcuboot.c: In function 'boot_is_img_confirmed':
/opt/nordic/ncs/v2.9.2/nrf/include/flash_map_pm.h:47:22: error: 'PM_mcuboot_primary_ID' undeclared (first use in this function)
   47 | #define PM_ID(label) PM_##label##_ID
      |                      ^~~
/opt/nordic/ncs/v2.9.2/nrf/include/flash_map_pm.h:52:35: note: in expansion of macro 'PM_ID'
   52 | #define FIXED_PARTITION_ID(label) PM_ID(label)
      |                                   ^~~~~
/opt/nordic/ncs/v2.9.2/zephyr/subsys/dfu/boot/mcuboot_priv.h:22:34: note: in expansion of macro 'FIXED_PARTITION_ID'
   22 | #define FLASH_AREA_IMAGE_PRIMARY FIXED_PARTITION_ID(SLOT0_LABEL)
      |                                  ^~~~~~~~~~~~~~~~~~
/opt/nordic/ncs/v2.9.2/zephyr/subsys/dfu/boot/mcuboot.c:236:30: note: in expansion of macro 'FLASH_AREA_IMAGE_PRIMARY'
  236 |         rc = flash_area_open(FLASH_AREA_IMAGE_PRIMARY, &fa);
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~
/opt/nordic/ncs/v2.9.2/nrf/include/flash_map_pm.h:47:22: note: each undeclared identifier is reported only once for each function it appears in
   47 | #define PM_ID(label) PM_##label##_ID
      |                      ^~~
/opt/nordic/ncs/v2.9.2/nrf/include/flash_map_pm.h:52:35: note: in expansion of macro 'PM_ID'
   52 | #define FIXED_PARTITION_ID(label) PM_ID(label)
      |                                   ^~~~~
/opt/nordic/ncs/v2.9.2/zephyr/subsys/dfu/boot/mcuboot_priv.h:22:34: note: in expansion of macro 'FIXED_PARTITION_ID'
   22 | #define FLASH_AREA_IMAGE_PRIMARY FIXED_PARTITION_ID(SLOT0_LABEL)
      |                                  ^~~~~~~~~~~~~~~~~~
/opt/nordic/ncs/v2.9.2/zephyr/subsys/dfu/boot/mcuboot.c:236:30: note: in expansion of macro 'FLASH_AREA_IMAGE_PRIMARY'
  236 |         rc = flash_area_open(FLASH_AREA_IMAGE_PRIMARY, &fa);
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~
/opt/nordic/ncs/v2.9.2/zephyr/subsys/dfu/boot/mcuboot.c: In function 'boot_write_img_confirmed':
/opt/nordic/ncs/v2.9.2/zephyr/subsys/dfu/boot/mcuboot.c:68:49: error: 'PM_MCUBOOT_PRIMARY_ID' undeclared (first use in this function)
   68 |         #define ACTIVE_SLOT_FLASH_AREA_ID       PM_MCUBOOT_PRIMARY_ID
      |                                                 ^~~~~~~~~~~~~~~~~~~~~
/opt/nordic/ncs/v2.9.2/zephyr/subsys/dfu/boot/mcuboot.c:263:29: note: in expansion of macro 'ACTIVE_SLOT_FLASH_AREA_ID'
  263 |         if (flash_area_open(ACTIVE_SLOT_FLASH_AREA_ID, &fa) != 0) {
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~~
[176/410] Building C object zephyr/subsys/net/ip/CMakeFiles/subsys__net__ip.dir/net_if.c.obj

After I used the migration script to migrate my boards from the HW V1 to V2 I started getting this issue.

I get it across two diffrent boards, I tired other versions of the sdk and tool chain and same issue.

Parents
  • Hello,

    do you have a sysbuild.conf file, and does it contain these lines?

    SB_CONFIG_PARTITION_MANAGER=y
    SB_CONFIG_BOOTLOADER_MCUBOOT=y

  • When I create the the file with those configs the build gets stuck with:
    No fprotect backend selected.

  •  https://devzone.nordicsemi.com/f/nordic-q-a/107303/config_bootloader_mcuboot-on-custom-nrf9160-board/463822  

    Check if the advice in this thread solves your issue.

    If you are still stuck after this, can tell what board you are building for, and preferably also provide the files so it can be reproduced?

  • It did not.
    I tried some more experiments. I went back to HWMV1 which builds on 2.6.2
    I upgraded the Toolchain and ncs to 2.8.2, and I mosved to using the norf9151dk board.
    I attached our prj.config file and the overlay we use with the dk board.


    I put those configs you mentioned into sysbuild.conf

    SB_CONFIG_PARTITION_MANAGER=y
    SB_CONFIG_BOOTLOADER_MCUBOOT=y

    It fails with this

    414/419] Linking C executable zephyr/zephyr_pre0.elf
    FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map /Users/charlesfayal/Projects/NOWI/Engineering/Firmware/cellular-building-monitor/build_dk_nrf9151/cellular-building-monitor/zephyr/zephyr_pre0.map 
    : && ccache /opt/nordic/ncs/toolchains/b8efef2ad5/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc -Os -DNDEBUG -gdwarf-4 zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj -o zephyr/zephyr_pre0.elf  zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj  tfm/api_ns/interface/lib/s_veneers.o  -T  zephyr/linker_zephyr_pre0.cmd  -Wl,-Map=/Users/charlesfayal/Projects/NOWI/Engineering/Firmware/cellular-building-monitor/build_dk_nrf9151/cellular-building-monitor/zephyr/zephyr_pre0.map  -Wl,--whole-archive  app/libapp.a  zephyr/libzephyr.a  zephyr/arch/common/libarch__common.a  zephyr/arch/arch/arm/core/libarch__arm__core.a  zephyr/arch/arch/arm/core/cortex_m/libarch__arm__core__cortex_m.a  zephyr/arch/arch/arm/core/cortex_m/cmse/libarch__arm__core__cortex_m__cmse.a  zephyr/arch/arch/arm/core/mpu/libarch__arm__core__mpu.a  zephyr/lib/libc/newlib/liblib__libc__newlib.a  zephyr/lib/libc/common/liblib__libc__common.a  zephyr/lib/posix/options/liblib__posix__options.a  zephyr/lib/net_buf/liblib__net_buf.a  zephyr/soc/soc/nrf9151/libsoc__nordic.a  zephyr/subsys/random/libsubsys__random.a  zephyr/subsys/dfu/boot/libsubsys__dfu__boot.a  zephyr/subsys/net/libsubsys__net.a  zephyr/subsys/net/l2/offloaded_netdev/libsubsys__net__l2__offloaded_netdev.a  zephyr/subsys/net/ip/libsubsys__net__ip.a  zephyr/subsys/net/lib/mqtt/libsubsys__net__lib__mqtt.a  zephyr/subsys/net/lib/http/libsubsys__net__lib__http.a  zephyr/drivers/clock_control/libdrivers__clock_control.a  zephyr/drivers/console/libdrivers__console.a  zephyr/drivers/entropy/libdrivers__entropy.a  zephyr/drivers/flash/libdrivers__flash.a  zephyr/drivers/gpio/libdrivers__gpio.a  zephyr/drivers/hwinfo/libdrivers__hwinfo.a  zephyr/drivers/i2c/libdrivers__i2c.a  zephyr/drivers/pinctrl/libdrivers__pinctrl.a  zephyr/drivers/pwm/libdrivers__pwm.a  zephyr/drivers/serial/libdrivers__serial.a  zephyr/drivers/timer/libdrivers__timer.a  zephyr/drivers/watchdog/libdrivers__watchdog.a  modules/nrf/lib/nrf_modem_lib/lib..__nrf__lib__nrf_modem_lib.a  modules/nrf/lib/at_cmd_custom/lib..__nrf__lib__at_cmd_custom.a  modules/nrf/lib/at_monitor/lib..__nrf__lib__at_monitor.a  modules/nrf/lib/at_host/lib..__nrf__lib__at_host.a  modules/nrf/lib/at_parser/lib..__nrf__lib__at_parser.a  modules/nrf/lib/lte_link_control/lib..__nrf__lib__lte_link_control.a  modules/nrf/lib/modem_battery/lib..__nrf__lib__modem_battery.a  modules/nrf/lib/modem_info/lib..__nrf__lib__modem_info.a  modules/nrf/lib/modem_key_mgmt/lib..__nrf__lib__modem_key_mgmt.a  modules/nrf/lib/date_time/lib..__nrf__lib__date_time.a  modules/nrf/lib/hw_id/lib..__nrf__lib__hw_id.a  modules/nrf/lib/modem_antenna/lib..__nrf__lib__modem_antenna.a  modules/nrf/subsys/nrf_security/src/zephyr/libmbedtls_zephyr.a  modules/nrf/subsys/net/lib/download_client/lib..__nrf__subsys__net__lib__download_client.a  modules/nrf/subsys/net/lib/fota_download/lib..__nrf__subsys__net__lib__fota_download.a  modules/nrf/subsys/net/lib/aws_jobs/lib..__nrf__subsys__net__lib__aws_jobs.a  modules/nrf/subsys/net/lib/aws_fota/lib..__nrf__subsys__net__lib__aws_fota.a  modules/nrf/subsys/net/lib/aws_iot/lib..__nrf__subsys__net__lib__aws_iot.a  modules/nrf/subsys/net/lib/mqtt_helper/lib..__nrf__subsys__net__lib__mqtt_helper.a  modules/nrf/subsys/dfu/dfu_target/lib..__nrf__subsys__dfu__dfu_target.a  modules/nrf/subsys/fw_info/lib..__nrf__subsys__fw_info.a  modules/nrf/modules/trusted-firmware-m/lib..__nrf__modules__trusted-firmware-m.a  modules/nrf/modules/trusted-firmware-m/libtfm_api_nrf.a  modules/mcuboot/boot/bootutil/zephyr/libmcuboot_util.a  modules/trusted-firmware-m/libtfm_api.a  modules/cjson/libcjson.a  modules/nanopb/libmodules__nanopb.a  modules/hal_nordic/nrfx/libmodules__hal_nordic__nrfx.a  /opt/nordic/ncs/v2.9.2/nrfxlib/nrf_modem/lib/cellular/nrf9120/soft-float/libmodem.a  -Wl,--no-whole-archive  zephyr/kernel/libkernel.a  -L/Users/charlesfayal/Projects/NOWI/Engineering/Firmware/cellular-building-monitor/build_dk_nrf9151/cellular-building-monitor/zephyr  zephyr/arch/common/libisr_tables.a  -mcpu=cortex-m33  -mthumb  -mabi=aapcs  -mfp16-format=ieee  -fuse-ld=bfd  -Wl,--gc-sections  -Wl,--build-id=none  -Wl,--sort-common=descending  -Wl,--sort-section=alignment  -Wl,-u,_OffsetAbsSyms  -Wl,-u,_ConfigAbsSyms  -nostdlib  -static  -Wl,-X  -Wl,-N  -Wl,--orphan-handling=warn  -Wl,-no-pie  -L"/opt/nordic/ncs/toolchains/b8efef2ad5/opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi"/lib/thumb/v8-m.main/nofp  -u_printf_float  -specs=nano.specs  modules/nrf/subsys/nrf_security/src/libmbedcrypto.a  modules/nrf/subsys/nrf_security/src/libmbedcrypto_base.a  modules/nrf/subsys/nrf_security/src/libnrf_security_utils.a  zephyr/kernel/libkernel.a  /opt/nordic/ncs/v2.9.2/nrfxlib/crypto/nrf_oberon/lib/cortex-m33/soft-float/liboberon_mbedtls_3.0.15.a  /opt/nordic/ncs/v2.9.2/nrfxlib/crypto/nrf_oberon/lib/cortex-m33/soft-float/liboberon_3.0.15.a  -lc -L"/opt/nordic/ncs/toolchains/b8efef2ad5/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/thumb/v8-m.main/nofp" -lm -lc -lgcc -lc && cd /Users/charlesfayal/Projects/NOWI/Engineering/Firmware/cellular-building-monitor/build_dk_nrf9151/cellular-building-monitor/zephyr && /opt/nordic/ncs/toolchains/b8efef2ad5/Cellar/cmake/3.21.0/bin/cmake -E true
    /opt/nordic/ncs/toolchains/b8efef2ad5/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/i2c/libdrivers__i2c.a(i2c_nrfx_twim_common.c.obj): in function `nrf_twim_frequency_set':
    /opt/nordic/ncs/v2.9.2/modules/hal/nordic/nrfx/hal/nrf_twim.h:883: undefined reference to `log_const_i2c_nrfx_twim'
    /opt/nordic/ncs/toolchains/b8efef2ad5/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/i2c/libdrivers__i2c.a(i2c_nrfx_twim_common.c.obj): in function `i2c_nrfx_twim_msg_transfer':
    /opt/nordic/ncs/v2.9.2/zephyr/drivers/i2c/i2c_nrfx_twim_common.c:84: undefined reference to `log_const_i2c_nrfx_twim'
    /opt/nordic/ncs/toolchains/b8efef2ad5/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/i2c/libdrivers__i2c.a(i2c_nrfx_twim_common.c.obj): in function `i2c_nrfx_twim_common_init':
    /opt/nordic/ncs/v2.9.2/zephyr/drivers/i2c/i2c_nrfx_twim_common.c:140: undefined reference to `log_const_i2c_nrfx_twim'
    /opt/nordic/ncs/toolchains/b8efef2ad5/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: modules/nrf/lib/lte_link_control/lib..__nrf__lib__lte_link_control.a(lte_lc.c.obj): in function `lte_lc_periodic_search_request':
    /opt/nordic/ncs/v2.9.2/nrf/lib/lte_link_control/lte_lc.c:211: undefined reference to `periodicsearchconf_request'
    collect2: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.

    If I don't use those configs it fails because there's no configured step for mcuboot

    Here's our overlay

    &pinctrl {
    
    	pwmbuzz {
    		compatible = "pwm-leds";
    		buzzpwm: buzz_pwm {
    			pwms = <&pwm0 0 PWM_HZ(880) PWM_POLARITY_NORMAL>;
    		};
    	};
    
    	pwm0_buzz_default: pwm0_buzz_default {
    		group1 {
    			psels = <NRF_PSEL(PWM_OUT0, 0, 5)>;
    			//nordic,invert;
    		};
    	};
    
    	pwm0_buzz_sleep: pwm0_buzz_sleep {
    		group1 {
    			psels = <NRF_PSEL(PWM_OUT0, 0, 5)>;
    			low-power-enable;
    		};
    	};
    
    	i2c2_default_alt: i2c2_default_alt {
    		group1 {
    			nordic,drive-mode = <NRF_DRIVE_H0H1>;
    			psels = <NRF_PSEL(TWIM_SDA, 0, 30)>,
    					<NRF_PSEL(TWIM_SCL, 0, 31)>;
    		};
    	};
    
    	i2c2_sleep_alt: i2c2_sleep_alt {
    		group1 {
    			nordic,drive-mode = <NRF_DRIVE_H0H1>;
    			psels = <NRF_PSEL(TWIM_SDA, 0, 30)>,
    					<NRF_PSEL(TWIM_SCL, 0, 31)>;
    			low-power-enable;
    		};
    	};
    
    	i2c1_default_alt: i2c1_default_alt {
    		group1 {
    			nordic,drive-mode = <NRF_DRIVE_H0H1>;
    			psels = <NRF_PSEL(TWIM_SDA, 0, 26)>,
    					<NRF_PSEL(TWIM_SCL, 0, 27)>;
    		};
    	};
    
    	i2c1_sleep_alt: i2c1_sleep_alt {
    		group1 {
    			nordic,drive-mode = <NRF_DRIVE_H0H1>;
    			psels = <NRF_PSEL(TWIM_SDA, 0, 27)>,
    					<NRF_PSEL(TWIM_SCL, 0, 27)>;
    			low-power-enable;
    		};
    	};
    };
    
    buzz_pwm_inst: &pwm0 {
    	status = "okay";
    	pinctrl-0 = <&pwm0_buzz_default>;
    	pinctrl-1 = <&pwm0_buzz_sleep>;
    	pinctrl-names = "default", "sleep";
    };
    
    mag2: &i2c2 {
    	status = "disabled";
    	compatible = "nordic,nrf-twim";
    	pinctrl-0 = <&i2c2_default_alt>;
    	pinctrl-1 = <&i2c2_sleep_alt>;
    	pinctrl-names = "default", "sleep";
        clock-frequency = < I2C_BITRATE_FAST >;
    };
    
    mag1: &i2c3 {
    	status = "okay";
    	compatible = "nordic,nrf-twim";
    	pinctrl-0 = <&i2c1_default_alt>;
    	pinctrl-1 = <&i2c1_sleep_alt>;
    	pinctrl-names = "default", "sleep";
        clock-frequency = < I2C_BITRATE_FAST >;
    };
    
    / {
    	magnetometer {
    		compatible = "gpio-keys";
    		magpower: mag_power {
    			gpios = <&gpio0 0 (GPIO_ACTIVE_HIGH)>;
    			label = "lis2mdl power pin";
    		};
    		magint: mag_int {
    			gpios = <&gpio0 1 (GPIO_ACTIVE_HIGH)>;
    			label = "lis2mdl int pin";
    		};
    		mag2power: mag2_power {
    			gpios = <&gpio0 4 (GPIO_ACTIVE_HIGH)>;
    			label = "sensor 2 power pin";
    		};
    
    		mag2int: mag2_int {
    			gpios = <&gpio0 3 (GPIO_ACTIVE_HIGH)>;
    			label = "sensor 2 interrupt pin";
    		};
    	};
    	
    	buttons {
    		compatible = "gpio-keys";
    		power_button: button_0 {
    			gpios = <&gpio0 14 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
    			label = "Power Button";
    		};
    	};
    	
    	aliases {
    		successled = &led0;
    		infoled = &led1;
    		errorled = &led2;
    		buzzer = &buzzpwm;
    		power-button = &power_button;
    	};
    };

    Here's our prj.conf

    # AT Host
    CONFIG_UART_INTERRUPT_DRIVEN=y 
    CONFIG_AT_HOST_LIBRARY=y
    
    # Log
    CONFIG_LOG=y
    CONFIG_SERIAL=y
    CONFIG_CONSOLE=y
    CONFIG_UART_CONSOLE=y
    CONFIG_LOG_MODE_IMMEDIATE=y
    
    # NEWLIB C
    CONFIG_NEWLIB_LIBC=y
    CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
    CONFIG_STDOUT_CONSOLE=y
    CONFIG_CBPRINTF_FP_SUPPORT=y
    
    # Network
    CONFIG_NETWORKING=y
    CONFIG_NET_NATIVE=n
    
    # LTE link control
    CONFIG_LTE_LINK_CONTROL=y
    CONFIG_LTE_NETWORK_MODE_LTE_M=y
    
    # Modem library
    CONFIG_NRF_MODEM_LIB=y
    CONFIG_MODEM_KEY_MGMT=y
    
    # AWS IoT library
    CONFIG_AWS_IOT=y
    CONFIG_AWS_IOT_APP_DEVICE_ID_USE_HW_ID=y
    CONFIG_AWS_IOT_BROKER_HOST_NAME="<retracted>"
    CONFIG_MQTT_HELPER_SEC_TAG=<retracted>
    CONFIG_AWS_FOTA_DOWNLOAD_SECURITY_TAG=<retracted>
    # Request the shadow upon a connection to AWS. Sends a shadow request every time which is not needed
    # CONFIG_AWS_IOT_AUTO_DEVICE_SHADOW_REQUEST=y 
    CONFIG_AWS_IOT_TOPIC_UPDATE_DELTA_SUBSCRIBE=y
    CONFIG_MQTT_HELPER_LAST_WILL=y
    CONFIG_AWS_IOT_TOPIC_GET_ACCEPTED_SUBSCRIBE=n
    CONFIG_AWS_IOT_TOPIC_GET_REJECTED_SUBSCRIBE=n
    CONFIG_MQTT_HELPER_RX_TX_BUFFER_SIZE=2048
    CONFIG_AWS_IOT_LOG_LEVEL_OFF=y
    # Default is 30 second but it blocks the algorithm 
    CONFIG_AWS_IOT_CONNECT_TIMEOUT_SECONDS=30
    
    # MQTT - Maximum MQTT keepalive timeout specified by AWS IoT Core is 1200 anything higher just disconnects
    # Settin git at 6000 so it definitely disconnects
    CONFIG_MQTT_KEEPALIVE=6000 
    CONFIG_MQTT_CLEAN_SESSION=n
    
    # Date Time library
    CONFIG_DATE_TIME=y
    
    # Modem information
    CONFIG_MODEM_INFO=y
    CONFIG_BUILD_WITH_TFM=y
    
    # MCUBOOT
    CONFIG_BOOTLOADER_MCUBOOT=y
    CONFIG_MCUBOOT_IMG_MANAGER=y
    
    # Image manager
    CONFIG_IMG_MANAGER=y
    CONFIG_STREAM_FLASH=y
    CONFIG_FLASH_MAP=y
    CONFIG_FLASH=y
    CONFIG_IMG_ERASE_PROGRESSIVELY=y
    
    # AWS FOTA
    CONFIG_AWS_FOTA=y
    CONFIG_FOTA_DOWNLOAD=y
    CONFIG_DFU_TARGET=y
    
    # CJSON
    CONFIG_CJSON_LIB=y
    
    # ProtoBuf
    CONFIG_NANOPB=y
    
    # Download client (needed by AWS FOTA)
    CONFIG_DOWNLOAD_CLIENT=y
    CONFIG_DOWNLOAD_CLIENT_STACK_SIZE=4096
    
    # SENSOR
    CONFIG_I2C=y
    CONFIG_I2C_LOG_LEVEL_OFF=y
    # BUZZER
    CONFIG_PWM=y
    
    # PM
    CONFIG_PM_DEVICE=y
    
    # WDT
    CONFIG_WATCHDOG=y
    CONFIG_WDT_DISABLE_AT_BOOT=y
    CONFIG_WDT_LOG_LEVEL_OFF=y
    
    # NVS
    CONFIG_NVS=y
    CONFIG_FLASH_PAGE_LAYOUT=y
    CONFIG_MPU_ALLOW_FLASH_WRITE=y
    CONFIG_NVS_LOG_LEVEL_OFF=y
    
    # Disabling unused peripherals
    CONFIG_SPI=n
    CONFIG_ADC=n
    
    # Heap and stacks
    CONFIG_HEAP_MEM_POOL_SIZE=65536
    CONFIG_MAIN_STACK_SIZE=32768
    

  • Can you try building this on SDK v3.0.0 or newer?

Reply Children
  • Failed agian with 3.1.1

    with these configs in sysbuild.conf

    SB_CONFIG_PARTITION_MANAGER=y
    SB_CONFIG_BOOTLOADER_MCUBOOT=y



    [289/412] Building C object modules/nrf/subsys/net/lib/download_client/CMakeFiles/..__nrf__subsys__net__lib__download_client.dir/src/download_client.c.obj
    FAILED: modules/nrf/subsys/net/lib/download_client/CMakeFiles/..__nrf__subsys__net__lib__download_client.dir/src/download_client.c.obj 
    ccache /opt/nordic/ncs/toolchains/5c0d382932/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc -DKERNEL -DK_HEAP_MEM_POOL_SIZE=65536 -DMBEDTLS_CONFIG_FILE=\"nrf-config.h\" -DMBEDTLS_PSA_CRYPTO_CONFIG_FILE=\"nrf-psa-crypto-config.h\" -DNRF54L_CONFIGURATION_56_ENABLE=0 -DNRF9120_XXAA -DNRF_SKIP_FICR_NS_COPY_TO_RAM -DNRF_TRUSTZONE_NONSECURE -DPB_MAX_REQUIRED_FIELDS=64 -DUSE_PARTITION_MANAGER=1 -D_ANSI_SOURCE -D__LINUX_ERRNO_EXTENSIONS__ -D__PROGRAM_START -D__ZEPHYR__=1 -I/Users/charlesfayal/Projects/NOWI/Engineering/Firmware/cellular-building-monitor/build_dk_nrf9151/cellular-building-monitor/zephyr/include/generated/zephyr -I/opt/nordic/ncs/v3.1.1/zephyr/include -I/Users/charlesfayal/Projects/NOWI/Engineering/Firmware/cellular-building-monitor/build_dk_nrf9151/cellular-building-monitor/zephyr/include/generated -I/opt/nordic/ncs/v3.1.1/zephyr/soc/nordic -I/opt/nordic/ncs/v3.1.1/zephyr/lib/libc/newlib/include -I/opt/nordic/ncs/v3.1.1/zephyr/soc/nordic/nrf91/. -I/opt/nordic/ncs/v3.1.1/zephyr/soc/nordic/common/. -I/opt/nordic/ncs/v3.1.1/nrf/include -I/opt/nordic/ncs/v3.1.1/nrf/lib/at_parser/include -I/Users/charlesfayal/Projects/NOWI/Engineering/Firmware/cellular-building-monitor/build_dk_nrf9151/cellular-building-monitor/tfm/api_ns/interface/include -I/opt/nordic/ncs/v3.1.1/nrf/subsys/net/lib/download_client/./include -I/opt/nordic/ncs/v3.1.1/nrf/modules/trusted-firmware-m/. -I/opt/nordic/ncs/v3.1.1/nrf/include/tfm -I/opt/nordic/ncs/v3.1.1/nrf/tests/include -I/opt/nordic/ncs/v3.1.1/modules/lib/cjson -I/opt/nordic/ncs/v3.1.1/nrf/modules/cjson/include -I/opt/nordic/ncs/v3.1.1/modules/lib/nanopb -I/opt/nordic/ncs/v3.1.1/modules/hal/cmsis/CMSIS/Core/Include -I/opt/nordic/ncs/v3.1.1/modules/hal/cmsis_6/CMSIS/Core/Include -I/opt/nordic/ncs/v3.1.1/zephyr/modules/cmsis_6/. -I/opt/nordic/ncs/v3.1.1/nrf/modules/hal_nordic/. -I/opt/nordic/ncs/v3.1.1/modules/hal/nordic/nrfx -I/opt/nordic/ncs/v3.1.1/modules/hal/nordic/nrfx/drivers/include -I/opt/nordic/ncs/v3.1.1/modules/hal/nordic/nrfx/mdk -I/opt/nordic/ncs/v3.1.1/zephyr/modules/hal_nordic/nrfx/. -I/opt/nordic/ncs/v3.1.1/nrfxlib/nrf_modem/include -I/Users/charlesfayal/Projects/NOWI/Engineering/Firmware/cellular-building-monitor/boards -I/Users/charlesfayal/Projects/NOWI/Engineering/Firmware/cellular-building-monitor/src/cloud -I/Users/charlesfayal/Projects/NOWI/Engineering/Firmware/cellular-building-monitor/src/wdt -I/Users/charlesfayal/Projects/NOWI/Engineering/Firmware/cellular-building-monitor/src/buzzer -I/Users/charlesfayal/Projects/NOWI/Engineering/Firmware/cellular-building-monitor/src/twi -I/Users/charlesfayal/Projects/NOWI/Engineering/Firmware/cellular-building-monitor/src/led -I/Users/charlesfayal/Projects/NOWI/Engineering/Firmware/cellular-building-monitor/src/algorithm -I/Users/charlesfayal/Projects/NOWI/Engineering/Firmware/cellular-building-monitor/src/utils -I/Users/charlesfayal/Projects/NOWI/Engineering/Firmware/cellular-building-monitor/src/algorithm/building-monitor-algorithm/algorithm -I/Users/charlesfayal/Projects/NOWI/Engineering/Firmware/cellular-building-monitor/src/algorithm/building-monitor-algorithm/algorithm/utilities -I/Users/charlesfayal/Projects/NOWI/Engineering/Firmware/cellular-building-monitor/src/algorithm/building-monitor-algorithm/drivers -I/Users/charlesfayal/Projects/NOWI/Engineering/Firmware/cellular-building-monitor/src/algorithm/building-monitor-algorithm/drivers/lis2mdl -I/Users/charlesfayal/Projects/NOWI/Engineering/Firmware/cellular-building-monitor/src/algorithm/building-monitor-algorithm/filters -I/Users/charlesfayal/Projects/NOWI/Engineering/Firmware/cellular-building-monitor/src/algorithm/building-monitor-algorithm/interfaces -I/Users/charlesfayal/Projects/NOWI/Engineering/Firmware/cellular-building-monitor/src -I/Users/charlesfayal/Projects/NOWI/Engineering/Firmware/cellular-building-monitor/build_dk_nrf9151/cellular-building-monitor/generated/interface_nrf_security_psa -I/opt/nordic/ncs/v3.1.1/nrf/subsys/nrf_security/include -I/opt/nordic/ncs/v3.1.1/modules/crypto/oberon-psa-crypto/include -I/opt/nordic/ncs/v3.1.1/nrf/subsys/nrf_security/src/threading/include -I/opt/nordic/ncs/v3.1.1/nrf/subsys/nrf_security/src/utils -I/opt/nordic/ncs/v3.1.1/modules/crypto/oberon-psa-crypto/library -I/opt/nordic/ncs/v3.1.1/modules/crypto/mbedtls/library -I/opt/nordic/ncs/v3.1.1/modules/crypto/mbedtls/include -I/opt/nordic/ncs/v3.1.1/modules/crypto/mbedtls/include/library -I/opt/nordic/ncs/v3.1.1/nrfxlib/crypto/nrf_oberon/include -I/opt/nordic/ncs/v3.1.1/nrfxlib/crypto/nrf_oberon/include/mbedtls -isystem /opt/nordic/ncs/v3.1.1/zephyr/lib/libc/common/include -fno-strict-aliasing -Os -imacros /Users/charlesfayal/Projects/NOWI/Engineering/Firmware/cellular-building-monitor/build_dk_nrf9151/cellular-building-monitor/zephyr/include/generated/zephyr/autoconf.h -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m33 -mthumb -mabi=aapcs -mfp16-format=ieee --sysroot=/opt/nordic/ncs/toolchains/5c0d382932/opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi -imacros /opt/nordic/ncs/v3.1.1/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wdouble-promotion -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-pic -fno-pie -fno-asynchronous-unwind-tables -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=/Users/charlesfayal/Projects/NOWI/Engineering/Firmware/cellular-building-monitor=CMAKE_SOURCE_DIR -fmacro-prefix-map=/opt/nordic/ncs/v3.1.1/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/opt/nordic/ncs/v3.1.1=WEST_TOPDIR -ffunction-sections -fdata-sections -specs=nano.specs -D_POSIX_THREADS -std=c11 -MD -MT modules/nrf/subsys/net/lib/download_client/CMakeFiles/..__nrf__subsys__net__lib__download_client.dir/src/download_client.c.obj -MF modules/nrf/subsys/net/lib/download_client/CMakeFiles/..__nrf__subsys__net__lib__download_client.dir/src/download_client.c.obj.d -o modules/nrf/subsys/net/lib/download_client/CMakeFiles/..__nrf__subsys__net__lib__download_client.dir/src/download_client.c.obj -c /opt/nordic/ncs/v3.1.1/nrf/subsys/net/lib/download_client/src/download_client.c
    /opt/nordic/ncs/v3.1.1/nrf/subsys/net/lib/download_client/src/download_client.c: In function 'set_recv_socket_timeout':
    /opt/nordic/ncs/v3.1.1/nrf/subsys/net/lib/download_client/src/download_client.c:128:15: warning: implicit declaration of function 'setsockopt'; did you mean 'zsock_setsockopt'? [-Wimplicit-function-declaration]
      128 |         err = setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &timeo, sizeof(timeo));
          |               ^~~~~~~~~~
          |               zsock_setsockopt
    /opt/nordic/ncs/v3.1.1/nrf/subsys/net/lib/download_client/src/download_client.c: In function 'host_lookup':
    /opt/nordic/ncs/v3.1.1/nrf/subsys/net/lib/download_client/src/download_client.c:236:16: error: variable 'hints' has initializer but incomplete type
      236 |         struct addrinfo hints = {
          |                ^~~~~~~~
    /opt/nordic/ncs/v3.1.1/nrf/subsys/net/lib/download_client/src/download_client.c:237:18: error: 'struct addrinfo' has no member named 'ai_family'
      237 |                 .ai_family = family,
          |                  ^~~~~~~~~
    /opt/nordic/ncs/v3.1.1/nrf/subsys/net/lib/download_client/src/download_client.c:237:30: warning: excess elements in struct initializer
      237 |                 .ai_family = family,
          |                              ^~~~~~
    /opt/nordic/ncs/v3.1.1/nrf/subsys/net/lib/download_client/src/download_client.c:237:30: note: (near initialization for 'hints')
    /opt/nordic/ncs/v3.1.1/nrf/subsys/net/lib/download_client/src/download_client.c:236:25: error: storage size of 'hints' isn't known
      236 |         struct addrinfo hints = {
          |                         ^~~~~
    /opt/nordic/ncs/v3.1.1/nrf/subsys/net/lib/download_client/src/download_client.c:249:23: warning: implicit declaration of function 'getaddrinfo'; did you mean 'net_addr_ntop'? [-Wimplicit-function-declaration]
      249 |                 err = getaddrinfo(hostname, pdnserv, &hints, &ai);
          |                       ^~~~~~~~~~~
          |                       net_addr_ntop
    /opt/nordic/ncs/v3.1.1/nrf/subsys/net/lib/download_client/src/download_client.c:260:22: error: invalid use of undefined type 'struct addrinfo'
      260 |         memcpy(sa, ai->ai_addr, ai->ai_addrlen);
          |                      ^~
    /opt/nordic/ncs/v3.1.1/nrf/subsys/net/lib/download_client/src/download_client.c:260:35: error: invalid use of undefined type 'struct addrinfo'
      260 |         memcpy(sa, ai->ai_addr, ai->ai_addrlen);
          |                                   ^~
    /opt/nordic/ncs/v3.1.1/nrf/subsys/net/lib/download_client/src/download_client.c:261:9: warning: implicit declaration of function 'freeaddrinfo'; did you mean 'zsock_freeaddrinfo'? [-Wimplicit-function-declaration]
      261 |         freeaddrinfo(ai);
          |         ^~~~~~~~~~~~
          |         zsock_freeaddrinfo
    /opt/nordic/ncs/v3.1.1/nrf/subsys/net/lib/download_client/src/download_client.c:236:25: warning: unused variable 'hints' [-Wunused-variable]
      236 |         struct addrinfo hints = {
          |                         ^~~~~
    /opt/nordic/ncs/v3.1.1/nrf/subsys/net/lib/download_client/src/download_client.c: In function 'client_socket_connect':
    /opt/nordic/ncs/v3.1.1/nrf/subsys/net/lib/download_client/src/download_client.c:288:18: warning: implicit declaration of function 'socket' [-Wimplicit-function-declaration]
      288 |         dl->fd = socket(dl->remote_addr.sa_family, type, dl->proto);
          |                  ^~~~~~
    /opt/nordic/ncs/v3.1.1/nrf/subsys/net/lib/download_client/src/download_client.c:340:17: warning: implicit declaration of function 'inet_ntop' [-Wimplicit-function-declaration]
      340 |                 inet_ntop(dl->remote_addr.sa_family, sin_addr, ip_addr_str, sizeof(ip_addr_str));
          |                 ^~~~~~~~~
    /opt/nordic/ncs/v3.1.1/nrf/subsys/net/lib/download_client/src/download_client.c:346:15: warning: implicit declaration of function 'connect' [-Wimplicit-function-declaration]
      346 |         err = connect(dl->fd, &dl->remote_addr, addrlen);
          |               ^~~~~~~
    /opt/nordic/ncs/v3.1.1/nrf/subsys/net/lib/download_client/src/download_client.c:361:25: warning: implicit declaration of function 'close'; did you mean 'fclose'? [-Wimplicit-function-declaration]
      361 |                         close(dl->fd);
          |                         ^~~~~
          |                         fclose
    /opt/nordic/ncs/v3.1.1/nrf/subsys/net/lib/download_client/src/download_client.c: In function 'socket_send':
    /opt/nordic/ncs/v3.1.1/nrf/subsys/net/lib/download_client/src/download_client.c:480:24: warning: implicit declaration of function 'send' [-Wimplicit-function-declaration]
      480 |                 sent = send(client->fd, client->buf + off, len, 0);
          |                        ^~~~
    /opt/nordic/ncs/v3.1.1/nrf/subsys/net/lib/download_client/src/download_client.c: In function 'socket_recv':
    /opt/nordic/ncs/v3.1.1/nrf/subsys/net/lib/download_client/src/download_client.c:588:16: warning: implicit declaration of function 'recv' [-Wimplicit-function-declaration]
      588 |         return recv(dl->fd, dl->buf + dl->offset, sizeof(dl->buf) - dl->offset, 0);
          |                ^~~~
    [300/412] Building C object zephyr/drivers/serial/CMakeFiles/drivers__serial.dir/uart_nrfx_uarte.c.obj
    ninja: build stopped: subcommand failed.
    [10/20] No configure step for 'mcuboot'


    without those configs we still hit this issue
    opt/nordic/ncs/v3.1.1/zephyr/subsys/dfu/boot/mcuboot.c: In function 'boot_fetch_active_slot':
    /opt/nordic/ncs/v3.1.1/zephyr/subsys/dfu/boot/mcuboot.c:83:49: error: 'PM_MCUBOOT_PRIMARY_ID' undeclared (first use in this function)
       83 |         #define ACTIVE_SLOT_FLASH_AREA_ID       PM_MCUBOOT_PRIMARY_ID
          |                                                 ^~~~~~~~~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.1.1/zephyr/subsys/dfu/boot/mcuboot.c:149:16: note: in expansion of macro 'ACTIVE_SLOT_FLASH_AREA_ID'
      149 |         return ACTIVE_SLOT_FLASH_AREA_ID;
          |                ^~~~~~~~~~~~~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.1.1/zephyr/subsys/dfu/boot/mcuboot.c:83:49: note: each undeclared identifier is reported only once for each function it appears in
       83 |         #define ACTIVE_SLOT_FLASH_AREA_ID       PM_MCUBOOT_PRIMARY_ID
          |                                                 ^~~~~~~~~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.1.1/zephyr/subsys/dfu/boot/mcuboot.c:149:16: note: in expansion of macro 'ACTIVE_SLOT_FLASH_AREA_ID'
      149 |         return ACTIVE_SLOT_FLASH_AREA_ID;
          |                ^~~~~~~~~~~~~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.1.1/zephyr/subsys/dfu/boot/mcuboot.c: In function 'boot_is_img_confirmed':
    /opt/nordic/ncs/v3.1.1/zephyr/subsys/dfu/boot/mcuboot.c:83:49: error: 'PM_MCUBOOT_PRIMARY_ID' undeclared (first use in this function)
       83 |         #define ACTIVE_SLOT_FLASH_AREA_ID       PM_MCUBOOT_PRIMARY_ID
          |                                                 ^~~~~~~~~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.1.1/zephyr/subsys/dfu/boot/mcuboot.c:345:30: note: in expansion of macro 'ACTIVE_SLOT_FLASH_AREA_ID'
      345 |         rc = flash_area_open(ACTIVE_SLOT_FLASH_AREA_ID, &fa);
          |                              ^~~~~~~~~~~~~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.1.1/zephyr/subsys/dfu/boot/mcuboot.c: In function 'boot_write_img_confirmed':
    /opt/nordic/ncs/v3.1.1/zephyr/subsys/dfu/boot/mcuboot.c:83:49: error: 'PM_MCUBOOT_PRIMARY_ID' undeclared (first use in this function)
       83 |         #define ACTIVE_SLOT_FLASH_AREA_ID       PM_MCUBOOT_PRIMARY_ID
          |                                                 ^~~~~~~~~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.1.1/zephyr/subsys/dfu/boot/mcuboot.c:372:29: note: in expansion of macro 'ACTIVE_SLOT_FLASH_AREA_ID'
      372 |         if (flash_area_open(ACTIVE_SLOT_FLASH_AREA_ID, &fa) != 0) {
          |                             ^~~~~~~~~~~~~~~~~~~~~~~~~
    /opt/nordic/ncs/v3.1.1/zephyr/subsys/dfu/boot/mcuboot.c: In function 'boot_fetch_active_slot':
    /opt/nordic/ncs/v3.1.1/zephyr/subsys/dfu/boot/mcuboot.c:150:1: warning: control reaches end of non-void function [-Wreturn-type]
      150 | }
          | ^
    [226/410] Building C object zephyr/drivers/pwm/CMakeFiles/drivers__pwm.dir/pwm_nrfx.c.obj
    ninja: build stopped: subcommand failed.

  • Can you provide the zephyr.dts file for the first build?

Related