@@ -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
112115add_defines_from_platform_def (os .path .join (FRAMEWORK_DIR , "lib" , "platform_def.txt" ))
113116add_defines_from_platform_def (os .path .join (FRAMEWORK_DIR , "lib" , chip , "platform_def.txt" ))
117+
114118env .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-
147130if chip == "rp2040" :
148131 toolopts = ["-march=armv6-m" , "-mcpu=cortex-m0plus" , "-mthumb" ]
149132elif chip == "rp2350" :
0 commit comments