Skip to content

Commit 47079e6

Browse files
Clean up defines in p.io build
1 parent 22ad092 commit 47079e6

File tree

4 files changed

+16
-25
lines changed

4 files changed

+16
-25
lines changed

lib/rp2040/platform_def.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,7 @@
99
-DPICO_RP2040_B0_SUPPORTED=1
1010
-DPICO_RP2040_B1_SUPPORTED=1
1111
-DPICO_RP2040_B2_SUPPORTED=1
12+
-DARM_MATH_CM0_FAMILY
13+
-DARM_MATH_CM0_PLUS
14+
-DTARGET_RP2040
15+

lib/rp2350-riscv/platform_def.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@
66
-DPICO_PLATFORM=rp2350-riscv
77
-DPICO_RISCV=1
88
-DPICO_RP2350=1
9+
10+
-DTARGET_RP2350

lib/rp2350/platform_def.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@
44

55
-DPICO_PLATFORM=rp2350-arm-s
66
-DPICO_RP2350=1
7+
8+
-DTARGET_RP2350

tools/platformio-build.py

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -107,43 +107,26 @@ def add_defines_from_platform_def(file):
107107
line = line.strip()
108108
if line.startswith("-D"):
109109
defn = line[2:].split('=')
110-
env.Append( CPPDEFINES=[ (defn[0], defn[1]) ] )
110+
if len(defn) == 2:
111+
env.Append( CPPDEFINES=[ (defn[0], defn[1]) ] )
112+
else:
113+
env.Append( CPPDEFINES=[ defn[0] ] )
111114

112115
add_defines_from_platform_def(os.path.join(FRAMEWORK_DIR, "lib", "platform_def.txt"))
113116
add_defines_from_platform_def(os.path.join(FRAMEWORK_DIR, "lib", chip, "platform_def.txt"))
117+
114118
env.Append(
115119
CPPDEFINES=[
116120
("ARDUINO", 10810),
117121
"ARDUINO_ARCH_RP2040",
118122
("F_CPU", "$BOARD_F_CPU"),
119123
("BOARD_NAME", '\\"%s\\"' % env.subst("$BOARD")),
124+
# at this point, the main.py builder script hasn't updated upload.maximum_size yet,
125+
# so it's the original value for the full flash.
126+
("PICO_FLASH_SIZE_BYTES", board.get("upload.maximum_size"))
120127
]
121128
)
122129

123-
if chip == "rp2040":
124-
env.Append(
125-
CPPDEFINES=[
126-
"ARM_MATH_CM0_FAMILY",
127-
"ARM_MATH_CM0_PLUS",
128-
"TARGET_RP2040",
129-
("PICO_RP2040", "1"),
130-
# at this point, the main.py builder script hasn't updated upload.maximum_size yet,
131-
# so it's the original value for the full flash.
132-
("PICO_FLASH_SIZE_BYTES", board.get("upload.maximum_size"))
133-
]
134-
)
135-
elif (chip == "rp2350") or (chip == "rp2350-riscv"):
136-
env.Append(
137-
CPPDEFINES=[
138-
("PICO_RP2350", "1"),
139-
"TARGET_RP2350",
140-
("PICO_RP2350", "1"),
141-
# at this point, the main.py builder script hasn't updated upload.maximum_size yet,
142-
# so it's the original value for the full flash.
143-
("PICO_FLASH_SIZE_BYTES", board.get("upload.maximum_size"))
144-
]
145-
)
146-
147130
if chip == "rp2040":
148131
toolopts = ["-march=armv6-m", "-mcpu=cortex-m0plus", "-mthumb"]
149132
elif chip == "rp2350":

0 commit comments

Comments
 (0)