How to use the "arduino-samd21lpe" patches with PlatformIO, (Linux only): #3
Replies: 2 comments
-
Alternative MethodYou can also fork the "https://github.com/Seeed-Studio/ArduinoCore-samd" repository then modify and commit the "startup.c", "boards.txt" and "package.json" files and finally reference this in your "plaformio.ini" file like this: platform_packages =
I'd like to be able to remove the "platformio.ini" file entry that maps the "framework-arduino-samd-seeed" framework to "framework-arduino-samd-seeed-lpe", but currently haven't figured how else to stop the "atmelsam" platform and "seeed_xiao" board auto-selecting the "framework-arduino-samd-seeed" framework? |
Beta Was this translation helpful? Give feedback.
-
How to Create PlatformIO Low Power versions of the Arduino SAMD Core Frameworks: (for Seeed Studio and Arduino devices)(Final Method)Clone the original Arduino SAMD Core repositories: framework_folder="/home/<pio_user>/Documents/LPE"
mkdir "${framework_folder}"; cd "${framework_folder}"
git clone 'https://github.com/arduino/ArduinoCore-samd.git' framework-arduino-samd-lpe
git clone 'https://github.com/Seeed-Studio/ArduinoCore-samd.git' framework-arduino-samd-seeed-lpe Modify the "./cores/arduino/startup.c" files with the Low Power Modifications: (You can Diff the following file pairs from my personal repo for changes) Modify the "./package.json" files, changing the "name" and "url" values to the new "LPE" version: (Diff the following file pairs for changes) Create two new repositories on GitHub: Initial commit and remote push of repositories: cd "${framework_folder}/framework-arduino-samd-lpe"
git remote add GitHub ssh://git@GitHub/<github_user>/framework-arduino-samd-lpe.git
git init .
git commit -a -m 'Initial Commit'
git push GitHub --all
git push GitHub --tags cd "${framework_folder}/framework-arduino-samd-seeed-lpe"
git remote add GitHub ssh://git@GitHub/<github_user>/framework-arduino-samd-seeed-lpe.git
git init .
git commit -a -m 'Initial Commit'
git push GitHub --all
git push GitHub --tags Get PlaformIO to Update Frameworks, (using the "platformio.ini" file):
Force PlatformIO to compile against the LPE frameworks, (using the "platformio.ini" file):
Copy the "https://github.com/jnsbyr/arduino-samd21lpe/src" source files to the project folder: Notes:
Host GitHub
User <github_user>
Hostname github.com
IdentityFile ~/.ssh/github_ed25519
TCPKeepAlive yes
IdentitiesOnly yes |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Run these bash commands:
pio_user="${USER}" # User that you will be running PlatformIO with
package_folder="/home/${pio_user}/.platformio/packages"
patch_folder="/path/to/where/you/downloaded/arduino-samd21lpe-main/arduino-samd21lpe-main/patches/Seeduino-hardware-samd-1.8.3"
rm -rf "${package_folder}/framework-arduino-samd-seeed-lpe" # Remove if previously installed
cp -as "${package_folder}/framework-arduino-samd-seeed" "/tmp/" # Copy as soft links to temporary location
mv "/tmp/framework-arduino-samd-seeed" "${package_folder}/framework-arduino-samd-seeed-lpe" # Rename in correct location
Patch "startup.c"
rm "${package_folder}/framework-arduino-samd-seeed-lpe/cores/arduino/startup.c"
cp "${patch_folder}/startup.c" "${package_folder}/framework-arduino-samd-seeed-lpe/cores/arduino/startup.c"
chmod a+r,a+w "${package_folder}/framework-arduino-samd-seeed-lpe/cores/arduino/startup.c"
Patch "boards.txt"
rm "${package_folder}/framework-arduino-samd-seeed-lpe/boards.txt"
cp "${patch_folder}/boards.txt" "${package_folder}/framework-arduino-samd-seeed-lpe/boards.txt"
chmod a+r,a+w "${package_folder}/framework-arduino-samd-seeed-lpe/boards.txt"
Rename package to "framework-arduino-samd-seeed-lpe"
rm "${package_folder}/framework-arduino-samd-seeed-lpe/package.json"
cp "${package_folder}/framework-arduino-samd-seeed/package.json" "${package_folder}/framework-arduino-samd-seeed-lpe/package.json"
sed -i 's|"name":[[:space:]]*"framework-arduino-samd-seeed"|"name": "framework-arduino-samd-seeed-lpe"|' "$package_folder/framework-arduino-samd-seeed-lpe/package.json"
chown -hR "${pio_user}:${pio_user}" "${package_folder}/framework-arduino-samd-seeed-lpe" # Change ownership to PlatformIO user
Edit "platformio.ini":
build_flags = -DF_CPU=48000000L ; You can change this to other frequencies
platform_packages =
framework-arduino-samd-seeed @ file:///home/<pio_user>/.platformio/packages/framework-arduino-samd-seeed-lpe ; Force compiler to use the LPE framework
framework-arduino-samd-seeed-lpe @ file:///home/<pio_user>/.platformio/packages/framework-arduino-samd-seeed-lpe
; Note: Change <pio_user> to actual PlatformIO user name
Notes:
Beta Was this translation helpful? Give feedback.
All reactions