Skip to content

Commit 00c0bc1

Browse files
authored
Fix libraries and RAM size in PlatformIO build (#440)
1 parent 5980993 commit 00c0bc1

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

tools/platformio-build.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
platform = env.PioPlatform()
2020
board = env.BoardConfig()
2121
upload_protocol = env.subst("$UPLOAD_PROTOCOL") or "picotool"
22-
ram_size = board.get("upload.maximum_ram_size")
22+
#ram_size = board.get("upload.maximum_ram_size") # PlatformIO gives 264K here
23+
# override to correct 256K for RAM section in linkerscript
24+
ram_size = 256 * 1024 # not the 264K, which is 256K SRAM + 2*4K SCRATCH(X/Y).
2325

2426
FRAMEWORK_DIR = platform.get_package_dir("framework-arduinopico")
2527
assert os.path.isdir(FRAMEWORK_DIR)
@@ -84,12 +86,16 @@
8486

8587
LIBSOURCE_DIRS=[os.path.join(FRAMEWORK_DIR, "libraries")],
8688

87-
LIBPATH=[
88-
os.path.join(FRAMEWORK_DIR, "lib")
89-
],
89+
# do **NOT** Add lib to LIBPATH, otherwise
90+
# erroneous libstdc++.a will be found that crashes!
91+
#LIBPATH=[
92+
# os.path.join(FRAMEWORK_DIR, "lib")
93+
#],
9094

91-
# link lib/libpico.a
92-
LIBS=["pico", "m", "c", "stdc++", "c"]
95+
# link lib/libpico.a by full path, ignore libstdc++
96+
LIBS=[
97+
File(os.path.join(FRAMEWORK_DIR, "lib", "libpico.a")),
98+
"m", "c", "stdc++", "c"]
9399
)
94100

95101

0 commit comments

Comments
 (0)