mirror of
https://github.com/stnolting/neorv32.git
synced 2025-04-23 21:57:33 -04:00
[sw] 🐛 fix heap size override via console
This commit is contained in:
parent
e26297e669
commit
4d4bb69715
3 changed files with 6 additions and 8 deletions
|
@ -277,10 +277,10 @@ calling `make` without the need to change the makefile(s) or the linker script.
|
|||
to the executable (`-g`) and will also re-define the linker script's `__neorv32_heap_size` variable setting the maximal heap
|
||||
size to 4096 bytes (see sections <<_linker_script>> and <<_ram_layout>>):
|
||||
|
||||
.Using the `USER_FLAGS` Variable for Customization
|
||||
.Using the `USER_FLAGS` Variable for Customization (setting the heap size to 4kB)
|
||||
[source,bash]
|
||||
----
|
||||
$ make USER_FLAGS+="-g -Wl,--__neorv32_heap_size,__heap_size=4096" clean_all exe
|
||||
$ make USER_FLAGS+="-Wl,--defsym,__neorv32_heap_size=4096" clean_all exe
|
||||
----
|
||||
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
/**********************************************************************//**
|
||||
* @name Max heap size (from linker script's "__neorv32_heap_size")
|
||||
**************************************************************************/
|
||||
extern const unsigned __crt0_max_heap;
|
||||
extern char __crt0_max_heap[];
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
|
@ -85,12 +85,12 @@ int main() {
|
|||
neorv32_uart0_printf("<<< Newlib demo/test program >>>\n\n");
|
||||
|
||||
// heap size definition
|
||||
volatile uint32_t max_heap = (uint32_t)&__crt0_max_heap;
|
||||
volatile uint32_t max_heap = (uint32_t)__crt0_max_heap;
|
||||
if (max_heap > 0){
|
||||
neorv32_uart0_printf("MAX heap size: %u bytes\n", max_heap);
|
||||
}
|
||||
else {
|
||||
neorv32_uart0_printf("ERROR! No heap size defined (linker script -> '__neorv32_heap_size')!\n");
|
||||
neorv32_uart0_printf("ERROR! No heap size defined (USER_FLAGS+='-Wl,--defsym,__neorv32_heap_size=1024')!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
# Configure max HEAP size
|
||||
USER_FLAGS+="-Wl,--defsym,__neorv32_heap_size=1024"
|
||||
override USER_FLAGS += "-Wl,--defsym,__neorv32_heap_size=1024"
|
||||
|
||||
# Modify this variable to fit your NEORV32 setup (neorv32 home folder)
|
||||
NEORV32_HOME ?= ../../..
|
||||
|
||||
include $(NEORV32_HOME)/sw/common/common.mk
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue