Skip to content

Commit 57d1e9a

Browse files
committed
bricks/_common_stm32/link: Use full remaining RAM for stack.
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.
1 parent 5d7b056 commit 57d1e9a

File tree

7 files changed

+24
-8
lines changed

7 files changed

+24
-8
lines changed

bricks/_common_stm32/link.ld

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

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

98
/* define output sections */
109
SECTIONS
@@ -81,7 +80,8 @@ SECTIONS
8180
.stack :
8281
{
8382
. = ALIGN(4);
84-
. = . + _stack_size; /* will cause linker error if there is not enough space for stack. */
83+
_sstack = .;
84+
. = . + _minimal_stack_size; /* will cause linker error if there is not enough space for stack. */
8585
. = ALIGN(4);
8686
} >RAM
8787

bricks/cityhub/city_hub.ld

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ MEMORY
2323
}
2424

2525
"MAGIC_OFFSET" = 0x100;
26-
_stack_size = 4K;
26+
27+
/* Minimal stack size to allow the build to proceed. The actual stack size is whatever is left after
28+
statically allocated memory. It can be tuned by setting PBSYS_CONFIG_PROGRAM_LOAD_RAM_SIZE. */
29+
_minimal_stack_size = 4K;
2730

2831
/* Start of data storage. */
2932
_pbdrv_block_device_storage_start = ORIGIN(FLASH_USER_0);

bricks/debug/debug.ld

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@ MEMORY
99
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
1010
}
1111

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

bricks/essentialhub/essential_hub.ld

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,7 @@ MEMORY
1818
}
1919

2020
"FW_INFO_OFFSET" = 0x200;
21-
_stack_size = 16K;
21+
22+
/* Minimal stack size to allow the build to proceed. The actual stack size is whatever is left after
23+
statically allocated memory. It can be tuned by setting PBSYS_CONFIG_PROGRAM_LOAD_RAM_SIZE. */
24+
_minimal_stack_size = 12K;

bricks/movehub/move_hub.ld

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ MEMORY
2323
}
2424

2525
"MAGIC_OFFSET" = 0x100;
26-
_stack_size = 3K;
26+
27+
/* Minimal stack size to allow the build to proceed. The actual stack size is whatever is left after
28+
statically allocated memory. It can be tuned by setting PBSYS_CONFIG_PROGRAM_LOAD_RAM_SIZE. */
29+
_minimal_stack_size = 3K;
2730

2831
/* Start of data storage. */
2932
_pbdrv_block_device_storage_start = ORIGIN(FLASH_USER_0);

bricks/primehub/prime_hub.ld

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,6 @@ MEMORY
1717
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 320K
1818
}
1919

20-
_stack_size = 16K;
20+
/* Minimal stack size to allow the build to proceed. The actual stack size is whatever is left after
21+
statically allocated memory. It can be tuned by setting PBSYS_CONFIG_PROGRAM_LOAD_RAM_SIZE. */
22+
_minimal_stack_size = 16K;

bricks/technichub/technic_hub.ld

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ MEMORY
2323
}
2424

2525
"MAGIC_OFFSET" = 0x200;
26-
_stack_size = 8K;
26+
27+
/* Minimal stack size to allow the build to proceed. The actual stack size is whatever is left after
28+
statically allocated memory. It can be tuned by setting PBSYS_CONFIG_PROGRAM_LOAD_RAM_SIZE. */
29+
_minimal_stack_size = 8K;
2730

2831
/* Start of data storage. */
2932
_pbdrv_block_device_storage_start = ORIGIN(FLASH_USER_0);

0 commit comments

Comments
 (0)