nrf/boards: Update memory.ld to include bootloader offsets.

Adding variables that can be set from other linker scripts:

- _bootloader_head_size:
    Bootloader flash offset in front of the application.

- _bootloader_tail_size:
    Bootloader offset from the tail of the flash.
    In case the bootloader is located at the end.

- _bootloader_head_ram_size:
    Bootloader RAM usage in front of the application.

Updated calculations of application flash and RAM.
This commit is contained in:
Glenn Ruben Bakke 2020-07-16 22:19:19 +02:00
parent 5020b14d54
commit 2489688635

View File

@ -1,18 +1,20 @@
/* Flash layout: softdevice | application | filesystem */
/* RAM layout: softdevice RAM | application RAM */
_ram_start = DEFINED(_ram_start) ? _ram_start : 0x20000000;
_flash_start = DEFINED(_flash_start) ? _flash_start : 0;
_sd_size = DEFINED(_sd_size) ? _sd_size : _flash_start;
/* Flash layout: bootloader_head | softdevice | application | filesystem | bootloader_tail */
/* RAM layout: bootloader RAM | softdevice RAM | application RAM */
_bootloader_head_size = DEFINED(_bootloader_head_size) ? _bootloader_head_size : 0;
_bootloader_tail_size = DEFINED(_bootloader_tail_size) ? _bootloader_tail_size : 0;
_bootloader_head_ram_size = DEFINED(_bootloader_head_ram_size) ? _bootloader_head_ram_size : 0;
_head_size = DEFINED(_sd_size) ? _sd_size : _bootloader_head_size;
_head_ram = DEFINED(_sd_ram) ? _sd_ram : _bootloader_head_ram_size;
_sd_size = DEFINED(_sd_size) ? _sd_size : 0;
_sd_ram = DEFINED(_sd_ram) ? _sd_ram : 0;
_fs_size = DEFINED(_fs_size) ? _fs_size : 64K; /* TODO: set to 0 if not using the filesystem */
_app_size = _flash_size - _sd_size - _fs_size;
_app_start = _sd_size;
_fs_start = _sd_size + _app_size;
_app_size = _flash_size - _head_size - _fs_size - _bootloader_tail_size;
_app_start = _head_size;
_fs_start = _head_size + _app_size;
_fs_end = _fs_start + _fs_size;
_app_ram_start = _ram_start + _sd_ram;
_app_ram_size = _ram_size - _sd_ram;
_app_ram_start = 0x20000000 + _head_ram;
_app_ram_size = _ram_size - _head_ram;
_heap_start = _ebss;
_heap_end = _ram_end - _stack_size;
_heap_size = _heap_end - _heap_start;