From 8ea321106823866adcb6c4881b4045939b56cc3a Mon Sep 17 00:00:00 2001 From: Daniel Thompson Date: Sat, 9 May 2020 14:13:47 +0100 Subject: [PATCH] nrf: linker scripts: Reserve the first 32 bytes of RAM These 32 bytes can be used as pseudo-NVRAM to allow communication between the payload and the bootloader. The pseudo-NVRAM driver can be written in pure python (using machine.mem32) so there no code changes beyond reserving the memory are required. --- ports/nrf/boards/memory.ld | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ports/nrf/boards/memory.ld b/ports/nrf/boards/memory.ld index c95daf3d9..e11ddb1ff 100644 --- a/ports/nrf/boards/memory.ld +++ b/ports/nrf/boards/memory.ld @@ -1,15 +1,17 @@ /* Flash layout: softdevice | application | filesystem */ /* RAM layout: softdevice RAM | application RAM */ + _sd_size = DEFINED(_sd_size) ? _sd_size : 0; _sd_ram = DEFINED(_sd_ram) ? _sd_ram : 0; +_pnvram = 32; _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; _fs_end = _fs_start + _fs_size; -_app_ram_start = 0x20000000 + _sd_ram; -_app_ram_size = _ram_size - _sd_ram; +_app_ram_start = 0x20000000 + _sd_ram + _pnvram; +_app_ram_size = _ram_size - _sd_ram - _pnvram; _heap_start = _ebss; _heap_end = _ram_end - _stack_size; _heap_size = _heap_end - _heap_start;