How to configure memory layout in Asset Tracker v2 app

Hello,

We are currently using NRF Connect SDK 2.2.0 and even more specifically the Asset Tracker v2 application in nrf9160dk board. By the moment we are only including some dependencies which our future application will need. This dependencies include new kernel modules and new application libraries (only modified CMakeList).

After building the application, when is time to link we have the following error:

"zephyr/zephyr_pre0.elf section `rodata' will not fit in region `FLASH'"

I saw other posts related to mine like this one MCUBootloader won't build for custom board - zephyr/zephyr_pre0.elf section `text' will not fit in region `FLASH' but not sure if we have the same issue.

Therefore, How can i modified the memory layout of Asset tracker application in order to give it more space to the APP? 

This is my current memory layout:

Best regards,

Javier

  • I had the same issues. In the end I went through the pain of external flash for the FOTA image, (It seems to be fixed in V2.2.0) 

    Do you have external flash? you could use that for the FOTA image to be stored in. 

    Do you need FOTA? 

    Have you turned off debug?

    Have you turned on optimisations?

    Can you get rid of bits of AT2 you don't need? 

    If you don't have the external flash, there is not much extra you can add to AT2 without running out of space. 

  • Have a look at Marshalls suggestions, they are good.
    I also recommend optimizing flash usage before changing the partitioning.

    If you need to change the flash partitioning, you use static partitioning.

    1. Have a look at pm_static.yml for a sample
    2. Have a look at build/partitions.yml for your projects current partitioning.
    3. Create your own pm_static.yml

    Regards,
    Sigurd Hellesvik

  • Hello   and  ,

    By the moment we are using the nrf9160dk so we do not have a external flash. However, using the 1MB internal flash should be enough, if you have a look to the memory layout of the Asset Tracker, there is a lot of free space:

    We are in a early stage, so, we do not need FOTA now as well as I did not start with the project optimisations, as I said, I only included some dependencies to Asset Tracker, I did not include any development yet. If I have to start with optimisations now.... it is not promising.

    What is AT2?

    As I understood, Partition Manager is deprecated, no? Asset Tracker uses the information of the Device Tree to allocate each partition, no? Once I built the application, I see build/partitions.yml but I do know how can I configure it.

    Regards

  • jfpastrana said:
    As I understood, Partition Manager is deprecated, no?

    Partition Manager is not deprecated.
    If you add MCUboot, partition manager will be enabled to include it as a child image.

    jfpastrana said:
    We are in a early stage, so, we do not need FOTA now as well as I did not start with the project optimisations, as I said, I only included some dependencies to Asset Tracker, I did not include any development yet. If I have to start with optimisations now.... it is not promising.

    When using Partition Manager, the build will be split into multiple images.
    The flash overflow can be either in the application or in a child image.
    Can you check which part of the build gets the error?

    jfpastrana said:
    Once I built the application, I see build/partitions.yml but I do know how can I configure it.

    Do you mean that you do not know how?
    In that case, you do so by using pm_static.yml.

    jfpastrana said:
    By the moment we are using the nrf9160dk so we do not have a external flash.

    If you want to test using external flash with thenRF9160DK, you can.
    But you need to reconfigure the DK first though.
    Let me know if you want instructions on how to do this.

    Regards,
    Sigurd Hellesvik

  • That free space is for the FOTA Image to be stored. 

    AT2 = Asset Tracker 2 (sorry) 

    If you are not going to upgrade the boot loader (in the field), you can turn off the first stage bootloader in your prj.conf

    #we are never going to upgrade the bootloader in the field.

    CONFIG_SECURE_BOOT=n
    CONFIG_BUILD_S1_VARIANT=n
    I'm using the dynamic partition manager, so it all gets a bit opaque, as to how to disable the image second slot, (as I just moved mine to external flash), but it should be doable. 
    perhaps this is a place to start. 
    CONFIG_FOTA_DOWNLOAD=n
Related