3.0a7, unable to build mbed framework for new board

First things first:

$ pio --version
PlatformIO, version 3.0.0a7

In my fork of platform-ststm32 there is new board defined, that is supported in v122 and v123 of mbed framework. I installed the platform using GH archive link:

$ pio platform install https://github.com/zgoda/platform-ststm32/archive/bluepill_f103c8.zip
PlatformManager: Installing bluepill_f103c8
Downloading...
Unpacking  [####################################]  100%
ststm32 @ 0.1.0 has been successfully installed!
PackageManager: Installing toolchain-gccarmnoneeabi @ >=1.40803.0,<1.40805.0
toolchain-gccarmnoneeabi @ 1.40804.0 is already installed
PackageManager: Installing tool-scons @ >=2.3.0,<2.6.0
tool-scons @ 2.4.1 is already installed
The platform 'https://github.com/zgoda/platform-ststm32/archive/bluepill_f103c8.zip' has been successfully installed!
The rest of packages will be installed automatically depending on your build environment.

Now if I try to initialize test project for this board I get:

$ pio init -d testp01 -b bluepill_f103c8 --ide atom
The next files/directories have been created in /home/jazg/tmp/testp01
platformio.ini - Project Configuration File
src - Put your source files here
lib - Put here project specific (private) libraries
Error: [Wed Aug 24 11:49:13 2016] Processing bluepill_f103c8 (platform: ststm32, board: bluepill_f103c8, framework: mbed)
------------------------------------------------------------------------------------------------------------------------
PackageManager: Installing framework-mbed @ ~1.121.0
Downloading...
Unpacking...
framework-mbed @ 1.121.1 has been successfully installed!
Verbose mode can be enabled via `-v, --verbose` option
Collected 3 compatible libraries
Looking for dependencies...


scons: warning: Ignoring missing SConscript '/home/jazg/.platformio/platforms/ststm32/builder/frameworks/mbed/mbed.py'
File "/home/jazg/.local/lib/python2.7/site-packages/platformio/builder/tools/platformio.py", line 248, in BuildFrameworks
KeyError: 'CPPPATH':
File "/home/jazg/.local/lib/python2.7/site-packages/platformio/builder/main.py", line 125:
env.SConscript("$BUILD_SCRIPT")
File "/home/jazg/.platformio/packages/tool-scons/script/../engine/SCons/Script/SConscript.py", line 551:
return _SConscript(self.fs, *files, **subst_kw)
File "/home/jazg/.platformio/packages/tool-scons/script/../engine/SCons/Script/SConscript.py", line 260:
exec _file_ in call_stack[-1].globals
File "/home/jazg/.platformio/platforms/ststm32/builder/main.py", line 145:
target_elf = env.BuildProgram()
File "/home/jazg/.platformio/packages/tool-scons/script/../engine/SCons/Environment.py", line 224:
return self.method(*nargs, **kwargs)
File "/home/jazg/.local/lib/python2.7/site-packages/platformio/builder/tools/platformio.py", line 61:
deplibs = env.BuildDependentLibraries("$PROJECTSRC_DIR")
File "/home/jazg/.platformio/packages/tool-scons/script/../engine/SCons/Environment.py", line 224:
return self.method(*nargs, **kwargs)
File "/home/jazg/.local/lib/python2.7/site-packages/platformio/builder/tools/piolib.py", line 543:
project.search_deps_recursive(lib_builders)
File "/home/jazg/.local/lib/python2.7/site-packages/platformio/builder/tools/piolib.py", line 325:
search_paths)
File "/home/jazg/.local/lib/python2.7/site-packages/platformio/builder/tools/piolib.py", line 272:
for inc in self._get_found_includes(lib_builders, search_paths):
File "/home/jazg/.local/lib/python2.7/site-packages/platformio/builder/tools/piolib.py", line 235:
items = tuple(self.env.Dir(d) for d in lb.get_inc_dirs())
File "/home/jazg/.local/lib/python2.7/site-packages/platformio/builder/tools/piolib.py", line 454:
for path in self.env['CPPPATH']:
File "/home/jazg/.platformio/packages/tool-scons/script/../engine/SCons/Environment.py", line 410:
return self._dict[key]
============================================== [ERROR] Took 32.57 seconds ==============================================

Is there anything I should do additionally to get newer mbed framework version?

This platform has a few “submodules”/simlinks. See https://github.com/zgoda/platform-ststm32/tree/develop/builder/frameworks

GitHub doesn’t support them when generate ZIP/TAR.GZ archive. Please check https://github.com/zgoda/platform-ststm32/archive/bluepill_f103c8.zip and you will not see files in frameworks directory.

In this case, need to use plain Git repository URL. PlatformIO Package Manager will handle submodules automatically. Try:

pio platform install https://github.com/zgoda/platform-ststm32.git#bluepill_f103c8
```

P.S: Also, you can test custom board without forking development platform. See updated docs http://docs.platformio.org/en/latest/platforms/creating_board.html

Thanks, the idea is to have support for this board in platform-ststm32 and that’s the purpose of fork. Will do a PR when I confirm this board is working properly.

Aaa, that is very cool! :blush: We will wait for your PR! Thanks.

Unfortunately installing from plain repo URL did not change much, pkgmgr still tries to build v121:

IOError: [Errno 2] No such file or directory: '/home/jazg/.platformio/packages/framework-mbed/variant/BLUEPILL_F103C8/BLUEPILL_F103C8.eix'

There is no such variant in v121.

That because @valeros has not merged feature/new-mbed-builder-integration to develop branch yet. Please install feature/new-mbed-builder-integration and place temporary your board to boards folder in the platform root.

pio platform uninstall ststm32
pio platform install https://github.com/platformio/platform-ststm32.git#feature/new-mbed-builder-integration 

Then, if it works, @valeros will merge feature/new-mbed-builder-integration to develop. Please test new ARM mbed builder with your different projects.

1 Like

Thank you, this time it worked, project has been properly initialized and I was able to build MBED_BLINKY example without errors. Will report back if it works on the board later today as I don’t have it at hand.

One thing that is missing is the upload protocol that is specified in board def as stlink and did not made into platformio.ini file.

One thing that is missing is the upload protocol that is specified in board def as stlink and did not made into platformio.ini file.

What do you mean? Did tool-stlink start uploading?

No, I can’t test this now. It’s just upload_protocol setting missing in platformio.ini for this env.

And tool-stlink did not get installed upon project initialization.

Parts skipped for brevity:

$ pio platform show ststm32

Package toolchain-gccarmnoneeabi
--------------------------------
Type: toolchain
Requirements: >=1.40803.0,<1.40805.0
Installed: Yes
Description: gcc-arm-embedded
Url: https://launchpad.net/gcc-arm-embedded
Version: 1.40804.0

Package tool-stlink
-------------------
Type: uploader
Requirements: ~1.10200.0
Installed: No (optional)

Package framework-mbed
----------------------
Type: framework
Requirements: ~2.123.0
Installed: Yes
Description: mbed Framework
Url: http://mbed.org
Version: 2.123.0

Package tool-scons
------------------
Requirements: >=2.3.0,<2.6.0
Installed: Yes
Description: SCons software construction tool
Url: http://www.scons.org
Version: 2.4.1

Content of board def file:

{
  "build": {
    "core": "stm32", 
    "cpu": "cortex-m3", 
    "f_cpu": "72000000L", 
    "ldscript": "stm32f103xb.ld", 
    "mcu": "stm32f103c8t6", 
    "variant": "stm32f1"
  }, 
  "frameworks": [
    "mbed"
  ], 
  "name": "BluePill F103C8", 
  "upload": {
    "maximum_ram_size": 20480, 
    "maximum_size": 65536,
    "protocol": "stlink"
  }, 
  "url": "http://www.st.com/content/st_com/en/products/microcontrollers/stm32-32-bit-arm-cortex-mcus/stm32f1-series/stm32f103/stm32f103c8.html", 
  "vendor": "generic"
}

You specified protocol in the board manifest so tool-stlink should be installed after first pio run -t upload command.

OK, thank you. Will report later today when I get back from work. Anyway I’m impressed with new build system. :+1:

1 Like

Okay, I confirm project initialization, build and upload works, program does what was intended to do. Good work, gents!