Flash overflow?

Hello,

I'm trying to merge together a couple of sample projects to make a prototype (in particular, the LTE-BLE gateway, and AWS-IoT samples) - to run on the nRF 9160DK

When I try and compile, I get the following errors:

/opt/nordic/ncs/toolchains/20d68df7e5/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/zephyr_pre0.elf section `text' will not fit in region `FLASH'

/opt/nordic/ncs/toolchains/20d68df7e5/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: region `FLASH' overflowed by 119504 bytes

How can I resolve this please? Or is it just too big to try and fit onto the Dev Kit?

Regards,

Ben

  • Hello Ben,

    I took over the case since my colleague is currently unavailable, but it will take me a bit to understand the background and the issue.

    Sorry for the delays and thank you for your patience.

    Best regards,

    Michal

  • Hi Michal - have you had a chance to get up-to-speed with this one yet?

    Let me try and help by summarising

    • I am working on a project based on the AWS_IoT sample
      • nRF9160 DK / nRF Connect SDK v2.6.0
    • I am trying to add BLE functionality to the sample
      • I just need to be able to scan for BLE advertisements
    • I am now able to add the BLE via kconfig and compile the code
    • If I try to actually perform a BLE function (i.e. a scan), I get the following error:

    ASSERTION FAIL [err == 0] @ WEST_TOPDIR/zephyr/subsys/bluetooth/host/hci_core.c:331

    Regards,
    Ben

  • It might help to get the current thread context that is calling the HCI functionality here. 

    Can you please enable the below in your prj.conf file, compile and rerun the firmware and give us the assert handler and serial logs details here? That will help understand the context more.

    CONFIG_THREAD_ANALYZER=y
    CONFIG_THREAD_NAME=y
    CONFIG_THREAD_MONITOR=y
    CONFIG_DEBUG_OPTIMIZATIONS=y
    

  • Hi Susheel - thank you for the reply.

    Is this what you need to see?:

    ASSERTION FAIL [err == 0] @ WEST_TOPDIR/zephyr/subsys/bluetooth/host/hci_core.c:331
            command opcode 0x0c03 timeout with err -11
    [00:00:10.267,791] <err> os: r0/a1:  0x00000003  r1/a2:  0x00000002  r2/a3:  0x00000001
    [00:00:10.267,791] <err> os: r3/a4:  0x0000014b r12/ip:  0x00000004 r14/lr:  0x00028e11
    [00:00:10.267,822] <err> os:  xpsr:  0x41000000
    [00:00:10.267,822] <err> os: Faulting instruction address (r15/pc): 0x00028e1c
    [00:00:10.267,883] <err> os: >>> ZEPHYR FATAL ERROR 3: Kernel oops on CPU 0
    [00:00:10.267,913] <err> os: Current thread: 0x20010ec0 (main)
    [00:00:10.323,974] <err> fatal_error: Resetting system

    Regards,

    Ben

  • This seems like a hardfault on stack over on main thread. Have you tried to increase the CONFIG_MAIN_STACK_SIZE in your prj.conf?

    If you are using or nRF extension on Visual Studio code  you can see the GUI for KConfig and increase the value of the main stack to see if this issue gets solved. 

    Also, It is a good idea to enable the Thread_Analyzer while in development phase of your project to have.a good idea on the stack usage on threads you are using in your sofware delevelopment.

Related