Enable Heap for nRF51822

Fix the undefined symbol NRF_SRAM_END
Configure SRAM part for Heap
This commit is contained in:
Xue Liu 2015-11-13 13:39:40 +01:00
parent 31c9f3ef3b
commit 65f1d8f409
3 changed files with 12 additions and 6 deletions

View File

@ -28,13 +28,13 @@ extern int rt_application_init(void);
#ifdef __CC_ARM
extern int Image$$RW_IRAM1$$ZI$$Limit;
#define NRF_SRAM_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit)
#define NRF_HEAP_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit)
#elif __ICCARM__
#pragma section="HEAP"
#define NRF_SRAM_BEGIN (__segment_end("HEAP"))
#define NRF_HEAP_BEGIN (__segment_end("HEAP"))
#else
extern int __bss_end;
#define NRF_SRAM_BEGIN (&__bss_end)
#define NRF_HEAP_BEGIN (&__bss_end)
#endif
/**
@ -58,7 +58,7 @@ void rtthread_startup(void)
rt_system_timer_init();
#ifdef RT_USING_HEAP
rt_system_heap_init((void*)NRF_SRAM_BEGIN, (void*)NRF_SRAM_END);
rt_system_heap_init((void*)NRF_HEAP_BEGIN, (void*)NRF_SRAM_END);
#endif
/* init scheduler system */

View File

@ -12,6 +12,12 @@
#ifndef __BOARD_H__
#define __BOARD_H__
// <o> Internal SRAM memory size[Kbytes] <16 or 32>
// <i>Default: 16
#define NRF_SRAM_BEGIN (0x20000000)
#define NRF_SRAM_SIZE (16 * 1024)
#define NRF_SRAM_END (NRF_SRAM_BEGIN + NRF_SRAM_SIZE)
//#endif
void rt_hw_board_init(void);

View File

@ -49,10 +49,10 @@
/* SECTION: Memory Management */
/* Using Memory Pool Management*/
/* #define RT_USING_MEMPOOL */
#define RT_USING_MEMPOOL
/* Using Dynamic Heap Management */
//#define RT_USING_HEAP
#define RT_USING_HEAP
/* Using Small MM */
#define RT_USING_SMALL_MEM