Skip to content

Commit 1bbd672

Browse files
committed
Merge branch 'release/v3.4.0'
2 parents e170b13 + 67af58b commit 1bbd672

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1289
-262
lines changed

.github/workflows/examples.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
strategy:
88
fail-fast: false
99
matrix:
10-
os: [ubuntu-16.04, windows-latest, macos-latest]
10+
os: [ubuntu-18.04, windows-latest, macos-latest]
1111
python-version: [3.7]
1212
example:
1313
- "examples/arduino-blink"

boards/tinypico.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"extra_flags": "-DARDUINO_TINYPICO -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue",
88
"f_cpu": "240000000L",
99
"f_flash": "40000000L",
10-
"flash_mode": "dio",
10+
"flash_mode": "qio",
1111
"mcu": "esp32",
1212
"variant": "pico32"
1313
},

builder/frameworks/_embed_files.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def transform_to_asm(target, source, env):
125125
),
126126
suffix=".txt.o",
127127
),
128-
TxtToAsm=Builder(
128+
FileToAsm=Builder(
129129
action=env.VerboseAction(
130130
" ".join(
131131
[
@@ -136,7 +136,7 @@ def transform_to_asm(target, source, env):
136136
),
137137
"-DDATA_FILE=$SOURCE",
138138
"-DSOURCE_FILE=$TARGET",
139-
"-DFILE_TYPE=TEXT",
139+
"-DFILE_TYPE=$FILE_TYPE",
140140
"-P",
141141
join(
142142
env.PioPlatform().get_package_dir("framework-espidf") or "",
@@ -166,7 +166,13 @@ def transform_to_asm(target, source, env):
166166

167167
files = extract_files(flags, files_type)
168168
if "espidf" in env.subst("$PIOFRAMEWORK"):
169-
env.Requires(join("$BUILD_DIR", "${PROGNAME}.elf"), env.TxtToAsm(files))
169+
env.Requires(
170+
join("$BUILD_DIR", "${PROGNAME}.elf"),
171+
env.FileToAsm(
172+
files,
173+
FILE_TYPE="TEXT" if files_type == "embed_txtfiles" else "BINARY",
174+
),
175+
)
170176
else:
171177
embed_files(files, files_type)
172178
remove_config_define(flags, files_type)

builder/frameworks/espidf.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,16 @@
5353
TOOLCHAIN_DIR = platform.get_package_dir(
5454
"toolchain-%s"
5555
% (
56-
"riscv-esp"
56+
"riscv32-esp"
5757
if mcu == "esp32c3"
58-
else ("xtensa32s2" if mcu == "esp32s2" else "xtensa32")
58+
else ("xtensa-esp32s2" if mcu == "esp32s2" else "xtensa-esp32")
5959
)
6060
)
6161

62+
# Legacy toolchains for mixed IDF/Arduino projects
63+
if "arduino" in env.subst("$PIOFRAMEWORK"):
64+
TOOLCHAIN_DIR = platform.get_package_dir("toolchain-xtensa32")
65+
6266
assert os.path.isdir(FRAMEWORK_DIR)
6367
assert os.path.isdir(TOOLCHAIN_DIR)
6468

@@ -997,7 +1001,8 @@ def _get_installed_pip_packages():
9971001
return result
9981002

9991003
deps = {
1000-
"cryptography": ">=2.1.4",
1004+
# https://github.com/platformio/platform-espressif32/issues/635
1005+
"cryptography": ">=2.1.4,<35.0.0",
10011006
"future": ">=0.15.2",
10021007
"pyparsing": ">=2.0.3,<2.4.0",
10031008
"kconfiglib": "==13.7.1",
@@ -1348,7 +1353,7 @@ def _skip_prj_source_files(node):
13481353

13491354
ulp_dir = os.path.join(PROJECT_DIR, "ulp")
13501355
if os.path.isdir(ulp_dir) and os.listdir(ulp_dir) and mcu != "esp32c3":
1351-
env.SConscript("ulp.py", exports="env project_config idf_variant")
1356+
env.SConscript("ulp.py", exports="env sdk_config project_config idf_variant")
13521357

13531358
#
13541359
# Process OTA partition and image

builder/frameworks/ulp.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@
1414

1515
import os
1616

17-
from SCons.Script import Import
18-
17+
from platformio import fs
1918
from platformio.util import get_systype
2019
from platformio.proc import where_is_program
2120

22-
Import("env project_config idf_variant")
21+
from SCons.Script import Import
22+
23+
Import("env sdk_config project_config idf_variant")
2324

2425
ulp_env = env.Clone()
2526
platform = ulp_env.PioPlatform()
@@ -36,7 +37,8 @@ def prepare_ulp_env_vars(env):
3637
additional_packages = [
3738
os.path.join(
3839
platform.get_package_dir(
39-
"toolchain-xtensa%s" % ("32s2" if idf_variant == "esp32s2" else "32")
40+
"toolchain-xtensa-esp%s"
41+
% ("32s2" if idf_variant == "esp32s2" else "32")
4042
),
4143
"bin",
4244
),
@@ -58,8 +60,9 @@ def prepare_ulp_env_vars(env):
5860

5961
def collect_ulp_sources():
6062
return [
61-
os.path.join(ulp_env.subst("$PROJECT_DIR"), "ulp", f)
63+
fs.to_unix_path(os.path.join(ulp_env.subst("$PROJECT_DIR"), "ulp", f))
6264
for f in os.listdir(os.path.join(ulp_env.subst("$PROJECT_DIR"), "ulp"))
65+
if f.endswith((".c", ".S", ".s"))
6366
]
6467

6568

@@ -77,6 +80,8 @@ def get_component_includes(target_config):
7780

7881

7982
def generate_ulp_config(target_config):
83+
riscv_ulp_enabled = sdk_config.get("ESP32S2_ULP_COPROC_RISCV", False)
84+
8085
ulp_sources = collect_ulp_sources()
8186
cmd = (
8287
os.path.join(platform.get_package_dir("tool-cmake"), "bin", "cmake"),
@@ -87,15 +92,17 @@ def generate_ulp_config(target_config):
8792
"components",
8893
"ulp",
8994
"cmake",
90-
"toolchain-%s-ulp.cmake" % idf_variant,
95+
"toolchain-%s-ulp%s.cmake"
96+
% (idf_variant, "-riscv" if riscv_ulp_enabled else ""),
9197
),
9298
'-DULP_S_SOURCES="%s"' % ";".join(ulp_sources),
9399
"-DULP_APP_NAME=ulp_main",
94100
"-DCOMPONENT_DIR=" + os.path.join(ulp_env.subst("$PROJECT_DIR"), "ulp"),
95101
'-DCOMPONENT_INCLUDES="%s"' % ";".join(get_component_includes(target_config)),
96-
"-DIDF_PATH=" + FRAMEWORK_DIR,
97-
"-DSDKCONFIG=" + os.path.join(BUILD_DIR, "config", "sdkconfig.h"),
102+
"-DIDF_PATH=" + fs.to_unix_path(FRAMEWORK_DIR),
103+
"-DSDKCONFIG_HEADER=" + os.path.join(BUILD_DIR, "config", "sdkconfig.h"),
98104
"-DPYTHON=" + env.subst("$PYTHONEXE"),
105+
"-DULP_COCPU_IS_RISCV=%s" % ("ON" if riscv_ulp_enabled else "OFF"),
99106
"-GNinja",
100107
"-B",
101108
ULP_BUILD_DIR,

builder/main.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@ def _get_board_f_flash(env):
3131
return str(int(int(frequency) / 1000000)) + "m"
3232

3333

34+
def _get_board_flash_mode(env):
35+
mode = env.subst("$BOARD_FLASH_MODE")
36+
if mode == "qio":
37+
return "dio"
38+
elif mode == "qout":
39+
return "dout"
40+
return mode
41+
42+
3443
def _parse_size(value):
3544
if isinstance(value, int):
3645
return value
@@ -71,8 +80,13 @@ def _parse_partitions(env):
7180
"flags": tokens[5] if len(tokens) > 5 else None
7281
}
7382
result.append(partition)
74-
next_offset = (_parse_size(partition['offset']) +
75-
_parse_size(partition['size']))
83+
next_offset = _parse_size(partition["offset"]) + _parse_size(
84+
partition["size"]
85+
)
86+
87+
bound = 0x10000 if partition["type"] in ("0", "app") else 4
88+
next_offset = (next_offset + bound - 1) & ~(bound - 1)
89+
7690
return result
7791

7892

@@ -130,6 +144,7 @@ def __fetch_spiffs_size(target, source, env):
130144

131145
env.Replace(
132146
__get_board_f_flash=_get_board_f_flash,
147+
__get_board_flash_mode=_get_board_flash_mode,
133148

134149
AR="%s-elf-ar" % toolchain_arch,
135150
AS="%s-elf-as" % toolchain_arch,
@@ -302,7 +317,7 @@ def __fetch_spiffs_size(target, source, env):
302317
"--before", "default_reset",
303318
"--after", "hard_reset",
304319
"write_flash", "-z",
305-
"--flash_mode", "$BOARD_FLASH_MODE",
320+
"--flash_mode", "${__get_board_flash_mode(__env__)}",
306321
"--flash_freq", "${__get_board_f_flash(__env__)}",
307322
"--flash_size", "detect"
308323
],

examples/espidf-aws-iot/components/esp-aws-iot/aws-iot-device-sdk-embedded-C/PortingGuide.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ For additional details about API parameters refer to the [API documentation](htt
7676
Define the `TLSDataParams` Struct as in `network_platform.h`
7777
This is used for data specific to the TLS library being used.
7878

79-
`IoT_Error_t iot_tls_init(Network *pNetwork, char *pRootCALocation, const char *pDeviceCertLocation,
80-
const char *pDevicePrivateKeyLocation, const char *pDestinationURL,
79+
`IoT_Error_t iot_tls_init(Network *pNetwork, char *pRootCALocation, char *pDeviceCertLocation,
80+
char *pDevicePrivateKeyLocation, char *pDestinationURL,
8181
uint16_t DestinationPort, uint32_t timeout_ms, bool ServerVerificationFlag);`
8282
Initialize the network client / structure.
8383

examples/espidf-aws-iot/components/esp-aws-iot/aws-iot-device-sdk-embedded-C/README.md

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,11 @@
1-
**We have released version 4.0.0 beta 1 of this SDK on the [v4_beta](https://github.com/aws/aws-iot-device-sdk-embedded-C/tree/v4_beta) branch and encourage everyone to give it a try.**
1+
# AWS IoT Device SDK for Embedded C
22

3-
Version 4 is a new design, and therefore **NOT** backwards compatible with version 3.0.1. We will continue to fix bugs in v3.0.1 even after v4.0.0 is released, but we may not add new features to v3.0.1.
3+
This tag [3.1.5](https://github.com/aws/aws-iot-device-sdk-embedded-C/tree/v3.1.5) contains the v3 version of AWS IoT Device SDK for Embedded C. No new features will be added to this tag; instead, only bug fixes will be made and minimally tested.
44

5-
Please be aware that v4 beta may have bugs and performance issues. Additionally, there are currently missing features compared to v3.0.1. See the [README](https://github.com/aws/aws-iot-device-sdk-embedded-C/blob/v4_beta/README.md/) on the v4_beta branch for more information.
6-
7-
## Branches
8-
9-
### Master branch
10-
The [master](https://github.com/aws/aws-iot-device-sdk-embedded-C/tree/master) branch will now contain bug fixes/features that have been minimally tested to ensure nothing major is broken. The current version on the master branch is v3.0.1. Eventually, we will move v4.0.0 to the master branch and move v3.0.1 to a legacy branch.
11-
12-
### Release branch
13-
The [release](https://github.com/aws/aws-iot-device-sdk-embedded-C/tree/release) branch will contain new releases for the SDK that have been tested thoroughly on all supported platforms. Please ensure that you are tracking the release branch for all production work. The current version on the release branch is v3.0.1. Eventually, we will move v4.0.0 to the release branch and move v3.0.1 to a legacy branch.
14-
15-
### v4_beta branch
16-
The [v4_beta](https://github.com/aws/aws-iot-device-sdk-embedded-C/tree/v4_beta) branch will contain new features and a new design that inherits from both the AWS IoT Device SDK Embedded C and the libraries provided with Amazon FreeRTOS. This is version 4.0.0 of the SDK. Please be aware that v4 beta may have bugs and performance issues. Eventually, we will move v4.0.0 to the master/release branches and delete v4 beta branch.
17-
18-
### Development branch
19-
20-
The [development](https://github.com/aws/aws-iot-device-sdk-embedded-C/tree/development) currently hosts development of the next iteration of the AWS IoT Embedded C SDK version 4. It is currently a work in progress and should not be used to create any products. We will update this README when that status changes.
215

226
## Overview
237

24-
The AWS IoT device SDK for embedded C is a collection of C source files which can be used in embedded applications to securely connect to the [AWS IoT platform](http://docs.aws.amazon.com/iot/latest/developerguide/what-is-aws-iot.html). It includes transport clients **MQTT**, **TLS** implementations and examples for their use. It also supports AWS IoT specific features such as **Thing Shadow**. It is distributed in source form and intended to be built into customer firmware along with application code, other libraries and RTOS. For additional information about porting the Device SDK for embedded C onto additional platforms please refer to the [PortingGuide](https://github.com/aws/aws-iot-device-sdk-embedded-c/blob/master/PortingGuide.md/).
8+
The AWS IoT device SDK for embedded C is a collection of C source files which can be used in embedded applications to securely connect to the [AWS IoT platform](http://docs.aws.amazon.com/iot/latest/developerguide/what-is-aws-iot.html). It includes transport clients **MQTT**, **TLS** implementations and examples for their use. It also supports AWS IoT specific features such as **Thing Shadow**. It is distributed in source form and intended to be built into customer firmware along with application code, other libraries and RTOS. For additional information about porting the Device SDK for embedded C onto additional platforms please refer to the [PortingGuide](./PortingGuide.md).
259

2610
## Features
2711
The Device SDK simplifies access to the Pub/Sub functionality of the AWS IoT broker via MQTT and provide APIs to interact with Thing Shadows. The SDK has been tested to work with the AWS IoT platform to ensure best interoperability of a device with the AWS IoT platform.
80.6 KB
Loading
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/**
2+
@page architecture SDK Architecture and Design
3+
@brief This page documents the architecture and design goals of this SDK.
4+
5+
The Embedded C SDK has a layered architecture. It is currently based on the MQTT protocol, but may support protocols like HTTP in the future.
6+
7+
This SDK is primarily targeted for resource-constrained devices.
8+
9+
@section architecture_considerations Considerations during design
10+
- Low memory footprint (around 6k of code size without TLS library for the MQTT layer)
11+
- Flexibility in picking and choosing functionality
12+
- Static memory only (no malloc)
13+
- Configurable resource usage (JSON tokens, MQTT subscription handlers, etc.)
14+
- Portability across RTOSes
15+
16+
@section architecture_diagram Layered architecture
17+
@brief There are primarily 3 layers in the SDK as shown in the diagram below.
18+
19+
@image html architecture.png
20+
21+
@subsection architecture_tls TLS layer
22+
23+
This SDK uses TLS sockets to talk to the server. We provide wrappers around mbed TLS (ARM) that allow the libraries to connect with AWS IoT Platform.
24+
25+
@subsection architecture_mqtt AWS IoT MQTT client
26+
27+
The MQTT library included in this SDK is a modification of the [Paho C MQTT client](https://www.eclipse.org/paho/clients/c/). MQTT is a standardized publish subscribe protocol popular on embedded devices. AWS IoT supports the MQTT protocol for communication with devices. This MQTT library can be used standalone or with other AWS IoT services such as Thing Shadows or Jobs.
28+
29+
@subsection architecture_shadow Thing Shadow
30+
31+
This SDK provides a client implementation for [AWS IoT Thing Shadows](https://docs.aws.amazon.com/iot/latest/developerguide/iot-device-shadows.html). A device's Shadow is a JSON document that is used to store and retrieve its current state information in the cloud regardless of whether it is connected to the Internet.
32+
*/

0 commit comments

Comments
 (0)