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

How to determine the App RAM base address in the linker script?

I understand part of ram is used by the softdevice, but I see different addresses are used in different examples that use the same softdevice, namely S132. For example,

in ble_app_hrs/pca10040/s132/armgcc/ble_app_hrs_gcc_nrf52.ld, RAM (rwx) : ORIGIN = 0x20002c38, LENGTH = 0xd3c8

In ble_app_uart/pca10040/s132/armgcc/ble_app_uart_gcc_nrf52.ld, RAM (rwx) : ORIGIN = 0x20002128, LENGTH = 0xded8

How is the exactly value being determined?

Parents
  • This is documented in the sd_ble_enable() call, although you'll find in all the recent SDKs this has been abstracted away inside the standard softdevice_handler which also now contains a macro to work out what the memory usage ought to be.

    You basically give the sd_ble_enable() call a pointer to uint32_t which contains the address of the start of user memory, it either returns an error telling you you've not given it enough RAM or it returns ok and puts the minimum value of the app RAM base back in the pointer.

    So the best way is to use softdevice_handler, or just give it lots of RAM, break after the sd_ble_enable() call and note down the value, then set the linker script to that.

Reply
  • This is documented in the sd_ble_enable() call, although you'll find in all the recent SDKs this has been abstracted away inside the standard softdevice_handler which also now contains a macro to work out what the memory usage ought to be.

    You basically give the sd_ble_enable() call a pointer to uint32_t which contains the address of the start of user memory, it either returns an error telling you you've not given it enough RAM or it returns ok and puts the minimum value of the app RAM base back in the pointer.

    So the best way is to use softdevice_handler, or just give it lots of RAM, break after the sd_ble_enable() call and note down the value, then set the linker script to that.

Children
  • RK

    app_ram_base will only be what I set it to in the IAR IDE wright?

    If I set it to 0x20001FF0 then that is what app_ram_base displays. If I set it to 0x20002FF0 then that is what app_ram_base displays.

    So in IAR one only adjusts the RAM start and end address, not the size

    So where does SD get the RAM info, if all I do is tell the linker in advance where RAM starts?

    Any help appreciated

Related