Someone use the Platformio for STM32Duino ?
Is a good platform for various type of boards.
The website ist http://platformio.org/
It is fast and have a plugin for atom editor,
with auto-complete code for arduino (another plugin).
I use it in MacOSX and works very well, better than poor Arduino IDE
Regards
Joao Lopes
Thanks for the link.
I think the limitation with what I can see on the site is that it only seems to support STM designed boards, e.g Nucleo and Discovery.
Without downloading and installing etc, It be hard to know if it could be modified to suit the Maple mini or the myriad of other No-Name / generic boards that most people are using.
My other question would be how its library support is handled for third party Arduino libraries, (not libs that come with it)
Thanks for the link.
I think the limitation with what I can see on the site is that it only seems to support STM designed boards, e.g Nucleo and Discovery.
Without downloading and installing etc, It be hard to know if it could be modified to suit the Maple mini or the myriad of other No-Name / generic boards that most people are using.
I will download today
PS.
Does it support CortexM0 devices as well.
I’m looking at NRF51822 BLE on Arduino as well, using an existing core by RedBearLab, which is written for the Arduino IDE
Edit.
I just tried to install on Windows, but even though I have python 2.7 installed it, the pip command doesn’t seem to do what it does on Linux etc
Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> pip
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'pip' is not defined
>>> pip install -U pip setuptools
File "<stdin>", line 1
pip install -U pip setuptools
^
SyntaxError: invalid syntax
>>>
2. If you don’t want to upgrade your Python, then use PlatformIO installer script.
3. As for NRF51822 BLE on Arduino. Is this board the same like https://github.com/platformio/platformio/issues/319 ? Please describe in that issue what do you need. We are working on it.
Re: RFDuino
I think they use a different processor. I can’t remember which processor it is. I know its by Nordic, but its not the nRF51822.
But I’m still trying to get an optimized install solution for the nRF51822 on the normal Arduino IDE, so there is no point in me trying to get it working with anything else until I get the basics working ![]()
I think they use a different processor. I can’t remember which processor it is. I know its by Nordic, but its not the nRF51822.)[/quote]
Are you thinking the NRF24L01 possibly?
Re: RFDuino
I think they use a different processor. I can’t remember which processor it is. I know its by Nordic, but its not the nRF51822.
But I’m still trying to get an optimized install solution for the nRF51822 on the normal Arduino IDE, so there is no point in me trying to get it working with anything else until I get the basics working ![]()
Thanks for the info on the rfduino, I will check out their IDE
Actually is an Editor with building capabilities (like Arduino IDE) but the editor and project management is vastly improved. There are many plugins to add functionality in the environment (Auto styling, code completion, etc)
The basic idea is that you can have different platforms and different frameworks for each platform.
I tested with avr-arduino, esp8266-arduino and stm32-opencm3… working very well.
The only piece that is missing is the stm32-arduino framework. I will try to find an easy way to do this… it seems not very difficult….
If you can use MS Windows, Visual Micro supports Arduino concepts and GCC to target ARM processors. It is free with an optional low cost software-only debugger. It’s a plug-in for Visual Studio which is free now a days. That gets you best of breed code editing and project controls.
Visual Micro specifically works with Arduino’s oddball build process and boards files. The Teensy 3 (ARM M4 but not ST) is one with quite a few users.
There’s also Visual GDB, $100, which is also Ardino-esque for ARM targets, and has a real SWD hardware debugger. It too is a Visual Studio plug-in.
Alas, no Mac or Linux version.
The IDE of my choice for native development is Code::Blocks. It is fast, small, has very good editor (with code completion, refactoring etc), runs on Win/Linux/Mac, supports external tools (avrdude, stlink, etc) and supports multiple toolchains and multiple targets on the same project. No big magic, good editor and user definable compiler options for each target.
I am using it for many years and I am happy with it.
I have build many avr templates (with and without arduino core) and recently I have build a stm32duino template (if someone need it I will post it).
PlatformIO is an interesting platform, it tries to unify many things and many things are happening under the hood. It is not mature yet but it is promising.
The IDE of my choice for native development is Code::Blocks.
The IDE of my choice for native development is Code::Blocks.
Is there any news on this “platformio” question.
(I’ve also come across this IDE a couple of weeks ago and I do like it)
Cheerio! Kr. Bonne.
Anyone interested in this? Since I have only STM32F103RB, I can’t test all of them.
But, I could port more STM’s, if there would be some testers
Also, I could ask PlatformIO dev’s to add this, so it would be supported officialy.
Using PlatformIO 3.0, more info here: https://github.com/platformio/platformio/issues/423.
So, soon i will add more boards.
thanks
I know ATOM is meant to be able to upload but I just cant get that side of it working… Shame really.
Currently, generic f103r* / f103c* and maple v3 boards are supported. More will be added soon.
Flashing is either serial or dfu(with stm32duino bootloader).
What you need to do is:
1) Install PlatformIO IDE http://platformio.org/platformio-ide
2) Launch terminal in PlatformIO IDE and write:
platformio platform install https://github.com/platformio/platform-ststm32.git
Atom is a very nice editor with beautiful syntax coloring and code completion, if it is possible to combine it with stm32duino build capability and automatic upload, this would be a very good alternative to arduino ide.
EDIT: OK, I tried it (the generic c8), it works and builds binary (by default) starting at 0x08000000 without USB support. I will try other types of boards to see if dfu upload works, but my first impression is very good. Platform IO made huge progress in the last months, I am watching the progress of the project from last March and I am impressed with the achievments and the commitment of developers.
@ubis, the blue_pill board is already in boards collection but currently seems to support only the mbed framework, I think that arduinostm32 must be added
Atom is a very nice editor with beautiful syntax coloring and code completion, if it is possible to combine it with stm32duino build capability and automatic upload, this would be a very good alternative to arduino ide.
EDIT: OK, I tried it (the generic c8), it works and builds binary (by default) starting at 0x08000000 without USB support. I will try other types of boards to see if dfu upload works, but my first impression is very good. Platform IO made huge progress in the last months, I am watching the progress of the project from last March and I am impressed with the achievments and the commitment of developers.
@ubis, the blue_pill board is already in boards collection but currently seems to support only the mbed framework, I think that arduinostm32 must be added
PlatformManager: Installing platform-ststm32
Error: VCS: `git` client is not installed in your systemUploading is only possible at 0x08000000, so it will delete the bootloader (boards with bootloader starts at 0x08005000)
Uploading methods are:
dfu
serial
but not ST-Link (we use mostly ST-Link2.0 and not the new version ST-Link2.1 (as on nucleo boards))?
Boards:
Ok, you can use the generic ones, but the board we use mostly is the “maple mini” – this board is sadly missing (we use the maple mini as reference board for nearly everything – if it wont run on the maple mini, I will not run elsewhere). I tried to manually inserting a maple_mini.json into C:\Users\madias\.platformio\platforms\ststm32\boards but it won’t shown up.
C:\Users\madias\.platformio\packages\framework-arduinoststm32\STM32F1\variants
Is this folder considered by platformIO?
ST-Link is already inside platformio, this issue is also very easy to solve.
PlatformIO is not only an advanced building system for embedded world it is like a distribution (like linux distributions) as the project provides everything, toolchains, tools, frameworks etc. This is a huge job!( 3 operating systems, 200+ boards, 15+ platforms, 10+ frameworks, Library Browser). I am wondering how it is possible for such small developing team, and how they will support the system with updates (in frameworks, toolchains, etc)
Only trap: We have some additional menu items in the Arduino IDE, like choosing the bootloader. This must be implemented someway.
BTW: It seems like plattformIO is going for a business plan: https://pioplus.com/pricing.html
src\main.cpp: In function 'void setup()':
src\main.cpp:3:1: error: 'Serial' was not declared in this scope
Serial.begin(9600);
^
*** [.pioenvs\genericSTM32F103CB\src\main.o] Error 1
[ERROR] Took 1.59 secondsYou define a project by creating the platform.ini, for example it is possible to define an arduino/uno board build by these lines in platformio.ini:
[env:uno]
platform = atmelavr
framework = arduino
board = uno
Uploading is only possible at 0x08000000, so it will delete the bootloader (boards with bootloader starts at 0x08005000)
Uploading methods are:
dfu
serial
but not ST-Link (we use mostly ST-Link2.0 and not the new version ST-Link2.1 (as on nucleo boards))?
Boards:
Ok, you can use the generic ones, but the board we use mostly is the “maple mini” – this board is sadly missing (we use the maple mini as reference board for nearly everything – if it wont run on the maple mini, I will not run elsewhere). I tried to manually inserting a maple_mini.json into C:\Users\madias\.platformio\platforms\ststm32\boards but it won’t shown up.
C:\Users\madias\.platformio\packages\framework-arduinoststm32\STM32F1\variants
Is this folder considered by platformIO?
[Mon Sep 12 11:47:16 2016] Processing bluepill_f103c8 (platform: ststm32, board: bluepill_f103c8, framework: mbed)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
Collected 7 compatible libraries
Looking for dependencies...
Project does not have dependencies
Compiling .pioenvs/bluepill_f103c8/src/main.o
src/main.cpp:16:21: fatal error: Arduino.h: No such file or directory
#include <Arduino.h>
^
compilation terminated.
*** [.pioenvs/bluepill_f103c8/src/main.o] Error 1
========================== [ERROR] Took 1.66 seconds ==========================
[Mon Sep 12 11:47:16 2016] Processing bluepill_f103c8 (platform: ststm32, board: bluepill_f103c8, framework: mbed)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
Collected 7 compatible libraries
Looking for dependencies...
Project does not have dependencies
Compiling .pioenvs/bluepill_f103c8/src/main.o
src/main.cpp:16:21: fatal error: Arduino.h: No such file or directory
#include <Arduino.h>
^
compilation terminated.
*** [.pioenvs/bluepill_f103c8/src/main.o] Error 1
========================== [ERROR] Took 1.66 seconds ==========================
Don’t forget to add upload_procotol = serial or dfu in platformio.ini to enable automatic flashing
So I tried for my maple mini
[env:genericSTM32F103CB]
platform = ststm32
framework = arduino
board = genericSTM32F103CB
upload_port = /dev/cu.usbmodem411
UPLOAD_PROTOCOL = dfuSo I tried for my maple mini
[env:genericSTM32F103CB]
platform = ststm32
framework = arduino
board = genericSTM32F103CB
upload_port = /dev/cu.usbmodem411
UPLOAD_PROTOCOL = dfu[env:genericSTM32F103CB]
platform = ststm32
framework = arduino
board = genericSTM32F103CB
UPLOAD_PROTOCOL = serial
[env:bluepill_f103c8]
platform = ststm32
board = bluepill_f103c8
framework = arduino
upload_port = COM10
upload_protocol = serial
lib_deps=SPI
I can build and upload (dfu) with platformio but after flashing there’s no COM port.
Compiling with Arduino IDE is quite time-consuming especially with old laptops so it would be so great to get platformio working.
Any hints where to start looking ?
In your compile flags, do you have the “-DSERIAL_USB” defined ?
In your compile flags, do you have the “-DSERIAL_USB” defined ?
EDIT:
Added bolded rows to arduino.py and the size is approximately the same than with Arduino build.
env.Append(
CCFLAGS=[
“–param”, “max-inline-insns-single=500”,
“-march=armv7-m”,
“-fno-exceptions”,
“-fno-rtti”,
“-fno-threadsafe-statics”,
],
I am currently trying to use PlatformIO for generic C8 projects, and managed to successfully build a simple blinky project.
It also uploads over DFU (manual reset):
Uploading .pioenvs\genericSTM32F103CB\firmware.bin
maple_loader v0.1
Resetting to bootloader via DTR pulse
Reset via USB Serial Failed! Did you select the right serial port?
Searching for DFU device [1EAF:0003]...
Assuming the board is in perpetual bootloader mode and continuing to attempt dfu programming...
Found it!
Opening USB Device 0x1eaf:0x0003...
Found Runtime: [0x1eaf:0x0003] devnum=1, cfg=0, intf=0, alt=2, name="STM32duino bootloader v1.0 Upload to Flash 0x8002000"
Setting Configuration 1...
Claiming USB DFU Interface...
Setting Alternate Setting ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
Transfer Size = 0x0400
bytes_per_hash=283
Starting download: [##################################################] finished!
error resetting after download: usb_reset: could not reset device, win error: The system cannot find the file specified.
state(8) = dfuMANIFEST-WAIT-RESET, status(0) = No error condition is present
Done!
Resetting USB to switch back to runtime mode
[SUCCESS] Took 12.78 seconds
I am currently trying to use PlatformIO for generic C8 projects, and managed to successfully build a simple blinky project.
It also uploads over DFU (manual reset):
Uploading .pioenvs\genericSTM32F103CB\firmware.bin
maple_loader v0.1
Resetting to bootloader via DTR pulse
Reset via USB Serial Failed! Did you select the right serial port?
Searching for DFU device [1EAF:0003]...
Assuming the board is in perpetual bootloader mode and continuing to attempt dfu programming...
Found it!
Opening USB Device 0x1eaf:0x0003...
Found Runtime: [0x1eaf:0x0003] devnum=1, cfg=0, intf=0, alt=2, name="STM32duino bootloader v1.0 Upload to Flash 0x8002000"
Setting Configuration 1...
Claiming USB DFU Interface...
Setting Alternate Setting ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
Transfer Size = 0x0400
bytes_per_hash=283
Starting download: [##################################################] finished!
error resetting after download: usb_reset: could not reset device, win error: The system cannot find the file specified.
state(8) = dfuMANIFEST-WAIT-RESET, status(0) = No error condition is present
Done!
Resetting USB to switch back to runtime mode
[SUCCESS] Took 12.78 seconds
I doubt, because it seems that PlatformIO uses for build the “toolchain-gccarmnoneeabi” folder.
I doubt, because it seems that PlatformIO uses for build the “toolchain-gccarmnoneeabi” folder.
And this is because the DFU USB is compiled with a different (newer) version than the standard supported one by Arduino_STM32.
Any version other than 4.8.3-2014Q1 is known to cause troubles.
But blinky still doesn’t work. I think I have to change anyway the linker script, too.
Where is the “arduino.py” located?
But blinky still doesn’t work. I think I have to change anyway the linker script, too.
Where is the “arduino.py” located?
There is “Build” icon in ATOM which I just press and then watch the show
Btw, autocomplete works just fine for me in ATOM with CLANG (win10 64bit).
There is “Build” icon in ATOM which I just press and then watch the show
This is a method which can be applied for each chip variant in part, independent on the project and board.
The solution is to edit the respective JSON files, to be found under “\.platformio\platforms\ststm32\boards”
For the blue pill I am using env:genericSTM32F103CB (because of extra flash size
), which corresponds to “genericSTM32F103CB.json” with following content (adapted already):
{
"build": {
"core": "maple",
"cpu": "cortex-m3",
"extra_flags": "-DARDUINO_GENERIC_STM32F103C -DMCU_STM32F103CB",
"f_cpu": "72000000L",
"hwids": [
["0x1EAF", "0x0003"],
["0x1EAF", "0x0004"]
],
"ldscript": "bootloader_20.ld",
"mcu": "stm32f103cb",
"variant": "generic_stm32f103c"
},
"frameworks": ["arduino"],
"name": "STM32F103CB (20k RAM. 128k Flash)",
"upload": {
"disable_flushing": false,
"maximum_ram_size": 20480,
"maximum_size": 131072,
"protocol": "dfu",
"require_upload_port": false,
"use_1200bps_touch": false,
"wait_for_upload_port": false
},
"url": "http://www.st.com/content/st_com/en/products/microcontrollers/stm32-32-bit-arm-cortex-mcus/stm32f1-series/stm32f103/stm32f103cb.html",
"vendor": "Generic"
}
This is a method which can be applied for each chip variant in part, independent on the project and board.
The solution is to edit the respective JSON files, to be found under “\.platformio\platforms\ststm32\boards”
For the blue pill I am using env:genericSTM32F103CB (because of extra flash size
), which corresponds to “genericSTM32F103CB.json” with following content (adapted already):
{
"build": {
"core": "maple",
"cpu": "cortex-m3",
"extra_flags": "-DARDUINO_GENERIC_STM32F103C -DMCU_STM32F103CB",
"f_cpu": "72000000L",
"hwids": [
["0x1EAF", "0x0003"],
["0x1EAF", "0x0004"]
],
"ldscript": "bootloader_20.ld",
"mcu": "stm32f103cb",
"variant": "generic_stm32f103c"
},
"frameworks": ["arduino"],
"name": "STM32F103CB (20k RAM. 128k Flash)",
"upload": {
"disable_flushing": false,
"maximum_ram_size": 20480,
"maximum_size": 131072,
"protocol": "dfu",
"require_upload_port": false,
"use_1200bps_touch": false,
"wait_for_upload_port": false
},
"url": "http://www.st.com/content/st_com/en/products/microcontrollers/stm32-32-bit-arm-cortex-mcus/stm32f1-series/stm32f103/stm32f103cb.html",
"vendor": "Generic"
}
I must say, it is a very nice package, I like it a lot
Pros:
– simple generate/import “Arduino” projects
– hackable INI
– easy connection with Eclipse as editor and/or debug tool (OpenOCD) – no need for Sloeber!
The only thing I am not satisfied is the editor feature of ATOM. A simple dragging of selected code lines is not possible, which I consider a basic feature of any editor – Npp does it very nicely, Eclipse too.
But anyway, there is no perfect solution, and I think I will use only Eclipse (Neon 3) as editor, combined with PlatformIO as build/config tool from now on.
Is there a need for a wiki entry for this?
Taken into account that there are a lot of stm32 variants, i think it is a good possibility to quickly personalize it.
And the changes are immediately active, no need to restart the ide
I could setup two different configurations (DFU and STlink upload) using two different json files, and switched through quickly changing one line in the ini file. After couple of seconds (needed to re-index the project) was the new config active and build was ready to go.
And also a good feature: if you change one file, only that file will be recompiled so that the consecutive build is done in 3 seconds. Very fast!
Anyone is welcome to add more info + comment.
pio init –ide=eclipse –board=genericSTM32F103CB
Build with: pio run
Clean: pio run -t clean
As well as upload : pio run -t upload
there is also serial monitor. I have a .bat file that builds and uploads and starts Serial monitor after 3 seconds.
EDIT: Here, I can not attach .bat files so here it is. Adjust timeout accordingly. 3 secs seems to be just about enough.
platformio run -t upload
timeout 3
platformio device monitor --baud=230400 --port=COM17
Can you share with us the batch file? I would add it to the wiki.
Can you share with us the batch file? I would add it to the wiki.
The I could start the serial terminal within Eclipse.
EDIT
This is possible by inserting to the .cproject file as the last target (end of file minus 4 lines) the following lines:
<target name="PlatformIO: Open serial terminal" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>platformio</buildCommand>
<buildArguments>-f -c eclipse</buildArguments>
<buildTarget>device monitor --baud=230400 --port=COM4</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>false</runAllBuilders>
</target>
Can you share with us the batch file? I would add it to the wiki.
As simple? Don’t know. But it doesn’t even support dragging selected lines, so it is really no go for me.
but for me i’d stick with eclipse as i do java, tomcat servlets (you could do processing https://processing.org/ in there as well), arduino (stm32duino), android, python and general c/c all in one place, eclipse really lives up to its name eclipse
This is what I usually do:
– import Arduino project with Platformio
and then
– export the project to Eclipse
All you should finally do is to import the project folder to Eclipse, and you are good to go.
And you can also debug with Eclipse ![]()
Blue pill seems locked after first upload, it can’t upload again with error message unknown chip id! 0xa05f0000. After some hours of googling, i found that set the jumper 0 to 1 make it uploadable again. But with Arduino IDE. Using platform.io, the upload is success but the code didn’t running.
After read some post here, i try different approach by changing genericSTM32F103CB.json inside .platformio\platforms\ststm32\boards to use “bootloader_20.ld”. Blue pill is not locked but the code didn’t running.
stevestrong wrote:I think I have found a more appropriate way to adapt linking and upload parameters.
This is a method which can be applied for each chip variant in part, independent on the project and board.
The solution is to edit the respective JSON files, to be found under “\.platformio\platforms\ststm32\boards”
For the blue pill I am using env:genericSTM32F103CB (because of extra flash size
), which corresponds to “genericSTM32F103CB.json” with following content (adapted already):
{
"build": {
"core": "maple",
"cpu": "cortex-m3",
"extra_flags": "-DARDUINO_GENERIC_STM32F103C -DMCU_STM32F103CB",
"f_cpu": "72000000L",
"hwids": [
["0x1EAF", "0x0003"],
["0x1EAF", "0x0004"]
],
"ldscript": "bootloader_20.ld",
"mcu": "stm32f103cb",
"variant": "generic_stm32f103c"
},
"frameworks": ["arduino"],
"name": "STM32F103CB (20k RAM. 128k Flash)",
"upload": {
"disable_flushing": false,
"maximum_ram_size": 20480,
"maximum_size": 131072,
"protocol": "dfu",
"require_upload_port": false,
"use_1200bps_touch": false,
"wait_for_upload_port": false
},
"url": "http://www.st.com/content/st_com/en/products/microcontrollers/stm32-32-bit-arm-cortex-mcus/stm32f1-series/stm32f103/stm32f103cb.html",
"vendor": "Generic"
}
http://www.stm32duino.com/viewtopic.php?f=22&t=1958
^^^ perpetual boot loader mode keeps the maple mini in dfu mode and prevents it from jumping to the sketch in which you can’t upload the sketch
note that if you are using blue pill, without the (user1 – boot0) button like the maple mini, then you should not be setting the boot0 pin, if you set boot0 pin, the mcu will drop into uart update mode, in which you’d need to use another uart dongle to upload the sketch. if you are using bluepill, my suggestion is press reset and try to perform the upload again when the led starts fast blinks
———————
in the first hand you would need to figure out how to connect to the board and be able to run dfu-util.exe -l, the output of dfu-util.exe -l should look something like the example below, which show that at least dfu uploads is working.
this section below isn’t too relevant until at least dfu is shown to be working
—————–
there is one more thing, which is whether your board is shipped with a *stock maple bootloader*
that would need you to be able to run the command dfu-util.exe -l shortly after you press reset and the leds are blinking
if it is the ‘stock maple bootloader’ you would only see 2 options alt=0 upload to ram, alt=1 upload to flash 0x8005000, something like this:
> dfu-util -l
dfu-util 0.8
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2014 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to [email protected]
Found DFU: [1eaf:0003] ver=0200, devnum=44, cfg=1, intf=0, alt=1, name="DFU Program FLASH 0x08005000", serial="LLM 003"
Found DFU: [1eaf:0003] ver=0200, devnum=44, cfg=1, intf=0, alt=0, name="DFU Program RAM 0x20000C00", serial="LLM 003"
This is what I usually do:
– import Arduino project with Platformio
and then
– export the project to Eclipse
All you should finally do is to import the project folder to Eclipse, and you are good to go.
And you can also debug with Eclipse ![]()
http://platformio.org/get-started/ide
‘processing’ in eclipse is documented by the processing team itself
https://processing.org/tutorials/eclipse/
python in eclipse is a plug in
https://marketplace.eclipse.org/content … de-eclipse
![]()
I think, the most comfortable way to debug it is within Eclipse though.
stevestrong wrote:You can export the Platformio project to Eclipse very easily.
This is what I usually do:
– import Arduino project with Platformio
and then
– export the project to Eclipse
All you should finally do is to import the project folder to Eclipse, and you are good to go.
And you can also debug with Eclipse ![]()

