NRF54L15, error: 'FLASH_DEVICE_BASE' undeclared, while using BLE for OTA

Hello,

I am trying to implement OTA through BLE, and as Im building the program, Im getting a build error as : 

error: 'FLASH_DEVICE_BASE' undeclared (first use in this function)
58 | *ret = FLASH_DEVICE_BASE;

The application is getting build properly, but the mcuboot is not getting build.

I am using sdk version v3.0.2.

  • Hi,

    I have not found any reference sto this error before, and this is normally not something you need to set. Can you explain how you add the bootlader and share the full build log?

  • Hello, 
    I was facing this issue in flash_map_extended.c file in the path : C:\ncs\v3.0.2\bootloader\mcuboot\boot\zephyr\flash_map_extended.c

    BOOT_LOG_MODULE_DECLARE(mcuboot);

    #if (!defined(CONFIG_XTENSA) && DT_HAS_CHOSEN(zephyr_flash_controller))
    #define FLASH_DEVICE_ID SOC_FLASH_0_ID
    #define FLASH_DEVICE_BASE CONFIG_FLASH_BASE_ADDRESS
    #define FLASH_DEVICE_NODE DT_CHOSEN(zephyr_flash_controller)

    #elif (defined(CONFIG_XTENSA) && DT_NODE_EXISTS(DT_INST(0, jedec_spi_nor)))
    #define FLASH_DEVICE_ID SPI_FLASH_0_ID
    #define FLASH_DEVICE_BASE 0
    #define FLASH_DEVICE_NODE DT_INST(0, jedec_spi_nor)

    #elif defined(CONFIG_SOC_FAMILY_ESPRESSIF_ESP32)

    #define FLASH_DEVICE_ID SPI_FLASH_0_ID
    #define FLASH_DEVICE_BASE 0
    #define FLASH_DEVICE_NODE DT_CHOSEN(zephyr_flash_controller)

    #elif (defined(CONFIG_SOC_SERIES_NRF54HX) && DT_HAS_CHOSEN(zephyr_flash))

    #define FLASH_DEVICE_ID SPI_FLASH_0_ID
    #define FLASH_DEVICE_BASE CONFIG_FLASH_BASE_ADDRESS
    #define FLASH_DEVICE_NODE DT_CHOSEN(zephyr_flash)

    #else
    #error "FLASH_DEVICE_ID could not be determined"
    #endif

    static const struct device *flash_dev = DEVICE_DT_GET(FLASH_DEVICE_NODE);

    int flash_device_base(uint8_t fd_id, uintptr_t *ret)
    {
        if (fd_id != FLASH_DEVICE_ID) {
            BOOT_LOG_ERR("invalid flash ID %d; expected %d",
                         fd_id, FLASH_DEVICE_ID);
            return -EINVAL;
        }
        *ret = FLASH_DEVICE_BASE;
        return 0;
    }
    In this function, the build error occured when non of the conditions were reached. But when I made the condition as : 
    #elif (defined(CONFIG_SOC_SERIES_NRF54HX) || defined(CONFIG_SOC_SERIES_NRF54LX) &&DT_HAS_CHOSEN(zephyr_flash))
    The code was build, and OTA also was possible.
    Am I supposed to change the libraby file in this way?
    Or is there any other workaround for this?
  • Hi,

    You should not need to make any changes in that file. I am curions about how you ended up in this. Are you attempting to enable the BL2 bootloader from TF-M or similar? That is not supported with nRF Connect SDK. Instructions fro adding bootloader in nRF Connect SDK can be found here (I also recomend the module on that here).

  • How I added the Bootloader :

    mcuboot.overlay - 

    / {
        chosen {
            zephyr,code-partition = &slot0_partition;
            zephyr,flash = &cpuapp_rram;
        };
    };
    mcuboot.conf:
    CONFIG_PM_PARTITION_SIZE_MCUBOOT=0xF000
    CONFIG_BOOT_MAX_IMG_SECTORS=512
    CONFIG_MPU_ALLOW_FLASH_WRITE=y
    CONFIG_FLASH_PAGE_LAYOUT=y
    CONFIG_MULTITHREADING=y

    CONFIG_FLASH=y
    CONFIG_FLASH_MAP=y
    sysbuild.conf : 
    SB_CONFIG_BOOTLOADER_MCUBOOT=y
    prj.conf
    CONFIG_IMG_MANAGER=y
    CONFIG_STREAM_FLASH=y
    CONFIG_BOOTLOADER_MCUBOOT=y
    CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y
    CONFIG_BOOTLOADER_MCUBOOT=y
  • Hi,

    This looks mostly sensible. However, the .overlay file there have configs you could put in the board files and that are allready there is using a DK. Are you using a DK or a custom board?

    If using a DK and to have a working example, you can refer to the smp_svr sample that support the nRF54L15 DK out of the box.

    If you don't make any progress, perhaps you can share the full project along with how you build and if using a custom baord, also the custom board files?

Related