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

>
> On Tue, Jan 19, 2021 at 8:52 AM Sven Barth via fpc-devel <
> fpc-devel@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.
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to