section `rodata' will not fit in region `FLASH bin/ld.exe: region `FLASH' overflowed by 6134 bytes

The project can be compiled and run normally before adding CONFIG_MCUMGR   and other configurations。

The detailed configurations added are as follows:

CONFIG_MCUMGR=y

CONFIG_BOOTLOADER_MCUBOOT=y

CONFIG_MCUMGR_MGMT_NOTIFICATION_HOOKS=y

CONFIG_MCUMGR_CMD_IMG_MGMT=y

CONFIG_MCUMGR_GRP_IMG_STATUS_HOOKS=y

CONFIG_MCUMGR_GRP_IMG_UPLOAD_CHECK_HOOK=y

CONFIG_MCUBOOT_IMAGE_VERSION="2.1.4+0"

After that, there was an error in compiling:

The result was successfully compiled before adding the above configuration:

nrf5340 flash has 1M bytes, which accounts for 16.38% without boot, and it is impossible to add the boot function to exceed the size。

my  prj.con

#
# Copyright (c) 2018 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

# Enable the UART driver

CONFIG_NRFX_UARTE0=y


# Make sure printk is printing to the UART console
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
#300k 204800
CONFIG_HEAP_MEM_POOL_SIZE= 204800
CONFIG_MAIN_STACK_SIZE=8192
CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME="Nordic_UART_Service"
CONFIG_BT_DEVICE_APPEARANCE=833
CONFIG_BT_MAX_CONN=1

# Enable the NUS service
CONFIG_BT_NUS=y

# Enable bonding
CONFIG_BT_SETTINGS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y
CONFIG_NVS=y
CONFIG_SETTINGS=y

# Enable DK LED and Buttons library
CONFIG_DK_LIBRARY=y

# This example requires more workqueue stack
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096

# Config logger
CONFIG_LOG=y
CONFIG_USE_SEGGER_RTT=y
CONFIG_LOG_BACKEND_RTT=y
CONFIG_LOG_BACKEND_UART=n
CONFIG_LOG_PRINTK=n

# CONFIG_ASSERT=y
# 编译
CONFIG_DEBUG_THREAD_INFO=y
CONFIG_DEBUG_OPTIMIZATIONS=y
CONFIG_BT_NUS_SECURITY_ENABLED=n

# *****蓝牙协议配置*****

#  更新参数
CONFIG_BT_USER_DATA_LEN_UPDATE=y
CONFIG_BT_USER_PHY_UPDATE=y
CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=n

# 参数大小
CONFIG_BT_BUF_ACL_RX_SIZE=502
CONFIG_BT_ATT_PREPARE_COUNT=2
CONFIG_BT_L2CAP_TX_BUF_COUNT=10
CONFIG_BT_L2CAP_TX_MTU=512
CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
CONFIG_BT_CONN_TX_MAX=10
CONFIG_BT_BUF_ACL_TX_COUNT=10
CONFIG_BT_BUF_ACL_TX_SIZE=502

# 需要在child_img 的prj 再次设置
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
CONFIG_BT_CTLR_PHY_2M=y
CONFIG_BT_CTLR_RX_BUFFERS=2
CONFIG_BT_CTLR_SDC_MAX_CONN_EVENT_LEN_DEFAULT=4000000


# 外设配置
CONFIG_I2C=y
CONFIG_SPI=y
CONFIG_NFCT_PINS_AS_GPIOS=y
CONFIG_SENSOR=y
CONFIG_ADC=y

CONFIG_NRFX_RTC0=y
CONFIG_NEWLIB_LIBC=y
CONFIG_POSIX_API=y
CONFIG_ADXL345=y
# CONFIG_ADXL367=y
#zerphyr 配置
CONFIG_FORCE_NO_ASSERT=y
CONFIG_NUM_COOP_PRIORITIES=10
CONFIG_NUM_PREEMPT_PRIORITIES=11

# 添加支持littlefs 相关配置
CONFIG_FILE_SYSTEM=y
CONFIG_FILE_SYSTEM_LITTLEFS=y

# 升级相关
CONFIG_MCUMGR=y
CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_MCUMGR_MGMT_NOTIFICATION_HOOKS=y
CONFIG_MCUMGR_CMD_IMG_MGMT=y
CONFIG_MCUMGR_GRP_IMG_STATUS_HOOKS=y
CONFIG_MCUMGR_GRP_IMG_UPLOAD_CHECK_HOOK=y
CONFIG_MCUBOOT_IMAGE_VERSION="2.1.4+0"

Please help me with this,thanks!

Parents Reply Children
  • Hmm

    Can you paste all of partitions.yml into Insert->Code in a reply here?

  • EMPTY_0:
      address: 0xfe000
      end_address: 0x100000
      placement:
        after:
        - settings_storage
      region: flash_primary
      size: 0x2000
    app:
      address: 0x10200
      end_address: 0xfc000
      region: flash_primary
      size: 0xebe00
    external_flash:
      address: 0x0
      end_address: 0x800000
      region: external_flash
      size: 0x800000
    littlefs_storage:
      address: 0x0
      device: w25q64
      end_address: 0x800000
      filesystem: littlefs
      placement:
        before:
        - end
      region: external_flash
      size: 0x800000
    mcuboot:
      address: 0x0
      end_address: 0x10000
      placement:
        before:
        - mcuboot_primary
      region: flash_primary
      size: 0x10000
    mcuboot_pad:
      address: 0x10000
      end_address: 0x10200
      placement:
        align:
          start: 0x4000
        before:
        - mcuboot_primary_app
      region: flash_primary
      size: 0x200
    mcuboot_primary:
      address: 0x10000
      end_address: 0xfc000
      orig_span: &id001
      - app
      - mcuboot_pad
      region: flash_primary
      size: 0xec000
      span: *id001
    mcuboot_primary_app:
      address: 0x10200
      end_address: 0xfc000
      orig_span: &id002
      - app
      region: flash_primary
      size: 0xebe00
      span: *id002
    mcuboot_secondary:
      address: 0x1000000
      device: DT_CHOSEN(nordic_pm_ext_flash)
      end_address: 0x10ec000
      placement:
        align:
          start: 0x4
      region: external_flash
      share_size:
      - mcuboot_primary
      size: 0xec000
    otp:
      address: 0xff8100
      end_address: 0xff83fc
      region: otp
      size: 0x2fc
    pcd_sram:
      address: 0x20000000
      end_address: 0x20002000
      placement:
        after:
        - start
      region: sram_primary
      size: 0x2000
    rpmsg_nrf53_sram:
      address: 0x20070000
      end_address: 0x20080000
      placement:
        before:
        - end
      region: sram_primary
      size: 0x10000
    settings_storage:
      address: 0xfc000
      end_address: 0xfe000
      placement:
        align:
          start: 0x4000
        before:
        - end
      region: flash_primary
      size: 0x2000
    sram_primary:
      address: 0x20002000
      end_address: 0x20070000
      region: sram_primary
      size: 0x6e000
    

  • dower said:
    I'm using an internal flash

    False.

    From the partitions.yml that you posted, we can see that mcuboot_secondary is in external flash.

    mcuboot_secondary:
      address: 0x1000000
      device: DT_CHOSEN(nordic_pm_ext_flash)
      end_address: 0x10ec000
      placement:
        align:
          start: 0x4
      region: external_flash
      share_size:
      - mcuboot_primary
      size: 0xec000

    Use CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY if you want to configure this.

Related