Lazarus

Programming => Embedded => Operating Systems => Embedded - ARM => Topic started by: petex on January 14, 2021, 09:51:27 am

Title: Resources for STM32
Post by: petex on January 14, 2021, 09:51:27 am
hello,
I am looking into using FPC/Laz to cross compile for the STM32 card. The Arduino IDE provides a lot of in-built libraries and code examples but it is not Pascal. To me, the STM32 "blue pill" is really cheap and powerful and sits in a gap between the 8 bit PIC and the Pi.

The Ultibo project looks really good and a similar thing for Arduino cards would be nice. I have used Lazarus on the Raspberry PI and that works well. I have used Mickroelectonika Pascal on the PIC16F628 and that works really well.

One of the first things I would want to do in my experimentation is read/write to the usart. I guess a lot of this basic stuff has been done before. Are there any links to such libraries available ?
Looking through the other posts here it also seems that linking to C code can be problematic as well.

I have looked around for websites/blogs about using Lazarus with Arduinos and its quite sketchy. I haven't found much in the WIKI either.

I am also looking for examples on writing an interrupt handler in this environment.

I am guessing that there is no integrated debugger available.
Title: Re: Resources for STM32
Post by: MiR on January 14, 2021, 09:57:48 am
Re-check the forum posts, there is a list of Ressources for programming embedded targets and also threads about debugging from within the ide.
Linking to C-code also works pretty well, I know of people that actually link to the Arduino C-Libs for SAMD51 chips and I myself link to FreeRTOS and some debugging tools without issue.

MiR
Title: Re: Resources for STM32
Post by: PascalDragon on January 14, 2021, 10:01:46 am
One of the first things I would want to do in my experimentation is read/write to the usart. I guess a lot of this basic stuff has been done before. Are there any links to such libraries available ?

You can take a look at the Microcontroller Board Framework (https://github.com/michael-ring/mbf). It seems to support STM32 in general, though I don't know whether it supports your specific board.

Looking through the other posts here it also seems that linking to C code can be problematic as well.

C code is usually not the problem. But Arduino is mostly (simple) C++ and that is problematic.

I have looked around for websites/blogs about using Lazarus with Arduinos and its quite sketchy. I haven't found much in the WIKI either.

So you didn't find this (https://wiki.freepascal.org/ARM_Embedded_Tutorial) or more in general this (https://wiki.freepascal.org/Category:Embedded)?
Title: Re: Resources for STM32
Post by: petex on January 14, 2021, 10:21:37 am
Quote
So you didn't find this or more in general this?

Yes I did. I followed the instructions but had the problems on my previous post.
Title: Re: Resources for STM32
Post by: dseligo on January 14, 2021, 11:25:54 am
You have wrong link here, I fixed it:
So you didn't find this (https://wiki.freepascal.org/ARM_Embedded_Tutorial) or more in general this (https://wiki.freepascal.org/Category:Embedded)?
Title: Re: Resources for STM32
Post by: MiR on January 14, 2021, 11:39:05 am
When I am honest I must say that the documentation on Wiki is good, but it mostly scratches the surface for stm32, it is more in-depth for AVR

More Info can actually be found here in the Forum, like for example info on this stm32f103 specific library that was used in the thread about DMA (The thread actually covers UART and interrupts when I remember correctly).
Title: Re: Resources for STM32
Post by: PascalDragon on January 14, 2021, 03:09:42 pm
You have wrong link here, I fixed it:
So you didn't find this (https://wiki.freepascal.org/ARM_Embedded_Tutorial) or more in general this (https://wiki.freepascal.org/Category:Embedded)?

I've now fixed it in my post as well. Thank you... :-[
Title: Re: Resources for STM32
Post by: MarkMLl on January 14, 2021, 03:25:15 pm
When I am honest I must say that the documentation on Wiki is good, but it mostly scratches the surface for stm32, it is more in-depth for AVR

In fairness, there's been a lot of people working on understanding the AVR family largely because of the Arduino's popularity. They've been helped by the fact that there's a lot of commonality in control registers and peripherals across the range, and that not having an OS most AVR boards make it pretty obvious when something's not quite right (none of this "is the hardware not doing what I want or have I got the API parameters wrong?").

While ARM chips have been round for decades and have been fairly accessible since the days of the NSLU2 "Slug" and various "smart plugs" etc., the STM32 with its particular mix of control registers is much more recent and has attracted /relatively/ little attention.

In both cases I miss the simplicity of being able to attach a logic analyser onto the system bus, but that's another issue entirely.

MarkMLl
Title: Re: Resources for STM32
Post by: trev on January 14, 2021, 09:19:15 pm
When I am honest I must say that the documentation on Wiki is good, but it mostly scratches the surface for stm32, it is more in-depth for AVR

More Info can actually be found here in the Forum, like for example info on this stm32f103 specific library that was used in the thread about DMA (The thread actually covers UART and interrupts when I remember correctly).

It would be helpful if you could transfer any useful STM32 info to the Wiki for future travellers to make their journeys easier.
TinyPortal © 2005-2018