Hey there. Apologies in advance, as I know this topic has been discussed before, but I’ve hit a bit of a brick wall in following the guides linked in the other threads.
The thread above details adding a new board to platformio, however, it seems that this board has an existing svd file. I’m trying to add support for the CANFDuino, which uses the ATSAM series of micros. This particular variant I have uses the ATSAMC21G17A, which it seems there is not an SVD file for. The closest I could find in the atmelsam/misc/svd directory is the ATSAMC21J18A.
The C21J and C21G have numerous differences, and I’m a bit out of my element here. The vendor (Togglebit) supplies a driver package for Arduino IDE which, in combination with the “Atmel SAMD Boards” package allows for writing to the device with Arduino IDE. They also package some libraries for utilizing the onboard CANFD controllers.
Is there any quick and easy way to port the arduino libraries over to platformio?
Here is the “getting started” page for the CANFDuino, which links to the driver packages:
That’s not just “adding a board”, that’s “adding a whole forked Arduino core with supporting packages and a board definition”.
You will need advanced PlatformIO knowledge if you want to do this yourself, regarding platform-atmelsam code, PlatformIO packages (package.json, platform.json), compiler settings, etc.
I recently wrote the repo GitHub - maxgerhardt/pio-samd51n19-test that adds support for a not-yet supported chip type, you can see some things regarding board JSON files there.
More concretely, you will need to modify or add a framework-arduino-samd-XYZ (with XYZ e.g. naming canfduino packages, also a framework-cmsis-atmel-canfduino (since they have their own special) packages, reference those in the platform.json and in the platform’s python code, and in your board file reference those forked cores.
Bummer. That sounds like a tremendous amount of work. Thanks for the response. I suppose I’ll delve into that when I can. I can’t really get anything worthwhile done in the arduino IDE.
Awesome! Can you please check the following things though:
In the platformio.ini, there’s the line
which is to inject the bossac.exe version that is found in the CANFduino repo as the used bossac.exe upload. That is however Windows only and would not permit usage on Linux or Mac. PlatformIO however has bossac in quite a few different versions and for a lot more OSes.
Can you please try these lines instead and report back which work and which don’t?
Hi @maxgerhardt, i think that I am in a similar situation as @devin since i have a " a whole forked Arduino core with supporting packages and a board definition”. I am also very much out of my depth with implementing this within platformio.
So I am hoping that you could grace me with your help!
My microcontroller is one of the esp32 PLCs made by industrialshields, specifically the ESP32 PLC 19R
I have made a github repo with the contents of the .arduino15 folder that seems to contain the same directories as your framework-arduino-samd-5gnbiot, so hopefully this will help a bunch.
so the files in the repo are direct copies of the ones that get downloaded by arduino IDE using the custom url provided by industrialshields.
Looking at the files it seems that there are some changes/additions made eg /hardware/esp32/2.1.2/cores/industrialshields/expanded-gpio.c, so that seems to suggest that files have been changed/added in core?
If core files were modified (but I hope they kept tools/platformio-build*.py) but the build logic itself hasn’t changed then you could just use platform_packages to inject the IndustrialShields version of Arduino-ESP32 and add boards/their_new_board.json files for the board definition.
Can you open a new topic about creating IndustrialShields support?