Arduino DUE and Free Pascal. lazarus / 79-Embedded - ARM ---------------------------------------------------------------------- marcov · 2016-09-30 10:21 Anybody have experience with FPC and an Arduino DUE (which is a Cortex M3 SAM3X8E) or similar ARMs ? I'm planning to connect a W5500 to an Arduino DUE and port a minimal UDP-only stack over to it, but coming from dsPIC33e, I'll have to start at the bottom, the datasheet looks fairly daunting. Peripherals that I need  - DMA a block (read/write) to SPI      - with CS going low before the transfer, and up again after. (e.g. in the DMA finished interrupt).      - Some notifications that it is finished. (dma finished interrupt again)      - 8/16/32-bit DMA, does it matter?  (e.g. dspic33e has two bit pauses between units, so 16-bit DMA saves 2 bits per 16-bits send (18 instead of 20 bits per 16-bits payload)  - Watching the INT pin with some hardware pin thingy. (edge high-to- low or so)  - updating simple volatile variables to communicate between interrupt and the main program. in dspic33e simple operations on volatiles (  e.g. int++ in an interrupt handler) can be considered atomic, and no increments or decrements are lost. How is this on ARM M3?  - I need some form of time keeping (e.g. for the reset period of the W5500 on startup). I'm an intermediate programmer in C, I haven't done anything embedded in FPC. If anybody can give me tips/hints about this, that would be welcome. The hardware is still in the mail, I'm just starting to read up. ---------------------------------------------------------------------- Thaddy · 2016-09-30 11:07 Have a look at this thread which was very helpful to me. http://forum.lazarus.freepascal.org/index.php?topic=30960.0 I have arduino's, but no due, though. [edit] OTOH I don't see that processor architecture listed on my arm compiler (fpc -i) ---------------------------------------------------------------------- Laksen · 2016-09-30 12:43 Support for Cortex M3 is pretty good I would say. There's even support for SAM3X8E in trunk. Build a compiler with OS_TARGET=embedded CPU_TARGET=arm SUBARCH=armv7m Compile with -Parm -Tembedded -Cparmv7em -WpATSAM3X8E -O3 -Oonostackframe Bam. Lazarus even has code completion for the hidden RTL units. So you can code directly to it ---------------------------------------------------------------------- Thaddy · 2016-09-30 12:52 @Laksen I don't see that SAM3X8E listed when I type fpc -i (in trunk from today) ---------------------------------------------------------------------- Laksen · 2016-09-30 13:10 It's sitting right there on line 965 of compiler/arm/cpuinfo.pas So it should be there if you see the rest of them? Did you mean to write fpc -Parm -i maybe? ---------------------------------------------------------------------- marcov · 2016-09-30 19:45 Thaddy thanks. That is mostly unrelated to this, but since I also ordered a Arduino Mega, that might be relevant still. I thought the AVR port didn't support the lesser atmels as on Arduino. Laksen: thanks. So that leaves me binutils and how to work with the bootloader (since I have no programmer).  Binutils can be probably taken from arduino IDE, and that also contains linker files that can tell me more about bootloader. A lot to study ---------------------------------------------------------------------- skalogryz · 2016-09-30 20:43 how about Ultibo project? ---------------------------------------------------------------------- marcov · 2016-09-30 20:51 Quote from: skalogryz on September 30, 2016, 10:43:20 pmhow about Ultibo project? I'm not entirely sure why that would be useful.  Seems to be geared towards heavier systems. I don't really need a kernel-application abstraction. Note that the (wiznet) w5500 is a socket chip, not an ethernet chip. It is typically used to give slow systems some network with low overhead. Maybe I can look at it to find out about e.g. DMA, but even then I think it is wiser to look at C examples for the exact same chip series or CMSIS ---------------------------------------------------------------------- Laksen · 2016-09-30 21:29 DMA controllers are very vendor specific. Won't make sense to look at anything but the datasheet. Or ASF if you dare, but it's the worst C codebase in existance ---------------------------------------------------------------------- avra · 2016-10-02 17:50 Quote from: marcov on September 30, 2016, 12:21:47 pmI need some form of time keepingYou could either implement an NTP client, or use some battery backed I2C RTC chip like MCP7940. The choice depends on your needs. ---------------------------------------------------------------------- Mathias · 2022-03-02 16:34 I got a cross compiler for the Due. Even uploading with bossac works. Unfortunately, the program will not start afterwards.