8000 nrf/boards: Check for stack/heap size using an assert. · andrewleech/micropython@0e5f842 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0e5f842

Browse files
aykevldpgeorge
authored andcommitted
nrf/boards: Check for stack/heap size using an assert.
The main effect of this is that the .bss is now accurate and doesn't include the stack and minimum heap size.
1 parent 7144e87 commit 0e5f842

File tree

2 files changed

+5
-19
lines changed

2 files changed

+5
-19
lines changed

ports/nrf/boards/common.ld

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -63,24 +63,6 @@ SECTIONS
6363
_ebss = .; /* define a global symbol at bss end; used by startup code and GC */
6464
} >RAM
6565

66-
/* this is to define the start of the heap, and make sure we have a minimum size */
67-
.heap :
68-
{
69-
. = ALIGN(4);
70-
PROVIDE ( end = . );
71-
PROVIDE ( _end = . );
72-
_heap_start = .; /* define a global symbol at heap start */
73-
. = . + _minimum_heap_size;
74-
} >RAM
75-
76-
/* this just checks there is enough RAM for the stack */
77-
.stack :
78-
{
79-
. = ALIGN(4);
80-
. = . + _stack_size;
81-
. = ALIGN(4);
82-
} >RAM
83-
8466
/* Remove information from the standard libraries */
8567
/*
8668
/DISCARD/ :
@@ -97,4 +79,3 @@ SECTIONS
9779
/* Define heap and stack areas */
9880
_ram_end = ORIGIN(RAM) + LENGTH(RAM);
9981
_estack = ORIGIN(RAM) + LENGTH(RAM);
100-
_heap_end = _ram_end - _stack_size;

ports/nrf/boards/memory.ld

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ _fs_start = _sd_size + _app_size;
1010
_fs_end = _fs_start + _fs_size;
1111
_app_ram_start = 0x20000000 + _sd_ram;
1212
_app_ram_size = _ram_size - _sd_ram;
13+
_heap_start = _ebss;
14+
_heap_end = _ram_end - _stack_size;
15+
_heap_size = _heap_end - _heap_start;
16+
17+
ASSERT(_heap_size >= _minimum_heap_size, "not enough RAM left for heap")
1318

1419
/* Specify the memory areas */
1520
MEMORY

0 commit comments

Comments
 (0)
0