Lazarus
Programming => Embedded => Operating Systems => Embedded - ARM => Topic started by: marcov on September 30, 2016, 12:21:47 pm
-
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.
-
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)
-
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 :)
-
@Laksen
I don't see that SAM3X8E listed when I type fpc -i (in trunk from today)
-
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?
-
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 :)
-
how about Ultibo (https://ultibo.org) project?
-
how about Ultibo (https://ultibo.org) 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
-
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 :(
-
I need some form of time keeping
You could either implement an NTP client, or use some battery backed I2C RTC chip like MCP7940. The choice depends on your needs.