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

nrf9160 region `FLASH' overflowed

1> FAILED: : && ccache /opt/gcc-arm-none-eabi-9-2019-q4-major/bin/arm-none-eabi-gcc zephyr/CMakeFiles/zephyr_prebuilt.dir/misc/empty_file.c.obj -o zephyr/zephyr_prebuilt.elf -Wl,-T zephyr/linker.cmd -Wl,-Map=/root/ncs/nrf/applications/serial_lte_modem/build_nrf9160dk_nrf9160ns/mcuboot/zephyr/zephyr_prebuilt.map -Wl,--whole-archive app/libapp.a zephyr/libzephyr.a zephyr/arch/common/libarch__common.a zephyr/arch/arch/arm/core/aarch32/libarch__arm__core__aarch32.a zephyr/arch/arch/arm/core/aarch32/cortex_m/libarch__arm__core__aarch32__cortex_m.a zephyr/arch/arch/arm/core/aarch32/cortex_m/mpu/libarch__arm__core__aarch32__cortex_m__mpu.a zephyr/arch/arch/arm/core/aarch32/cortex_m/cmse/libarch__arm__core__aarch32__cortex_m__cmse.a zephyr/lib/libc/minimal/liblib__libc__minimal.a zephyr/lib/posix/liblib__posix.a zephyr/soc/arm/common/cortex_m/libsoc__arm__common__cortex_m.a zephyr/boards/boards/arm/nrf9160dk_nrf9160/libboards__arm__nrf9160dk_nrf9160.a zephyr/drivers/gpio/libdrivers__gpio.a zephyr/drivers/flash/libdrivers__flash.a zephyr/drivers/serial/libdrivers__serial.a modules/nrf/lib/fprotect/lib..__nrf__lib__fprotect.a modules/nrf/drivers/hw_cc310/lib..__nrf__drivers__hw_cc310.a modules/mcuboot/boot/bootutil/zephyr/lib..__bootloader__mcuboot__boot__bootutil__zephyr.a modules/hal_nordic/nrfx/libmodules__hal_nordic__nrfx.a -Wl,--no-whole-archive zephyr/kernel/libkernel.a zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj -L"/opt/gcc-arm-none-eabi-9-2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/thumb/v8-m.main+fp/hard" -L/root/ncs/nrf/applications/serial_lte_modem/build_nrf9160dk_nrf9160ns/mcuboot/zephyr -lgcc zephyr/arch/common/libisr_tables.a /root/ncs/nrfxlib/crypto/nrf_cc310_platform/lib/cortex-m33/hard-float/no-interrupts/libnrf_cc310_platform_0.9.7.a -mcpu=cortex-m33 -mthumb -mabi=aapcs -mfpu=fpv5-sp-d16 -Wl,--gc-sections -Wl,--build-id=none -Wl,--sort-common=descending -Wl,--sort-section=alignment -Wl,-u,_OffsetAbsSyms -Wl,-u,_ConfigAbsSyms -nostdlib -static -no-pie -Wl,-X -Wl,-N -Wl,--orphan-handling=warn /root/ncs/nrfxlib/crypto/nrf_cc310_bl/lib/cortex-m33/hard-float/no-interrupts/libnrf_cc310_bl_0.9.12.a && cd /root/ncs/nrf/applications/serial_lte_modem/build_nrf9160dk_nrf9160ns/mcuboot/zephyr && /usr/bin/cmake -E echo

1> /opt/gcc-arm-none-eabi-9-2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: zephyr/zephyr_prebuilt.elf section `text' will not fit in region `FLASH'
1> /opt/gcc-arm-none-eabi-9-2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: region `FLASH' overflowed by 28628 bytes

in non-secure mode will happen

but in secure mode not happen

how to solve?

Parents
  • I got solve this is because mcuboot .text overflow

    when I use CONFIG_DEBUG=y

    in non-secure mode will hapen

    from Map=/root/ncs/nrf/applications/serial_lte_modem/build_nrf9160dk_nrf9160ns/mcuboot/zephyr/zephyr_prebuilt.map -Wl,--whole-archive app/libapp.a zephyr/libzephyr.a zephyr/arch/common/libarch__common.a

    check 
    ~/ncs/zephyr/samples/hello_world/build_nrf9160dk_nrf9160ns/mcuboot/zephyr/zephyr_prebuilt.map

    _flash_used = (LOADADDR (.last_section) - _image_rom_start)

    _image_rom_start = 0x0
    .last_section          =  0x0000000000012fd4

    ~/ncs/zephyr/samples/hello_world/build_nrf9160dk_nrf9160ns/partitions.yml
    mcuboot:
    address: 0x0
    end_address: 0xc000

    12fd4 - c000  = 6FD4 = 28628

    #also can use this tool
    python3 /root/ncs/nrf/scripts/partition_manager_report.py --input /root/ncs/zephyr/samples/hello_world/build_nrf9160dk_nrf9160ns/partitions.yml

    flash_primary (0x100000 - 1024kB):
    +--------------------------------------------------+
    | 0x0: mcuboot (0xc000 - 48kB) |
    | 0xc000: EMPTY_0 (0x4000 - 16kB) |
    +---0x10000: mcuboot_primary (0x78000 - 480kB)-----+
    | 0x10000: mcuboot_pad (0x200 - 512B) |
    +---0x10200: mcuboot_primary_app (0x77e00 - 479kB)-+
    | 0x10200: spm (0x10000 - 64kB) |
    | 0x20200: app (0x67e00 - 415kB) |
    +--------------------------------------------------+
    | 0x88000: mcuboot_secondary (0x78000 - 480kB) |
    +--------------------------------------------------+

    otp (0x2f4 - 756B):
    +------------------------------+
    | 0xff8108: otp (0x2f4 - 756B) |
    +------------------------------+

    sram_primary (0x40000 - 256kB):
    +------------------------------------------------+
    +---0x20000000: sram_secure (0x10000 - 64kB)-----+
    | 0x20000000: spm_sram (0x10000 - 64kB) |
    +---0x20010000: sram_nonsecure (0x30000 - 192kB)-+
    | 0x20010000: sram_primary (0x30000 - 192kB) |
    +------------------------------------------------+

     //////////////////////////////////solve way

    ~/ncs/zephyr/samples/hello_world/prj.conf

    # enable mcuboot/boot/zephyr project  add this
    CONFIG_BOOTLOADER_MCUBOOT=y

    becuase it use another config

    ~/ncs/bootloader/mcuboot/boot/zephyr/prj.conf

    and make .config in ~/ncs/zephyr/samples/hello_world/build_nrf9160dk_nrf9160ns/mcuboot/zephyr/.config

    also can check this, see gcc use -Os

    ~/ncs/zephyr/cmake/compiler/gcc/compiler_flags.cmake

    final make file in ses is ~/ncs/zephyr/samples/hello_world/build_nrf9160dk_nrf9160ns/build.emProject

    ///////////////////////////additional
    someone may ask EMPTY_0 for what to use
    in ~/ncs/nrf/samples/zigbee/ncp/configuration/nrf52840dongle_nrf52840/pm_static.yml

    # Flash reserved for MBR
    EMPTY_0:

    # Flash reserved for nRF5 Bootloader
    EMPTY_1:

    # SRAM reserved to be used by the nRF5 Bootloader
    EMPTY_2:

    explain mbr
    www.freecodecamp.org/.../

Reply
  • I got solve this is because mcuboot .text overflow

    when I use CONFIG_DEBUG=y

    in non-secure mode will hapen

    from Map=/root/ncs/nrf/applications/serial_lte_modem/build_nrf9160dk_nrf9160ns/mcuboot/zephyr/zephyr_prebuilt.map -Wl,--whole-archive app/libapp.a zephyr/libzephyr.a zephyr/arch/common/libarch__common.a

    check 
    ~/ncs/zephyr/samples/hello_world/build_nrf9160dk_nrf9160ns/mcuboot/zephyr/zephyr_prebuilt.map

    _flash_used = (LOADADDR (.last_section) - _image_rom_start)

    _image_rom_start = 0x0
    .last_section          =  0x0000000000012fd4

    ~/ncs/zephyr/samples/hello_world/build_nrf9160dk_nrf9160ns/partitions.yml
    mcuboot:
    address: 0x0
    end_address: 0xc000

    12fd4 - c000  = 6FD4 = 28628

    #also can use this tool
    python3 /root/ncs/nrf/scripts/partition_manager_report.py --input /root/ncs/zephyr/samples/hello_world/build_nrf9160dk_nrf9160ns/partitions.yml

    flash_primary (0x100000 - 1024kB):
    +--------------------------------------------------+
    | 0x0: mcuboot (0xc000 - 48kB) |
    | 0xc000: EMPTY_0 (0x4000 - 16kB) |
    +---0x10000: mcuboot_primary (0x78000 - 480kB)-----+
    | 0x10000: mcuboot_pad (0x200 - 512B) |
    +---0x10200: mcuboot_primary_app (0x77e00 - 479kB)-+
    | 0x10200: spm (0x10000 - 64kB) |
    | 0x20200: app (0x67e00 - 415kB) |
    +--------------------------------------------------+
    | 0x88000: mcuboot_secondary (0x78000 - 480kB) |
    +--------------------------------------------------+

    otp (0x2f4 - 756B):
    +------------------------------+
    | 0xff8108: otp (0x2f4 - 756B) |
    +------------------------------+

    sram_primary (0x40000 - 256kB):
    +------------------------------------------------+
    +---0x20000000: sram_secure (0x10000 - 64kB)-----+
    | 0x20000000: spm_sram (0x10000 - 64kB) |
    +---0x20010000: sram_nonsecure (0x30000 - 192kB)-+
    | 0x20010000: sram_primary (0x30000 - 192kB) |
    +------------------------------------------------+

     //////////////////////////////////solve way

    ~/ncs/zephyr/samples/hello_world/prj.conf

    # enable mcuboot/boot/zephyr project  add this
    CONFIG_BOOTLOADER_MCUBOOT=y

    becuase it use another config

    ~/ncs/bootloader/mcuboot/boot/zephyr/prj.conf

    and make .config in ~/ncs/zephyr/samples/hello_world/build_nrf9160dk_nrf9160ns/mcuboot/zephyr/.config

    also can check this, see gcc use -Os

    ~/ncs/zephyr/cmake/compiler/gcc/compiler_flags.cmake

    final make file in ses is ~/ncs/zephyr/samples/hello_world/build_nrf9160dk_nrf9160ns/build.emProject

    ///////////////////////////additional
    someone may ask EMPTY_0 for what to use
    in ~/ncs/nrf/samples/zigbee/ncp/configuration/nrf52840dongle_nrf52840/pm_static.yml

    # Flash reserved for MBR
    EMPTY_0:

    # Flash reserved for nRF5 Bootloader
    EMPTY_1:

    # SRAM reserved to be used by the nRF5 Bootloader
    EMPTY_2:

    explain mbr
    www.freecodecamp.org/.../

Children
Related