[fpc-devel] ARM embedded for ATSAM
Alfred
alfred at consulab.nl
Fri Sep 7 12:45:26 CEST 2018
Hello,
Intro.
After a long period of using C for writing firmware for Microchip PIC24
and PIC32, I am now switching hardware and software.
For future projects, I will use:
* the Atmel/Microchip ATSAM series; these are Cortex M-0/3/4 MPU.
* FPC for writing the firmware.
First tests show a successful use of FPC on ATSAMD14 and ATSAMD21 and
ATSAMCx.
Sidenote.
As abstraction-layer, I use the pxl library.
See : https://asphyre.net/products/pxl
This library allows me to use apps, that access hardware, transparent on
nearly all platforms, including Ultibo.
Code using pxl will look like this:
const
PinLED = 9;
var
FGPIO : TCustomGPIO;
begin
FGPIO := TMicroGPIO.Create; //<- for arm embedded on ATSAM.
//FGPIO := TFastGPIO.Create; //<- for RPi running Linux.
FGPIO.PinMode[PinLED] := TPinMode.Output;
FGPIO.PinValue[PinLED] := TPinValue.High;
FGPIO.Destroy;
end;
Question.
There are many different ATSAM processors. All with many different
features and peripherals.
I would like to add (many of) them as embedded targets.
To prevent cluttering of directories, I propose to use small definition
units, that use include and switches to make a (rough) differentiation
between ATSAM-processors. The switches are used in the include-files to
filter features.
************************************************
unit samd10c14;
{$define samd10c14}
interface
const
FLASH_SIZE = $4000; //* 16 kB */
FLASH_PAGE_SIZE = 64;
FLASH_NB_OF_PAGES = 256;
FLASH_USER_PAGE_SIZE = 64;
HMCRAMC0_SIZE = $1000; //* 4 kB */
{$i atmel/sam/sam-base.inc}
{$i atmel/sam/sam-irq.inc}
{$i atmel/sam/sam-ac.inc}
{$i atmel/sam/sam-adc.inc}
......
end;
************************************************
The {$define samd10c14} is used in the include-files to enable/disable
features.
This allows for a very efficient re-use of code.
Would the above be acceptable to be included in FPC trunk ?
Or are there other (better) ways to add ATSAM embedded targets ?
Thanks for your advice.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20180907/c0bcec56/attachment.html>
More information about the fpc-devel
mailing list