[fpc-devel] ARM embedded for ATSAM
Michael Ring
mail at michael-ring.org
Fri Sep 7 13:39:09 CEST 2018
definitions for microcontrollers are available in the rtl/embedded/arm
directory, there is one (sometimes several) pascal file for a class of
microcontrollers of one vendor.
There is some light glue in the compiler/arm/cpuinfo.pas and
systems/t_embed.pas directory to make a new microcontroller available.
What I do is to auto-generate the main microcontroller file from the
header files of the microcontroller vendor.
On top of this you can then build your own library or extend pxl.
Michael
Am 07.09.18 um 12:45 schrieb Alfred:
> 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.
>
> _______________________________________________
> fpc-devel maillist - fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20180907/97d7cb8e/attachment.html>
More information about the fpc-devel
mailing list