Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2015-05

Teensy (no OS) programmed with Free Pascal Embedded ARM

13 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Paul Breneman
to Paul Breneman
Paul Breneman wrote 12 lines
On 05/28/2015 08:45 AM, Paul Breneman wrote: > Wow, yesterday I started this new message: > http://forum.lazarus.freepascal.org/index.php/topic,28561.0.html > > And today Laksen says it's committed to SVN trunk. That was fast! > > Thanks to all the FPC developers! And today I finally made my first release: http://turbocontrol.com/simpleteensy.htm Can I put the 3 files (as, ld, objcopy) in my zip?

Since those files were on the freepascal.org site I figured it must be OK so I added all 6 of them and released a new 10 MB zip (also has the entire RTL for the release).

********

I left a message in this forum thread:
https://forum.pjrc.com/threads/28518-Teensy-with-Freepascal

Got a reply with lots of questions:
How easy is it to do all the common hardware things from Freepascal? How much low-level setup is required use digital and analog I/O? Can you use the serial ports? Timers? Capacitive touch sensing? Can you even access the registers without porting a massive header file? Is it possible to link with existing C or C++ libraries?

Any quick summary anyone would like for me to post as a response? Please write back here if you don't want to register on that forum.

Reply by email

Mark Morgan Lloyd
to Paul Breneman
Paul Breneman wrote 9 lines
Got a reply with lots of questions: How easy is it to do all the common hardware things from Freepascal? How much low-level setup is required use digital and analog I/O? Can you use the serial ports? Timers? Capacitive touch sensing? Can you even access the registers without porting a massive header file? Is it possible to link with existing C or C++ libraries? Any quick summary anyone would like for me to post as a response? Please write back here if you don't want to register on that forum.

My one question would be: how general is this? Specifically, how close is it to being able to program a breadboarded chip as described at http://hackaday.com/2015/10/09/arming-a-breadboard-everyone-should-program-an-arm/

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Michael Ring
to Mark Morgan Lloyd

I had a LPC1114 on the breadboard area of a development board for quite a while, fpc (trunk) is able to create binaries for this cpu. For lpc devices you need a linker script that creates a special checksum, besides this it works ootb.

Of course you have to work a lot more low level that with mbed.... But given the fact that the lpc1114 only has 32k of flash you do not want to have much highlevel abstraction anyway as you will run out of memory quite fast.

Michael

Mark Morgan Lloyd wrote 16 lines
Paul Breneman wrote: > Got a reply with lots of questions: > How easy is it to do all the common hardware things from Freepascal? > How much low-level setup is required use digital and analog I/O? Can > you use the serial ports? Timers? Capacitive touch sensing? Can you > even access the registers without porting a massive header file? Is > it possible to link with existing C or C++ libraries? > > Any quick summary anyone would like for me to post as a response? > Please write back here if you don't want to register on that forum. My one question would be: how general is this? Specifically, how close is it to being able to program a breadboarded chip as described at http://hackaday.com/2015/10/09/arming-a-breadboard-everyone-should-program-an-arm/

Reply by email

Jeppe Johansen
to Paul Breneman: Since those files were on the freepascal.org site I figured it must be OK so I added all…
Paul Breneman wrote 32 lines
On 10/10/2015 01:49 PM, Paul Breneman wrote: > On 05/28/2015 08:45 AM, Paul Breneman wrote: >> Wow, yesterday I started this new message: >> http://forum.lazarus.freepascal.org/index.php/topic,28561.0.html >> >> And today Laksen says it's committed to SVN trunk. That was fast! >> >> Thanks to all the FPC developers! > > And today I finally made my first release: > http://turbocontrol.com/simpleteensy.htm > > Can I put the 3 files (as, ld, objcopy) in my zip? Since those files were on the freepascal.org site I figured it must be OK so I added all 6 of them and released a new 10 MB zip (also has the entire RTL for the release). ******** I left a message in this forum thread: https://forum.pjrc.com/threads/28518-Teensy-with-Freepascal Got a reply with lots of questions: How easy is it to do all the common hardware things from Freepascal? How much low-level setup is required use digital and analog I/O? Can you use the serial ports? Timers? Capacitive touch sensing? Can you even access the registers without porting a massive header file? Is it possible to link with existing C or C++ libraries? Any quick summary anyone would like for me to post as a response? Please write back here if you don't want to register on that forum.

Posted a reply there.

But anyway, it's not very positive. There's nothing but the bare core so far.

If anyone is interested in diving into FPC+embedded I can much more readily recommend STM32 micros. In particular the STM32F746GDISCOVERY board is pretty awesome for $50 (208 MHz, 8 MB RAM, eth+lcd+stuff). I have been porting a pretty big part of the firmware library over here: https://github.com/Laksen/fp-stm32f7xx_hal

Reply by email

Michael Ring
to Jeppe Johansen

Wow Jeppe, I am impressed, you used your time much better than I did, your port looks pretty complete!

Please have a look at

https://github.com/yunkot/pxl

this lib was mentioned yesterday on lazarus list, this looks like a good layer above the lowlevel code, there are already implementations for several sensors and displays and it already supports Raspberry Pi.

The Author is also thinking about extending the lib in the direction of microcontrollers, so those two efforts combined could some day get a very user friendly solution that is a lot closer to what mbed is for the C guy today to what we have right now.

Michael

Jeppe Johansen wrote 50 lines
On 10/11/2015 03:54 PM, Paul Breneman wrote: > On 10/10/2015 01:49 PM, Paul Breneman wrote: >> On 05/28/2015 08:45 AM, Paul Breneman wrote: >>> Wow, yesterday I started this new message: >>> http://forum.lazarus.freepascal.org/index.php/topic,28561.0.html >>> >>> And today Laksen says it's committed to SVN trunk. That was fast! >>> >>> Thanks to all the FPC developers! >> >> And today I finally made my first release: >> http://turbocontrol.com/simpleteensy.htm >> >> Can I put the 3 files (as, ld, objcopy) in my zip? > > Since those files were on the freepascal.org site I figured it must > be OK so I added all 6 of them and released a new 10 MB zip (also has > the entire RTL for the release). > > ******** > > I left a message in this forum thread: > https://forum.pjrc.com/threads/28518-Teensy-with-Freepascal > > Got a reply with lots of questions: > How easy is it to do all the common hardware things from Freepascal? > How much low-level setup is required use digital and analog I/O? Can > you use the serial ports? Timers? Capacitive touch sensing? Can you > even access the registers without porting a massive header file? Is > it possible to link with existing C or C++ libraries? > > Any quick summary anyone would like for me to post as a response? > Please write back here if you don't want to register on that forum. Posted a reply there. But anyway, it's not very positive. There's nothing but the bare core so far. If anyone is interested in diving into FPC+embedded I can much more readily recommend STM32 micros. In particular the STM32F746GDISCOVERY board is pretty awesome for $50 (208 MHz, 8 MB RAM, eth+lcd+stuff). I have been porting a pretty big part of the firmware library over here: https://github.com/Laksen/fp-stm32f7xx_hal _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email

Jeppe Johansen
to Michael Ring
Michael Ring wrote 17 lines
Wow Jeppe, I am impressed, you used your time much better than I did, your port looks pretty complete! Please have a look at https://github.com/yunkot/pxl this lib was mentioned yesterday on lazarus list, this looks like a good layer above the lowlevel code, there are already implementations for several sensors and displays and it already supports Raspberry Pi. The Author is also thinking about extending the lib in the direction of microcontrollers, so those two efforts combined could some day get a very user friendly solution that is a lot closer to what mbed is for the C guy today to what we have right now. Michael

Thanks :)

Yeah, that PXL library looks like it has a lot of code already. Could be a great project to combine it with for sure!

Reply by email

Michael Ring
to Jeppe Johansen

I want to interface my Freedom-K64F code with this lib, on first view this looks pretty straightforward. Any chance to get your great patch for the use on arbitrary system units into trunk ? (the one you wrote for me to make cmsis work)

Jeppe Johansen wrote 25 lines
On 10/11/2015 10:10 PM, Michael Ring wrote: > Wow Jeppe, I am impressed, you used your time much better than I did, > your port looks pretty complete! > > Please have a look at > > https://github.com/yunkot/pxl > > this lib was mentioned yesterday on lazarus list, this looks like a > good layer above the lowlevel code, there are already implementations > for several sensors and displays and it already supports Raspberry Pi. > > The Author is also thinking about extending the lib in the direction > of microcontrollers, so those two efforts combined could some day get > a very user friendly solution that is a lot closer to what mbed is > for the C guy today to what we have right now. > > Michael Thanks :) Yeah, that PXL library looks like it has a lot of code already. Could be a great project to combine it with for sure! _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email

Jeppe Johansen
to Michael Ring

Not sure what you are referring to here?

Michael Ring wrote 37 lines
I want to interface my Freedom-K64F code with this lib, on first view this looks pretty straightforward. Any chance to get your great patch for the use on arbitrary system units into trunk ? (the one you wrote for me to make cmsis work) Am 11.10.15 um 22:33 schrieb Jeppe Johansen: > On 10/11/2015 10:10 PM, Michael Ring wrote: >> Wow Jeppe, I am impressed, you used your time much better than I >> did, your port looks pretty complete! >> >> Please have a look at >> >> https://github.com/yunkot/pxl >> >> this lib was mentioned yesterday on lazarus list, this looks like a >> good layer above the lowlevel code, there are already >> implementations for several sensors and displays and it already >> supports Raspberry Pi. >> >> The Author is also thinking about extending the lib in the direction >> of microcontrollers, so those two efforts combined could some day >> get a very user friendly solution that is a lot closer to what mbed >> is for the C guy today to what we have right now. >> >> Michael > Thanks :) > > Yeah, that PXL library looks like it has a lot of code already. Could > be a great project to combine it with for sure! > _______________________________________________ > fpc-devel maillist - > http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email

Michael Ring
to Jeppe Johansen

The code that makes the compiler work with conf files:

fpc -Fb*.conf

stm32f407vg]$ cat stm32f4xx.conf
STM32F401CB,stm32f401x,stm32f4xx.lkr,%FLASHBASE:0x08000000,%FLASHSIZE:0x00020000,%SRAMBASE:0x20000000,%SRAMSIZE:0x00010000 STM32F401RB,stm32f401x,stm32f4xx.lkr,%FLASHBASE:0x08000000,%FLASHSIZE:0x00020000,%SRAMBASE:0x20000000,%SRAMSIZE:0x00010000 STM32F401VB,stm32f401x,stm32f4xx.lkr,%FLASHBASE:0x08000000,%FLASHSIZE:0x00020000,%SRAMBASE:0x20000000,%SRAMSIZE:0x00010000

Jeppe Johansen wrote 44 lines
Not sure what you are referring to here? On 10/11/2015 10:47 PM, Michael Ring wrote: > I want to interface my Freedom-K64F code with this lib, on first view > this looks pretty straightforward. Any chance to get your great patch > for the use on arbitrary system units into trunk ? (the one you wrote > for me to make cmsis work) > > Am 11.10.15 um 22:33 schrieb Jeppe Johansen: >> On 10/11/2015 10:10 PM, Michael Ring wrote: >>> Wow Jeppe, I am impressed, you used your time much better than I >>> did, your port looks pretty complete! >>> >>> Please have a look at >>> >>> https://github.com/yunkot/pxl >>> >>> this lib was mentioned yesterday on lazarus list, this looks like a >>> good layer above the lowlevel code, there are already >>> implementations for several sensors and displays and it already >>> supports Raspberry Pi. >>> >>> The Author is also thinking about extending the lib in the >>> direction of microcontrollers, so those two efforts combined could >>> some day get a very user friendly solution that is a lot closer to >>> what mbed is for the C guy today to what we have right now. >>> >>> Michael >> Thanks :) >> >> Yeah, that PXL library looks like it has a lot of code already. >> Could be a great project to combine it with for sure! >> _______________________________________________ >> fpc-devel maillist - >> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel > > _______________________________________________ > fpc-devel maillist - > http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel > _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email

Jeppe Johansen
to Michael Ring

Well I think it might be too much for now. Haven't really maintained it since then

Anyway, from what I found last I tried with your headers I think there could be some improvement that might instead warrant their inclusion into SVN.
The main point back then was that the size was pretty tremendous.

To reduce size:
- Similar types be in common records. What I found was that using your generated headers for the STM32F7xx HAL required a lot of casting because all the GPIO records, for example, for all the different ports were different types. This cause duplication of all the helpers too.
- Could the helpers be in external units?
- Have an option to remove comments? Not sure how much this would give

Another thing was things like repeated sub records. CAN mailboxes or DMA channel streams all had the repeated registers, while the existing firmware codebase used arrays of records.
This probably changes from manufacturer to manufacturer but it might be nice to reduce size, and probably wouldn't require a lot of change when porting code.

Actually, maybe also not emit the bitband records? So far I've never once seen it used in normal code, and the places where it could be useful you might just as well calculate the offset yourself, or refer to it in an external unit(maybe one with the helpers? :)

Best Regards,
Jeppe

Michael Ring wrote 63 lines
The code that makes the compiler work with conf files: fpc -Fb*.conf stm32f407vg]$ cat stm32f4xx.conf STM32F401CB,stm32f401x,stm32f4xx.lkr,%FLASHBASE:0x08000000,%FLASHSIZE:0x00020000,%SRAMBASE:0x20000000,%SRAMSIZE:0x00010000 STM32F401RB,stm32f401x,stm32f4xx.lkr,%FLASHBASE:0x08000000,%FLASHSIZE:0x00020000,%SRAMBASE:0x20000000,%SRAMSIZE:0x00010000 STM32F401VB,stm32f401x,stm32f4xx.lkr,%FLASHBASE:0x08000000,%FLASHSIZE:0x00020000,%SRAMBASE:0x20000000,%SRAMSIZE:0x00010000 Am 11.10.15 um 22:58 schrieb Jeppe Johansen: > Not sure what you are referring to here? > > On 10/11/2015 10:47 PM, Michael Ring wrote: >> I want to interface my Freedom-K64F code with this lib, on first >> view this looks pretty straightforward. Any chance to get your great >> patch for the use on arbitrary system units into trunk ? (the one >> you wrote for me to make cmsis work) >> >> Am 11.10.15 um 22:33 schrieb Jeppe Johansen: >>> On 10/11/2015 10:10 PM, Michael Ring wrote: >>>> Wow Jeppe, I am impressed, you used your time much better than I >>>> did, your port looks pretty complete! >>>> >>>> Please have a look at >>>> >>>> https://github.com/yunkot/pxl >>>> >>>> this lib was mentioned yesterday on lazarus list, this looks like >>>> a good layer above the lowlevel code, there are already >>>> implementations for several sensors and displays and it already >>>> supports Raspberry Pi. >>>> >>>> The Author is also thinking about extending the lib in the >>>> direction of microcontrollers, so those two efforts combined could >>>> some day get a very user friendly solution that is a lot closer to >>>> what mbed is for the C guy today to what we have right now. >>>> >>>> Michael >>> Thanks :) >>> >>> Yeah, that PXL library looks like it has a lot of code already. >>> Could be a great project to combine it with for sure! >>> _______________________________________________ >>> fpc-devel maillist - >>> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel >> >> _______________________________________________ >> fpc-devel maillist - >> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel >> > > _______________________________________________ > fpc-devel maillist - > http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email

Michael Ring
to Jeppe Johansen

I've already addressed some of the issues, instead of using records I am using objects now (classes unfortunately do not work) and there's a base class for gpio, spi, i2c, uart.

The idea of having comments was that they show up as context sensitive help in Lazarus, they can easily be left out, same with bitbanded records, they are configurable.

I can see that I can address the issue with the repeated sub-records, they were bugging me too, but never bugging me enough to do something about it.

I will try to fix the headers for Frdm-k64f during the week, perhaps you can have a look if they are OK for inclusion.

Michael

Jeppe Johansen wrote 100 lines
Well I think it might be too much for now. Haven't really maintained it since then Anyway, from what I found last I tried with your headers I think there could be some improvement that might instead warrant their inclusion into SVN. The main point back then was that the size was pretty tremendous. To reduce size: - Similar types be in common records. What I found was that using your generated headers for the STM32F7xx HAL required a lot of casting because all the GPIO records, for example, for all the different ports were different types. This cause duplication of all the helpers too. - Could the helpers be in external units? - Have an option to remove comments? Not sure how much this would give Another thing was things like repeated sub records. CAN mailboxes or DMA channel streams all had the repeated registers, while the existing firmware codebase used arrays of records. This probably changes from manufacturer to manufacturer but it might be nice to reduce size, and probably wouldn't require a lot of change when porting code. Actually, maybe also not emit the bitband records? So far I've never once seen it used in normal code, and the places where it could be useful you might just as well calculate the offset yourself, or refer to it in an external unit(maybe one with the helpers? :) Best Regards, Jeppe On 10/11/2015 11:02 PM, Michael Ring wrote: > The code that makes the compiler work with conf files: > > fpc -Fb*.conf > > stm32f407vg]$ cat stm32f4xx.conf > STM32F401CB,stm32f401x,stm32f4xx.lkr,%FLASHBASE:0x08000000,%FLASHSIZE:0x00020000,%SRAMBASE:0x20000000,%SRAMSIZE:0x00010000 > > STM32F401RB,stm32f401x,stm32f4xx.lkr,%FLASHBASE:0x08000000,%FLASHSIZE:0x00020000,%SRAMBASE:0x20000000,%SRAMSIZE:0x00010000 > > STM32F401VB,stm32f401x,stm32f4xx.lkr,%FLASHBASE:0x08000000,%FLASHSIZE:0x00020000,%SRAMBASE:0x20000000,%SRAMSIZE:0x00010000 > > > > Am 11.10.15 um 22:58 schrieb Jeppe Johansen: >> Not sure what you are referring to here? >> >> On 10/11/2015 10:47 PM, Michael Ring wrote: >>> I want to interface my Freedom-K64F code with this lib, on first >>> view this looks pretty straightforward. Any chance to get your >>> great patch for the use on arbitrary system units into trunk ? (the >>> one you wrote for me to make cmsis work) >>> >>> Am 11.10.15 um 22:33 schrieb Jeppe Johansen: >>>> On 10/11/2015 10:10 PM, Michael Ring wrote: >>>>> Wow Jeppe, I am impressed, you used your time much better than I >>>>> did, your port looks pretty complete! >>>>> >>>>> Please have a look at >>>>> >>>>> https://github.com/yunkot/pxl >>>>> >>>>> this lib was mentioned yesterday on lazarus list, this looks like >>>>> a good layer above the lowlevel code, there are already >>>>> implementations for several sensors and displays and it already >>>>> supports Raspberry Pi. >>>>> >>>>> The Author is also thinking about extending the lib in the >>>>> direction of microcontrollers, so those two efforts combined >>>>> could some day get a very user friendly solution that is a lot >>>>> closer to what mbed is for the C guy today to what we have right >>>>> now. >>>>> >>>>> Michael >>>> Thanks :) >>>> >>>> Yeah, that PXL library looks like it has a lot of code already. >>>> Could be a great project to combine it with for sure! >>>> _______________________________________________ >>>> fpc-devel maillist - >>>> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel >>> >>> _______________________________________________ >>> fpc-devel maillist - >>> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel >>> >> >> _______________________________________________ >> fpc-devel maillist - >> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel > > _______________________________________________ > fpc-devel maillist - > http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel > _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email