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

Commit f4f56ab

Browse files
author
Daniel Campora
committed
esp32: Merge with master.
1 parent 195813d commit f4f56ab

Some content is hidden

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

48 files changed

+414
-270
lines changed

esp32/Makefile

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,23 @@ endif
1616

1717
TARGET ?= app
1818

19+
OEM ?= 0
20+
1921
# make 'release' the default build type
2022
BTYPE ?= release
2123

22-
# if the build directory is not given, make it reflect the board name.
23-
BUILD ?= build/$(BOARD)/$(BTYPE)
24+
LORA_BAND ?= USE_BAND_868
25+
ifeq ($(BOARD), LOPY)
26+
ifeq ($(LORA_BAND), USE_BAND_868)
27+
LORA_FREQ = 868
28+
else
29+
LORA_FREQ = 915
30+
endif
31+
BUILD = build/$(BOARD)_$(LORA_FREQ)/$(BTYPE)
32+
else
33+
LORA_FREQ =
34+
BUILD = build/$(BOARD)/$(BTYPE)
35+
endif
2436

2537
FROZEN_MPY_DIR = frozen
2638

@@ -41,6 +53,10 @@ else
4153
CFLAGS_XTENSA += -Og
4254
endif
4355

56+
ifeq ($(OEM), 1)
57+
CFLAGS_XTENSA += -DOEM_VERSION
58+
endif
59+
4460
CFLAGS = $(CFLAGS_XTENSA) -nostdlib -std=gnu99 -g3 -fstrict-volatile-bitfields -Iboards/$(BOARD)
4561

4662
LDFLAGS = -nostdlib -Wl,-Map=$(@:.elf=.map) -Wl,--no-check-sections -u call_user_start_cpu0

esp32/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ After that, build the ESP32 port for one of Pycom boards (first the bootloader,
1919

2020
$ cd ../esp32
2121
$ make BOARD=LOPY -j5 TARGET=boot
22-
$ make BOARD=LOPY -j5 TARGET=app clean
22+
$ make BOARD=LOPY -j5 LORA_BAND=USE_BAND_868 TARGET=app
2323

2424
Flash the board (connect P2 to GND and reset before starting):
2525

26-
$ make BOARD=LOPY flash
26+
$ make BOARD=LOPY -j5 LORA_BAND=USE_BAND_868 flash
2727

2828
Using frozen modules
2929
--------------------

esp32/application.mk

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -264,17 +264,6 @@ BOOT_LDFLAGS = $(LDFLAGS) -T esp32.bootloader.ld -T esp32.rom.ld -T esp32.periph
264264
# add the application linker script(s)
265265
APP_LDFLAGS += $(LDFLAGS) -T esp32_out.ld -T esp32.common.ld -T esp32.rom.ld -T esp32.peripherals.ld
266266

267-
LORA_BAND ?= USE_BAND_868
268-
ifeq ($(BOARD), LOPY)
269-
ifeq ($(LORA_BAND), USE_BAND_868)
270-
LORA_FREQ = 868
271-
else
272-
LORA_FREQ = 915
273-
endif
274-
else
275-
LORA_FREQ =
276-
endif
277-
278267
# add the application specific CFLAGS
279268
CFLAGS += $(APP_INC) -DMICROPY_NLR_SETJMP=1 -D$(LORA_BAND) -DMBEDTLS_CONFIG_FILE='"mbedtls/esp_config.h"' -DHAVE_CONFIG_H -DESP_PLATFORM
280269

@@ -361,7 +350,6 @@ $(BUILD)/application.a: $(OBJ)
361350
$(ECHO) "AR $@"
362351
$(Q) rm -f $@
363352
$(Q) $(AR) cru $@ $^
364-
365353
ifeq ($(BOARD), SIPY)
366354
$(BUILD)/application.elf: $(BUILD)/application.a $(BUILD)/esp32_out.ld
367355
$(ECHO) "LINK $@"

esp32/boards/LOPY/LOPY_868/script

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[
2+
["e", "0x8000", "0x1000"],
3+
["e", "0x110000", "0x1000"],
4+
["e", "0x210000", "0x1000"],
5+
["e", "0x320000", "0x1000"],
6+
["e", "0x37F000", "0x1000"],
7+
["w", "0x1000", "bootloader.bin"],
8+
["w", "0x8000", "partitions.bin"],
9+
["w", "0x10000", "lopy_868.bin"]
10+
]

esp32/boards/LOPY/LOPY_915/script

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[
2+
["e", "0x8000", "0x1000"],
3+
["e", "0x110000", "0x1000"],
4+
["e", "0x210000", "0x1000"],
5+
["e", "0x320000", "0x1000"],
6+
["e", "0x37F000", "0x1000"],
7+
["w", "0x1000", "bootloader.bin"],
8+
["w", "0x8000", "partitions.bin"],
9+
["w", "0x10000", "lopy_915.bin"]
10+
]

esp32/boards/LOPY/mpconfigboard.h

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,34 @@
1818

1919
#define MICROPY_HW_FLASH_SIZE (4 * 1024 * 1024)
2020

21-
#define MICROPY_LPWAN_DIO_PIN_NUM (23)
22-
#define MICROPY_LPWAN_DIO_PIN (pin_GPIO23)
21+
#if defined(OEM_VERSION)
22+
23+
#define MICROPY_LPWAN_RESET_PIN_NUM
24+
#define MICROPY_LPWAN_RESET_PIN_NAME
25+
#define MICROPY_LPWAN_RESET_PIN
26+
#define MICROPY_LPWAN_USE_RESET_PIN 0
27+
28+
#define MICROPY_LPWAN_DIO_PIN_NUM (23)
29+
#define MICROPY_LPWAN_DIO_PIN_NAME GPIO23
30+
#define MICROPY_LPWAN_DIO_PIN (pin_GPIO23)
31+
32+
#define MICROPY_LPWAN_NCS_PIN_NUM (18)
33+
#define MICROPY_LPWAN_NCS_PIN_NAME GPIO18
34+
#define MICROPY_LPWAN_NCS_PIN (pin_GPIO18)
35+
36+
#else
37+
38+
#define MICROPY_LPWAN_RESET_PIN_NUM (18)
39+
#define MICROPY_LPWAN_RESET_PIN_NAME GPIO18
40+
#define MICROPY_LPWAN_RESET_PIN (pin_GPIO18)
41+
#define MICROPY_LPWAN_USE_RESET_PIN 1
42+
43+
#define MICROPY_LPWAN_DIO_PIN_NUM (23)
44+
#define MICROPY_LPWAN_DIO_PIN_NAME GPIO23
45+
#define MICROPY_LPWAN_DIO_PIN (pin_GPIO23)
46+
47+
#define MICROPY_LPWAN_NCS_PIN_NUM (17)
48+
#define MICROPY_LPWAN_NCS_PIN_NAME GPIO17
49+
#define MICROPY_LPWAN_NCS_PIN (pin_GPIO17)
50+
51+
#endif

esp32/boards/SIPY/SIPY/script

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[
2+
["e", "0x8000", "0x1000"],
3+
["e", "0x110000", "0x1000"],
4+
["e", "0x210000", "0x1000"],
5+
["e", "0x320000", "0x1000"],
6+
["e", "0x37F000", "0x1000"],
7+
["w", "0x1000", "bootloader.bin"],
8+
["w", "0x8000", "partitions.bin"],
9+
["w", "0x10000", "sipy.bin"]
10+
]

esp32/boards/WIPY/WIPY/script

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[
2+
["e", "0x8000", "0x1000"],
3+
["e", "0x110000", "0x1000"],
4+
["e", "0x210000", "0x1000"],
5+
["e", "0x320000", "0x1000"],
6+
["e", "0x37F000", "0x1000"],
7+
["w", "0x1000", "bootloader.bin"],
8+
["w", "0x8000", "partitions.bin"],
9+
["w", "0x10000", "wipy.bin"]
10+
]

esp32/hal/esp32_mphal.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,19 @@ void mp_hal_feed_watchdog(void) {
7575
}
7676

7777
void mp_hal_delay_us(uint32_t us) {
78-
if (us < 1000) {
79-
ets_delay_us(us);
78+
if (us <= 1000) {
79+
if (us > 0) {
80+
ets_delay_us(us);
81+
}
8082
} else {
83+
uint32_t ms = us / 1000;
84+
us = us % 1000;
8185
MP_THREAD_GIL_EXIT();
82-
ets_delay_us(us);
86+
vTaskDelay (ms / portTICK_PERIOD_MS);
8387
MP_THREAD_GIL_ENTER();
88+
if (us > 0) {
89+
ets_delay_us(us);
90+
}
8491
}
8592
}
8693

esp32/lib/libbt.a

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)