[fpc-devel] Raspberry Pi Pico: Heapsize is initialized with wrong value
Michael Ring
mail at michael-ring.org
Mon Apr 1 22:33:42 CEST 2024
I am using heapmgr but with trunk compiler the value of __heapsize is
plain wrong (and way too big)
When I compile my code with my old compiler for pico all is fine, when I
debug into heapmgr I see that __heapsize is set correctly to 16384 based
on this setting:
program spi_st7789;
{$MODE OBJFPC}
{$H+}
{$MEMORY 16384,16384}
When I use current main compiler the value is 308528 which is more than
available memory, this is why I found the issue....
The reason for this is that a line from my original code for linkerfile
generation was not included:
Add(' *(.data .data.*)');
// Special Section for the Raspberry Pico, needed for linking to spi
* Add(' *(.time_critical*)');
* Add(' KEEP (*(.fpc .fpc.n_version .fpc.n_links))');
Add(' _edata = .;');
and for that reason the content of that section in loaded to start of
flash (and during startup to ram) instead of the correct data for __heapsize
Was there a reason for leaving this out when my code was merged to main?
I guess no, so I will create a PR to fix this issue, please comment when
there was a reason for leaving this out.
Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20240401/4851f6b1/attachment.htm>
More information about the fpc-devel
mailing list