[fpc-devel] Raspberry Pi Pico: Heapsize is initialized with wrong value

Michael Ring mail at michael-ring.org
Mon Apr 1 22:59:28 CEST 2024


PR:

https://gitlab.com/freepascal.org/fpc/source/-/merge_requests/638

Am 01.04.24 um 22:33 schrieb Michael Ring via fpc-devel:
>
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20240401/a0706523/attachment-0001.htm>


More information about the fpc-devel mailing list