Introducing the new Arduino core for STM32

The official STMicroelectronics Arduino core
fpiSTM
Posts: 89
Joined: Fri Sep 16, 2016 12:33 pm
Location: Le Mans, France

Introducing the new Arduino core for STM32

Post by fpiSTM » Thu May 18, 2017 6:34 am

Hi All,

I would like to introduce the new Arduino core for STM32:
https://github.com/stm32duino/Arduino_Core_STM32

A first package version is available through the Arduino IDE Boards manager by adding the following link to the "Additional Boards Managers URLs" field of the "Preferences" dialog:
https://github.com/stm32duino/BoardMana ... index.json

It now support every STM32 families based on HAL (all version added to the repo) , some boards are already available:
  • F0: Nucleo F091RC, Nucleo F030R8
    F1: Nucleo F103RB
    F2: Nucleo F207ZG
    F3: Nucleo F303RE
    F4: Nucleo F429ZI, STM32F407G-DISC1
    F7: STM32F746G-DISCOVERY
    L0: Nucleo L053R8, Nucleo L432KC
    L4: Nucleo L476RG
BP and MM will come soon.

No more static libraries for the HAL. By modifying the stm32YYxx_hal_conf.h in the variant, it is possible to enable or disable HAL features.
CMSIS is no more include in the source, it a package dependency and use the one package by Arduino: CMSIS 4.5.0.
ARM gcc toolchain has been updated to 6-2017-q1-update version to support F7 family (cortex-m7) but for other families the 4.8.3-2014q1 version still valid.
All pins are available based on mbed pinmap feature.
PeripheralPins.c automatically generated from stm32cube mcu xml file. This avoid issue on pins definition.
Python script to generate it, is available thanks the Arduino_Tools package or the github repo:
https://github.com/stm32duino/Arduino_Tools
Pins capabilities are configurable through this file by commenting or not pin description.
USB feature is available and disabled by default. To enable it, use the menu "Tools->USB Interface"

Further features will be added. Do not hesitate to contribute or submit issues.
uSD with FatFs has been added and tested on F7.
USB Serial is ongoing (CDC).
Ethernet support based on LwIp will be added.
ADC features will be extended.
...

I will update the wiki in order to be inline with this new core and adding add a page on how to include a new variant (PeripheralPins.c generation, config,...).
Wiki:
https://github.com/stm32duino/wiki/wiki
Last edited by fpiSTM on Wed Jul 12, 2017 2:51 pm, edited 3 times in total.

caniggia
Posts: 12
Joined: Tue Dec 06, 2016 2:38 pm

Re: Introducing the new Arduino core for STM32

Post by caniggia » Thu May 18, 2017 11:37 am

Hi
If i add '-DUSBCON' to .build.upload_flags in 'boards.txt',
i get this error:

Code: Select all

AppData\Local\Arduino15\packages\STM32\hardware\stm32f1\2017.1.20\cores\arduino\main.cpp:54:2: error: 'USBDevice' was not declared in this scope

  USBDevice.attach();

  ^

exit status 1
Error compiling for board BluePill F103C8.

caniggia
Posts: 12
Joined: Tue Dec 06, 2016 2:38 pm

Re: Introducing the new Arduino core for STM32

Post by caniggia » Thu May 18, 2017 12:01 pm

OK,
i've added '-USBCON' instead of '-DUSBCON' and now it compiles.

And if i add 'Serial.begin()' to the sketch i get USB virtual COM.

ChrisMicro
Posts: 227
Joined: Fri Mar 24, 2017 4:51 pm
Location: Germany

Re: Introducing the new Arduino core for STM32

Post by ChrisMicro » Thu May 18, 2017 1:56 pm

@ fpiSTM
very good :D Thank you.

I try the STM32F7 Discovery because I didn't have the compiler before.

Here is my first test:

1. download the package by the board manager as described above
==> status message:
Index error: could not find referenced tool name=openocd version=0.10.0-arduino1-static packager=arduino-org
Index error: could not find referenced tool name=nrf5x-cl-tools version=9.3.1 packager=arduino-org
Index error: could not find referenced tool name=openocd version=0.10.0-arduino1-static packager=arduino-org
Index error: could not find referenced tool name=nrf5x-cl-tools version=9.3.1 packager=arduino-org
Index error: could not find referenced tool name=openocd version=0.10.0-arduino1-static packager=arduino-org
Index error: could not find referenced tool name=nrf5x-cl-tools version=9.3.1 packager=arduino-org


2. compiling the blink example and download by mass storage:
==> it is blinking, very good

3. compile and download the " Arduino TFT Bitmap Logo example"
==> screen remains blank

fpiSTM
Posts: 89
Joined: Fri Sep 16, 2016 12:33 pm
Location: Le Mans, France

Re: Introducing the new Arduino core for STM32

Post by fpiSTM » Thu May 18, 2017 2:48 pm

@caniggia
You are not working with the repo mention in this thread. You work with the stm32f1.

@ChrisMicro
1. for the download status it is not link to the STM32 package as it do not mention openocd not the nrf5x.
Probably, link to another json file you have used.

2. ;)

3. Right, nice shot :roll:
I need to update the SD lib to use the default one if the card slot used is on the shield (SPI) or use the other if we want use the onboard card slot.
FYI, currently the LCD is not managed. I will add the support later.

holla2040
Posts: 3
Joined: Mon Nov 21, 2016 6:34 pm

Re: Introducing the new Arduino core for STM32

Post by holla2040 » Sat May 20, 2017 9:44 pm

on ubuntu 16.04 x64, arduino 1.8.1, I get this error when compiling blink,

fork/exec /home/holla/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-g++: no such file or directory
Error compiling for board BluePill F103C8

looks like the board manager isn't downloading the compiler.

-----

update: I deleted my ~/.arduino15 directory and re-installed the tools using board manager and
https://github.com/stm32duino/BoardMana ... index.json
then blink compiled fro BluePill F103CB, yay!

User avatar
Rick Kimball
Posts: 894
Joined: Tue Apr 28, 2015 1:26 am
Location: Eastern NC, US
Contact:

Re: Introducing the new Arduino core for STM32

Post by Rick Kimball » Fri Jun 09, 2017 9:35 pm

So is your goal to deprecate the F1 core at https://github.com/stm32duino/Arduino_Core_STM32F1 ?
-rick

fpiSTM
Posts: 89
Joined: Fri Sep 16, 2016 12:33 pm
Location: Le Mans, France

Re: Introducing the new Arduino core for STM32

Post by fpiSTM » Fri Jun 09, 2017 9:53 pm

Yes, as the new repo take in account several remarks done on this implementation (code size, limited pins definition, static library,...).
All current open issues on F1 will be reported and corrected.
Is there any problem with that ?

User avatar
Rick Kimball
Posts: 894
Joined: Tue Apr 28, 2015 1:26 am
Location: Eastern NC, US
Contact:

Re: Introducing the new Arduino core for STM32

Post by Rick Kimball » Fri Jun 09, 2017 10:09 pm

This architecture seems much better than the previous setup. I'm all for moving forward. The only reason I stopped looking at the other one was because of the issue with the pin mapping. That seems all taken care of in this new port.
-rick

fpiSTM
Posts: 89
Joined: Fri Sep 16, 2016 12:33 pm
Location: Le Mans, France

Re: Introducing the new Arduino core for STM32

Post by fpiSTM » Sat Jun 10, 2017 5:22 am

Yes this is one of the huge rework. Now all pins are available and I hope easily customizable thanks PeriperalPins.c (by comment/uncomment).
FYI, the new pins managements is fully inspired from mbed.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest