This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Flash Overflowed FOTA upgrade sdk 1.6.0 (Zephyr) nRF52

Hello
I made an application on the nRF52 sdk, which works correctly.
Now I want to add the ability to update the firmware via OTA bluetooth.
so my prj.conf file contains if following instructions;
CONFIG_BT = y
CONFIG_BT_BROADCASTER = y
CONFIG_BT_OBSERVER = y
CONFIG_BT_DEBUG_LOG = y
CONFIG_I2C = y
CONFIG_FPU = y
CONFIG_NEWLIB_LIBC = y
CONFIG_NEWLIB_LIBC_NANO = n
CONFIG_PWM = y
# Enable mcumgr.
CONFIG_MCUMGR = y
# Ensure an MCUboot-compatible binary is generated.
CONFIG_BOOTLOADER_MCUBOOT = y
# Enable flash operations. CONFIG_FLASH = y
# Enable most core commands.
CONFIG_MCUMGR_CMD_IMG_MGMT = y
CONFIG_MCUMGR_CMD_OS_MGMT = y CONFIG_MCUMGR_CMD_STAT_MGMT = y
CONFIG_MCUMGR_SMP_BT = y
And the main is the following:
#ifdef CONFIG_MCUMGR_CMD_OS_MGMT
#include "os_mgmt / os_mgmt.h"
#endif
#ifdef CONFIG_MCUMGR_CMD_IMG_MGMT
#include "img_mgmt / img_mgmt.h"
#endif
#ifdef CONFIG_MCUMGR_SMP_BT
#include "mgmt \ mcumgr \ smp_bt.h"
#endif
K_THREAD_DEFINE (rtc_task_id, STACKSIZE, Rtc_Task, NULL, NULL, NULL, PRIORITY, 0, 0);
K_THREAD_DEFINE (I2CManager_id, STACKSIZE, I2CManager, NULL, NULL, NULL, PRIORITY, 0, 0);
K_THREAD_DEFINE (bletxrx_id, STACKSIZE, BleTxRx, NULL, NULL, NULL, PRIORITY, 0, 0);
K_THREAD_DEFINE (Clock_id, STACKSIZE, ClockManager, NULL, NULL, NULL, PRIORITY, 0, 0);
void main () {
os_mgmt_register_group ();
img_mgmt_register_group ();
smp_bt_register ();
while (1) k_sleep (K_MSEC (10000));
}
When I build the solution, I get the following error:
region `FLASH' overflowed by 46088 bytes
see image below 
What steps should I take to solve the problem?
Thanks in advance
Fausto
volume_up
content_copy
share
Parents
  • Hi,

    Which nRF5 device are you working with? FOTA uses dual-bank update, which means you need to have double the flash size of the application available. Try running

    west build -t rom_report

    to see how much flash the different libraries on the application are using.

    Best regards,

    Marjeris

  • HI,

    I'm using nRF52dk_NRF52852,

    in witch directory i use the command 

    west build -t rom_report

    Tanks

    Best regards

    Fausto

  • Hi ,

    now i get this error

    what to do?

    thanks

    Best Regards

    Fausto

  • Hi, 

    i need help to solve the error in previous post.

    Thanks in avance

    Fausto

  • HI 

    I execute the command :  build -t rom_report,  (in the build_crf52dk_nrf52832 directory and get this error:

    :\Users\PCF\ncs\v1.6.0\zephyr\samples\bluetooth\scan_adv\build_nrf52dk_nrf52832>west build -t rom_report
    -- west build: running target rom_report
    [0/17] Performing build step for 'mcuboot_subimage'
    ninja: no work to do.
    [2/15] Linking C executable zephyr\zephyr_prebuilt.elf
    FAILED: zephyr/zephyr_prebuilt.elf zephyr/zephyr_prebuilt.map
    cmd.exe /C "cd . && C:\Users\PCF\ncs\v1.6.0\toolchain\opt\bin\arm-none-eabi-gcc.exe @CMakeFiles\zephyr_prebuilt.rsp -o zephyr\zephyr_prebuilt.elf && cmd.exe /C "cd /D C:\Users\PCF\ncs\v1.6.0\zephyr\samples\bluetooth\scan_adv\build_nrf52dk_nrf52832\zephyr && C:\Users\PCF\ncs\v1.6.0\toolchain\opt\bin\cmake.exe -E echo ""
    c:/users/pcf/ncs/v1.6.0/toolchain/opt/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: zephyr\zephyr_prebuilt.elf section `text' will not fit in region `FLASH'
    c:/users/pcf/ncs/v1.6.0/toolchain/opt/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: region `FLASH' overflowed by 46088 bytes
    collect2.exe: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: 'C:\Users\PCF\ncs\v1.6.0\toolchain\opt\bin\cmake.EXE' --build 'C:\Users\PCF\ncs\v1.6.0\zephyr\samples\bluetooth\scan_adv\build_nrf52dk_nrf52832' --target rom_report

    C:\Users\PCF\ncs\v1.6.0\zephyr\samples\bluetooth\scan_adv\build_nrf52dk_nrf52832>

    I need help to integrate the FOTA in my application.

    Tanks in avance.

    Fausto

  • HI,

    OK thank you.
    I have the nRFDK_nRF52832, so to test the FOTA I modified the code of the blink example, adding the following activations in the prj.conf

    CONFIG_GPIO=y

    # Enable mcumgr.
    CONFIG_MCUMGR=y

    # Ensure an MCUboot-compatible binary is generated.
    CONFIG_BOOTLOADER_MCUBOOT=y

    # Enable flash operations.
    CONFIG_FLASH=y

    # Enable most core commands.
    CONFIG_MCUMGR_CMD_IMG_MGMT=y
    CONFIG_MCUMGR_CMD_OS_MGMT=y
    CONFIG_MCUMGR_CMD_STAT_MGMT=y
    CONFIG_MCUMGR_SMP_BT=y

    I added the bluetooth.c file taken from the smp_svr example to the project, and I modified the main in this way .

    /*
    * Copyright (c) 2016 Intel Corporation
    *
    * SPDX-License-Identifier: Apache-2.0
    */

    #include <zephyr.h>
    #include <stats/stats.h>
    #include <device.h>
    #include <devicetree.h>
    #include <drivers/gpio.h>
    #include <bluetooth/bluetooth.h>
    #include <bluetooth/hci.h>
    #include <bluetooth/gap.h>
    #include "common.h"
    /* 1000 msec = 1 sec */
    #define SLEEP_TIME_MS 100

    /* The devicetree node identifier for the "led0" alias. */
    #define LED0_NODE DT_ALIAS(led0)

    #if DT_NODE_HAS_STATUS(LED0_NODE, okay)
    #define LED0 DT_GPIO_LABEL(LED0_NODE, gpios)
    #define PIN DT_GPIO_PIN(LED0_NODE, gpios)
    #define FLAGS DT_GPIO_FLAGS(LED0_NODE, gpios)
    #else
    /* A build error here means your board isn't set up to blink an LED. */
    #error "Unsupported board: led0 devicetree alias is not defined"
    #define LED0 ""
    #define PIN 0
    #define FLAGS 0
    #endif

    #ifdef CONFIG_MCUMGR_CMD_FS_MGMT
    #include <device.h>
    #include <fs/fs.h>
    #include "fs_mgmt/fs_mgmt.h"
    #include <fs/littlefs.h>
    #endif
    #ifdef CONFIG_MCUMGR_CMD_OS_MGMT
    #include "os_mgmt/os_mgmt.h"
    #endif
    #ifdef CONFIG_MCUMGR_CMD_IMG_MGMT
    #include "img_mgmt/img_mgmt.h"
    #endif
    #ifdef CONFIG_MCUMGR_CMD_STAT_MGMT
    #include "stat_mgmt/stat_mgmt.h"
    #endif
    #ifdef CONFIG_MCUMGR_SMP_BT
    #include "mgmt\mcumgr\smp_bt.h"
    #endif
    #ifdef CONFIG_MCUMGR_CMD_SHELL_MGMT
    #include "shell_mgmt/shell_mgmt.h"
    #endif
    #ifdef CONFIG_MCUMGR_CMD_FS_MGMT
    #include "fs_mgmt/fs_mgmt.h"
    #endif

    void main(void)
    {
    const struct device *dev;
    bool led_is_on = true;
    int ret;
    os_mgmt_register_group();
    img_mgmt_register_group();
    smp_bt_register();
    #ifdef CONFIG_MCUMGR_SMP_BT
    start_smp_bluetooth();
    #endif

    dev = device_get_binding(LED0);
    if (dev == NULL) {
    return;
    }

    ret = gpio_pin_configure(dev, PIN, GPIO_OUTPUT_ACTIVE | FLAGS);
    if (ret < 0) {
    return;
    }

    while (1) {
    gpio_pin_set(dev, PIN, (int)led_is_on);
    led_is_on = !led_is_on;
    k_msleep(SLEEP_TIME_MS);
    STATS_INC(smp_svr_stats, ticks);
    }
    }

    The project is compiled without errors, and start.


    Activated nRF Connect on my phone, I see the Zephyr connection, I can connect, I select the DFU button, I select the app_update.bin file generated, but the update procedure stops during validation.

    Could you help me understand where I went wrong.
    Thanks in advance
    Fausto
Reply
  • HI,

    OK thank you.
    I have the nRFDK_nRF52832, so to test the FOTA I modified the code of the blink example, adding the following activations in the prj.conf

    CONFIG_GPIO=y

    # Enable mcumgr.
    CONFIG_MCUMGR=y

    # Ensure an MCUboot-compatible binary is generated.
    CONFIG_BOOTLOADER_MCUBOOT=y

    # Enable flash operations.
    CONFIG_FLASH=y

    # Enable most core commands.
    CONFIG_MCUMGR_CMD_IMG_MGMT=y
    CONFIG_MCUMGR_CMD_OS_MGMT=y
    CONFIG_MCUMGR_CMD_STAT_MGMT=y
    CONFIG_MCUMGR_SMP_BT=y

    I added the bluetooth.c file taken from the smp_svr example to the project, and I modified the main in this way .

    /*
    * Copyright (c) 2016 Intel Corporation
    *
    * SPDX-License-Identifier: Apache-2.0
    */

    #include <zephyr.h>
    #include <stats/stats.h>
    #include <device.h>
    #include <devicetree.h>
    #include <drivers/gpio.h>
    #include <bluetooth/bluetooth.h>
    #include <bluetooth/hci.h>
    #include <bluetooth/gap.h>
    #include "common.h"
    /* 1000 msec = 1 sec */
    #define SLEEP_TIME_MS 100

    /* The devicetree node identifier for the "led0" alias. */
    #define LED0_NODE DT_ALIAS(led0)

    #if DT_NODE_HAS_STATUS(LED0_NODE, okay)
    #define LED0 DT_GPIO_LABEL(LED0_NODE, gpios)
    #define PIN DT_GPIO_PIN(LED0_NODE, gpios)
    #define FLAGS DT_GPIO_FLAGS(LED0_NODE, gpios)
    #else
    /* A build error here means your board isn't set up to blink an LED. */
    #error "Unsupported board: led0 devicetree alias is not defined"
    #define LED0 ""
    #define PIN 0
    #define FLAGS 0
    #endif

    #ifdef CONFIG_MCUMGR_CMD_FS_MGMT
    #include <device.h>
    #include <fs/fs.h>
    #include "fs_mgmt/fs_mgmt.h"
    #include <fs/littlefs.h>
    #endif
    #ifdef CONFIG_MCUMGR_CMD_OS_MGMT
    #include "os_mgmt/os_mgmt.h"
    #endif
    #ifdef CONFIG_MCUMGR_CMD_IMG_MGMT
    #include "img_mgmt/img_mgmt.h"
    #endif
    #ifdef CONFIG_MCUMGR_CMD_STAT_MGMT
    #include "stat_mgmt/stat_mgmt.h"
    #endif
    #ifdef CONFIG_MCUMGR_SMP_BT
    #include "mgmt\mcumgr\smp_bt.h"
    #endif
    #ifdef CONFIG_MCUMGR_CMD_SHELL_MGMT
    #include "shell_mgmt/shell_mgmt.h"
    #endif
    #ifdef CONFIG_MCUMGR_CMD_FS_MGMT
    #include "fs_mgmt/fs_mgmt.h"
    #endif

    void main(void)
    {
    const struct device *dev;
    bool led_is_on = true;
    int ret;
    os_mgmt_register_group();
    img_mgmt_register_group();
    smp_bt_register();
    #ifdef CONFIG_MCUMGR_SMP_BT
    start_smp_bluetooth();
    #endif

    dev = device_get_binding(LED0);
    if (dev == NULL) {
    return;
    }

    ret = gpio_pin_configure(dev, PIN, GPIO_OUTPUT_ACTIVE | FLAGS);
    if (ret < 0) {
    return;
    }

    while (1) {
    gpio_pin_set(dev, PIN, (int)led_is_on);
    led_is_on = !led_is_on;
    k_msleep(SLEEP_TIME_MS);
    STATS_INC(smp_svr_stats, ticks);
    }
    }

    The project is compiled without errors, and start.


    Activated nRF Connect on my phone, I see the Zephyr connection, I can connect, I select the DFU button, I select the app_update.bin file generated, but the update procedure stops during validation.

    Could you help me understand where I went wrong.
    Thanks in advance
    Fausto
Children
No Data
Related