[FEATURE] add -D ARDUINO_PARTITION_xxx build flag to platform.txt (#5804)

* [FEATURE]  ARDUINO_PARTITION_xxx build flag

Proposition: adding `-DARDUINO_PARTITION_{build.partitions}` flag to make the build partition information available at compile time.

Use cas example:

```C
#if defined ARDUINO_PARTITION_default
  // prevent compilation
  #error "This sketch needs 'Minimal SPIFFS' partition scheme to compile" 
  // or disable sketch features that need flash space
  #define USE_HUGE_BITMAP_IMAGES false
#endif
```

* Adding -DARDUINO_PARTITION_{build.partitions} (see #5804)
This commit is contained in:
tobozo
2021-11-06 12:58:48 +01:00
committed by GitHub
parent 83884a0cda
commit 674cf812e7
4 changed files with 9 additions and 6 deletions

View File

@ -300,7 +300,8 @@ env.Append(
("F_CPU", "$BOARD_F_CPU"),
("ARDUINO", 10812),
("ARDUINO_VARIANT", '\\"%s\\"' % env.BoardConfig().get("build.variant").replace('"', "")),
("ARDUINO_BOARD", '\\"%s\\"' % env.BoardConfig().get("name").replace('"', ""))
("ARDUINO_BOARD", '\\"%s\\"' % env.BoardConfig().get("name").replace('"', "")),
"ARDUINO_PARTITION_%s" % env.BoardConfig().get("build.partitions", "default.csv").replace(".csv", "")
],
LIBSOURCE_DIRS=[