Skip to content

Commit

Permalink
Platform.IO adjust to new paths
Browse files Browse the repository at this point in the history
  • Loading branch information
earlephilhower committed Aug 17, 2024
1 parent 724e88c commit a7d733d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ jobs:
pio pkg install --global --platform https://github.com/maxgerhardt/platform-raspberrypi.git
pio pkg install --global --tool symlink://.
- name: Build Multicore Example
run: pio ci --board=rpipico --board=adafruit_feather -O "platform_packages=framework-arduinopico@symlink:///home/runner/work/arduino-pico/arduino-pico" libraries/rp2040/examples/Multicore/Multicore.ino
run: pio ci -v --board=rpipico --board=adafruit_feather -O "platform_packages=framework-arduinopico@symlink:///home/runner/work/arduino-pico/arduino-pico" libraries/rp2040/examples/Multicore/Multicore.ino
- name: Build Fade Example
run: pio ci --board=rpipico --board=adafruit_feather -O "platform_packages=framework-arduinopico@symlink:///home/runner/work/arduino-pico/arduino-pico" libraries/rp2040/examples/Fade/Fade.ino
- name: Build TinyUSB Example
Expand Down
32 changes: 19 additions & 13 deletions tools/platformio-build.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,14 @@

# read includes from this file to add them into CPPPATH later for good IDE intellisense
# will use original -iprefix <prefix> @<file> for compilation though.
includes_file = os.path.join(FRAMEWORK_DIR, "lib", "platform_inc.txt")
includes_file = os.path.join(FRAMEWORK_DIR, "lib", "rp2040", "platform_inc.txt")
file_lines = []
includes = []
with open(includes_file, "r") as fp:
file_lines = fp.readlines()
includes_file = os.path.join(FRAMEWORK_DIR, "lib", "core_inc.txt")
with open(includes_file, "r") as fp:
file_lines = file_lines + fp.readlines()
for l in file_lines:
path = l.strip().replace("-iwithprefixbefore/", "").replace("/", os.sep)
# emulate -iprefix <framework path>.
Expand Down Expand Up @@ -89,22 +92,22 @@ def is_pio_build():
)

# pico support library depends on ipv6 enable/disable
libpico = File(os.path.join(FRAMEWORK_DIR, "lib", "libpico.a"))
libpico = File(os.path.join(FRAMEWORK_DIR, "lib", "rp2040", "libpico.a"))
if "PIO_FRAMEWORK_ARDUINO_ENABLE_BLUETOOTH" in flatten_cppdefines:
if "PIO_FRAMEWORK_ARDUINO_ENABLE_IPV6" in flatten_cppdefines:
libpicow = File(os.path.join(FRAMEWORK_DIR, "lib", "libipv4-ipv6-bt.a"))
libpicow = File(os.path.join(FRAMEWORK_DIR, "lib", "rp2040", "libipv4-ipv6-bt.a"))
else:
libpicow = File(os.path.join(FRAMEWORK_DIR, "lib", "libipv4-bt.a"))
libpicow = File(os.path.join(FRAMEWORK_DIR, "lib", "rp2040", "libipv4-bt.a"))
env.Append(
CPPDEFINES=[
("ENABLE_CLASSIC", 1),
("ENABLE_BLE", 1)
]
)
elif "PIO_FRAMEWORK_ARDUINO_ENABLE_IPV6" in flatten_cppdefines:
libpicow = File(os.path.join(FRAMEWORK_DIR, "lib", "libipv4-ipv6.a"))
libpicow = File(os.path.join(FRAMEWORK_DIR, "lib", "rp2040", "libipv4-ipv6.a"))
else:
libpicow = File(os.path.join(FRAMEWORK_DIR, "lib", "libipv4.a"))
libpicow = File(os.path.join(FRAMEWORK_DIR, "lib", "rp2040", "libipv4.a"))

env.Append(
ASFLAGS=env.get("CCFLAGS", [])[:],
Expand All @@ -117,7 +120,7 @@ def is_pio_build():
"-mcpu=cortex-m0plus",
"-mthumb",
"-ffunction-sections",
"-fdata-sections"
"-fdata-sections",
# -iprefix etc. added later if in build mode
],

Expand Down Expand Up @@ -154,7 +157,8 @@ def is_pio_build():
"-march=armv6-m",
"-mcpu=cortex-m0plus",
"-mthumb",
"@%s" % os.path.join(FRAMEWORK_DIR, "lib", "platform_wrap.txt"),
"@%s" % os.path.join(FRAMEWORK_DIR, "lib", "rp2040", "platform_wrap.txt"),
"@%s" % os.path.join(FRAMEWORK_DIR, "lib", "core_wrap.txt"),
"-u_printf_float",
"-u_scanf_float",
# no cross-reference table, heavily spams the output
Expand All @@ -177,10 +181,10 @@ def is_pio_build():

# link lib/libpico.a by full path, ignore libstdc++
LIBS=[
File(os.path.join(FRAMEWORK_DIR, "lib", "ota.o")),
File(os.path.join(FRAMEWORK_DIR, "lib", "rp2040", "ota.o")),
libpico,
libpicow,
File(os.path.join(FRAMEWORK_DIR, "lib", "libbearssl.a")),
File(os.path.join(FRAMEWORK_DIR, "lib", "rp2040", "libbearssl.a")),
"m", "c", stdcpp_lib, "c"]
)

Expand All @@ -190,11 +194,13 @@ def is_pio_build():
else:
env.Append(CCFLAGS=[
"-iprefix" + os.path.join(FRAMEWORK_DIR),
"@%s" % os.path.join(FRAMEWORK_DIR, "lib", "platform_inc.txt")
"@%s" % os.path.join(FRAMEWORK_DIR, "lib", "rp2040", "platform_inc.txt"),
"@%s" % os.path.join(FRAMEWORK_DIR, "lib", "core_inc.txt")
])
env.Append(ASFLAGS=[
"-iprefix" + os.path.join(FRAMEWORK_DIR),
"@%s" % os.path.join(FRAMEWORK_DIR, "lib", "platform_inc.txt")
"@%s" % os.path.join(FRAMEWORK_DIR, "lib", "rp2040", "platform_inc.txt"),
"@%s" % os.path.join(FRAMEWORK_DIR, "lib", "core_inc.txt")
])

def configure_usb_flags(cpp_defines):
Expand Down Expand Up @@ -301,7 +307,7 @@ def configure_network_flags(cpp_defines):

linkerscript_cmd = env.Command(
os.path.join("$BUILD_DIR", "memmap_default.ld"), # $TARGET
os.path.join(FRAMEWORK_DIR, "lib", "memmap_default.ld"), # $SOURCE
os.path.join(FRAMEWORK_DIR, "lib", "rp2040", "memmap_default.ld"), # $SOURCE
env.VerboseAction(" ".join([
'"$PYTHONEXE" "%s"' % os.path.join(
FRAMEWORK_DIR, "tools", "simplesub.py"),
Expand Down

0 comments on commit a7d733d

Please sign in to comment.