From c22eb3e9ca84aed433d79b9616b0c27340b2758c Mon Sep 17 00:00:00 2001 From: hathach Date: Tue, 3 Oct 2017 22:18:13 +0700 Subject: [PATCH] update memory layout --- cores/nRF5/linker/bluefruit52_s132_v500.ld | 46 +++++++++++++++++++ cores/nRF5/linker/nrf5x_common.ld | 9 ++-- .../examples/Hardware/blinky/blinky.ino | 4 -- .../nffs/examples/EraseNffs/EraseNffs.ino | 4 +- .../flash_map/include/flash_map/flash_map.h | 2 +- 5 files changed, 54 insertions(+), 11 deletions(-) create mode 100755 cores/nRF5/linker/bluefruit52_s132_v500.ld diff --git a/cores/nRF5/linker/bluefruit52_s132_v500.ld b/cores/nRF5/linker/bluefruit52_s132_v500.ld new file mode 100755 index 00000000..5999e8a8 --- /dev/null +++ b/cores/nRF5/linker/bluefruit52_s132_v500.ld @@ -0,0 +1,46 @@ +/* Linker script to configure memory regions. */ + +SEARCH_DIR(.) +GROUP(-lgcc -lc -lnosys) + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x23000, LENGTH = 0x26000 /* Max 152 KB for dual banks */ + + /* SRAM required by S132 depend on + * - Attribute Table Size + * - Number of concurrent connection central + peripherl + secure links + * Several configuration with different SRAM config is included for reference + */ + + /* ATTR SIZE = 0x0B00, (central, prph, sec) = (0, 1, 0) */ + /* RAM (rwx) : ORIGIN = 0x20001B00 + 0x0B00, LENGTH = 0xE500 - 0x0B00 */ + + /* ATTR SIZE = 0x0B00, (central, prph, sec) = (4, 1, 1) */ + RAM (rwx) : ORIGIN = 0x20001B00 + (0x0B00 + 0x1280), LENGTH = 0xE500 - (0x0B00 + 0x1280) + + /* ATTR SIZE = 0x0B00, (central, prph, sec) = (7, 1, 1) */ + /* RAM (rwx) : ORIGIN = 0x20001B00 + (0x0B00 + 0x1F08), LENGTH = 0xE500 - (0x0B00 + 0x1F08) */ +} + +SECTIONS +{ + .fs_data : + { + PROVIDE(__start_fs_data = .); + KEEP(*(.fs_data)) + PROVIDE(__stop_fs_data = .); + } > RAM +} INSERT AFTER .data; + +INCLUDE "nrf5x_common.ld" + +/* S132 v2.0.1 role configuration SRAM usage */ +/* APP_RAM_BASE_CENTRAL_LINKS_0_PERIPH_LINKS_1_SEC_COUNT_0_MID_BW 0x20001fe8 */ + +/* APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_1_SEC_COUNT_1_MID_BW 0x20003268 inc = 1280 */ +/* APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_1_SEC_COUNT_2_MID_BW 0x20003438 inc = 1450 */ +/* APP_RAM_BASE_CENTRAL_LINKS_4_PERIPH_LINKS_1_SEC_COUNT_4_MID_BW 0x200037d0 inc = 17e8 */ + +/* APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_1_SEC_COUNT_1_MID_BW 0x20003ef0 inc = 1F08*/ +/* APP_RAM_BASE_CENTRAL_LINKS_7_PERIPH_LINKS_1_SEC_COUNT_7_MID_BW 0x200049b8 inc = 29d0*/ diff --git a/cores/nRF5/linker/nrf5x_common.ld b/cores/nRF5/linker/nrf5x_common.ld index 5c9077b1..4f2277da 100755 --- a/cores/nRF5/linker/nrf5x_common.ld +++ b/cores/nRF5/linker/nrf5x_common.ld @@ -1,4 +1,4 @@ -/* Linker script for Nordic Semiconductor nRF51 devices +/* Linker script for Nordic Semiconductor nRF52 devices * * Version: Sourcery G++ 4.5-1 * Support: https://support.codesourcery.com/GNUToolchain/ @@ -38,6 +38,7 @@ OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") * __bss_end__ * __end__ * end + * __HeapBase * __HeapLimit * __StackLimit * __StackTop @@ -87,8 +88,8 @@ SECTIONS KEEP(*(.eh_frame*)) } > FLASH - - .ARM.extab : + + .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } > FLASH @@ -101,7 +102,7 @@ SECTIONS __exidx_end = .; __etext = .; - + .data : AT (__etext) { __data_start__ = .; diff --git a/libraries/Bluefruit52Lib/examples/Hardware/blinky/blinky.ino b/libraries/Bluefruit52Lib/examples/Hardware/blinky/blinky.ino index bf105401..e3733216 100644 --- a/libraries/Bluefruit52Lib/examples/Hardware/blinky/blinky.ino +++ b/libraries/Bluefruit52Lib/examples/Hardware/blinky/blinky.ino @@ -24,13 +24,9 @@ void setup() { // the loop function runs over and over again forever void loop() { -#if 0 for (int i = 0; i < 2; i++) { digitalToggle(LED_BLUE); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second } -#endif - - systemOff(A0, HIGH); } diff --git a/libraries/nffs/examples/EraseNffs/EraseNffs.ino b/libraries/nffs/examples/EraseNffs/EraseNffs.ino index b68b8ee8..81feaef7 100644 --- a/libraries/nffs/examples/EraseNffs/EraseNffs.ino +++ b/libraries/nffs/examples/EraseNffs/EraseNffs.ino @@ -14,12 +14,12 @@ #include -/* This example erase the content of 28KB User Data starting from 0x6D000 +/* This example erase the content of 28KB User Data starting from 0x6F000 * (used by NFFS) using low level API sd_flash_page_erase() with SoftDevice * DISABLED. In other words, it performs low level formating of NFFS. */ -#define STARTING_ADDR 0x06D000 +#define STARTING_ADDR 0x06F000 #define SECTOR_SIZE 4096 #define ERASE_SIZE (7*SECTOR_SIZE) diff --git a/libraries/nffs/src/sys/flash_map/include/flash_map/flash_map.h b/libraries/nffs/src/sys/flash_map/include/flash_map/flash_map.h index b4149ceb..b25df7f3 100644 --- a/libraries/nffs/src/sys/flash_map/include/flash_map/flash_map.h +++ b/libraries/nffs/src/sys/flash_map/include/flash_map/flash_map.h @@ -26,7 +26,7 @@ extern "C" { // Adafruit #define NFFS_SECTOR_NUM 7 -#define NFFS_START_ADDR 0x6D000 +#define NFFS_START_ADDR 0x6F000 #define FLASH_AREA_NFFS 0