Created
September 7, 2023 21:32
-
-
Save djessup/de84f7ba9db5939e2df8403a76d96d90 to your computer and use it in GitHub Desktop.
Raspberry Pi Pico PlatformIO configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Custom pioasm compiler script for platformio. | |
(c) 2022 by P.Z. | |
(c) 2023 by D.J. | |
""" | |
from os.path import join | |
import glob | |
import sys | |
Import("env") | |
platform = env.PioPlatform() | |
PROJ_SRC = env["PROJECT_SRC_DIR"] | |
INCLUDE_SRC = env["PROJECT_INCLUDE_DIR"] | |
# TOOLCHAIN_PKG="toolchain-rp2040-earlephilhower" | |
TOOLCHAIN_PKG="pioasm" | |
print("==============================================") | |
print('PIO ASSEMBLY COMPILER') | |
try: | |
PIOASM_DIR = platform.get_package_dir(TOOLCHAIN_PKG) | |
except: | |
print(f'{TOOLCHAIN_PKG} not found!') | |
print("please install it using the following command:") | |
print(f'pio pkg install -g --tool "earlephilhower/{TOOLCHAIN_PKG}@https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.0.0-a/x86_64-w64-mingw32.arm-none-eabi-d3d2e6b.230824.zip"') | |
sys.exit() | |
def compile_pio_dir(path): | |
PIO_FILES = glob.glob(join(path, '*.pio'), recursive=True) | |
if PIO_FILES: | |
PIOASM_EXE = join(PIOASM_DIR, "pioasm") | |
print("Found .pio files:") | |
for filename in PIO_FILES: | |
env.Execute(PIOASM_EXE + f' -o c-sdk {filename} {filename}.h') | |
else: | |
print(f'NO *.pio FILES FOUND in {path}!') | |
print("Looking for .pio files to compile...") | |
compile_pio_dir(PROJ_SRC) | |
compile_pio_dir(INCLUDE_SRC) | |
print("==============================================") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; PlatformIO Project Configuration File | |
; | |
; Build options: build flags, source filter | |
; Upload options: custom upload port, speed and extra flags | |
; Library options: dependencies, extra library storages | |
; Advanced options: extra scripting | |
; | |
; Please visit documentation for the other options and examples | |
; https://docs.platformio.org/page/projectconf.html | |
[platformio] | |
; if debugging, select the environment here. | |
; default_envs = pico_earlephilhower_picoprobe_debugging | |
default_envs = pico | |
[env] | |
monitor_speed = 115200 | |
[env:pico] | |
platform = https://github.com/maxgerhardt/platform-raspberrypi.git | |
board = pico | |
framework = arduino | |
board_build.core = earlephilhower | |
board_build.filesystem_size = 0.5m | |
debug_tool = cmsis-dap | |
upload_protocol = cmsis-dap | |
debug_init_break = tbreak loop | |
debug_svd_path = .pio/rp2040.svd | |
platform_packages = | |
maxgerhardt/framework-arduinopico@https://github.com/maxgerhardt/arduino-pico.git | |
maxgerhardt/toolchain-pico@https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.0.0-a/x86_64-w64-mingw32.arm-none-eabi-d3d2e6b.230824.zip | |
pioasm@https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.0.0-a/x86_64-w64-mingw32.pioasm-6a7db34.230824.zip | |
extra_scripts = | |
pre:scripts/pioasm.py ; pre-build script to generate assembly headers for .pio files | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This template is intended for use with a standard Pico board, connected to host via another Pico running the picotool firmware. Should be easy enough to adapt for a debug probe instead. If using a unofficial RP2040 board, adapt the filesystem size accordingly.