Skip to content

Commit dca8013

Browse files
authored
Merge pull request #1 from espressif/master
up to 11/05/2017
2 parents 1156534 + 126674c commit dca8013

Some content is hidden

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

108 files changed

+1211
-1315
lines changed

boards.txt

+39-1
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,44 @@ esp32thing.menu.UploadSpeed.512000.upload.speed=512000
122122

123123
##############################################################
124124

125+
nina_w10.name=u-blox NINA-W10 series (ESP32)
126+
127+
nina_w10.upload.tool=esptool
128+
nina_w10.upload.maximum_size=1310720
129+
nina_w10.upload.maximum_data_size=294912
130+
nina_w10.upload.wait_for_upload_port=true
131+
132+
nina_w10.serial.disableDTR=true
133+
nina_w10.serial.disableRTS=true
134+
135+
nina_w10.build.mcu=esp32
136+
nina_w10.build.core=esp32
137+
nina_w10.build.variant=nina_w10
138+
nina_w10.build.board=UBLOX_NINA_W10
139+
nina_w10.build.f_cpu=240000000L
140+
nina_w10.build.boot=bootloader
141+
nina_w10.build.partitions=minimal
142+
nina_w10.build.flash_mode=dio
143+
nina_w10.build.flash_size=2MB
144+
nina_w10.build.flash_freq=40m
145+
146+
nina_w10.menu.UploadSpeed.921600=921600
147+
nina_w10.menu.UploadSpeed.921600.upload.speed=921600
148+
nina_w10.menu.UploadSpeed.115200=115200
149+
nina_w10.menu.UploadSpeed.115200.upload.speed=115200
150+
nina_w10.menu.UploadSpeed.256000.windows=256000
151+
nina_w10.menu.UploadSpeed.256000.upload.speed=256000
152+
nina_w10.menu.UploadSpeed.230400.windows.upload.speed=256000
153+
nina_w10.menu.UploadSpeed.230400=230400
154+
nina_w10.menu.UploadSpeed.230400.upload.speed=230400
155+
nina_w10.menu.UploadSpeed.460800.linux=460800
156+
nina_w10.menu.UploadSpeed.460800.macosx=460800
157+
nina_w10.menu.UploadSpeed.460800.upload.speed=460800
158+
nina_w10.menu.UploadSpeed.512000.windows=512000
159+
nina_w10.menu.UploadSpeed.512000.upload.speed=512000
160+
161+
##############################################################
162+
125163
widora-air.name=Widora AIR
126164

127165
widora-air.upload.tool=esptool
@@ -1377,4 +1415,4 @@ CoreESP32.menu.UploadSpeed.460800.linux=460800
13771415
CoreESP32.menu.UploadSpeed.460800.macosx=460800
13781416
CoreESP32.menu.UploadSpeed.460800.upload.speed=460800
13791417
CoreESP32.menu.UploadSpeed.512000.windows=512000
1380-
CoreESP32.menu.UploadSpeed.512000.upload.speed=512000
1418+
CoreESP32.menu.UploadSpeed.512000.upload.speed=512000

cores/esp32/Arduino.h

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "freertos/task.h"
3434
#include "freertos/semphr.h"
3535
#include "esp32-hal.h"
36+
#include "esp8266-compat.h"
3637
#include "soc/gpio_reg.h"
3738

3839
#include "stdlib_noniso.h"

cores/esp32/esp32-hal-i2c.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,8 @@ i2c_err_t i2cRead(i2c_t * i2c, uint16_t address, bool addr_10bit, uint8_t * data
340340
// Save bytes from the buffer as they arrive instead of doing them at the end of the loop since there is no
341341
// pause from an END operation in this approach.
342342
if((!isEndNear) && (nextCmdCount < 2)) {
343-
if (willRead = ((len>32)?32:len)) {
343+
willRead = ((len>32)?32:len);
344+
if (willRead > 0) {
344345
if (willRead > 1) {
345346
i2cSetCmd(i2c, cmdIdx, I2C_CMD_READ, (amountRead[ inc( &cmdIdx ) ] = willRead -1), false, false, false);
346347
nextCmdCount++;
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
1-
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
2-
//
3-
// Licensed under the Apache License, Version 2.0 (the "License");
4-
// you may not use this file except in compliance with the License.
5-
// You may obtain a copy of the License at
6-
7-
// http://www.apache.org/licenses/LICENSE-2.0
8-
//
9-
// Unless required by applicable law or agreed to in writing, software
10-
// distributed under the License is distributed on an "AS IS" BASIS,
11-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
// See the License for the specific language governing permissions and
13-
// limitations under the License.
14-
15-
#ifndef IN_H_
16-
#define IN_H_
17-
18-
#include "lwip/inet.h"
19-
20-
#define IN6_IS_ADDR_MULTICAST(a) IN_MULTICAST(a)
21-
22-
#endif /* IN_H_ */
1+
// esp8266-compat.h - Compatibility functions to help ESP8266 libraries and user code run on ESP32
2+
3+
// Copyright (c) 2017 Evandro Luis Copercini. All rights reserved.
4+
//
5+
// Licensed under the Apache License, Version 2.0 (the "License");
6+
// you may not use this file except in compliance with the License.
7+
// You may obtain a copy of the License at
8+
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing, software
12+
// distributed under the License is distributed on an "AS IS" BASIS,
13+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
// See the License for the specific language governing permissions and
15+
// limitations under the License.
16+
17+
#ifndef _ESP8266_COMPAT_H_
18+
#define _ESP8266_COMPAT_H_
19+
20+
#define ICACHE_FLASH_ATTR
21+
#define ICACHE_RAM_ATTR IRAM_ATTR
22+
23+
24+
#endif /* _ESP8266_COMPAT_H_ */

libraries/ArduinoOTA/src/ArduinoOTA.cpp

+15-3
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,11 @@ void ArduinoOTAClass::begin() {
122122
}
123123

124124
int ArduinoOTAClass::parseInt(){
125-
char data[16];
125+
char data[INT_BUFFER_SIZE];
126126
uint8_t index = 0;
127127
char value;
128128
while(_udp_ota.peek() == ' ') _udp_ota.read();
129-
while(true){
129+
while(index < INT_BUFFER_SIZE - 1){
130130
value = _udp_ota.peek();
131131
if(value < '0' || value > '9'){
132132
data[index++] = '\0';
@@ -347,15 +347,27 @@ void ArduinoOTAClass::_runUpdate() {
347347
}
348348
}
349349

350+
void ArduinoOTAClass::end() {
351+
_initialized = false;
352+
_udp_ota.stop();
353+
if(_mdnsEnabled){
354+
MDNS.end();
355+
}
356+
_state = OTA_IDLE;
357+
#ifdef OTA_DEBUG
358+
OTA_DEBUG.println("OTA server stopped.");
359+
#endif
360+
}
361+
350362
void ArduinoOTAClass::handle() {
351363
if (_state == OTA_RUNUPDATE) {
352364
_runUpdate();
353365
_state = OTA_IDLE;
354366
}
355367
if(_udp_ota.parsePacket()){
356368
_onRx();
357-
_udp_ota.flush();
358369
}
370+
_udp_ota.flush(); // always flush, even zero length packets must be flushed.
359371
}
360372

361373
int ArduinoOTAClass::getCommand() {

libraries/ArduinoOTA/src/ArduinoOTA.h

+6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
#include <functional>
66
#include "Update.h"
77

8+
#define INT_BUFFER_SIZE 16
9+
10+
811
typedef enum {
912
OTA_IDLE,
1013
OTA_WAITAUTH,
@@ -63,6 +66,9 @@ class ArduinoOTAClass
6366
//Starts the ArduinoOTA service
6467
void begin();
6568

69+
//Ends the ArduinoOTA service
70+
void end();
71+
6672
//Call this in loop() to run the service
6773
void handle();
6874

libraries/HTTPClient/src/HTTPClient.cpp

+21-3
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ class TransportTraits
5454
class TLSTraits : public TransportTraits
5555
{
5656
public:
57-
TLSTraits(const char* CAcert) :
58-
_cacert(CAcert)
57+
TLSTraits(const char* CAcert, const char* clicert = nullptr, const char* clikey = nullptr) :
58+
_cacert(CAcert), _clicert(clicert), _clikey(clikey)
5959
{
6060
}
6161

@@ -67,12 +67,16 @@ class TLSTraits : public TransportTraits
6767
bool verify(WiFiClient& client, const char* host) override
6868
{
6969
WiFiClientSecure& wcs = static_cast<WiFiClientSecure&>(client);
70-
wcs.setCACert(_cacert);
70+
wcs.setCACert(_cacert);
71+
wcs.setCertificate(_clicert);
72+
wcs.setPrivateKey(_clikey);
7173
return true;
7274
}
7375

7476
protected:
7577
const char* _cacert;
78+
const char* _clicert;
79+
const char* _clikey;
7680
};
7781

7882
/**
@@ -203,6 +207,20 @@ bool HTTPClient::begin(String host, uint16_t port, String uri, const char* CAcer
203207
return true;
204208
}
205209

210+
bool HTTPClient::begin(String host, uint16_t port, String uri, const char* CAcert, const char* cli_cert, const char* cli_key)
211+
{
212+
clear();
213+
_host = host;
214+
_port = port;
215+
_uri = uri;
216+
217+
if (strlen(CAcert) == 0) {
218+
return false;
219+
}
220+
_transportTraits = TransportTraitsPtr(new TLSTraits(CAcert, cli_cert, cli_key));
221+
return true;
222+
}
223+
206224
/**
207225
* end
208226
* called after the payload is handled

libraries/HTTPClient/src/HTTPClient.h

+1
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ class HTTPClient
129129
bool begin(String url, const char* CAcert);
130130
bool begin(String host, uint16_t port, String uri = "/");
131131
bool begin(String host, uint16_t port, String uri, const char* CAcert);
132+
bool begin(String host, uint16_t port, String uri, const char* CAcert, const char* cli_cert, const char* cli_key);
132133

133134
void end(void);
134135

platform.txt

+8-5
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ version=0.0.1
33

44
runtime.tools.xtensa-esp32-elf-gcc.path={runtime.platform.path}/tools/xtensa-esp32-elf
55

6-
tools.esptool.cmd="{runtime.platform.path}/tools/esptool"
7-
tools.esptool.cmd.linux=python "{runtime.platform.path}/tools/esptool.py"
8-
tools.esptool.cmd.windows="{runtime.platform.path}/tools/esptool.exe"
6+
tools.esptool.path={runtime.platform.path}/tools
7+
tools.esptool.cmd=esptool
8+
tools.esptool.cmd.linux=esptool.py
9+
tools.esptool.cmd.windows=esptool.exe
910

1011
tools.esptool.network_cmd=python "{runtime.platform.path}/tools/espota.py"
1112
tools.esptool.network_cmd.windows="{runtime.platform.path}/tools/espota.exe"
@@ -78,7 +79,8 @@ recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.f
7879
recipe.objcopy.eep.pattern={tools.gen_esp32part.cmd} -q "{runtime.platform.path}/tools/partitions/{build.partitions}.csv" "{build.path}/{build.project_name}.partitions.bin"
7980

8081
## Create hex
81-
recipe.objcopy.hex.pattern={tools.esptool.cmd} --chip esp32 elf2image --flash_mode "{build.flash_mode}" --flash_freq "{build.flash_freq}" --flash_size "{build.flash_size}" -o "{build.path}/{build.project_name}.bin" "{build.path}/{build.project_name}.elf"
82+
recipe.objcopy.hex.pattern="{tools.esptool.path}/{tools.esptool.cmd}" --chip esp32 elf2image --flash_mode "{build.flash_mode}" --flash_freq "{build.flash_freq}" --flash_size "{build.flash_size}" -o "{build.path}/{build.project_name}.bin" "{build.path}/{build.project_name}.elf"
83+
recipe.objcopy.hex.pattern.linux=python "{tools.esptool.path}/{tools.esptool.cmd}" --chip esp32 elf2image --flash_mode "{build.flash_mode}" --flash_freq "{build.flash_freq}" --flash_size "{build.flash_size}" -o "{build.path}/{build.project_name}.bin" "{build.path}/{build.project_name}.elf"
8284

8385
## Save hex
8486
recipe.output.tmp_file={build.project_name}.bin
@@ -94,5 +96,6 @@ recipe.size.regex.data=^(?:\.dram0\.data|\.dram0\.bss)\s+([0-9]+).*
9496
tools.esptool.upload.protocol=esp32
9597
tools.esptool.upload.params.verbose=
9698
tools.esptool.upload.params.quiet=
97-
tools.esptool.upload.pattern={cmd} --chip esp32 --port "{serial.port}" --baud {upload.speed} --before default_reset --after hard_reset write_flash -z --flash_mode {build.flash_mode} --flash_freq {build.flash_freq} --flash_size detect 0xe000 "{runtime.platform.path}/tools/partitions/boot_app0.bin" 0x1000 "{runtime.platform.path}/tools/sdk/bin/{build.boot}.bin" 0x10000 "{build.path}/{build.project_name}.bin" 0x8000 "{build.path}/{build.project_name}.partitions.bin"
99+
tools.esptool.upload.pattern="{path}/{cmd}" --chip esp32 --port "{serial.port}" --baud {upload.speed} --before default_reset --after hard_reset write_flash -z --flash_mode {build.flash_mode} --flash_freq {build.flash_freq} --flash_size detect 0xe000 "{runtime.platform.path}/tools/partitions/boot_app0.bin" 0x1000 "{runtime.platform.path}/tools/sdk/bin/{build.boot}.bin" 0x10000 "{build.path}/{build.project_name}.bin" 0x8000 "{build.path}/{build.project_name}.partitions.bin"
100+
tools.esptool.upload.pattern.linux=python "{path}/{cmd}" --chip esp32 --port "{serial.port}" --baud {upload.speed} --before default_reset --after hard_reset write_flash -z --flash_mode {build.flash_mode} --flash_freq {build.flash_freq} --flash_size detect 0xe000 "{runtime.platform.path}/tools/partitions/boot_app0.bin" 0x1000 "{runtime.platform.path}/tools/sdk/bin/{build.boot}.bin" 0x10000 "{build.path}/{build.project_name}.bin" 0x8000 "{build.path}/{build.project_name}.partitions.bin"
98101
tools.esptool.upload.network_pattern={network_cmd} -i "{serial.port}" -p "{network.port}" "--auth={network.password}" -f "{build.path}/{build.project_name}.bin"

tools/get.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
if 'Windows' in platform.system():
2525
import requests
2626

27-
current_dir = os.path.dirname(os.path.realpath(__file__))
27+
current_dir = os.path.dirname(os.path.realpath(unicode(__file__)))
2828
dist_dir = current_dir + '/dist/'
2929

3030
def sha256sum(filename, blocksize=65536):

tools/sdk/bin/bootloader.bin

48 Bytes
Binary file not shown.

tools/sdk/bin/bootloader_qio.bin

48 Bytes
Binary file not shown.

tools/sdk/include/config/sdkconfig.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@
6868
#define CONFIG_CONSOLE_UART_NUM 0
6969
#define CONFIG_ESP32_APPTRACE_LOCK_ENABLE 1
7070
#define CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_RC 1
71-
#define CONFIG_LWIP_THREAD_LOCAL_STORAGE_INDEX 0
7271
#define CONFIG_TCP_OVERSIZE_MSS 1
7372
#define CONFIG_FOUR_UNIVERSAL_MAC_ADDRESS 1
7473
#define CONFIG_CONSOLE_UART_DEFAULT 1
@@ -85,7 +84,7 @@
8584
#define CONFIG_TCPIP_TASK_STACK_SIZE 2560
8685
#define CONFIG_FATFS_CODEPAGE_850 1
8786
#define CONFIG_TASK_WDT 1
88-
#define CONFIG_MAIN_TASK_STACK_SIZE 8192
87+
#define CONFIG_MAIN_TASK_STACK_SIZE 4096
8988
#define CONFIG_SPIFFS_PAGE_CHECK 1
9089
#define CONFIG_TASK_WDT_TIMEOUT_S 5
9190
#define CONFIG_INT_WDT_TIMEOUT_MS 300

tools/sdk/include/console/esp_console.h

+2
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ esp_err_t esp_console_cmd_register(const esp_console_cmd_t *cmd);
107107
* @param[out] cmd_ret return code from the command (set if command was run)
108108
* @return
109109
* - ESP_OK, if command was run
110+
* - ESP_ERR_INVALID_ARG, if the command line is empty, or only contained
111+
* whitespace
110112
* - ESP_ERR_NOT_FOUND, if command with given name wasn't registered
111113
* - ESP_ERR_INVALID_STATE, if esp_console_init wasn't called
112114
*/

0 commit comments

Comments
 (0)