Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit adafd9d

Browse filesBrowse files
authored
Merge pull request espressif#4538 from loick111/feature/custom_variants_dir
The goal is to allow custom configuration for `variants_dir` to define our own board variant directly in the project. With this functionnality, we are now allowed to define in our projects a custom board **AND** a custom variant. https://docs.platformio.org/en/latest/platforms/creating_board.html#custom-embedded-boards Here is an example of how to define a custom board with custom variant: ``` my_project ├── boards │ └── custom_esp32dev.json └── variants └── custom-esp32dev └── pins_arduino.h ``` custom_esp32dev.json ```json { "build": { "arduino":{ "ldscript": "esp32_out.ld" }, "core": "esp32", "extra_flags": "-DARDUINO_ESP32_DEV", "f_cpu": "240000000L", "f_flash": "40000000L", "flash_mode": "dio", "mcu": "esp32", "variants_dir": "variants", "variant": "custom-esp32dev" }, "connectivity": [ "wifi", "bluetooth", "ethernet", "can" ], "debug": { "openocd_board": "esp-wroom-32.cfg" }, "frameworks": [ "arduino", "espidf" ], "name": "My Custom Espressif ESP32 Dev Module", "upload": { "flash_size": "4MB", "maximum_ram_size": 327680, "maximum_size": 4194304, "require_upload_port": true, "speed": 460800 }, "url": "https://en.wikipedia.org/wiki/ESP32", "vendor": "Espressif" } ```
2 parents e41fb08 + ac9fdef commit adafd9d
Copy full SHA for adafd9d

File tree

Expand file treeCollapse file tree

1 file changed

+7
-3
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-3
lines changed

‎tools/platformio-build.py

Copy file name to clipboardExpand all lines: tools/platformio-build.py
+7-3Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,16 +194,20 @@
194194

195195
libs = []
196196

197+
variants_dir = join(FRAMEWORK_DIR, "variants")
198+
199+
if "build.variants_dir" in env.BoardConfig():
200+
variants_dir = join("$PROJECT_DIR", env.BoardConfig().get("build.variants_dir"))
201+
197202
if "build.variant" in env.BoardConfig():
198203
env.Append(
199204
CPPPATH=[
200-
join(FRAMEWORK_DIR, "variants",
201-
env.BoardConfig().get("build.variant"))
205+
join(variants_dir, env.BoardConfig().get("build.variant"))
202206
]
203207
)
204208
libs.append(env.BuildLibrary(
205209
join("$BUILD_DIR", "FrameworkArduinoVariant"),
206-
join(FRAMEWORK_DIR, "variants", env.BoardConfig().get("build.variant"))
210+
join(variants_dir, env.BoardConfig().get("build.variant"))
207211
))
208212

209213
envsafe = env.Clone()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.