mirror of
https://github.com/micropython/micropython.git
synced 2025-12-16 09:50:15 +01:00
stm32/main: Add support for additional GC blocks.
Add support for defining additional GC blocks via linker scripts. A board would need to define `_gc_blocks_table_start` and `_gc_blocks_table_end` and within that region have pairs of (address, length) for each GC block to add. Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
This commit is contained in:
committed by
Damien George
parent
0815b45479
commit
cbe50635e8
@@ -521,6 +521,23 @@ soft_reset:
|
||||
// GC init
|
||||
gc_init(MICROPY_HEAP_START, MICROPY_HEAP_END);
|
||||
|
||||
// Add additional GC blocks (if enabled).
|
||||
#if MICROPY_GC_SPLIT_HEAP
|
||||
typedef struct {
|
||||
uint8_t *addr;
|
||||
uint32_t size;
|
||||
} gc_blocks_table_t;
|
||||
|
||||
extern const gc_blocks_table_t _gc_blocks_table_start;
|
||||
extern const gc_blocks_table_t _gc_blocks_table_end;
|
||||
|
||||
for (gc_blocks_table_t const *block = &_gc_blocks_table_start; block < &_gc_blocks_table_end; block++) {
|
||||
if (block->size) {
|
||||
gc_add(block->addr, block->addr + block->size);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if MICROPY_ENABLE_PYSTACK
|
||||
static mp_obj_t pystack[384];
|
||||
mp_pystack_init(pystack, &pystack[384]);
|
||||
|
||||
Reference in New Issue
Block a user