Platformio

Development environment specific, Arduino, Eclipse, VS2013,Em::Blocks etc
stevestrong
Posts: 1011
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: Platformio

Postby stevestrong » Tue Apr 04, 2017 6:09 pm

I also have to manually reset the board but this is because the firmware won't got to serial USB mode.

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.

michael_l
Posts: 319
Joined: Mon Aug 24, 2015 6:11 pm

Re: Platformio

Postby michael_l » Tue Apr 04, 2017 6:11 pm

One other thing about platformio is that during compile errors it does not show correct line for .ino. It must be because it does preprocess .ino first. Arduino IDE of course shows it correctly.

stevestrong
Posts: 1011
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: Platformio

Postby stevestrong » Tue Apr 04, 2017 6:14 pm

I have converted the INO file into CPP file and I have no problems with line numbers: they are shown correctly in ATOM.

michael_l
Posts: 319
Joined: Mon Aug 24, 2015 6:11 pm

Re: Platformio

Postby michael_l » Tue Apr 04, 2017 7:08 pm

stevestrong wrote:I have converted the INO file into CPP file and I have no problems with line numbers: they are shown correctly in ATOM.


I use QtCreator which is light and fast and because I couldnt get autocomplete working in Atom even I installed the autocomplete-clang plugin

stevestrong
Posts: 1011
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: Platformio

Postby stevestrong » Wed Apr 05, 2017 7:32 am

OK, I managed to replace the 4.8.4 compiler with the 4.8.3 Q1. Just downloaded the wanted version and unzipped to the correct folder.
But blinky still doesn't work. I think I have to change anyway the linker script, too.

Where is the "arduino.py" located?
Last edited by stevestrong on Wed Apr 05, 2017 4:03 pm, edited 2 times in total.

michael_l
Posts: 319
Joined: Mon Aug 24, 2015 6:11 pm

Re: Platformio

Postby michael_l » Wed Apr 05, 2017 8:10 am

stevestrong wrote:OK, I managed to replace the 4.8.4 compiler with the 4.8.3 Q1. Just downloaded the new version and unzipped to the correct folder.
But blinky still doesn't work. I think I have to change anyway the linker script, too.

Where is the "arduino.py" located?


Can you post commandline for linking (pio run -v) ?

arduino.py is in platformio\platforms\ststm32\builder\frameworks

stevestrong
Posts: 1011
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: Platformio

Postby stevestrong » Wed Apr 05, 2017 8:52 am

I do not call extra command line for linking.
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).

michael_l
Posts: 319
Joined: Mon Aug 24, 2015 6:11 pm

Re: Platformio

Postby michael_l » Wed Apr 05, 2017 8:57 am

stevestrong wrote:I do not call extra command line for linking.
There is "Build" icon in ATOM which I just press and then watch the show :)


Yes, ok :D

you can build with: 'pio run -v' from command line in project directory and in the end you'll see the linker command..

stevestrong
Posts: 1011
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: Platformio

Postby stevestrong » Wed Apr 05, 2017 9:00 am

OK, thanks, I will check it in the evening.

stevestrong
Posts: 1011
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: Platformio

Postby stevestrong » Wed Apr 05, 2017 5:22 pm

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):

Code: Select all

{
  "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"
}

Here I could set the upload method to "dfu" and the ld script to "bootlader_20".
Upload over DFU works flawlessly, including automatic reset before and after upload.

Of course, the bluepill JSON can also be edited accordingly.

Now its time to go further and combine PlatformIO with Eclipse for debugging... :mrgreen:


Return to “IDE's”

Who is online

Users browsing this forum: No registered users and 1 guest