Working with custom packages

Hi, I have tried working with a custom package by forking and adding as platform_packages as below:

[env:nrf52_dk]
platform = nordicnrf52
platform_packages = framework-arduinoadafruitnrf52 @ https://github.com/sylvioalves/Adafruit_nRF52_Arduino.git
board = my_custom_board
framework = arduino
debug_tool = jlink
upload_protocol = jlink

However, it does not work, even adding the packages.json file into that branch it still crashes with the error below:

File "/home/sylvio/.platformio/packages/tool-scons/scons-local-4.1.0/SCons/Script/SConscript.py", line 280:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "/home/sylvio/.platformio/platforms/nordicnrf52@5.0.0/builder/frameworks/arduino/adafruit.py", line 38:
    assert isdir(CORE_DIR)

The other issue is that setting a specific branch ..".git#branch" won’t work.

Is there a way to configure platformio.ini to use external/local folder instead of having it (copied) at ./platformio/packages?

Example:

  1. Create a workspace in VSCode
  2. Add a new folder with a sample project: ex: /home/user/arduino/hello_world
  3. Add a new custom packages into VSCode from: /home/user/arduino/custom_package
  4. Configure platformio.ini to allow my custom package to run in the path above so that I can develop in it at its original folder path. Any modifications on this custom packages folder can be tracked and tested in runtime (with .git structure configured).

Any code reference would be good.

Thanks.

The code responsible for that is

Here it checks whether the “core” attribute in the board’s JSON file maps to an existing folder in the cores/ folder. Since GitHub - sylvioalves/Adafruit_nRF52_Arduino: Adafruit code for the Nordic nRF52 BLE SoC on Arduino has the folder cores/nRF5, the value there has to be nRF5.

Reference board

So where is the JSON definition for that? And what does it specify in core?