Skip to content

Commit d92c768

Browse files
ivankravetsme-no-dev
authored andcommitted
Add support for custom partition table; use built-in esptool.py (#195)
1 parent fb8fe67 commit d92c768

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

tools/platformio-build.py

+24-1
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,19 @@
8080
join(FRAMEWORK_DIR, "tools", "sdk", "include", "lwip"),
8181
join(FRAMEWORK_DIR, "cores", env.BoardConfig().get("build.core"))
8282
],
83+
8384
LIBPATH=[
8485
join(FRAMEWORK_DIR, "tools", "sdk", "lib"),
8586
join(FRAMEWORK_DIR, "tools", "sdk", "ld")
8687
],
88+
8789
LIBS=[
8890
"gcc", "stdc++", "app_update", "bootloader_support", "bt", "btdm_app", "c", "c_nano", "coap", "coexist", "core", "cxx", "driver", "esp32", "ethernet", "expat", "fatfs", "freertos", "hal", "json", "log", "lwip", "m", "mbedtls", "mdns", "micro-ecc", "net80211", "newlib", "nghttp", "nvs_flash", "openssl", "phy", "pp", "rtc", "sdmmc", "smartconfig", "spi_flash", "tcpip_adapter", "ulp", "vfs", "wpa", "wpa2", "wpa_supplicant", "wps", "xtensa-debug-module"
91+
],
92+
93+
UPLOADERFLAGS=[
94+
"--before", "default_reset",
95+
"--after", "hard_reset"
8996
]
9097
)
9198

@@ -103,12 +110,16 @@
103110

104111
UPLOADERFLAGS=[
105112
"0x1000", '"%s"' % join(FRAMEWORK_DIR, "tools", "sdk", "bin", "bootloader.bin"),
106-
"0x8000", '"%s"' % join(FRAMEWORK_DIR, "tools", "partitions", "default.bin"),
113+
"0x8000", '"%s"' % join("$BUILD_DIR", "partitions.bin"),
107114
"0xe000", '"%s"' % join(FRAMEWORK_DIR, "tools", "partitions", "boot_app0.bin"),
108115
"0x10000"
109116
]
110117
)
111118

119+
env.Replace(
120+
UPLOADER=join(FRAMEWORK_DIR, "tools", "esptool.py")
121+
)
122+
112123
#
113124
# Target: Build Core Library
114125
#
@@ -135,3 +146,15 @@
135146
))
136147

137148
env.Prepend(LIBS=libs)
149+
150+
#
151+
# Generate partition table
152+
#
153+
154+
partition_table = env.Command(
155+
join("$BUILD_DIR", "partitions.bin"),
156+
join(FRAMEWORK_DIR, "tools", "partitions", "default.csv"),
157+
'"$PYTHONEXE" "%s" -q $SOURCE $TARGET' % join(
158+
FRAMEWORK_DIR, "tools", "gen_esp32part.py")
159+
)
160+
env.Depends("$BUILD_DIR/$PROGNAME$PROGSUFFIX", partition_table)

0 commit comments

Comments
 (0)