PlatformIO Community

Framework cached in build process - how to change it

My Visual Studio code/ PlatformIO experience is less than a week, please tolerate the Newbieness.

I have installed platformio, I have created a project and it compiles.

While compiling it compiles driver files under ~/.platformio/packages/frameworktobeused/lib

All this is fine.

The framework installed under packages has to be changed to a development framework codebase. I have moved the “frameworktobeused” to “old_frameworktobeused” and install the development framework inside packages as “frameworktobeused”.

I did a build clean, removed the .cache folder under .platformio.

When I rebuild the project, I still see the compiler picking up include files from the old frame work- it is using the directory path “old_frameworktobeused”

How do I make it use the newly installed framework.

Many thanks

I’d not remove the .platformio\.cache folder, if you want to regenerate the project files for intellisense you have to execute the “Rebuild Intellisense” index task (https://docs.platformio.org/en/latest/ide/vscode.html#project-tasks) .

This regenerates the .vscode\* files in the project, most importantly the c_cpp_properties.json.

If there are still errors after that you’d need to show the content of that file and the path of the files you want to include.

Many thanks for trying to help me. The following is the extract of c_cpp_properties.json
If you notice the include path, it has /home/krishnak/.platformio/packages/old-framework-kendryte-standalone-sdk-old/lib/bsp"

When the platformio was installed for kendryte-stand-alone-sdk - that folder used to be /home/krishnak/.platformio/packages/framework-kendryte-standalone-sdk/lib/bsp", however I had to install a newer version of the SDK than what is available using platform IO to get my code compiled, hence I moved the kendryte-standalone-sdk to old-framework-kendryte-standalone-sdk-old. I copied the latest SDK to ./platformio/packages/framework-kendryte-standalone-sdk

However when I rebuild as you notice below, the properties file has changed itself to the old-framework-kendryte-standalone-sdk-old

I did as per your suggestion, but this file gets regenerated with the old sdk folder name in the includes even if I change the folder name of the sdk, I want the include path to have the new sdk path.

configurations": [
    {
        "name": "!!! WARNING !!! AUTO-GENERATED FILE, PLEASE DO NOT MODIFY IT AND USE https://docs.platformio.org/page/projectconf/section_env_build.html#build-flags"
    },
    {
        "name": "Linux",
        "includePath": [
            "/home/krishnak/visualstudioworkspace/freshdownloadfastface/include",
            "/home/krishnak/visualstudioworkspace/freshdownloadfastface/src",
            "/home/krishnak/.platformio/packages/old-framework-kendryte-standalone-sdk-old/lib/bsp",
            "/home/krishnak/.platformio/packages/old-framework-kendryte-standalone-sdk-old/lib/bsp/include",
            "/home/krishnak/.platformio/packages/old-framework-kendryte-standalone-sdk-old/lib/drivers",
            "/home/krishnak/.platformio/packages/old-framework-kendryte-standalone-sdk-old/lib/drivers/include",
            "/home/krishnak/.platformio/packages/old-framework-kendryte-standalone-sdk-old/lib/utils/include",
            "/home/krishnak/.platformio/packages/tool-unity",
            ""
        ],
        "browse": {
            "limitSymbolsToIncludedHeaders": true,
            "path": [
                "/home/krishnak/visualstudioworkspace/freshdownloadfastface/include",
                "/home/krishnak/visualstudioworkspace/freshdownloadfastface/src",
                "/home/krishnak/.platformio/packages/old-framework-kendryte-standalone-sdk-old/lib/bsp",
                "/home/krishnak/.platformio/packages/old-framework-kendryte-standalone-sdk-old/lib/bsp/include",
                "/home/krishnak/.platformio/packages/old-framework-kendryte-standalone-sdk-old/lib/drivers",
                "/home/krishnak/.platformio/packages/old-framework-kendryte-standalone-sdk-old/lib/drivers/include",
                "/home/krishnak/.platformio/packages/old-framework-kendryte-standalone-sdk-old/lib/utils/include",
                "/home/krishnak/.platformio/packages/tool-unity",
                ""
            ]
        },

So what exactly do you have as your platformio.ini?

I’m not sure if this is going to work. To setup a framework correctly you also have to add the correct package.json which identifies the new version and reference the new version / package in the platformio.ini. Can you give the output of ls for /home/krishnak/.platformio/packages/old-framework-kendryte-standalone-sdk-old and your new SDK folder?

My platformio.ini has this

[platformio]

build_dir=project_build_files

[env:sipeed-maix-one-dock]

platform = kendryte210

framework = kendryte-standalone-sdk

board = sipeed-maix-one-dock

monitor_speed = 115200

~/.platformio/packages$ ls -l
drwxr-xr-x 10 krishnak krishnak 4096 Dec 17 14:13 framework-kendryte-standalone-sdk
drwx------ 7 krishnak krishnak 4096 Dec 12 10:47 old-framework-kendryte-standalone-sdk-old

old-framework-kendryte-standalone-sdk-old$ ls -la
total 84
drwx------  7 krishnak krishnak  4096 Dec 12 10:47 .
drwxr-xr-x 11 krishnak krishnak  4096 Jan 11 20:51 ..
-rwxr-xr-x  1 krishnak krishnak  2764 Jul  4  2019 CHANGELOG.md
-rwxr-xr-x  1 krishnak krishnak   944 Jul  4  2019 .clang-format
drwxr-xr-x  2 krishnak krishnak  4096 Dec 12 10:47 cmake
-rwxr-xr-x  1 krishnak krishnak  1107 Jul  4  2019 CMakeLists.txt
-rwxr-xr-x  1 krishnak krishnak 14974 Jul  4  2019 .gitignore
-rwxr-xr-x  1 krishnak krishnak  1355 Jul  4  2019 kendryte-package.json
drwxr-xr-x  2 krishnak krishnak  4096 Dec 12 10:47 lds
drwxr-xr-x  5 krishnak krishnak  4096 Dec 12 10:47 lib
-rwxr-xr-x  1 krishnak krishnak 11342 Jul  4  2019 LICENSE
-rwxr-xr-x  1 krishnak krishnak   214 Jul 18 13:41 package.json
-rwxr-xr-x  1 krishnak krishnak  1798 Jul  4  2019 README.md
drwxr-xr-x  2 krishnak krishnak  4096 Dec 12 10:47 scripts
drwxr-xr-x  3 krishnak krishnak  4096 Dec 12 10:47 src
-rwxr-xr-x  1 krishnak krishnak  2200 Jul  4  2019 .travis.yml

framework-kendryte-standalone-sdk$ ls -la
total 96
drwxr-xr-x 10 krishnak krishnak  4096 Dec 17 14:13 .
drwxr-xr-x 11 krishnak krishnak  4096 Jan 11 20:51 ..
-rw-r--r--  1 krishnak krishnak  2764 Dec 17 14:13 CHANGELOG.md
-rw-r--r--  1 krishnak krishnak   944 Dec 17 14:13 .clang-format
drwxr-xr-x  2 krishnak krishnak  4096 Dec 17 14:13 cmake
-rw-r--r--  1 krishnak krishnak  1107 Dec 17 14:13 CMakeLists.txt
drwxr-xr-x  2 krishnak krishnak  4096 Dec 17 14:13 .github
-rw-r--r--  1 krishnak krishnak 15791 Dec 17 14:13 .gitignore
-rw-r--r--  1 krishnak krishnak  2159 Dec 17 14:13 kendryte-package.json
drwxr-xr-x  2 krishnak krishnak  4096 Dec 17 14:13 lds
drwxr-xr-x  6 krishnak krishnak  4096 Dec 17 14:13 lib
-rw-r--r--  1 krishnak krishnak 11342 Dec 17 14:13 LICENSE
-rw-r--r--  1 krishnak krishnak   217 Dec 17 14:13 package.json
-rw-r--r--  1 krishnak krishnak  1798 Dec 17 14:13 README.md
drwxr-xr-x  2 krishnak krishnak  4096 Dec 17 14:13 scripts
drwxr-xr-x  3 krishnak krishnak  4096 Dec 17 14:13 src
drwxr-xr-x  3 krishnak krishnak  4096 Dec 17 14:13 third_party
-rw-r--r--  1 krishnak krishnak  2200 Dec 17 14:13 .travis.yml
drwxr-xr-x  2 krishnak krishnak  4096 Dec 17 14:13 .vscode

Content of both package.json files?

/packages/framework-kendryte-standalone-sdk$ more package.json 
{
    "name": "framework-kendryte210-standalone-sdk",
    "description": "This SDK is for Kendryte K210 without OS support.",
    "version": "0.5.4",
    "url": "https://github.com/kendryte/kendryte-standalone-sdk"
}


old-framework-kendryte-standalone-sdk-old$ more package.json 
{
    "name": "framework-kendryte-standalone-sdk",
    "description": "This SDK is for Kendryte K210 without OS support.",
    "version": "0.5.6",
    "url": "https://github.com/kendryte/kendryte-standalone-sdk"
}

The version number inside the “old sdk” is higher than the version number of the sdk in development release, however what is inside framework-kendryte-standalone-sdk is the one which I want to use, as it is the latest development code.

I just did another test by changing name field inside the package…json of old-frame-work-kendryte-standalone-sd,
from
“name”: “framework-kendryte-standalone-sdk”,
to
“name”: “old-framework-kendryte-standalone-sdk”,

I did a intellisense rebuild, what has happened is a new folder called /.platformio/packages/framework-kendryte-standalone-sdk@0.5.6$

has been created by the IDE with the code base from the released version 0.5.6.

So the IDE is looking at some where else to determine which code base to use, probably the git url?

I tried to sort this to use the correct SDK folder by following this, version number has to match with the latest released version number for the directory to be used. So I changed the version number in package.json of the development version to match the released version 0.5.6.
Note: version number even if it is greater didn’t work.

Though the above version numbering prevented the build system from picking the incorrect directory, what has happened actually is that source files have been synced to 0.5.6 and the development release code has been over written, now back to catch 22 :slight_smile:

I have followed the above steps from scratch.

my new frame work is called kendryte-standalone-sdk-develop

I have created a folder framework-kendryte-standalone-sdk-develop under packages and added the code there

I have added this frame work in sipeed-maix-one-dock.json inside boards folder
“frameworks”: [
“kendryte-standalone-sdk-develop”,
“kendryte-standalone-sdk”,
“kendryte-freertos-sdk”,
“arduino”
],

I have updated platform.json and followed all the steps.

When I rebuild intellisense task, I get this one line error

 Executing task: platformio init --ide vscode <


The current working directory /home/krishnak/visualstudioworkspace/fastfacedtect will be used for the project.

The next files/directories have been created in /home/krishnak/visualstudioworkspace/fastfacedtect
include - Put project header files here
lib - Put here project specific (private) libraries
src - Put project source files here
platformio.ini - Project Configuration File
Error: Detected unknown package 'framework-kendryte-standalone-sdk-develop'
The terminal process terminated with exit code: 1

I have added the necessary code in the boards/appropriate.json file as well

  ],
        "variant": "sipeed_maix_one_dock",
        "board_def": "BOARD_SIPEED_MAIX_ONE_DOCK"
    },
    "frameworks": [
        "kendryte-standalone-sdk-develop",
        "kendryte-standalone-sdk",
        "kendryte-freertos-sdk",
        "arduino"
    ],

EDIT: The error was due to a typo in package,json in the new framework, it works!!! Thanks for your help

1 Like