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

Commit 50f84dd

Browse files
author
iwahdan88
committed
New Development Release v1.19.0.b4
Added Feautures: - Added RTC memory support - Added uasyncio module - Added Lora mesh functionality with openthread protocol Fixes: - Fixed problems with Non-Blocking Sockets - Updated broken link in Contributing agreement
1 parent 44b21d6 commit 50f84dd

32 files changed

+2449
-369
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
To get started, <a href="https://www.clahub.com/agreements/pycom/pycom-micropython">sign the Contributor License Agreement</a>.
1+
To get started, <a href="https://www.clahub.com/agreements/pycom/pycom-micropython-sigfox">sign the Contributor License Agreement</a>.
22

33
When reporting an issue and especially submitting a pull request, please
44
make sure that you are acquainted with Contributor Guidelines:

esp32/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ LIBS = -L$(ESP_IDF_COMP_PATH)/esp32/lib -L$(ESP_IDF_COMP_PATH)/esp32/ld -L$(ESP_
8383
$(ESP_IDF_COMP_PATH)/newlib/lib/libm-psram-workaround.a \
8484
$(ESP_IDF_COMP_PATH)/newlib/lib/libc-psram-workaround.a \
8585
-lfreertos -ljson -ljsmn -llwip -lnewlib -lvfs -lopenssl -lmbedtls -lwpa_supplicant \
86-
-lxtensa-debug-module -lbt -lsdmmc -lsoc -lheap -lbootloader_support -lmicro-ecc -u ld_include_panic_highint_hdl \
87-
86+
-lxtensa-debug-module -lbt -lsdmmc -lsoc -lheap -lbootloader_support -lmicro-ecc -lopenthread \
87+
-u ld_include_panic_highint_hdl
8888
ifeq ($(BOARD), $(filter $(BOARD), FIPY))
8989
LIBS += sigfox/modsigfox_fipy.a
9090
endif

esp32/application.mk

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ APP_INC += -I../lib/oofatfs
7171
APP_INC += -I../lib
7272
APP_INC += -I../drivers/sx127x
7373
APP_INC += -I../ports/stm32
74+
APP_INC += -I$(ESP_IDF_COMP_PATH)/openthread/src
7475

7576
APP_MAIN_SRC_C = \
7677
main.c \
@@ -127,7 +128,6 @@ APP_MODS_SRC_C = $(addprefix mods/,\
127128
modusocket.c \
128129
modnetwork.c \
129130
modwlan.c \
130-
moduselect.c \
131131
modutime.c \
132132
modpycom.c \
133133
moduqueue.c \
@@ -191,6 +191,11 @@ APP_LORA_SRC_C = $(addprefix lora/,\
191191
sx1276-board.c \
192192
sx1272-board.c \
193193
board.c \
194+
otplat_alarm.c \
195+
otplat_radio.c \
196+
ot-settings.c \
197+
ot-log.c \
198+
ot-task.c \
194199
)
195200

196201
APP_LIB_LORA_SRC_C = $(addprefix lib/lora/,\
@@ -435,7 +440,7 @@ SIGN_BINARY = $(ESPSECUREPY) sign_data --keyfile $(SECURE_KEY)
435440

436441
# actual command for signing a binary
437442
# it should be used as:
438-
# $(ENCRYPT_BINARY) $(ENCRYPT_0x10000) -o image_encrypt.bin image.bin
443+
# $(ENCRYPT_BINARY) $(ENCRYPT_0x10000) -o image_encrypt.bin image.bin
439444
ENCRYPT_BINARY = $(ESPSECUREPY) encrypt_flash_data --keyfile $(ENCRYPT_KEY)
440445
ENCRYPT_0x10000 = --address 0x10000
441446
ENCRYPT_0x1A0000 = --address 0x1A0000
@@ -466,20 +471,20 @@ CFLAGS += -DCONFIG_SECURE_BOOT_ENABLED=1
466471
# find the configured private key file
467472
ORIG_SECURE_KEY := $(call resolvepath,$(call dequote,$(SECURE_KEY)),$(PROJECT_PATH))
468473

469-
$(ORIG_SECURE_KEY):
474+
$(ORIG_SECURE_KEY):
470475
$(ECHO) "Secure boot signing key '$@' missing. It can be generated using: "
471476
$(ECHO) "$(ESPSECUREPY) generate_signing_key $(SECURE_KEY)"
472477
exit 1
473478

474-
# public key name; the name is important
479+
# public key name; the name is important
475480
# because it will go into the elf with symbols having name derived out of this one
476481
SECURE_BOOT_VERIFICATION_KEY = signature_verification_key.bin
477482

478483
# verification key derived from signing key.
479484
$(SECURE_BOOT_VERIFICATION_KEY): $(ORIG_SECURE_KEY)
480485
$(ESPSECUREPY) extract_public_key --keyfile $< $@
481486

482-
# key used for bootloader digest
487+
# key used for bootloader digest
483488
SECURE_BOOTLOADER_KEY = secure-bootloader-key.bin
484489

485490
$(SECURE_BOOTLOADER_KEY): $(ORIG_SECURE_KEY)
@@ -490,15 +495,15 @@ BOOTLOADER_REFLASH_DIGEST = $(BUILD)/bootloader/bootloader-reflash-digest.bin
490495
BOOTLOADER_REFLASH_DIGEST_ENC = $(BOOTLOADER_REFLASH_DIGEST)_enc
491496

492497
ORIG_ENCRYPT_KEY := $(call resolvepath,$(call dequote,$(ENCRYPT_KEY)),$(PROJECT_PATH))
493-
$(ORIG_ENCRYPT_KEY):
498+
$(ORIG_ENCRYPT_KEY):
494499
$(ECHO) "WARNING: Encryption key '$@' missing. It can be created using: "
495500
$(ECHO) "$(ESPSECUREPY) generate_flash_encryption_key $(ENCRYPT_KEY)"
496501
exit 1
497-
502+
498503
else #ifeq ($(SECURE), on)
499-
SECURE_BOOT_VERIFICATION_KEY =
500-
SECURE_BOOTLOADER_KEY =
501-
ORIG_ENCRYPT_KEY =
504+
SECURE_BOOT_VERIFICATION_KEY =
505+
SECURE_BOOTLOADER_KEY =
506+
ORIG_ENCRYPT_KEY =
502507
endif #ifeq ($(SECURE), on)
503508

504509

@@ -525,7 +530,7 @@ ifeq ($(SECURE), on)
525530
$(OBJCOPY) $(OBJCOPY_EMBED_ARGS) $(SECURE_BOOT_VERIFICATION_KEY) $(SECURE_BOOT_VERIFICATION_KEY).bin.o ;\
526531
$(AR) cru libbootloader_support.a *.o ;\
527532
$(CP) libbootloader_support.a ../
528-
$(Q) $(RM) -rf ./bootloader/lib/bootloader_support_temp
533+
$(Q) $(RM) -rf ./bootloader/lib/bootloader_support_temp
529534
endif #ifeq ($(SECURE), on)
530535
$(ECHO) "LINK $(CC) *** $(BOOT_LDFLAGS) *** $(BOOT_LIBS) -o $@"
531536
$(Q) $(CC) $(BOOT_LDFLAGS) $(BOOT_LIBS) -o $@
@@ -591,7 +596,7 @@ ifeq ($(SECURE), on)
591596
endif #ifeq ($(SECURE), on)
592597
$(ECHO) "LINK $@"
593598
$(Q) $(CC) $(APP_LDFLAGS) $(APP_LIBS) -o $@
594-
$(Q) $(SIZE) $@
599+
$(SIZE) $@
595600

596601
$(APP_BIN): $(BUILD)/application.elf $(PART_BIN) $(ORIG_ENCRYPT_KEY)
597602
$(ECHO) "IMAGE $@"
@@ -626,7 +631,7 @@ ifeq ($(SECURE), on)
626631
$(ECHO) $(SEPARATOR)
627632
$(ECHO) $(SEPARATOR)
628633
endif # feq ($(SECURE), on)
629-
634+
630635
$(BUILD)/esp32_out.ld: $(ESP_IDF_COMP_PATH)/esp32/ld/esp32.ld sdkconfig.h
631636
$(ECHO) "CPP $@"
632637
$(Q) $(CC) -I. -C -P -x c -E $< -o $@

esp32/get_idf_libs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def main():
5252
shutil.copy(src + '/vfs/libvfs.a', dst)
5353
shutil.copy(src + '/wpa_supplicant/libwpa_supplicant.a', dst)
5454
shutil.copy(src + '/xtensa-debug-module/libxtensa-debug-module.a', dst)
55-
55+
shutil.copy(src + '/openthread/libopenthread.a', dst)
5656

5757
if __name__ == "__main__":
5858
main()

esp32/lib/libopenthread.a

15.2 MB
Binary file not shown.

esp32/lora/ot-log.c

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/*
2+
* Copyright (c) 2018, Pycom Limited.
3+
*
4+
* This software is licensed under the GNU GPL version 3 or any
5+
* later version, with permitted additional terms. For more information
6+
* see the Pycom Licence v1.0 document supplied with this file, or
7+
* available at https://www.pycom.io/opensource/licensing
8+
*/
9+
10+
#include <stdint.h>
11+
#include <stdbool.h>
12+
#include <string.h>
13+
#include <stdarg.h>
14+
#include "ot-log.h"
15+
16+
#include "pycom_config.h"
17+
#include <openthread/types.h>
18+
#include <openthread/config.h>
19+
#include <openthread/platform/alarm-milli.h>
20+
#include <openthread/platform/uart.h>
21+
#include <openthread-core-config.h>
22+
#include <openthread/platform/logging.h>
23+
24+
#define LOG_PARSE_BUFFER_SIZE 2048
25+
26+
static char logString[LOG_PARSE_BUFFER_SIZE + 1];
27+
static uint16_t length = 0;
28+
29+
/**
30+
* This function outputs logs.
31+
*
32+
* @param[in] aLogLevel The log level.
33+
* @param[in] aLogRegion The log region.
34+
* @param[in] aFormat A pointer to the format string.
35+
* @param[in] ... Arguments for the format specification.
36+
*
37+
*/
38+
void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion,
39+
const char *aFormat, ...) {
40+
(void) aLogRegion;
41+
42+
if (aLogLevel <= OPENTHREAD_CONFIG_LOG_LEVEL) {
43+
44+
length += sprintf(&logString[length], " %d ", otPlatAlarmMilliGetNow());
45+
// Parse user string.
46+
va_list paramList;
47+
va_start(paramList, aFormat);
48+
length += vsnprintf(&logString[length],
49+
(LOG_PARSE_BUFFER_SIZE - length), aFormat, paramList);
50+
51+
if (length > LOG_PARSE_BUFFER_SIZE) {
52+
length = LOG_PARSE_BUFFER_SIZE;
53+
}
54+
55+
logString[length++] = '\n';
56+
va_end(paramList);
57+
}
58+
}
59+
60+
void otPlatLogBuf(const char *aBuf, uint16_t aBufLength) {
61+
62+
if (LOG_PARSE_BUFFER_SIZE - length < aBufLength)
63+
aBufLength = LOG_PARSE_BUFFER_SIZE - length;
64+
65+
memcpy(&logString[length], aBuf, aBufLength);
66+
length += aBufLength;
67+
}
68+
69+
void otPlatLogBufHex(const uint8_t *aBuf, uint16_t aBufLength) {
70+
71+
if (LOG_PARSE_BUFFER_SIZE - length < aBufLength)
72+
aBufLength = LOG_PARSE_BUFFER_SIZE - length;
73+
for (int i = 0; i < aBufLength; i++) {
74+
length += sprintf(&logString[length], "%x ", aBuf[i]);
75+
}
76+
}
77+
78+
void otPlatLogFlush(void) {
79+
ets_printf("%s", logString); // output whole log string
80+
memset(logString, 0, length);
81+
length = 0;
82+
}
83+

esp32/lora/ot-log.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* Copyright (c) 2018, Pycom Limited.
3+
*
4+
* This software is licensed under the GNU GPL version 3 or any
5+
* later version, with permitted additional terms. For more information
6+
* see the Pycom Licence v1.0 document supplied with this file, or
7+
* available at https://www.pycom.io/opensource/licensing
8+
*/
9+
10+
#ifndef LORA_OT_LOG_H_
11+
#define LORA_OT_LOG_H_
12+
13+
void otPlatLogFlush(void);
14+
15+
// openThread log a buffer
16+
void otPlatLogBuf(const char *aBuf, uint16_t aBufLength);
17+
void otPlatLogBufHex(const uint8_t *aBuf, uint16_t aBufLength);
18+
19+
#endif /* LORA_OT_LOG_H_ */

0 commit comments

Comments
 (0)