Skip to content

Fixed missing section for Raspberry Pi Pico

Summary

Add a missing section to the embedded linkerscript

System

  • Operating system:
  • ARM
  • Microcontroller

What is the current bug behavior?

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

What is the behavior after applying this patch?

No more HardFault because of access of non existent memory

Relevant logs and/or screenshots

Merge request reports