Platformio

Development environment specific, Arduino, Eclipse, VS2013,Em::Blocks etc
aster
Posts: 79
Joined: Thu Mar 30, 2017 2:41 pm
Location: bella italy
Contact:

Re: Platformio

Post by aster » Thu May 18, 2017 12:17 am

is here someone who is using the platformio ide without eclipse? is it simple as the arduino ide?

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

Re: Platformio

Post by stevestrong » Thu May 18, 2017 11:36 am

ATOM is the embedded editor and, although may be fancier than Arduino IDE, I don't like it.
As simple? Don't know. But it doesn't even support dragging selected lines, so it is really no go for me.

ag123
Posts: 698
Joined: Thu Jul 21, 2016 4:24 pm

Re: Platformio

Post by ag123 » Thu May 18, 2017 11:59 am

nothing against platformio really, it is probably a good ide, worth trying out
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 :lol:

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

Re: Platformio

Post by stevestrong » Thu May 18, 2017 12:10 pm

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

erinqvnm
Posts: 1
Joined: Thu May 18, 2017 12:02 pm

Re: Platformio

Post by erinqvnm » Thu May 18, 2017 12:22 pm

Hi, i've been troubled with platform.io to upload blue pill. It has been 2 days and i still can't figure out how to upload it as easy as Arduino IDE.

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

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:
I also tried your method, but didn't get it to work because somehow it can't find the dfu: Couldn't find the DFU device: [1EAF:0003]. Any help?

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

Re: Platformio

Post by stevestrong » Thu May 18, 2017 1:52 pm

bootloader_20.ld is only applicable if you flashed the stm32duino bootloader (version 2.0) (see wiki).

Also see Uploading.

ag123
Posts: 698
Joined: Thu Jul 21, 2016 4:24 pm

Re: Platformio

Post by ag123 » Thu May 18, 2017 11:30 pm

the dfu problem is related to the different problem, first of all try to put the device in "perpetual bootloader mode"
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:

Code: Select all

> 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 dfu-util@lists.gnumonks.org

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"
if you can verify that it is the stock bootloader then the ldscript is different e.g.

Code: Select all

"ldscript": "flash.ld",
and flash.ld should have contents like this, you should be able to find this file with these contents in the same folder as bootloader_20.ld,

Code: Select all

/*
 * libmaple linker script for "Flash" builds.
 *
 * A Flash build puts .text (and .rodata) in Flash, and
 * .data/.bss/heap (of course) in SRAM, but offsets the sections by
 * enough space to store the Maple bootloader, which lives in low
 * Flash and uses low memory.
 */

/*
 * This pulls in the appropriate MEMORY declaration from the right
 * subdirectory of stm32/mem/ (the environment must call ld with the
 * right include directory flags to make this happen). Boards can also
 * use this file to use any of libmaple's memory-related hooks (like
 * where the heap should live).
 */
MEMORY
{
  ram (rwx) : ORIGIN = 0x20000C00, LENGTH = 17K
  rom (rx)  : ORIGIN = 0x08005000, LENGTH = 108K
}

/* Provide memory region aliases for common.inc */
REGION_ALIAS("REGION_TEXT", rom);
REGION_ALIAS("REGION_DATA", ram);
REGION_ALIAS("REGION_BSS", ram);
REGION_ALIAS("REGION_RODATA", rom);

/* Let common.inc handle the real work. */
INCLUDE common.inc

aster
Posts: 79
Joined: Thu Mar 30, 2017 2:41 pm
Location: bella italy
Contact:

Re: Platformio

Post by aster » Fri May 19, 2017 7:53 am

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 ;)
I thought that i could do it also with platformio, but is it a command line debugger or does it have a GUI?

The possibility to run progessing and python on eclipse is interesting :roll:

ag123
Posts: 698
Joined: Thu Jul 21, 2016 4:24 pm

Re: Platformio

Post by ag123 » Fri May 19, 2017 9:40 am

i think it has a command line interface, a gui and a 'cloud' ui (not tried it though) :lol:
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
:)

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

Re: Platformio

Post by stevestrong » Fri May 19, 2017 9:45 am

You could debug (theoretically) directly within Platformio (ATOM). I did not try it.
I think, the most comfortable way to debug it is within Eclipse though.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests