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

Commit 2833cf5

Browse files
author
Islam Wahdan
authored
Firmware Release Candidate v1.20.0.rc7 - Pybytes v0.9.7
## New Features * Pymesh feature added from Pygo ## Improvments * Adding do_handshake for non-blocking sockets * Gracefully handle EAGAIN return of Socket.write in AwsMQTT lib * make openthread over lora a build-time configuration option (Author: @martijnthe) * Added factory LTE modem reset option and method to check UE coverage * Updated Pybytes lib ## Bug Fixes * Fix an issue in cleaning up user threads during of soft-reset * Fix issue causing Device crash when safe booting (CTRL-F) while BLE/Wlan enabled * LTE module bug fixes * Fix Makefile bug where SIPY FIPY and LOPY4 excluded secure boot co-authored by: @Xykon [[email protected]](mailto:[email protected]) and @martijnthe
1 parent a8a62b0 commit 2833cf5

Some content is hidden

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

63 files changed

+1639
-746
lines changed

esp32/application.mk

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -192,11 +192,17 @@ APP_LORA_SRC_C = $(addprefix lora/,\
192192
sx1276-board.c \
193193
sx1272-board.c \
194194
board.c \
195+
)
196+
197+
APP_LORA_OPENTHREAD_SRC_C = $(addprefix lora/,\
195198
otplat_alarm.c \
196199
otplat_radio.c \
197200
ot-settings.c \
198201
ot-log.c \
199-
ot-task.c \
202+
)
203+
204+
APP_MOD_MESH_SRC_C = $(addprefix mods/,\
205+
modmesh.c \
200206
)
201207

202208
APP_LIB_LORA_SRC_C = $(addprefix lib/lora/,\
@@ -305,6 +311,13 @@ ifeq ($(BOARD),$(filter $(BOARD), FIPY GPY))
305311
OBJ += $(addprefix $(BUILD)/, $(APP_LTE_SRC_C:.c=.o) $(APP_MODS_LTE_SRC_C:.c=.o))
306312
endif
307313

314+
# add OPENTHREAD code only if flag enabled and for LOPY, LOPY4 and FIPY
315+
ifeq ($(OPENTHREAD), on)
316+
ifeq ($(BOARD), $(filter $(BOARD), LOPY LOPY4 FIPY))
317+
OBJ += $(addprefix $(BUILD)/, $(APP_LORA_OPENTHREAD_SRC_C:.c=.o) $(APP_MOD_MESH_SRC_C:.c=.o))
318+
endif
319+
endif # ifeq ($(OPENTHREAD), on)
320+
308321
OBJ += $(addprefix $(BUILD)/, $(APP_MAIN_SRC_C:.c=.o) $(APP_HAL_SRC_C:.c=.o) $(APP_LIB_SRC_C:.c=.o))
309322
OBJ += $(addprefix $(BUILD)/, $(APP_MODS_SRC_C:.c=.o) $(APP_STM_SRC_C:.c=.o))
310323
OBJ += $(addprefix $(BUILD)/, $(APP_FATFS_SRC_C:.c=.o) $(APP_LITTLEFS_SRC_C:.c=.o) $(APP_UTIL_SRC_C:.c=.o) $(APP_TELNET_SRC_C:.c=.o))
@@ -325,6 +338,12 @@ ifeq ($(BOARD),$(filter $(BOARD), FIPY GPY))
325338
SRC_QSTR += $(APP_MODS_LTE_SRC_C)
326339
endif
327340

341+
ifeq ($(OPENTHREAD), on)
342+
ifeq ($(BOARD), $(filter $(BOARD), LOPY LOPY4 FIPY))
343+
SRC_QSTR += $(APP_MOD_MESH_SRC_C)
344+
endif
345+
endif # ifeq ($(OPENTHREAD), on)
346+
328347
# Append any auto-generated sources that are needed by sources listed in
329348
# SRC_QSTR
330349
SRC_QSTR_AUTO_DEPS +=
@@ -580,20 +599,14 @@ ifeq ($(SECURE), on)
580599
$(ECHO) $(SEPARATOR)
581600
endif #ifeq ($(SECURE), on)
582601
endif #ifeq ($(TARGET), $(filter $(TARGET), boot boot_app))
583-
ifeq ($(TARGET), $(filter $(TARGET), app boot_app))
584602

585603

604+
ifeq ($(TARGET), $(filter $(TARGET), app boot_app))
586605

587606
$(BUILD)/application.a: $(OBJ)
588607
$(ECHO) "AR $@"
589608
$(Q) rm -f $@
590609
$(Q) $(AR) cru $@ $^
591-
ifeq ($(BOARD), $(filter $(BOARD), SIPY FIPY LOPY4))
592-
$(BUILD)/application.elf: $(BUILD)/application.a $(BUILD)/esp32_out.ld
593-
$(ECHO) "LINK $@"
594-
$(Q) $(CC) $(APP_LDFLAGS) $(APP_LIBS) -o $@
595-
$(Q) $(SIZE) $@
596-
else
597610
$(BUILD)/application.elf: $(BUILD)/application.a $(BUILD)/esp32_out.ld $(SECURE_BOOT_VERIFICATION_KEY)
598611
ifeq ($(COPY_IDF_LIB), 1)
599612
$(ECHO) "COPY IDF LIBRARIES $@"
@@ -618,7 +631,6 @@ endif #ifeq ($(SECURE), on)
618631
$(ECHO) "LINK $@"
619632
$(Q) $(CC) $(APP_LDFLAGS) $(APP_LIBS) -o $@
620633
$(SIZE) $@
621-
endif #ifeq ($(BOARD), $(filter $(BOARD), SIPY FIPY LOPY4))
622634

623635
$(APP_BIN): $(BUILD)/application.elf $(PART_BIN) $(ORIG_ENCRYPT_KEY)
624636
$(ECHO) "IMAGE $@"
0 Bytes
Binary file not shown.

esp32/bootloader/lib/liblog.a

0 Bytes
Binary file not shown.

esp32/bootloader/lib/libmicro-ecc.a

0 Bytes
Binary file not shown.

esp32/bootloader/lib/libsoc.a

0 Bytes
Binary file not shown.

esp32/bootloader/lib/libspi_flash.a

0 Bytes
Binary file not shown.

esp32/frozen/Common/MQTTMsgHandler.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,10 @@ def _send_packet(self, packet):
222222
try:
223223
if self._sock:
224224
written = self._sock.write(packet)
225-
print('Packet sent. (Length: %d)' % written)
225+
if(written == None):
226+
written = -1
227+
else:
228+
print('Packet sent. (Length: %d)' % written)
226229
except socket.error as err:
227230
print('Socket send error {0}'.format(err))
228231
return False

esp32/frozen/Pybytes/_main.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,11 @@
6767

6868
# Please put your USER code below this line
6969

70-
# SEND VIRTUAL VALUE
70+
# SEND SIGNAL
7171
# You can currently send Strings, Int32, Float32 and Tuples to pybytes using this method.
72-
# Soon you will be able to send Coordinates, Longs, Unsigned numerical types, and more.
73-
# pybytes.send_signal(pin, value)
72+
# pybytes.send_signal(signalNumber, value)
7473

75-
# SEND SENSOR DATA THROUGH VIRTUAL PINS
74+
# SEND SENSOR DATA THROUGH SIGNALS
7675
# # If you use a Pysense, some libraries are necessary to access its sensors
7776
# # you can find them here: https://github.com/pycom/pycom-libraries
7877
#

esp32/frozen/Pybytes/_pybytes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def send_signal(self, pin, value):
102102

103103
def send_virtual_pin_value(self, persistent, pin, value):
104104
print("This function is deprecated and will be removed in the future. Use send_signal(signalNumber, value)")
105-
self.send_signal(pin, [value])
105+
self.send_signal(pin, value)
106106

107107
def __periodical_pin_callback(self, periodical_pin):
108108
if (periodical_pin.pin_type == __PERIODICAL_PIN.TYPE_DIGITAL):

esp32/frozen/Pybytes/_pybytes_connection.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,15 +122,15 @@ def connect_lte(self, reconnect=True, check_interval=0.5):
122122
try:
123123
from network import LTE
124124
time.sleep(3)
125-
print_debug(1, 'LTE init(carrier={})'.format(lte_cfg.get('carrier')))
125+
print_debug(1, 'LTE init(carrier={}, cid={})'.format(lte_cfg.get('carrier'), lte_cfg.get('cid', 1)))
126126
self.lte = LTE(carrier=lte_cfg.get('carrier')) # instantiate the LTE object
127-
print_debug(1, 'LTE attach(band={}, apn={})'.format(lte_cfg.get('band'), lte_cfg.get('apn')))
128-
self.lte.attach(band=lte_cfg.get('band'), apn=lte_cfg.get('apn')) # attach the cellular modem to a base station
127+
print_debug(1, 'LTE attach(band={}, apn={}, type={})'.format(lte_cfg.get('band'), lte_cfg.get('apn'), lte_cfg.get('type')))
128+
self.lte.attach(band=lte_cfg.get('band'), apn=lte_cfg.get('apn'), type=lte_cfg.get('type')) # attach the cellular modem to a base station
129129
while not self.lte.isattached():
130130
time.sleep(0.25)
131131
time.sleep(1)
132-
print_debug(1, 'LTE connect(cid={})'.format(lte_cfg.get('cid',1)))
133-
self.lte.connect(cid=lte_cfg.get('cid',1)) # start a data session and obtain an IP address
132+
print_debug(1, 'LTE connect()')
133+
self.lte.connect() # start a data session and obtain an IP address
134134
print_debug(1, 'LTE is_connected()')
135135
while not self.lte.isconnected():
136136
time.sleep(0.25)

esp32/hal/esp32_mphal.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
#include "modmachine.h"
3535
#include "updater.h"
3636
#include "bootloader.h"
37+
#include "modwlan.h"
38+
#include "modbt.h"
3739

3840
#include "freertos/FreeRTOS.h"
3941
#include "freertos/task.h"
@@ -190,6 +192,9 @@ void mp_hal_delay_ms(uint32_t delay) {
190192
void mp_hal_reset_safe_and_boot(bool reset) {
191193
boot_info_t boot_info;
192194
uint32_t boot_info_offset;
195+
/* Disable Wifi/BT to avoid cache region being accessed since it will be disabled when updating Safe boot flag in flash */
196+
wlan_deinit(NULL);
197+
bt_deinit(NULL);
193198
if (updater_read_boot_info (&boot_info, &boot_info_offset)) {
194199
boot_info.safeboot = SAFE_BOOT_SW;
195200
updater_write_boot_info (&boot_info, boot_info_offset);

esp32/lib/libbootloader_support.a

0 Bytes
Binary file not shown.

esp32/lib/libbt.a

0 Bytes
Binary file not shown.

esp32/lib/libcxx.a

0 Bytes
Binary file not shown.

esp32/lib/libdriver.a

0 Bytes
Binary file not shown.

esp32/lib/libesp32.a

-12 Bytes
Binary file not shown.

esp32/lib/libesp_adc_cal.a

0 Bytes
Binary file not shown.

esp32/lib/libexpat.a

0 Bytes
Binary file not shown.

esp32/lib/libfreertos.a

0 Bytes
Binary file not shown.

esp32/lib/libheap.a

0 Bytes
Binary file not shown.

esp32/lib/libjsmn.a

0 Bytes
Binary file not shown.

esp32/lib/libjson.a

0 Bytes
Binary file not shown.

esp32/lib/liblog.a

0 Bytes
Binary file not shown.

esp32/lib/liblwip.a

0 Bytes
Binary file not shown.

esp32/lib/libmbedtls.a

0 Bytes
Binary file not shown.

esp32/lib/libmicro-ecc.a

0 Bytes
Binary file not shown.

esp32/lib/libnewlib.a

0 Bytes
Binary file not shown.

esp32/lib/libnghttp.a

0 Bytes
Binary file not shown.

esp32/lib/libnvs_flash.a

0 Bytes
Binary file not shown.

esp32/lib/libopenssl.a

0 Bytes
Binary file not shown.

esp32/lib/libopenthread.a

898 KB
Binary file not shown.

esp32/lib/libpthread.a

0 Bytes
Binary file not shown.

esp32/lib/libsdmmc.a

0 Bytes
Binary file not shown.

esp32/lib/libsmartconfig_ack.a

0 Bytes
Binary file not shown.

esp32/lib/libsoc.a

0 Bytes
Binary file not shown.

esp32/lib/libspi_flash.a

0 Bytes
Binary file not shown.

esp32/lib/libtcpip_adapter.a

0 Bytes
Binary file not shown.

esp32/lib/libvfs.a

0 Bytes
Binary file not shown.

esp32/lib/libwpa_supplicant.a

0 Bytes
Binary file not shown.

esp32/lib/libxtensa-debug-module.a

0 Bytes
Binary file not shown.

esp32/lora/ot-log.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include "ot-log.h"
1515

1616
#include "pycom_config.h"
17-
#include <openthread/types.h>
1817
#include <openthread/config.h>
1918
#include <openthread/platform/alarm-milli.h>
2019
#include <openthread/platform/uart.h>
@@ -73,6 +72,7 @@ void otPlatLogBufHex(const uint8_t *aBuf, uint16_t aBufLength) {
7372
for (int i = 0; i < aBufLength; i++) {
7473
length += sprintf(&logString[length], "%x ", aBuf[i]);
7574
}
75+
logString[length++] = '\n';
7676
}
7777

7878
void otPlatLogFlush(void) {

0 commit comments

Comments
 (0)