Update Request for VS Code PlatformIO tutorial

I’ve been away a while and am now trying to setup the a fresh dev environment for:

MacOS + VS Code + Platform IO + RAK4631 + RUI3

I’ve previously used the Arduino environment because I couldn’t get the Platform IO thing working. I’d hoped that after a break of a year it might have been easier this time, but I’m still stuck, possibly with more dead links than before.

I have worked my way very carefully through the Platform IO setup tutorial. I think my issue is getting the board support packages into the right place. The tutorial refers to a python patch script that I’ve since read only works to update existing BSPs. Looking at the script, I don’t understand what it’s trying to do with the “. ./” referenced destination directories, because they don’t have any agreement to the default directory structure under “/Users/me/.platformio”

@beegee, would you please take a look at the setup platformIO tutorial and verify it is up to date. Alternatively, could you point me to another run sheet to work my way through.

Many thanks

Edit: typos

The python script works and the tutorial is still up-to-date.
But I can’t test on MacOS, I do not have any Apple device.

But installation should be similar on MacOS, I just don’t know where PlatformIO is installed.

You need to install the nRF52 platform in PIO first.
you need to have an application compiled. Only after a compilation the complete platform+package is installed.

You place the unzipped files into a folder RAK_PATCH into the PlatformIO installation directory:

You open a terminal in the RAK-PATCH folder

Run the patch python ./rak_patch.py

There might be errors for platforms you haven’t installed. You can ignore them.

If that doesn’t work, you can patch the platform and package manually:

You need to install the nRF52 platform in PIO first.
you need to have an application compiled. Only after a compilation the complete platform+package is installed.

(1) Copy .platfomio ==> RAK_PATCH ==> packages ==> framework-arduinoadafruitnrf52 to .platformio ==> packages ==> framework-arduinoadafruitnrf52
:exclamation: ALLOW OVERWRITES :exclamation:

(1) Copy .platfomio ==> RAK_PATCH ==> platforms ==> nordicnrf52 to .platformio ==> platforms ==> framework-nordicnrf52
:exclamation: ALLOW OVERWRITES :exclamation:

I believe I did all those steps. The first indication of the process going off the rails was when I ran the python script.

% python rak_patch.py
Patching RAK4631
Could not find ../platforms/nordicnrf52/boards
Patching RAK11200
Could not find ../platforms/espressif32/boards
Patching RAK11310
Could not find ../platforms/raspberrypi/boards
Patch done, check output if successful

The .platformio directory is by default directly under /User/me. This is where I unpacked the ZIP file.

% pwd

 % ls -la
total 2584
drwxr-xr-x  13 markjeffree  staff      416 20 May 15:24 .
drwxr-x---+ 40 markjeffree  staff     1280 20 May 19:37 ..
drwxr-xr-x   6 markjeffree  staff      192 20 May 15:32 .cache
-rw-r--r--@  1 markjeffree  staff  1065058 20 May 10:29 RAK_PATCH.zip
-rw-r--r--@  1 markjeffree  staff   236954  6 Sep  2021 Update RAK WisBlock modules in PlatformIO platforms and packages.pdf
-rw-r--r--   1 markjeffree  staff      259 20 May 13:39 appstate.json
-rw-r--r--   1 markjeffree  staff       90 20 May 13:50 homestate.json
drwxr-xr-x  15 markjeffree  staff      480 20 May 13:50 packages
drwxr-xr-x   8 markjeffree  staff      256 20 May 10:19 penv
drwxr-xr-x   6 markjeffree  staff      192 20 May 13:47 platforms
drwxr-xr-x   9 markjeffree  staff      288 20 May 10:19 python3
-rw-r--r--@  1 markjeffree  staff     3111 20 May 15:24 rak_patch.py
-rw-r--r--@  1 markjeffree  staff     3111 20 May 15:03 rak_patch.py.backup

The double dot slash (which doesn’t render well) ". . / " prefix on the destination directories in the script would seem to point nowhere useful, since it’s effectively trying to find a user called “platforms”. I’m happy to patch the python patch script, but I’m not completely clear on what it’s trying to do.

Ahh. I think I need another layer of directory under the .platformio directory. Stand by …

Further along than before:

% python rak_patch.py 
Patching RAK4631
Patched RAK4631
Patching RAK11200
Patched RAK11200
Patching RAK11310
File not found.
Traceback (most recent call last):
  File "/Users/markjeffree/.platformio/RAK_PATCH/rak_patch.py", line 66, in <module>
    copy_files_ext(src_dir1, src_dir2, src_dir3, dest_dir1, dest_dir2, dest_dir3, "RAK11310")
  File "/Users/markjeffree/.platformio/RAK_PATCH/rak_patch.py", line 27, in copy_files_ext
    shutil.copyfile(src_3+"/Print.h", dest_3+"/Print.h")
  File "/Users/markjeffree/.rye/py/[email protected]/lib/python3.12/shutil.py", line 262, in copyfile
    with open(dst, 'wb') as fdst:
FileNotFoundError: [Errno 2] No such file or directory: '../packages/framework-arduino-mbed/cores/arduino/api/Print.h'

Since I only care about the RAK4631, I could step off at this point, but would you like me to keep trying to test the macOS case?

You seem not to have the RP2040 platform installed, so the error message is normal.

Glad you got it to work.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.