Skip to content

Commit

Permalink
bricks/_common_stm32/link: Use full remaining RAM for stack.
Browse files Browse the repository at this point in the history
Also rename the hub-specific value to explain that it is not the
actual stack size but only a lower bound to force a build error,
similar to upstream MicroPython.
  • Loading branch information
laurensvalk committed Oct 20, 2022
1 parent 5d7b056 commit 57d1e9a
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 8 deletions.
4 changes: 2 additions & 2 deletions bricks/_common_stm32/link.ld
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

/* top end of the stack */
_estack = ORIGIN(RAM) + LENGTH(RAM);
_sstack = _estack - _stack_size;

/* define output sections */
SECTIONS
Expand Down Expand Up @@ -81,7 +80,8 @@ SECTIONS
.stack :
{
. = ALIGN(4);
. = . + _stack_size; /* will cause linker error if there is not enough space for stack. */
_sstack = .;
. = . + _minimal_stack_size; /* will cause linker error if there is not enough space for stack. */
. = ALIGN(4);
} >RAM

Expand Down
5 changes: 4 additions & 1 deletion bricks/cityhub/city_hub.ld
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ MEMORY
}

"MAGIC_OFFSET" = 0x100;
_stack_size = 4K;

/* Minimal stack size to allow the build to proceed. The actual stack size is whatever is left after
statically allocated memory. It can be tuned by setting PBSYS_CONFIG_PROGRAM_LOAD_RAM_SIZE. */
_minimal_stack_size = 4K;

/* Start of data storage. */
_pbdrv_block_device_storage_start = ORIGIN(FLASH_USER_0);
Expand Down
4 changes: 3 additions & 1 deletion bricks/debug/debug.ld
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ MEMORY
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
}

_stack_size = 8K;
/* Minimal stack size to allow the build to proceed. The actual stack size is whatever is left after
statically allocated memory. It can be tuned by setting PBSYS_CONFIG_PROGRAM_LOAD_RAM_SIZE. */
_minimal_stack_size = 8K;
5 changes: 4 additions & 1 deletion bricks/essentialhub/essential_hub.ld
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@ MEMORY
}

"FW_INFO_OFFSET" = 0x200;
_stack_size = 16K;

/* Minimal stack size to allow the build to proceed. The actual stack size is whatever is left after
statically allocated memory. It can be tuned by setting PBSYS_CONFIG_PROGRAM_LOAD_RAM_SIZE. */
_minimal_stack_size = 12K;
5 changes: 4 additions & 1 deletion bricks/movehub/move_hub.ld
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ MEMORY
}

"MAGIC_OFFSET" = 0x100;
_stack_size = 3K;

/* Minimal stack size to allow the build to proceed. The actual stack size is whatever is left after
statically allocated memory. It can be tuned by setting PBSYS_CONFIG_PROGRAM_LOAD_RAM_SIZE. */
_minimal_stack_size = 3K;

/* Start of data storage. */
_pbdrv_block_device_storage_start = ORIGIN(FLASH_USER_0);
Expand Down
4 changes: 3 additions & 1 deletion bricks/primehub/prime_hub.ld
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ MEMORY
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 320K
}

_stack_size = 16K;
/* Minimal stack size to allow the build to proceed. The actual stack size is whatever is left after
statically allocated memory. It can be tuned by setting PBSYS_CONFIG_PROGRAM_LOAD_RAM_SIZE. */
_minimal_stack_size = 16K;
5 changes: 4 additions & 1 deletion bricks/technichub/technic_hub.ld
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ MEMORY
}

"MAGIC_OFFSET" = 0x200;
_stack_size = 8K;

/* Minimal stack size to allow the build to proceed. The actual stack size is whatever is left after
statically allocated memory. It can be tuned by setting PBSYS_CONFIG_PROGRAM_LOAD_RAM_SIZE. */
_minimal_stack_size = 8K;

/* Start of data storage. */
_pbdrv_block_device_storage_start = ORIGIN(FLASH_USER_0);
Expand Down

0 comments on commit 57d1e9a

Please sign in to comment.