Skip to content

Commit c3e3a5c

Browse files
committed
Merge branch 'release/v0.6.0'
2 parents ecf0ebc + 0924036 commit c3e3a5c

File tree

35 files changed

+2092
-78
lines changed

35 files changed

+2092
-78
lines changed

.travis.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@ python:
55
env:
66
- PLATFORMIO_PROJECT_DIR=examples/arduino-blink
77
- PLATFORMIO_PROJECT_DIR=examples/arduino-wifiscan
8+
- PLATFORMIO_PROJECT_DIR=examples/espidf-ble-adv
9+
- PLATFORMIO_PROJECT_DIR=examples/espidf-coap-server
810
- PLATFORMIO_PROJECT_DIR=examples/espidf-hello-world
911
- PLATFORMIO_PROJECT_DIR=examples/espidf-http-request
10-
- PLATFORMIO_PROJECT_DIR=examples/simba-blink
12+
- PLATFORMIO_PROJECT_DIR=examples/espidf-peripherals-uart
13+
- PLATFORMIO_PROJECT_DIR=examples/espidf-storage-sdcard
1114
- PLATFORMIO_PROJECT_DIR=examples/pumbaa-blink
15+
- PLATFORMIO_PROJECT_DIR=examples/simba-blink
1216

1317
install:
1418
- pip install -U https://github.com/platformio/platformio/archive/develop.zip

appveyor.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@ environment:
44
matrix:
55
- PLATFORMIO_PROJECT_DIR: "examples/arduino-blink"
66
- PLATFORMIO_PROJECT_DIR: "examples/arduino-wifiscan"
7+
- PLATFORMIO_PROJECT_DIR: "examples/espidf-ble-adv"
8+
- PLATFORMIO_PROJECT_DIR: "examples/espidf-coap-server"
79
- PLATFORMIO_PROJECT_DIR: "examples/espidf-hello-world"
810
- PLATFORMIO_PROJECT_DIR: "examples/espidf-http-request"
9-
- PLATFORMIO_PROJECT_DIR: "examples/simba-blink"
11+
- PLATFORMIO_PROJECT_DIR: "examples/espidf-peripherals-uart"
12+
- PLATFORMIO_PROJECT_DIR: "examples/espidf-storage-sdcard"
1013
- PLATFORMIO_PROJECT_DIR: "examples/pumbaa-blink"
14+
- PLATFORMIO_PROJECT_DIR: "examples/simba-blink"
1115

1216
install:
1317
- cmd: git submodule update --init --recursive

builder/frameworks/espidf.py

Lines changed: 185 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
https://github.com/espressif/esp-idf
2121
"""
2222

23-
from os import listdir
24-
from os.path import isdir, join
23+
from os import listdir, walk
24+
from os.path import basename, isdir, isfile, join
2525

2626
from SCons.Script import DefaultEnvironment
2727

@@ -35,36 +35,115 @@
3535
"framework-espidf")
3636

3737

38+
def parse_mk(path):
39+
result = {}
40+
variable = None
41+
multi = False
42+
with open(path) as fp:
43+
for line in fp.readlines():
44+
line = line.strip()
45+
if not line or line.startswith("#"):
46+
continue
47+
# remove inline comments
48+
if " # " in line:
49+
line = line[:line.index(" # ")]
50+
if not multi and "=" in line:
51+
variable, line = line.split("=", 1)
52+
if variable.endswith((":", "+")):
53+
variable = variable[:-1]
54+
variable = variable.strip()
55+
line = line.strip()
56+
if not variable or not line:
57+
continue
58+
multi = line.endswith('\\')
59+
if multi:
60+
line = line[:-1].strip()
61+
if variable not in result:
62+
result[variable] = []
63+
result[variable].extend([l.strip() for l in line.split()])
64+
if not multi:
65+
variable = None
66+
return result
67+
68+
69+
def build_component(path):
70+
envsafe = env.Clone()
71+
src_filter = "+<*> -<test> -<tests>"
72+
if isfile(join(path, "component.mk")):
73+
params = parse_mk(join(path, "component.mk"))
74+
if params.get("COMPONENT_PRIV_INCLUDEDIRS"):
75+
inc_dirs = params.get("COMPONENT_PRIV_INCLUDEDIRS")
76+
envsafe.Prepend(
77+
CPPPATH=[join(path, d) for d in inc_dirs])
78+
if params.get("CFLAGS"):
79+
envsafe.Append(CCFLAGS=params.get("CFLAGS"))
80+
if params.get("COMPONENT_OBJS"):
81+
src_filter = "-<*>"
82+
for f in params.get("COMPONENT_OBJS"):
83+
src_filter += " +<%s>" % f.replace(".o", ".c")
84+
elif params.get("COMPONENT_SRCDIRS"):
85+
src_filter = "-<*>"
86+
src_dirs = params.get("COMPONENT_SRCDIRS")
87+
if "." in src_dirs:
88+
src_dirs.remove(".")
89+
src_filter += " +<*.c*>"
90+
for f in src_dirs:
91+
src_filter += " +<%s/*.c*>" % f
92+
93+
return envsafe.BuildLibrary(
94+
join("$BUILD_DIR", "%s" % basename(path)), path,
95+
src_filter=src_filter
96+
)
97+
98+
3899
def build_espidf_bootloader():
39100
envsafe = env.Clone()
101+
envsafe.Append(CPPDEFINES=[("BOOTLOADER_BUILD", 1)])
40102
envsafe.Replace(
41-
CPPDEFINES=["ESP_PLATFORM", ("BOOTLOADER_BUILD", 1)],
42-
43103
LIBPATH=[
44104
join(FRAMEWORK_DIR, "components", "esp32", "ld"),
105+
join(FRAMEWORK_DIR, "components", "esp32", "lib"),
45106
join(FRAMEWORK_DIR, "components", "bootloader", "src", "main")
46107
],
47108

48109
LINKFLAGS=[
49-
"-Os",
50110
"-nostdlib",
51111
"-Wl,-static",
52112
"-u", "call_user_start_cpu0",
53-
"-Wl,-static",
54113
"-Wl,--gc-sections",
55114
"-T", "esp32.bootloader.ld",
56-
"-T", "esp32.rom.ld"
115+
"-T", "esp32.rom.ld",
116+
"-T", "esp32.bootloader.rom.ld"
57117
]
58118
),
59119

60-
envsafe.Append(CCFLAGS=["-fstrict-volatile-bitfields"])
120+
envsafe.Append(
121+
CPPPATH=[
122+
join(FRAMEWORK_DIR, "components", "esp32")
123+
]
124+
)
61125

62126
envsafe.Replace(
63127
LIBS=[
128+
envsafe.BuildLibrary(
129+
join("$BUILD_DIR", "bootloaderSupport"),
130+
join(FRAMEWORK_DIR, "components", "bootloader_support")
131+
),
64132
envsafe.BuildLibrary(
65133
join("$BUILD_DIR", "bootloaderLog"),
66134
join(FRAMEWORK_DIR, "components", "log")
67-
), "gcc"
135+
),
136+
envsafe.BuildLibrary(
137+
join("$BUILD_DIR", "bootloaderSPIFlash"),
138+
join(FRAMEWORK_DIR, "components", "spi_flash"),
139+
src_filter="-<*> +<spi_flash_rom_patch.c>"
140+
),
141+
envsafe.BuildLibrary(
142+
join("$BUILD_DIR", "bootloaderMicroEcc"),
143+
join(FRAMEWORK_DIR, "components", "micro-ecc"),
144+
src_filter="+<*> -<micro-ecc/test>"
145+
),
146+
"rtc", "gcc", "stdc++"
68147
]
69148
)
70149

@@ -80,27 +159,53 @@ def build_espidf_bootloader():
80159
env.Prepend(
81160
CPPPATH=[
82161
join("$PROJECTSRC_DIR"),
83-
join(FRAMEWORK_DIR, "components", "nghttp", "include"),
84-
join(FRAMEWORK_DIR, "components", "nghttp", "port", "include"),
162+
join(FRAMEWORK_DIR, "components", "xtensa-debug-module", "include"),
163+
join(FRAMEWORK_DIR, "components", "app_update", "include"),
164+
join(FRAMEWORK_DIR, "components", "bootloader_support", "include"),
165+
join(FRAMEWORK_DIR, "components",
166+
"bootloader_support", "include_priv"),
85167
join(FRAMEWORK_DIR, "components", "bt", "include"),
168+
join(FRAMEWORK_DIR, "components", "coap", "port", "include"),
169+
join(FRAMEWORK_DIR, "components", "coap", "port", "include", "coap"),
170+
join(FRAMEWORK_DIR, "components", "coap", "libcoap", "include"),
171+
join(FRAMEWORK_DIR, "components", "coap",
172+
"libcoap", "include", "coap"),
173+
join(FRAMEWORK_DIR, "components", "cxx", "include"),
86174
join(FRAMEWORK_DIR, "components", "driver", "include"),
175+
join(FRAMEWORK_DIR, "components", "driver", "include", "driver"),
87176
join(FRAMEWORK_DIR, "components", "esp32", "include"),
177+
join(FRAMEWORK_DIR, "components", "ethernet", "include"),
178+
join(FRAMEWORK_DIR, "components", "expat", "include", "expat"),
179+
join(FRAMEWORK_DIR, "components", "expat", "port", "include"),
180+
join(FRAMEWORK_DIR, "components", "fatfs", "src"),
88181
join(FRAMEWORK_DIR, "components", "freertos", "include"),
89-
join(FRAMEWORK_DIR, "components", "freertos", "include", "freertos"),
182+
join(FRAMEWORK_DIR, "components", "json", "include"),
183+
join(FRAMEWORK_DIR, "components", "json", "port", "include"),
90184
join(FRAMEWORK_DIR, "components", "log", "include"),
91-
join(FRAMEWORK_DIR, "components", "newlib", "include"),
92-
join(FRAMEWORK_DIR, "components", "nvs_flash", "include"),
93-
join(FRAMEWORK_DIR, "components", "spi_flash", "include"),
94-
join(FRAMEWORK_DIR, "components", "tcpip_adapter", "include"),
95185
join(FRAMEWORK_DIR, "components", "lwip", "include", "lwip"),
96186
join(FRAMEWORK_DIR, "components", "lwip", "include", "lwip", "port"),
97187
join(FRAMEWORK_DIR, "components", "lwip", "include", "lwip", "posix"),
98-
join(FRAMEWORK_DIR, "components", "expat", "include", "expat"),
99-
join(FRAMEWORK_DIR, "components", "expat", "port", "include"),
100-
join(FRAMEWORK_DIR, "components", "json", "include"),
101-
join(FRAMEWORK_DIR, "components", "json", "port", "include"),
188+
join(FRAMEWORK_DIR, "components", "lwip", "apps", "ping"),
189+
join(FRAMEWORK_DIR, "components", "mbedtls", "port", "include"),
102190
join(FRAMEWORK_DIR, "components", "mbedtls", "include"),
103-
join(FRAMEWORK_DIR, "components", "mbedtls", "port", "include")
191+
join(FRAMEWORK_DIR, "components", "mdns", "include"),
192+
join(FRAMEWORK_DIR, "components", "micro-ecc", "micro-ecc"),
193+
join(FRAMEWORK_DIR, "components", "newlib", "include"),
194+
join(FRAMEWORK_DIR, "components", "newlib", "platform_include"),
195+
join(FRAMEWORK_DIR, "components", "nghttp", "include"),
196+
join(FRAMEWORK_DIR, "components", "nghttp", "port", "include"),
197+
join(FRAMEWORK_DIR, "components", "nvs_flash", "include"),
198+
join(FRAMEWORK_DIR, "components", "openssl", "include"),
199+
join(FRAMEWORK_DIR, "components", "openssl", "include", "internal"),
200+
join(FRAMEWORK_DIR, "components", "openssl", "include", "platform"),
201+
join(FRAMEWORK_DIR, "components", "openssl", "include", "openssl"),
202+
join(FRAMEWORK_DIR, "components", "sdmmc", "include"),
203+
join(FRAMEWORK_DIR, "components", "spi_flash", "include"),
204+
join(FRAMEWORK_DIR, "components", "tcpip_adapter", "include"),
205+
join(FRAMEWORK_DIR, "components", "ulp", "include"),
206+
join(FRAMEWORK_DIR, "components", "vfs", "include"),
207+
join(FRAMEWORK_DIR, "components", "wpa_supplicant", "include"),
208+
join(FRAMEWORK_DIR, "components", "wpa_supplicant", "port", "include")
104209
],
105210

106211
LIBPATH=[
@@ -113,25 +218,51 @@ def build_espidf_bootloader():
113218
],
114219

115220
LIBS=[
116-
"hal", "crypto", "core", "net80211", "phy", "rtc", "pp", "wpa",
117-
"smartconfig", "btdm_app", "m", "c", "gcc"
221+
"btdm_app", "hal", "coexist", "core", "net80211", "phy", "rtc", "pp",
222+
"wpa", "wpa2", "wps", "smartconfig", "m", "c", "gcc", "stdc++"
118223
]
119224
)
120225

121-
env.Append(
122-
LIBSOURCE_DIRS=[
123-
join(FRAMEWORK_DIR, "libraries")
226+
for root, dirs, _ in walk(join(
227+
FRAMEWORK_DIR, "components", "bt", "bluedroid")):
228+
for d in dirs:
229+
if (d == "include"):
230+
env.Append(CPPPATH=[join(root, d)])
231+
232+
233+
env.Prepend(
234+
CFLAGS=["-Wno-old-style-declaration"],
235+
236+
CPPDEFINES=[
237+
"WITH_POSIX",
238+
("IDF_VER", '\\"%s\\"' %
239+
platform.get_package_version("framework-espidf"))
124240
],
125241

242+
CCFLAGS=[
243+
"-Wall",
244+
"-Werror=all",
245+
"-Wno-error=deprecated-declarations",
246+
"-Wextra",
247+
"-Wno-unused-parameter",
248+
"-Wno-sign-compare",
249+
"-Wno-error=unused-function"
250+
],
251+
252+
LIBSOURCE_DIRS=[join(FRAMEWORK_DIR, "libraries")]
253+
)
254+
255+
env.Append(
126256
LINKFLAGS=[
257+
"-u", "__cxa_guard_dummy",
127258
"-T", "esp32.common.ld",
128259
"-T", "esp32.rom.ld",
129260
"-T", "esp32.peripherals.ld"
130261
],
131262

132263
UPLOADERFLAGS=[
133264
"0x1000", join("$BUILD_DIR", "bootloader.bin"),
134-
"0x4000", join("$BUILD_DIR", "partitions_table.bin"),
265+
"0x8000", join("$BUILD_DIR", "partitions_table.bin"),
135266
"0x10000"
136267
]
137268
)
@@ -142,14 +273,14 @@ def build_espidf_bootloader():
142273

143274
partition_table = env.Command(
144275
join("$BUILD_DIR", "partitions_table.bin"),
145-
join(FRAMEWORK_DIR, "components",
146-
"partition_table", "partitions_singleapp.csv"),
147-
'"$PYTHONEXE" "%s" -q $SOURCE $TARGET' % join(
148-
FRAMEWORK_DIR, "components", "partition_table", "gen_esp32part.py")
149-
)
276+
join(FRAMEWORK_DIR, "components", "partition_table",
277+
"partitions_singleapp.csv"),
278+
env.VerboseAction('"$PYTHONEXE" "%s" -q $SOURCE $TARGET' % join(
279+
FRAMEWORK_DIR, "components", "partition_table", "gen_esp32part.py"),
280+
"Generating partitions $TARGET"))
150281

151-
env.Depends("$BUILD_DIR/$PROGNAME$PROGSUFFIX", partition_table)
152282

283+
env.Depends("$BUILD_DIR/$PROGNAME$PROGSUFFIX", partition_table)
153284

154285
#
155286
# Generate linker script
@@ -158,8 +289,9 @@ def build_espidf_bootloader():
158289
linker_script = env.Command(
159290
join("$BUILD_DIR", "esp32_out.ld"),
160291
join(FRAMEWORK_DIR, "components", "esp32", "ld", "esp32.ld"),
161-
"$CC -I$PROJECTSRC_DIR -C -P -x c -E $SOURCE -o $TARGET"
162-
)
292+
env.VerboseAction(
293+
"$CC -I$PROJECTSRC_DIR -C -P -x c -E $SOURCE -o $TARGET",
294+
"Generating LD script $TARGET"))
163295

164296
env.Depends("$BUILD_DIR/$PROGNAME$PROGSUFFIX", linker_script)
165297

@@ -177,16 +309,27 @@ def build_espidf_bootloader():
177309
libs = []
178310

179311
ignore_dirs = (
180-
"bootloader", "esptool_py", "idf_test", "newlib", "partition_table")
312+
"bootloader",
313+
"bootloader_support",
314+
"esptool_py",
315+
"idf_test",
316+
"partition_table",
317+
"nghttp",
318+
"spi_flash"
319+
)
181320

182321
for d in listdir(join(FRAMEWORK_DIR, "components")):
183322
if d in ignore_dirs:
184323
continue
185-
if isdir(join(FRAMEWORK_DIR, "components", d)):
186-
libs.append(env.BuildLibrary(
187-
join("$BUILD_DIR", "%s" % d),
188-
join(FRAMEWORK_DIR, "components", d),
189-
src_filter="+<*> -<test>"
190-
))
324+
component_dir = join(FRAMEWORK_DIR, "components", d)
325+
if isdir(component_dir):
326+
libs.append(build_component(component_dir))
327+
328+
329+
libs.append(env.BuildLibrary(
330+
join("$BUILD_DIR", "spi_flash"),
331+
join(FRAMEWORK_DIR, "components", "spi_flash"),
332+
src_filter="+<*> -<test>"
333+
))
191334

192335
env.Prepend(LIBS=libs)

builder/main.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ def _get_board_f_flash(env):
4949
"-g3",
5050
"-nostdlib",
5151
"-Wpointer-arith",
52-
"-Wno-error=unused-function",
5352
"-Wno-error=unused-but-set-variable",
5453
"-Wno-error=unused-variable",
5554
"-mlongcalls",
@@ -162,7 +161,6 @@ def _get_board_f_flash(env):
162161
env.VerboseAction("$UPLOADCMD", "Uploading $SOURCE")])
163162
env.AlwaysBuild(target_upload)
164163

165-
166164
#
167165
# Default targets
168166
#

examples/espidf-ble-adv/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.pioenvs
2+
.clang_complete
3+
.gcc-flags.json

0 commit comments

Comments
 (0)