SRAM enhancement

This commit is contained in:
hathach committed 2017-10-09 15:19:47 +07:00
1 parent 866c20ecf4
commit f2e1aa7fe4
9 files changed
+59 -46

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
# Adafruit nRF52 Arduino Core Changelog
## 0.8.0
## 0.9.0
## 0.7.5
+7 -6
View File
@@ -119,19 +119,20 @@ static void printMemRegion(const char* name, uint32_t top, uint32_t bottom, uint
char buffer[30];
if ( used )
{
sprintf(buffer, "%lu / %lu (%02lu%%)", used, top-bottom, (used*100)/ (top-bottom));
sprintf(buffer, "%5lu / %5lu (%02lu%%)", used, top-bottom, (used*100)/ (top-bottom));
}else
{
sprintf(buffer, "%lu", top-bottom);
}
Serial.printf("| %-10s: %-19s |\n", name, buffer);
Serial.printf("| %-5s| 0x%04X - 0x%04X | %-19s |\n", name, (uint16_t) bottom, (uint16_t) (top-1), buffer);
}
void dbgMemInfo(void)
{
Serial.printf (" _________________________________\n");
Serial.println("| |");
Serial.println(" ______________________________________________");
Serial.println("| Name | Addr 0x2000xxxx | Usage |");
Serial.println("| ---------------------------------------------|");
// Pritn SRAM used for Stack executed by S132 and ISR
printMemRegion("Stack", ((uint32_t) __StackTop), ((uint32_t) __StackLimit), dbgStackUsed() );
@@ -140,12 +141,12 @@ void dbgMemInfo(void)
printMemRegion("Heap", ((uint32_t) __HeapLimit), ((uint32_t) __HeapBase), dbgHeapUsed() );
// DATA + BSS
printMemRegion("Data & Bss", ((uint32_t) __bss_end__), ((uint32_t) __data_start__), 0);
printMemRegion("Bss", ((uint32_t) __bss_end__), ((uint32_t) __data_start__), 0);
// Print SRAM Used by SoftDevice
printMemRegion("S132", (uint32_t) __data_start__, 0x20000000, 0);
Serial.printf("|_________________________________|\n");
Serial.printf("|______________________________________________|\n");
Serial.println();
// Print Task list
+1 -1
View File
@@ -118,7 +118,7 @@
#define configUSE_IDLE_HOOK 1
#define configUSE_TICK_HOOK 0
#define configCHECK_FOR_STACK_OVERFLOW 1
#define configUSE_MALLOC_FAILED_HOOK 1
#define configUSE_MALLOC_FAILED_HOOK (CFG_DEBUG > 0 ? 1 : 0)
/* Run time and task stats gathering related definitions. */
#define configGENERATE_RUN_TIME_STATS 0
+14 -23
View File
@@ -6,25 +6,26 @@ GROUP(-lgcc -lc -lnosys)
MEMORY
{
FLASH (rx) : ORIGIN = 0x23000, LENGTH = 0x25000 /* Max 148 KB for dual banks */
RAM (rwx) : ORIGIN = 0x20002000 + 0x800, LENGTH = 0xE000 - 0x800
/* 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
* - Attribute Table Size 0x800
* - Vendor UUID count 20
* - Role concurrent connection central + peripherl + secure links
* -
*/
/* 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
{
. = ALIGN(4);
.svc_data :
{
PROVIDE(__start_svc_data = .);
KEEP(*(.svc_data))
PROVIDE(__stop_svc_data = .);
} > RAM
.fs_data :
{
PROVIDE(__start_fs_data = .);
@@ -34,13 +35,3 @@ SECTIONS
} 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*/
+5 -3
View File
@@ -73,11 +73,12 @@ caddr_t _sbrk( int incr )
return (caddr_t) prev_heap;
}
#if 0
void __malloc_lock(struct _reent *ptr)
{
(void) ptr;
ledOn(LED_RED);
vTaskSuspendAll();
}
void __malloc_unlock(struct _reent *ptr)
@@ -85,6 +86,7 @@ void __malloc_unlock(struct _reent *ptr)
(void) ptr;
ledOn(LED_BLUE);
}
#endif
xTaskResumeAll();
}
+1 -1
View File
@@ -1,5 +1,5 @@
name=Adafruit BLE Libraries for Bluefruit52
version=0.8.0
version=0.9.0
author=Adafruit
maintainer=Adafruit <info@adafruit.com>
sentence=Arduino library for nRF52-based Adafruit Bluefruit LE modules
+23 -5
View File
@@ -187,16 +187,33 @@ err_t AdafruitBluefruit::begin(bool prph_enable, bool central_enable)
#else
ble_cfg_t blecfg;
// ATTR Table Size
// Vendor UUID count
varclr(&blecfg);
blecfg.gatts_cfg.attr_tab_size.attr_tab_size = BLE_GATTS_ATTR_TAB_SIZE_DEFAULT; // BLE_GATTS_ATTR_TABLE_SIZE
VERIFY_STATUS ( sd_ble_cfg_set(BLE_GATTS_CFG_ATTR_TAB_SIZE, &blecfg, ram_start) );
blecfg.common_cfg.vs_uuid_cfg.vs_uuid_count = BLE_VENDOR_UUID_MAX;
VERIFY_STATUS ( sd_ble_cfg_set(BLE_COMMON_CFG_VS_UUID, &blecfg, ram_start) );
// Roles
varclr(&blecfg);
blecfg.gap_cfg.role_count_cfg.periph_role_count = (_prph_enabled ? 1 : 0);
blecfg.gap_cfg.role_count_cfg.central_role_count = (_central_enabled ? BLE_CENTRAL_MAX_CONN : 0);
blecfg.gap_cfg.role_count_cfg.central_sec_count = (_central_enabled ? BLE_CENTRAL_MAX_SECURE_CONN : 0);
VERIFY_STATUS( sd_ble_cfg_set(BLE_GAP_CFG_ROLE_COUNT, &blecfg, ram_start) );
// Device Name
// varclr(&blecfg);
// blecfg.gap_cfg.device_name_cfg =
// VERIFY_STATUS( sd_ble_cfg_set(BLE_GAP_CFG_DEVICE_NAME, &blecfg, ram_start) );
// TODO Service Changed
// varclr(&blecfg);
// blecfg.gatts_cfg.service_changed.service_changed = 1;
// VERIFY_STATUS ( sd_ble_cfg_set(BLE_GATTS_CFG_SERVICE_CHANGED, &blecfg, ram_start) );
// ATTR Table Size
varclr(&blecfg);
blecfg.gatts_cfg.attr_tab_size.attr_tab_size = BLE_GATTS_ATTR_TABLE_SIZE;
VERIFY_STATUS ( sd_ble_cfg_set(BLE_GATTS_CFG_ATTR_TAB_SIZE, &blecfg, ram_start) );
#if 0
// TODO ATT MTU
varclr(&blecfg);
@@ -232,9 +249,10 @@ err_t AdafruitBluefruit::begin(bool prph_enable, bool central_enable)
// between SoftDevices with the same major version number
PRINT_HEX(ram_start);
VERIFY_STATUS( sd_ble_enable(&ram_start) );
uint32_t err = sd_ble_enable(&ram_start);
PRINT_HEX(ram_start);
VERIFY_STATUS(err);
#endif
+3 -3
View File
@@ -43,9 +43,9 @@
#define CFG_MAX_DEVNAME_LEN 32
// Note changing these parameters will affect APP_RAM_BASE
// --> need to update RAM in feather52_s132.ld linker
#define BLE_GATTS_ATTR_TABLE_SIZE 0x0B00
#define BLE_VENDOR_UUID_MAX 10
// --> need to update RAM in linker file
#define BLE_GATTS_ATTR_TABLE_SIZE 0x800 //0x0B00 default is 0x580
#define BLE_VENDOR_UUID_MAX 20
#define BLE_PRPH_MAX_CONN 1
#define BLE_CENTRAL_MAX_CONN 4
#define BLE_CENTRAL_MAX_SECURE_CONN 1 // should be enough
+4 -3
View File
@@ -17,7 +17,7 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
name=Adafruit nRF52 Boards
version=0.8.0
version=0.9.0
# Compile variables
# -----------------
@@ -45,7 +45,8 @@ compiler.elf2bin.flags=-O binary
compiler.elf2bin.cmd=arm-none-eabi-objcopy
compiler.elf2hex.flags=-O ihex
compiler.elf2hex.cmd=arm-none-eabi-objcopy
compiler.ldflags=-mcpu={build.mcu} -mthumb {build.float_flags} -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align
compiler.ldflags=-mcpu={build.mcu} -mthumb {build.float_flags} -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align --specs=nano.specs --specs=nosys.specs
compiler.size.cmd=arm-none-eabi-size
# this can be overriden in boards.txt
@@ -95,7 +96,7 @@ recipe.S.o.pattern="{compiler.path}{compiler.S.cmd}" {compiler.S.flags} -DF_CPU=
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}"
## Combine gc-sections, archives, and objects
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" "-L{build.path}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} "-L{build.variant.path}" "-L{build.core.path}/linker" "-T{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" --specs=nano.specs --specs=nosys.specs {compiler.ldflags} -o "{build.path}/{build.project_name}.elf" {object_files} -Wl,--start-group -lm "{build.path}/{archive_file}" -Wl,--end-group
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" "-L{build.path}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} "-L{build.variant.path}" "-L{build.core.path}/linker" "-T{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" {compiler.ldflags} -o "{build.path}/{build.project_name}.elf" {object_files} -Wl,--start-group -lm "{build.path}/{archive_file}" -Wl,--end-group
## Create output (bin file)
#recipe.objcopy.bin.pattern="{compiler.path}{compiler.elf2bin.cmd}" {compiler.elf2bin.flags} {compiler.elf2bin.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.bin"