Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2020-01

Support for AVR subarch avrxmega3 (megaAVR 0, tinyAVR 0/1 series)

5 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Christo Crause

I would like to offer support for the relatively new AVR 8-bit subarchitecture avrxmega3 which includes the following series: megaAVR 0, tinyAVR 0 and 1. This adds 35 new controllers to FPC's repertoire. The current state can be viewed in a git branch (
https://github.com/ccrause/freepascal/tree/avrxmega3). I can also prepare a patch (perhaps two: compiler and rtl separately) if it is accepted into trunk.

There are very few differences between the classical avr8 and this new architecture. The only differences I have picked up and included in the compiler so far:
* Memory map excludes core register file, so I/O register addresses start at offset 0.
* 16-bit I/O register read/write order is different. Both read and write operations should access low register first.

Notes on controller units:
* Some interrupt names have aliases, I don't know how to specify an alias for interrupt vectors so I picked the first name in the device file.
* The I/O registers are grouped per peripheral, this naturally leads to using records to group the individual registers. There are a whole bunch of bit names with clashes between registers. To work around name clashes I decided to use objects and included the named bits inside the objects. An example of writing named bits to a register:

  ADC0.CTRLC := TADC.SAMPCAPbm or TADC.REFSEL_VDDREF or TADC.PRESC_DIV256;

Best wishes,
Christo

Reply by email

Florian Klämpfl
to Christo Crause
Christo Crause wrote 7 lines
I would like to offer support for the relatively new AVR 8-bit subarchitecture avrxmega3 which includes the following series: megaAVR 0, tinyAVR 0 and 1.  This adds 35 new controllers to FPC's repertoire. The current state can be viewed in a git branch (https://github.com/ccrause/freepascal/tree/avrxmega3).  I can also prepare a patch (perhaps two: compiler and rtl separately) if it is accepted into trunk.

If the patch quality is fine and the embedded units aren't too big (not MB scale) I see no reason not to do so.

Reply by email

Christo Crause
to Florian Klämpfl
PM Florian Klämpfl wrote 12 lines
Am 19.01.20 um 08:20 schrieb Christo Crause via fpc-devel: > I would like to offer support for the relatively new AVR 8-bit > subarchitecture avrxmega3 which includes the following series: megaAVR > 0, tinyAVR 0 and 1. This adds 35 new controllers to FPC's repertoire. > The current state can be viewed in a git branch > (https://github.com/ccrause/freepascal/tree/avrxmega3). I can also > prepare a patch (perhaps two: compiler and rtl separately) if it is > accepted into trunk. If the patch quality is fine and the embedded units aren't too big (not MB scale) I see no reason not to do so.

I have split the patch into 3 parts in issue 0036616.

On a related note, I have some developer board aliases from Michael (R) and Dimitrios. The board names are defined as new controllers, but the controllerunitstr has the name of the on-board controller. An example for Arduino Uno (popular hobbyist board):
controllertypestr:'ARDUINOUNO'; controllerunitstr:'ATMEGA328P';

Would these kind of aliases be allowed in cpuinfo? I guess it would help hobbyist beginners that only know the name of a board to have a slightly easier start in FPC.

Reply by email

Florian Klämpfl
to Christo Crause
Christo Crause wrote 10 lines
On a related note, I have some developer board aliases from Michael (R) and Dimitrios.  The board names are defined as new controllers, but the controllerunitstr has the name of the on-board controller. An example for Arduino Uno (popular hobbyist board): controllertypestr:'ARDUINOUNO'; controllerunitstr:'ATMEGA328P'; Would these kind of aliases be allowed in cpuinfo? I guess it would help hobbyist beginners that only know the name of a board to have a slightly easier start in FPC.

I think it is fine.

Reply by email

Michael Ring
to Florian Klämpfl

I just saw that trunk was updated, thank you for providing trunk support for avr atmega4808/09 chips!

Michael

Florian Klämpfl wrote 16 lines
Am 22.01.20 um 18:25 schrieb Christo Crause via fpc-devel: > On a related note, I have some developer board aliases from Michael > (R) and Dimitrios.  The board names are defined as new controllers, > but the  controllerunitstr has the name of the on-board controller. > An example for Arduino Uno (popular hobbyist board): > controllertypestr:'ARDUINOUNO'; controllerunitstr:'ATMEGA328P'; > > Would these kind of aliases be allowed in cpuinfo? I guess it would > help hobbyist beginners that only know the name of a board to have a > slightly easier start in FPC. > I think it is fine. _______________________________________________ fpc-devel maillist  -  https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email