platformio-core: Core 5.0.x can't handle platform-packages directive

Configuration

Operating system: Windows 10 64bit

PlatformIO Version (platformio --version): 5.0.1.

Description of problem

Platformio mishandles platform-packages directive

Steps to Reproduce

  1. Create a new project with platformio.ini as follows:
[env:adafruit_feather_nrf52840]
platform = nordicnrf52
board = adafruit_feather_nrf52840
framework = arduino
monitor_speed = 115200
;platform_packages = framework-arduinoadafruitnrf52 @ https://github.com/orrmany/Adafruit_nRF52_Arduino.git#develop-ant-plus-ble
  1. Add src/main.cpp with boiler plate blinky example:
#include <Arduino.h>
void setup()
{
  // initialize LED digital pin as an output.
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop()
{
  // turn the LED on (HIGH is the voltage level)
  digitalWrite(LED_BUILTIN, HIGH);
  // wait for a second
  delay(100);
  // turn the LED off by making the voltage LOW
  digitalWrite(LED_BUILTIN, LOW);
   // wait for a second
  delay(100);
}
  1. build your project. Observe that Platformio downloads and install the nRF55 platform with its toolchain, then it builds the project succesfully

  2. Edit your platformio.ini. Remove the leading semicolon from the front of the line: platform_packages = framework-arduinoadafruitnrf52 @ https://github.com/orrmany/Adafruit_nRF52_Arduino.git#develop-ant-plus-ble

  3. attempt to build

Actual Results

The build fails, the build script asserts (due to faulty download of wrong platform packages), like this:

AssertionError: :
  File "C:\Users\egbozie\.platformio\penv\lib\site-packages\platformio\builder\main.py", line 169:
    env.SConscript("$BUILD_SCRIPT")
  File "C:\Users\egbozie\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\SConscript.py", line 598:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\egbozie\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\SConscript.py", line 287:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "C:\Users\egbozie\.platformio\platforms\nordicnrf52\builder\main.py", line 194:
    target_elf = env.BuildProgram()
  File "C:\Users\egbozie\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Environment.py", line 219:
    return self.method(*nargs, **kwargs)
  File "C:\Users\egbozie\.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py", line 61:
    env.ProcessProgramDeps()
  File "C:\Users\egbozie\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Environment.py", line 219:
    return self.method(*nargs, **kwargs)
  File "C:\Users\egbozie\.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py", line 127:
    env.BuildFrameworks(env.get("PIOFRAMEWORK"))
  File "C:\Users\egbozie\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Environment.py", line 219:
    return self.method(*nargs, **kwargs)
  File "C:\Users\egbozie\.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py", line 342:
    SConscript(env.GetFrameworkScript(f), exports="env")
  File "C:\Users\egbozie\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\SConscript.py", line 661:
    return method(*args, **kw)
  File "C:\Users\egbozie\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\SConscript.py", line 598:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\egbozie\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\SConscript.py", line 287:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "C:\Users\egbozie\.platformio\platforms\nordicnrf52\builder\frameworks\arduino.py", line 29:
    env.SConscript("arduino/adafruit.py")
  File "C:\Users\egbozie\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\SConscript.py", line 598:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\egbozie\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\SConscript.py", line 287:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "C:\Users\egbozie\.platformio\platforms\nordicnrf52\builder\frameworks\arduino\adafruit.py", line 38:
    assert isdir(CORE_DIR)

Expected Results

It should build normally using the nRF52 platform fork https://github.com/orrmany/Adafruit_nRF52_Arduino.git#develop-ant-plus-ble

If problems with PlatformIO Build System:

The content of platformio.ini:

[env:adafruit_feather_nrf52840]
platform = nordicnrf52
board = adafruit_feather_nrf52840
framework = arduino
monitor_speed = 115200
;platform_packages = framework-arduinoadafruitnrf52 @ https://github.com/orrmany/Adafruit_nRF52_Arduino.git#develop-ant-plus-ble

Source file to reproduce issue:

#include <Arduino.h>
void setup()
{
  // initialize LED digital pin as an output.
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop()
{
  // turn the LED on (HIGH is the voltage level)
  digitalWrite(LED_BUILTIN, HIGH);
  // wait for a second
  delay(100);
  // turn the LED off by making the voltage LOW
  digitalWrite(LED_BUILTIN, LOW);
   // wait for a second
  delay(100);
}

Additional info

Obviously, PlatformIO downloads some bogus “midi-test” v. 1.0.0. package instead of the nRF52 platform fork above

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 2
  • Comments: 44 (16 by maintainers)

Commits related to this issue

Most upvoted comments

@orrmany Very good question! So, found the root why do you need to work official package. Could check these docs https://docs.platformio.org/en/latest/projectconf/advanced_scripting.html#override-package-files ?

If it is not clear, we would be happy to improve.

So, the goal is that you will not worry about the framework package. You will just patch it to your needs. This will help you to be up-to-date with the latest framework and apply your changes.

We don’t have forks because we don’t modify official software. The only what we do - we put package.json and fill manifest with metadata. Some packages are mirrored on Bintray. We plan to release our new front-end to the new registry soon.

Yes, just fork and put package.json to the root of the repository.