[fpc-devel] Proposal for implementing named address space support

Christo Crause christo.crause at gmail.com
Sat Mar 6 11:59:20 CET 2021


On Sun, Jan 24, 2021 at 10:13 PM Christo Crause <christo.crause at gmail.com>
wrote:

>
> On Tue, Jan 19, 2021 at 8:52 AM Sven Barth via fpc-devel <
> fpc-devel at lists.freepascal.org> wrote:
>
>>
>> It isn't that hard. You essentially need to make sure that the necessary
>> information is written in tpointerdef.ppuwrite and read again in
>> tpointerdef.ppuload. You also need to increase the PPULongVersion in unit
>> ppu and adjust the code in the ppudump utility.
>>
>
> Thank you Sven and Jonas, your hints helped me a lot.  For AVR, pointer
> types can now refer to sections and the compiler can generate appropriate
> access for pointer parameter types.
>
> My next challenge is to extend error checking so that call parameters are
> checked for section incompatibility.
>

A quick update:
By adding section information to type definitions (tdef) and type symbols
it is possible to propagate the necessary information via parameters. Now
it is possible to write overloaded procedures that handle section
information correctly.

type
  Byte_e = type Byte; section '.eeprom';

procedure writeTest(var a: byte); overload;
begin
  a := 123;
end;

procedure writeTest(var a: byte_e); overload;
begin
  a := 234;
end;

Other functionality and error checking is demonstrated in the various test
cases here:
https://github.com/ccrause/freepascal/tree/sectionsupport-rtl/tests/test/avr

Comments and suggestions are welcome.  Next development will focus more on
complicated types such as strings.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20210306/44697835/attachment.htm>


More information about the fpc-devel mailing list