-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
ports/stm32: Add support for additional GC blocks. #17019
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
f72e02c
to
6261a76
Compare
Code size report:
|
Short term this would have made a lot of sense for PSRAM on the RP2, too, though we don't have the luxury of per-board linker scripts yet. And additionally the linked issue relates to the wider problems with PSRAM on the RP2, a platform which exposes DMA and PIO to the end user in ways that could quickly trip them up when a buffer by chance falls into PSRAM. |
I hope we can find a way to standardize this, eventually, at least the C code in
That's another strong case for implementing the memory map feature. |
Can we unblock this PR if the current solution is acceptable? We have a demo/example that doesn't work without this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the late review.
This looks fine to me, it's a reasonable solution that gets things working. In the future it can be refined/improved and generalised to other ports.
I built ARDUINO_GIGA firmware and inspected the elf to see that the _gc_blocks_table_start
memory looked correct.
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 <[email protected]>
Signed-off-by: iabdalkader <[email protected]>
6261a76
to
5c6da11
Compare
Summary
This patch adds support for defining additional GC blocks (for split heap) via linker scripts. While split GC on its own is very useful, there isn't a standard way to actually use it, so maybe this will be a step towards that.
For the Giga board, a few blocks in SDRAM/SRAM are also enabled as an example.
Testing
I tested on the Giga, checked the blocks addresses an sizes passed to
gc_add
andmem_free
. This change is enabled conditionally when split heap is enabled, so should not have any effect on other boards as none use split heaps.Trade-offs and Alternatives
If linker scripts were processed through CPP, we could define these blocks in board config files and make the linker script section common. Since this is not the case, this table structure will have to be duplicated if other boards want to use this. I've tried to add a common linker script (
common_gc_table.ld
) but without CPP it's very hard to make this generic (the conditionals supported by ld script are very basic).Also, the blocks are defined in a particular order so that faster SRAM blocks are, hopefully, searched first. We wouldn't have to rely on this, if we had this feature: #16644