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

Migration from nRF52832 to nRF52810

Hi

Currently I try to migrate my software project (with SDK14.2, S132 (5.0.0), arm-gcc toolchain ) from nRF52832 to nRF52810 (with SDK14.2, S112 (5.1.0), arm-gcc toolchain).

But when I build the "new" nRF52810-project the linker tells me that I have a resource problem:

Linking target: _build/nrf52810_xxaa.out
Make library and executables
/usr/bin/arm-none-eabi-ar: creating _build/nrf52810_xxaa.a
/usr/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld: _build/nrf52810_xxaa.out section `.bss' will not fit in region `RAM'
/usr/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld: region RAM overflowed with stack
/usr/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld: region FLASH overflowed with .data and user data
/usr/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld: region `RAM' overflowed by 1484 bytes
collect2: error: ld returned 1 exit status

I think it is very "tight" but the application should fit into the nRF52810. This is the linker output of my "old" nRF52832-project:

/usr/bin/arm-none-eabi-ar: creating _build/nrf52832_xxaa.a
Linking target: _build/nrf52832_xxaa.out

   text    data     bss     dec     hex filename
  80768     200   16136   97104   17b50 _build/nrf52832_xxaa.out

Preparing: _build/nrf52832_xxaa.hex
Preparing: _build/nrf52832_xxaa.bin

So the application needs ~80kB flash and ~15kB RAM. Am I right?

This is what I did...

I followed the instructions in the guide Developing for nRF52810 --> Software emulation of nRF52810.

According to the "ble_app_blinky" example (nRF5_SDK_14.2.0_17b948a\examples\ble_peripheral\ble_app_blinky\pca10040e\s112\armgcc\ble_app_blinky_gcc_nrf52.ld) I have updated the MEMORY section in the linker file as follows:

MEMORY
{
  FLASH (rx) : ORIGIN = 0x18000, LENGTH = 0x18000
  RAM (rwx) :  ORIGIN = 0x20001cd0, LENGTH = 0x4330
}

So about 96kB Flash (0x18000 = 98304‬ B = 96 kB) and 16kB  RAM (0x4330 = 17200 B = 16kB) should be available for the application...

Does anybody know how to solve this problem?

Is there anything wrong with my linker settings?

In the blinky example the softdevice needs 7kB (0x1cd0 =  7376 B =  7kB) RAM. How can I determine the actual RAM consumption of the softdevice? In the devzone I found this description (Memory resource requirements). But this did not help me at all...

BTW: My application does not use the heap, only static memory allocation is used.

Thanks

 Alex

Parents
  • FormerMember
    +1 FormerMember

    I will start with the last:  When enabling the softdevice using the function nrf_sdh_ble_enable(), the actual RAM usage used by the application will be printed over UART/RTT when log is enabled and the severity level includes "warning (sdk_config.h).

    As stated in the S112 release note, the minimum amount RAM used by the softdevice is 3.68 kB. Could you try to lower the setting for the  amount of RAM used by the softdevice in your application, until it compiles? And then, check how much RAM the softdevice requires in you application?

  • Hi Kristin, thanks for your reply.

    I have changed the RAM size in the linker file. Furthermore I have set the HEAP_SIZE in the gcc_startup_nrf52810.S to 0 because I do not use dynamic memory allocation. So regarding the "overflowed RAM region" problem the linker is satisfied.

    But unfortunately I still have the Flash overflow problem and therefore no running application yet...

  • FormerMember
    0 FormerMember in reply to Alex

    From the build information, the ~80 kB application should fit well into the remaining 96kB of flash.

    Could you test how much you  need to increase the flash setting when compiling to make the compile finish without space issues? (Just for testing purpose..)

  • With the following linker-file settings the build is successful:

      FLASH (rx) : ORIGIN = 0x18000, LENGTH = 0x18500
      RAM (rwx) :  ORIGIN = 0x20000F10, LENGTH = 0x50F0

    Note:

    The stack and heap size in the gcc_startup_nrf52810.S are set as follows:

    Stack_Size = 2048       (default value)

    Heap_Size = 0

Reply Children
  • Hi Kristin,

    Finally I was successful :-)

    Due to a problem in the build configuration the application contained some unnecessary modules (nrf-log, RTT, remains of the bootloader etc.). Now the application fits into the flash as expected.

    After this I was able to read the actual RAM usage of the softdevice with the nrf_sdh_ble_enable() function (as you suggested).

    So this problem is solved, thanks.

Related