<html><head><style><![CDATA[#x99140e0c1d6a4e40a91fdb9ce47b12e0{
        font-family:'Segoe UI';
        font-size:12pt;
}#x2edaf26808594c9ab09bf5a9bacf8cc1{
        font-family:'Segoe UI';
        font-size:12pt;
}#xdd7be2969fb2492f940c0c10e0ff1c6b{
        font-family:'Segoe UI';
        font-size:12pt;
}#xa8e42006782f4540a05bd685b14e35b2{
        font-family:'Segoe UI';
        font-size:12pt;
}#xea798b92e0cf41ae81b06163a50020e8{
        font-family:'Segoe UI';
        font-size:12pt;
}#xebf1bcb88d134ec7a43afb100f84807a{
        font-family:'Segoe UI';
        font-size:12pt;
}#x550a2a54d1cb483085428ba56062d351{
        font-family:'Segoe UI';
        font-size:12pt;
}]]></style>

<style id="css_styles"><![CDATA[
blockquote.cite { margin-left: 5px; margin-right: 0px; padding-left: 10px; padding-right:0px; border-left: 1px solid #cccccc }
blockquote.cite2 {margin-left: 5px; margin-right: 0px; padding-left: 10px; padding-right:0px; border-left: 1px solid #cccccc; margin-top: 3px; padding-top: 0px; }
a img { border: 0px; }
li[style='text-align: center;'], li[style='text-align: right;'] {  list-style-position: inside;}
body { font-family: Segoe UI; font-size: 12pt;   }
]]></style>
</head>
<body>Hello,<div><br /></div><div>Intro.</div><div><br /></div><div>After a long period of using C for writing firmware for Microchip PIC24 and PIC32, I am now switching hardware and software.</div><div>For future projects, I will use:</div><div>* the Atmel/Microchip ATSAM series; these are Cortex M-0/3/4 MPU.</div><div><div id="xebf1bcb88d134ec7a43afb100f84807a"><div><div>* FPC for writing the firmware.</div></div></div></div><div>First tests show a successful use of FPC on ATSAMD14 and ATSAMD21 and ATSAMCx.</div><div><br /></div><div>Sidenote.</div><div><br /></div><div>As abstraction-layer, I use the pxl library.</div><div>See : <a href="https://asphyre.net/products/pxl" style="font-size: 12pt;">https://asphyre.net/products/pxl</a></div><div>This library allows me to use apps, that access hardware, transparent on nearly all platforms, including Ultibo.</div><div>Code using pxl will look like this:</div><div>const<br />  PinLED = 9;</div><div>var</div><div>  FGPIO : TCustomGPIO;<br />begin<br />  FGPIO := TMicroGPIO.Create; //<- for arm embedded on ATSAM.</div><div>  //FGPIO := TFastGPIO.Create; //<- for RPi running Linux.<br />  FGPIO.PinMode[PinLED] := TPinMode.Output;<br />  FGPIO.PinValue[PinLED] := TPinValue.High;</div><div><div id="xea798b92e0cf41ae81b06163a50020e8"><div><div>  FGPIO.Destroy;</div></div></div></div><div>end;</div><div><br /></div><div>Question.</div><div><br /></div><div>There are many different ATSAM processors. All with many different features and peripherals.</div><div>I would like to add (many of) them as embedded targets.</div><div><br /></div><div>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.</div><div><br /></div><div>************************************************</div><div>unit samd10c14;<br /><br />{$define samd10c14}<br /><br />interface<br /><br />const<br />  FLASH_SIZE            = $4000; //* 16 kB */<br />  FLASH_PAGE_SIZE       = 64;<br />  FLASH_NB_OF_PAGES     = 256;<br />  FLASH_USER_PAGE_SIZE  = 64;<br />  HMCRAMC0_SIZE         = $1000; //* 4 kB */<br /><br />{$i atmel/sam/sam-base.inc}<br />{$i atmel/sam/sam-irq.inc}<br />{$i atmel/sam/sam-ac.inc}<br />{$i atmel/sam/sam-adc.inc}</div><div>......</div><div>end;</div><div><div id="x550a2a54d1cb483085428ba56062d351"><div><div>************************************************</div></div><div>The {$define samd10c14} is used in the include-files to enable/disable features.</div><div>This allows for a very efficient re-use of code.</div><div><br /></div><div>Would the above be acceptable to be included in FPC trunk ?</div><div>Or are there other (better) ways to add ATSAM embedded targets ?</div><div><br /></div><div>Thanks for your advice.</div></div></div></body></html>