Porting Libraries from Arduino to STM32

Please read this if you are new to the STM32


Message to all users

I've upgraded the forum (PHPBB) to version 3.1.10 which is the last stable release in the 3.1 tree.

As far as I can tell everything is still working OK, e.g. all posts look like they are there and the attachments are OK

If anyone has any problems please PM me.
PS. Don't PM the admin account as for some reason I still don't get email notifications of these PM's (but I never have ;-)

porellan63
Posts: 3
Joined: Wed Jun 10, 2015 12:38 pm

Porting Libraries from Arduino to STM32

Postby porellan63 » Wed Jun 10, 2015 1:33 pm

Hello Roger

I am an electronic and I am learning to program the STM32F103RBT6 board from ebay. Olimexino from Maple have the stm32f103rbt6 also
Could you give us some tips or hints about how to port the arduino´s libraries to STM32F1 or STM32F4?
or Could you explain which the changes are in the header files.
I am using Arduino 1.6.4 and Arduino_STM32 hardware files
In this moment I would like to port the RGB16x32 libraries but i don't know how
Any help it would be very appreciated
Thanks, Regards
Pablo

User avatar
mrburnette
Posts: 1774
Joined: Mon Apr 27, 2015 12:50 pm
Location: Greater Atlanta
Contact:

Re: Porting Libraries from Arduino to STM32

Postby mrburnette » Wed Jun 10, 2015 3:43 pm

porellan63 wrote:Hello Roger

I am an electronic and I am learning to program the STM32F103RBT6 board from ebay. Olimexino from Maple have the stm32f103rbt6 also
Could you give us some tips or hints about how to port the arduino´s libraries to STM32F1 or STM32F4?
or Could you explain which the changes are in the header files.
I am using Arduino 1.6.4 and Arduino_STM32 hardware files
In this moment I would like to port the RGB16x32 libraries but i don't know how
Any help it would be very appreciated
Thanks, Regards
Pablo


Pablo:

Welcome!

Your question is not easily answered. However, most of the issues that I have seen are hardware-centric such as the SPI and the I2C which have already been handled (are are being handled) in the core. For user libraries, the issue is that the old AVR are 8-bit devices and the STM32 is a 32-bit ARM, so the simple answer is "variable typing" and casts in functions and obviously return values.

Here are the libraries already ported: http://stm32duino.com/viewtopic.php?f=13&t=274

I would recommend pulling one or two and comparing (with some OS tool you like) and then making a few notes between the original and the ported ones. Most of the libraries that have been converted, have comments that will help. It is not always the headers, but sometimes the cpp files, too. Just depends on structures. Fortunately, we have a few graphic libs already ported, so that code would be what I would recommend as a started to the learning experience.

WE all appreciate your enthusiasm and willingness to jump in and help! Roger will likely add some insight as well, but he is in Australia and has strange hours (for us in the Northern Hemisphere!)

Ray

User avatar
ahull
Posts: 1423
Joined: Mon Apr 27, 2015 11:04 pm
Location: Sunny Scotland
Contact:

Re: Porting Libraries from Arduino to STM32

Postby ahull » Wed Jun 10, 2015 3:51 pm

The only additional question would be which library/libraries are you trying to port. If the library uses digitalWrite() to switch on and off a bunch of pins then it will probably work out of the box. Anything more complicated will require a bit of rework.
- Andy Hull -

madias
Posts: 812
Joined: Mon Apr 27, 2015 11:26 am
Location: Vienna, Austria

Re: Porting Libraries from Arduino to STM32

Postby madias » Wed Jun 10, 2015 4:09 pm

Welcome Pablo,
I would just try the library out - if there are compile errors you can't fix it - post it! (Please with a reference to the used library).
One nasty problem (will fixed soon) is with pinMode's in the constructor, so take care of it (for the moment)!

Matthias

mbruck
Posts: 4
Joined: Mon Jun 15, 2015 7:26 am

Re: Porting Libraries from Arduino to STM32

Postby mbruck » Mon Jun 15, 2015 7:50 am

Possible to port Ethernet library for wiznet W5100. As I see from other forum, F1 series have hardware SPI bug ?

(Very cheap ethernet boards with hardware tcip/ip stack.)

User avatar
mrburnette
Posts: 1774
Joined: Mon Apr 27, 2015 12:50 pm
Location: Greater Atlanta
Contact:

Re: Porting Libraries from Arduino to STM32

Postby mrburnette » Mon Jun 15, 2015 12:15 pm

mbruck wrote:Possible to port Ethernet library for wiznet W5100. As I see from other forum, F1 series have hardware SPI bug ?

(Very cheap ethernet boards with hardware tcip/ip stack.)



http://stm32duino.com/viewtopic.php?f=13&t=240&hilit=ethernet

viewtopic.php?f=15&t=319&p=2787&hilit=ethernet#p2787

mausi_mick
Posts: 129
Joined: Fri Aug 12, 2016 1:40 pm

Re: Porting Libraries from Arduino to STM32

Postby mausi_mick » Tue Nov 15, 2016 2:03 am

Hi,

for the UTOUCH / URTOUCH lib , which originally works together with the UTFT-lib , I have modified the four examples sketches:

- URTouch_Calibration
- URTouch_ButtonTest
- URTouch_QuickDraw
- URTouch_QuickPaint

to work together with Adafruit SPI-Graphic libraries for ILI9341 displays :
Adafruit_GFX_AS
Adafruit_ILI9341_STM

It's possible to integrate these programs there ?

labude
Posts: 1
Joined: Wed Sep 07, 2016 7:18 pm

Re: Porting Libraries from Arduino to STM32

Postby labude » Fri Nov 18, 2016 9:41 pm

Hi mausi-mick,

i am very curious to see your sketches as i am failing to merge the Adafruit_ILI9341_STM lib with URTouch. Could you post the modified examples somewhere?

Thanks a lot!


Return to “Welcome & FAQs”

Who is online

Users browsing this forum: No registered users and 2 guests