Skip to content

Commit 01a9ae4

Browse files
committed
Change the link script to optimum the RAM layout
1 parent cd4c764 commit 01a9ae4

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

system/libarc32_arduino101/framework/src/os/balloc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ typedef struct {
4747
/** Allocate the memory blocks and tracking variables for each pool */
4848
#ifdef CONFIG_MEMORY_POOLS_BALLOC_TRACK_OWNER
4949
#define DECLARE_MEMORY_POOL(index, size, count) \
50-
uint8_t mblock_ ## index[count][size] __aligned(4); \
50+
uint8_t mblock_ ## index[count][size] __aligned(4) __attribute__ ((section(".kernelmempool"))); \
5151
uint32_t mblock_alloc_track_ ## index[count / BITS_PER_U32 + 1] = { 0 }; \
5252
uint32_t *mblock_owners_ ## index[count] = { 0 };
5353
#else
5454
#define DECLARE_MEMORY_POOL(index, size, count) \
55-
uint8_t mblock_ ## index[count][size] __aligned(4); \
55+
uint8_t mblock_ ## index[count][size] __aligned(4) __attribute__ ((section(".kernelmempool"))); \
5656
uint32_t mblock_alloc_track_ ## index[count / BITS_PER_U32 + \
5757
1] = { 0 };
5858
#endif
@@ -100,7 +100,7 @@ T_POOL_DESC mpool[] =
100100

101101
/** Allocate the memory blocks and tracking variables for each pool */
102102
#define DECLARE_MEMORY_POOL(index, size, count) \
103-
uint8_t mblock_ ## index[count][size]; \
103+
uint8_t mblock_ ## index[count][size] __attribute__ ((section(".kernelmempool"))); \
104104
uint32_t mblock_alloc_track_ ## index[count / BITS_PER_U32 + 1] = { 0 };
105105

106106
#include "memory_pool_list.def"
6.36 KB
Binary file not shown.

variants/arduino_101/linker_scripts/flash.ld

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ OUTPUT_FORMAT("elf32-littlearc", "elf32-bigarc", "elf32-littlearc")
4040
MEMORY
4141
{
4242
FLASH (rx) : ORIGIN = 0x40034000, LENGTH = 152K
43-
SRAM (wx) : ORIGIN = 0xa800e000, LENGTH = 24K
44-
DCCM (wx) : ORIGIN = 0x80000000, LENGTH = 8K
43+
SRAM (rwx) : ORIGIN = 0xa800e000, LENGTH = 24K
44+
DCCM (rw) : ORIGIN = 0x80000000, LENGTH = 8K
4545
}
4646

4747
/* Define default stack size and FIRQ stack size.
@@ -180,6 +180,14 @@ SECTIONS
180180

181181
/* Data Closely Coupled Memory (DCCM) */
182182
/* DCCM Start */
183+
.kernelmempool (NOLOAD) :
184+
{
185+
. = ALIGN(4);
186+
__dccm_start = .;
187+
*(.kernelmempool)
188+
*(".kernelmempool.*")
189+
__dccm_end = ALIGN(4);
190+
} > DCCM
183191
/* DCCM End */
184192

185193
}

0 commit comments

Comments
 (0)