Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.

Commit 24c3576

Browse files
authored
Merge pull request #473 from pycom/Dev
Push latest Dev changes into Release/v1.20
2 parents 58398d3 + 783192e commit 24c3576

File tree

277 files changed

+4573
-2129
lines changed

Some content is hidden

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

277 files changed

+4573
-2129
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ user.props
3636
.pydevproject
3737
.settings
3838
.launch
39+
.vscode
3940

4041
# Key files (for Flash Encryption and Secure Boot)
4142
secure_boot_signing_key.pem

Jenkinsfile

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,14 @@ node {
99
stage('Checkout') {
1010
checkout scm
1111
sh 'rm -rf esp-idf'
12-
sh 'git clone --depth=1 --recursive -b idf_v3.2 https://github.com/pycom/pycom-esp-idf.git esp-idf'
12+
sh 'git clone --recursive -b idf_v3.3.1 https://github.com/pycom/pycom-esp-idf.git esp-idf'
13+
IDF_HASH=get_idf_hash()
14+
dir('esp-idf'){
15+
sh 'git checkout ' + IDF_HASH
16+
sh 'git submodule update --init --recursive'
17+
}
1318
}
14-
19+
1520
stage('git-tag') {
1621
PYCOM_VERSION=get_version()
1722
GIT_TAG = sh (script: 'git rev-parse --short HEAD', returnStdout: true).trim()
@@ -85,7 +90,8 @@ def flashBuild(short_name, version, variant) {
8590
unstash 'esp32Tools'
8691
unstash 'tests'
8792
unstash 'tools'
88-
sh 'python esp32/tools/fw_updater/updater.py --port ' + device_name +' flash -t esp32/build-' + variant + '/' + board_name + '-' + version + '.tar.gz'
93+
sh 'python esp32/tools/fw_updater/updater.py --noexit --port ' + device_name +' flash -t esp32/build-' + variant + '/' + board_name + '-' + version + '.tar.gz'
94+
sh 'python esp32/tools/fw_updater/updater.py --port ' + device_name +' pybytes --auto_start False'
8995
}
9096
}
9197
}
@@ -114,6 +120,11 @@ def get_version() {
114120
matcher ? matcher[0][1].trim().replace('"','') : null
115121
}
116122

123+
def get_idf_hash() {
124+
def matcher = readFile('esp32/Makefile') =~ 'IDF_HASH=(.+)'
125+
matcher ? matcher[0][1].trim().replace('"','') : null
126+
}
127+
117128
def get_firmware_name(short_name) {
118129
node {
119130
def node_info = sh (script: 'cat ${JENKINS_HOME}/pycom-ic.conf || exit 0', returnStdout: true).trim()

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ board (PyBoard), the officially supported reference electronic circuit board.
2626
The following components are actively maintained by Pycom:
2727
- py/ -- the core Python implementation, including compiler, runtime, and
2828
core library.
29-
- exp32/ -- a version of MicroPython that runs on the ESP32 based boards from Pycom.
29+
- esp32/ -- a version of MicroPython that runs on the ESP32 based boards from Pycom.
3030
- tests/ -- test framework and test scripts.
3131

3232
Additional components:
@@ -74,7 +74,7 @@ Then when you need the toolchain you can type ``get_esp32`` on the command line
7474
You also need the ESP IDF along side this repository in order to build the ESP32 port.
7575
To get it:
7676

77-
$ git clone --recursive -b idf_v3.2 https://github.com/pycom/pycom-esp-idf.git
77+
$ git clone --recursive -b idf_v3.3.1 https://github.com/pycom/pycom-esp-idf.git
7878

7979
After cloning, if you did not specify the --recursive option, make sure to checkout all the submodules:
8080

docs/library/ussl.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,21 @@ network sockets, both client-side and server-side.
114114

115115
SSL sockets inherit all methods and from the standard sockets, see the :mod:`usocket` module.
116116

117+
.. function:: ssl.save_session(sock)
118+
119+
Takes an instance sock of ssl.SSLSocket, and returns an instance of ssl.SSLSession representing saved session data from the socket, which can be used to resume a SSL session later. Example::
120+
121+
import socket
122+
import ssl
123+
addr = socket.getaddrinfo('www.google.com', 443)[0][-1]
124+
sock_one = ssl.wrap_socket(socket.socket())
125+
sock_one.connect(addr) # performs a full ssl handshake
126+
session = ssl.save_session(sock_one)
127+
sock_one.close()
128+
sock_one = None
129+
sock_two = ssl.wrap_socket(socket.socket(), saved_session=session)
130+
sock_two.connect(addr) # resumes using saved session, resulting in a faster handshake
131+
117132
Exceptions
118133
----------
119134

docs/license.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2323
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2424
THE SOFTWARE.
2525

26-
Copyright (c) 2019, Pycom Limited.
26+
Copyright (c) 2020, Pycom Limited.
2727

2828
This software is licensed under the GNU GPL version 3 or any
2929
later version, with permitted additional terms. For more information

drivers/sx127x/sx1272/sx1272.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* This file is derived from the MicroPython project, http://micropython.org/
33
*
4-
* Copyright (c) 2019, Pycom Limited and its licensors.
4+
* Copyright (c) 2020, Pycom Limited and its licensors.
55
*
66
* This software is licensed under the GNU GPL version 3 or any later version,
77
* with permitted additional terms. For more information see the Pycom Licence

drivers/sx127x/sx1276/sx1276.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* This file is derived from the MicroPython project, http://micropython.org/
33
*
4-
* Copyright (c) 2019, Pycom Limited and its licensors.
4+
* Copyright (c) 2020, Pycom Limited and its licensors.
55
*
66
* This software is licensed under the GNU GPL version 3 or any later version,
77
* with permitted additional terms. For more information see the Pycom Licence

esp32/Makefile

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright © 2019, Pycom Limited.
2+
# Copyright © 2020, Pycom Limited.
33
#
44
# This software is licensed under the GNU GPL version 3 or any
55
# later version, with permitted additional terms. For more information
@@ -14,7 +14,7 @@ ifeq ($(wildcard boards/$(BOARD)/.),)
1414
$(error Invalid BOARD specified)
1515
endif
1616

17-
IDF_VERSION=3.2
17+
IDF_HASH=6ec081c
1818

1919
TARGET ?= boot_app
2020

@@ -103,17 +103,10 @@ LIBS = -L$(ESP_IDF_COMP_PATH)/esp32/lib -L$(ESP_IDF_COMP_PATH)/esp32/ld -L$(ESP_
103103
$(ESP_IDF_COMP_PATH)/newlib/lib/libc-psram-workaround.a \
104104
-lfreertos -ljson -ljsmn -llwip -lnewlib -lvfs -lopenssl -lmbedtls -lwpa_supplicant \
105105
-lxtensa-debug-module -lbt -lsdmmc -lsoc -lheap -lbootloader_support -lmicro-ecc \
106-
-u ld_include_panic_highint_hdl -lsmartconfig_ack -lmesh -lesp_ringbuf -lcoap -lmdns
107-
ifeq ($(BOARD), $(filter $(BOARD), FIPY))
108-
LIBS += sigfox/modsigfox_fipy.a
109-
endif
110-
111-
ifeq ($(BOARD), $(filter $(BOARD), LOPY4))
112-
LIBS += sigfox/modsigfox_lopy4.a
113-
endif
114-
115-
ifeq ($(BOARD), $(filter $(BOARD), SIPY))
116-
LIBS += sigfox/modsigfox_sipy.a
106+
-u ld_include_panic_highint_hdl -lsmartconfig_ack -lmesh -lesp_ringbuf -lcoap -lmdns -lefuse -lespcoredump -lapp_update
107+
ifeq ($(BOARD), $(filter $(BOARD), SIPY LOPY4 FIPY))
108+
LIBS += sigfox/modsigfox_$(BOARD).a
109+
$(BUILD)/application.elf: sigfox/modsigfox_$(BOARD).a
117110
endif
118111

119112
ifeq ($(OPENTHREAD), on)
@@ -134,7 +127,7 @@ endif #ifeq ($(LTE_LOG_BUFF),1)
134127

135128
B_LIBS = -Lbootloader/lib -Lbootloader -L$(BUILD)/bootloader -L$(ESP_IDF_COMP_PATH)/esp32/ld \
136129
-L$(ESP_IDF_COMP_PATH)/esp32/lib -llog -lcore -lbootloader_support \
137-
-lspi_flash -lsoc -lmicro-ecc -lgcc -lstdc++ -lgcov
130+
-lspi_flash -lsoc -lmicro-ecc -lgcc -lstdc++ -lgcov -lefuse
138131

139132
# objcopy paramters, to transform a binary file into an object file
140133
OBJCOPY_EMBED_ARGS = --input-target binary --output-target elf32-xtensa-le --binary-architecture xtensa --rename-section .data=.rodata.embedded

esp32/PyJTAG/Readme.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Short readme for how to use the PyJTAG
2+
3+
## Setup
4+
Generally follow these rules to setup JTAG debugging on your OS: https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/jtag-debugging/index.html
5+
6+
Download link for OpenOCD for ESP32 from Espressif: https://github.com/espressif/openocd-esp32/releases
7+
8+
9+
## Build the firmware
10+
Create the firmware with `BTYPE=debug` flag.
11+
12+
Note: Do not use the default pins assigned to UART, SPI, CAN because they are used by the JTAG. Pins not to be used: P4, P9, P10, P23.
13+
14+
## Setup the PyJTAG board
15+
16+
PyJTAG's switches:
17+
* ESP32 JTAG: all turned ON
18+
* ESP32 B.LOADER: all turned ON except SAFE_BOOT_SW which is OFF
19+
* TO LTE UART 1/2: does not matter
20+
* CURRENT SHUNTS: connected
21+
22+
Place the Pycom board with the reset button towards the Current Shunts. Now connect the PyJTAG via usb. You will see four new USB devices. On Linux this will look like this:
23+
```
24+
$ lsusb -d 0403:
25+
Bus 001 Device 010: ID 0403:6011 Future Technology Devices International, Ltd FT4232H Quad HS USB-UART/FIFO IC
26+
$ ls /dev/ttyUSB?
27+
/dev/ttyUSB0 /dev/ttyUSB1 /dev/ttyUSB2 /dev/ttyUSB3
28+
```
29+
30+
## Start OCD
31+
32+
Go to `esp32` folder in Firmware-Development repository and run:
33+
```
34+
PATH_TO_OPENOCD/bin/openocd -s PATH_TO_OPENOCD/share/openocd/scripts -s PyJTAG -f PyJTAG/interface/ftdi/esp32-pycom.cfg -f PyJTAG/board/esp32-pycom.cfg
35+
```
36+
37+
Output should be like:
38+
```
39+
Open On-Chip Debugger v0.10.0-esp32-20191114 (2019-11-14-14:15)
40+
Licensed under GNU GPL v2
41+
For bug reports, read
42+
http://openocd.org/doc/doxygen/bugs.html
43+
none separate
44+
adapter speed: 20000 kHz
45+
Info : Configured 2 cores
46+
Info : Listening on port 6666 for tcl connections
47+
Info : Listening on port 4444 for telnet connections
48+
Error: type 'esp32' is missing virt2phys
49+
Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
50+
Info : clock speed 20000 kHz
51+
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
52+
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
53+
Info : Listening on port 3333 for gdb connections
54+
```
55+
56+
## Start GDB
57+
58+
When OpenOCD is running, start GDB from `esp32` folder. Assuming you have a FIPY:
59+
```
60+
xtensa-esp32-elf-gdb -x PyJTAG/gdbinit build/FIPY/debug/application.elf
61+
```
62+
63+
In `PyJTAG/gdbinit` a breakpoint is configured at `TASK_Micropython`, so execution should stop there first:
64+
65+
```
66+
Thread 1 hit Temporary breakpoint 1, TASK_Micropython (pvParameters=0x0) at mptask.c:136
67+
```
68+
69+
70+
## REPL
71+
72+
Connect to `/dev/ttyUSB2` to reach the REPL terminal over usb serial. E.g. using pymakr in Atom.
73+
74+
## Troubleshooting
75+
If openocd says "Error: Connect failed", try to close gdb and openocd and start over.
76+
77+
If `/dev/ttyUSB0` doesn't show up or disappears, disconnect the PyJTAG board, reconnect and start over.
78+
79+
It can be advisable to use the `gdb` from the latest xtensa toolchain, even if an earlier version is used to build the firmware.
80+
81+
If `gdb` does not reach the `Thread 1 hit Temporary breakpoint ...` line, close and reopen `gdb`.
82+
83+
84+
## Versions
85+
There are two generations of PyJTAG boards:
86+
87+
1) First generation with green PCB has three blocks of switches. (Make sure SAFE_BOOT_SW is off.)
88+
2) Second generation with black PCB and two blocks of switches.
89+
90+
Both generation boards can be equipped with pogo pins that connect to the bottom of the development board and allow LTE debugging. There can either be pins that connect to a GPy or pins that conenct to a FiPy.
91+
92+
To reach the modem UART connect to `/dev/ttyUSB1`.
93+
94+
## Extra
95+
A few more details are here: https://pycomiot.atlassian.net/wiki/spaces/FIR/pages/966295564/Usage+of+PyJTAG
96+

esp32/PyJTAG/board/esp32-pycom.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
set ESP32_FLASH_VOLTAGE 3.3
2+
source [find target/esp32-pycom.cfg]

0 commit comments

Comments
 (0)