Custom Toolchain installation

Continuing the discussion from Framework cached in build process - how to change it:

I need to install a different version of the toolchain than what is supplied with default installation as there is a bug.

I followed this link Redirecting...

My platformio.ini has this extra entry as below

[env:override_default_toolchain]

platform = kendryte210

platform_packages = kendryte-toolchain

[env:sipeed-maix-one-dock]

platform = kendryte210

framework = kendryte-standalone-sdk-develop

board = sipeed-maix-one-dock

monitor_speed = 115200

I have a new folder under
~/.platformio/packages/kendryte-toolchain

This one has the tool chain installed in it under the same directory structure as the default tool chain.
I have placed a package.json in this folder which reads as follows

more package.json 

{
“description”: “RISC-V Kendryte210 GCC toolchain”,
“name”: “kendryte-toolchain”,
“system”: “linux_x86_64”,
“url”: “GitHub - kendryte/kendryte-gnu-toolchain: Kendryte GNU Toolchain”,
“version”: “8.2.0”
}

After this, I deleted my .vscode and did a rebuild intellisense, it is failing with the following message

Error: Processing override_default_toolchain (platform: kendryte210)

Verbose mode can be enabled via -v, --verbose option
Error: BoardConfig: Board is not defined
============================================== [FAILED] Took 1.36 seconds ==============================================

Environment Status Duration


override_default_toolchain FAILED 00:00:01.360
sipeed-maix-one-dock IGNORED
sipeed-maix-go IGNORED
sipeed-maix-bit IGNORED
sipeed-maixduino IGNORED
========================================= 1 failed, 0 succeeded in 00:00:01.360 =========================================

Could you please guide

You have an environment here with no boards. The options in env:XX don’t overwrite things globally. There you must use the special environment env (Redirecting...) or put the options directly in the target environment where all the options, including board, is defined.

Thank you, I modified the platformio.ini as follows

[env:sipeed-maix-one-dock-test]
platform = kendryte210
platform_packages = kendryte-toolchain
framework = kendryte-standalone-sdk-develop
board = sipeed-maix-one-dock
monitor_speed = 115200

Removed .vscode, ran build intellisense, ran build target - all working without errors.

But the build is including the default toolchain as well,

Processing sipeed-maix-one-dock-test (platform: kendryte210; framework: kendryte-standalone-sdk-develop; board: sipeed-maix-one-dock)
...
...
PACKAGES: toolchain-kendryte210 8.2.0, framework-kendryte-standalone-sdk-develop 0.5.4, kendryte-toolchain 8.2.0
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf

As you can see in the packages above, toolchain-kendryte210 8.2.0 is ALSO included - this is the default toolchain that came with installation of platformio.

My preference is to use the one under kendryte-toolchain 8.2.0 which appears at the end.

How to remove the default toolchain from this ?

Edit:
I followed this link

and modified my platformio.ini

[env:sipeed-maix-one-dock-test]
platform = kendryte210_dev
platform_packages = kendryte-toolchain
framework = kendryte-standalone-sdk-develop
board = sipeed-maix-one-dock
monitor_speed = 115200

I created a new platform folder kendryte210_dev under

~/.platformio/platforms/kendryte210_dev

and copied the kendryte210 folder’s content in to it.

in the platform.json in the new folder, I changed the following

"name": "kendryte210_dev",
....
....
"packages": {
        "kendryte-toolchain": {
            "type": "toolchain",
            "version": "~8.2.0"
        },

When I rebuild intellisense, I am getting this error

File "/home/krishnak/.platformio/penv/lib/python3.6/site-packages/platformio/managers/platform.py", line 253, in newPlatform
    cls.get_clsname(name),
AttributeError: module 'platformio.managers.platform.kendryte210_dev' has no attribute 'Kendryte210_devPlatform'

Let me know whether I need to create this new dummy platform to satisfy my needs for using a separate toolchain or is it not needed.

My two approaches as above are not allowing me to build using the toolchain of my choice. Could you please have a look.

I did the following and it seems to be working

  1. No need to create a new platform , as only new toolchain is to be used.

2.place the toolchain in the packages folder use a name something like toolchain-kendryte210@8.2.1
3. Copy the package.json from existing toolchain in to the new toolchain folder.
4. Modify the package.json to have a different version number <-- or else both of them seem to appear in the build process
5. Modify platformio.ini to reflect like this

    [env:sipeed-maix-one-dock-test]

    platform = kendryte210

    platform_packages = toolchain-kendryte210@8.2.1

    framework = kendryte-standalone-sdk-develop

    board = sipeed-maix-one-dock

   monitor_speed = 115200
1 Like