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

Florian Klämpfl florian at freepascal.org
Mon Apr 1 22:59:48 CEST 2024


On 01.04.24 22:33, Michael Ring via fpc-devel wrote:
> 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?

Probably plain oversight, maybe during conflict resolution or whatever. 
So please submit a PR to fix it.

> 
> 
> 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
> 
> 
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel



More information about the fpc-devel mailing list