Skip to content

Commit ca64950

Browse files
committed
wip fixes
1 parent 55784c9 commit ca64950

File tree

8 files changed

+28
-21
lines changed

8 files changed

+28
-21
lines changed

ports/espressif/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,8 +388,9 @@ BINARY_BLOBS += esp-idf/components/xtensa/$(IDF_TARGET)/libxt_hal.a
388388
ESP_IDF_COMPONENTS_EXPANDED += esp-idf/components/xtensa/$(IDF_TARGET)/libxt_hal.a
389389
endif
390390

391+
# BOOTLOADER_OFFSET is determined by chip type, based on the ROM bootloader, and is not changeable.
391392
ifeq ($(IDF_TARGET),esp32)
392-
BOOTLOADER_OFFSET = 0x0
393+
BOOTLOADER_OFFSET = 0x1000
393394
else ifeq ($(IDF_TARGET),esp32c3)
394395
BOOTLOADER_OFFSET = 0x0
395396
else ifeq ($(IDF_TARGET),esp32s3)
@@ -412,7 +413,7 @@ ESP_AUTOGEN_LD = $(BUILD)/esp-idf/esp-idf/$(IDF_TARGET)/$(IDF_TARGET)_out.ld $(B
412413

413414
FLASH_FLAGS = --flash_mode $(CIRCUITPY_ESP_FLASH_MODE) --flash_freq $(CIRCUITPY_ESP_FLASH_FREQ) --flash_size $(CIRCUITPY_ESP_FLASH_SIZE)
414415

415-
ESPTOOL_FLAGS ?= --before=default_reset --after=no_reset
416+
ESPTOOL_FLAGS ?= --before=default_reset --after=no_reset --baud 460800
416417

417418
ifeq ($(UF2_BOOTLOADER),1)
418419
all: $(BUILD)/firmware.bin $(BUILD)/firmware.uf2

ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,6 @@
4646

4747
// Explanation of how a user got into safe mode
4848
#define BOARD_USER_SAFE_MODE_ACTION translate("pressing SW38 button at start up.\n")
49+
50+
#define CIRCUITPY_DEBUG_UART_TX (&pin_GPIO8)
51+
#define CIRCUITPY_DEBUG_UART_RX (&pin_GPIO7)

ports/espressif/boards/adafruit_feather_esp32_v2/sdkconfig

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ CONFIG_PARTITION_TABLE_FILENAME="esp-idf-config/partitions-8MB-no-uf2.csv"
3333
#
3434
# ESP32-specific
3535
#
36-
# CONFIG_ESP32_SPIRAM_SUPPORT is not set
36+
CONFIG_ESP32_SPIRAM_SUPPORT=y
3737
# end of ESP32-specific
3838

3939
#
@@ -43,9 +43,3 @@ CONFIG_LWIP_LOCAL_HOSTNAME="Adafruit-Feather-ESP32-V2"
4343
# end of LWIP
4444

4545
# end of Component config
46-
47-
#
48-
# Deprecated options for backward compatibility
49-
#
50-
# CONFIG_SPIRAM_SUPPORT is not set
51-
# end of Deprecated options for backward compatibility

ports/espressif/common-hal/alarm/touch/TouchAlarm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,11 @@ void alarm_touch_touchalarm_set_alarm(const bool deep_sleep, const size_t n_alar
132132
#if defined(CONFIG_IDF_TARGET_ESP32)
133133
uint16_t touch_value;
134134
touch_pad_read(touch_channel, &touch_value);
135-
touch_pad_set_thresh(touch_channel, touch_value * 0.1); // 10%
135+
touch_pad_set_thresh(touch_channel, touch_value / 10); // 10%
136136
#else
137137
uint32_t touch_value;
138138
touch_pad_read_benchmark(touch_channel, &touch_value);
139-
touch_pad_set_threshold(touch_channel, touch_value * 0.1); // 10%
139+
touch_pad_set_thresh(touch_channel, touch_value / 10); // 10%
140140
#endif
141141
}
142142
}

ports/espressif/common-hal/microcontroller/Pin.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
#include "components/driver/include/driver/gpio.h"
3434
#include "components/hal/include/hal/gpio_hal.h"
3535

36+
#include "esp_log.h"
37+
#include "freertos/FreeRTOS.h"
38+
#include "freertos/task.h"
39+
3640
STATIC uint32_t never_reset_pins[2];
3741
STATIC uint32_t in_use[2];
3842

@@ -57,7 +61,7 @@ MP_WEAK bool espressif_board_reset_pin_number(gpio_num_t pin_number) {
5761
STATIC void _reset_pin(gpio_num_t pin_number) {
5862
// Never ever reset pins used for flash and RAM.
5963
#if defined(CONFIG_IDF_TARGET_ESP32)
60-
if (pin_number == 6 || pin_number == 11 || pin_number == 9 || pin_number == 10) {
64+
if (pin_number == 1 || pin_number == 6 || pin_number == 11 || pin_number == 9 || pin_number == 10 || pin_number == 17 || pin_number == 23) {
6165
return;
6266
}
6367
#elif defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3)
@@ -129,12 +133,15 @@ void common_hal_reset_pin(const mcu_pin_obj_t *pin) {
129133
}
130134

131135
void reset_all_pins(void) {
136+
ESP_LOGI("Pin.c", "reset_all_pins");
132137
for (uint8_t i = 0; i < GPIO_PIN_COUNT; i++) {
133138
uint32_t iomux_address = GPIO_PIN_MUX_REG[i];
134139
if (iomux_address == 0 ||
135140
(never_reset_pins[i / 32] & (1 << i % 32)) != 0) {
136141
continue;
137142
}
143+
ESP_LOGI("Pin.c", "about to reset pin %d", i);
144+
vTaskDelay(100);
138145
_reset_pin(i);
139146
}
140147
in_use[0] = never_reset_pins[0];

ports/espressif/esp-idf-config/partitions-8MB-no-uf2.csv

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
# partition table,, 0x8000, 4K
55
nvs, data, nvs, 0x9000, 20K,
66
otadata, data, ota, 0xe000, 8K,
7-
ota_0, 0, ota_0, 0x10000, 2048K,
8-
ota_1, 0, ota_1, 0x210000, 2048K,
7+
ota_0, app, ota_0, 0x10000, 2048K,
8+
ota_1, app, ota_1, 0x210000, 2048K,
99
user_fs, data, fat, 0x410000, 4032K,

ports/espressif/modules/esp32_pico_mini_02.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,10 @@
2727
#include "modules/module.h"
2828

2929
void never_reset_module_internal_pins(void) {
30-
// SPI Flash
30+
// SPI Flash and PSRAM
3131
common_hal_never_reset_pin(&pin_GPIO6);
32-
common_hal_never_reset_pin(&pin_GPIO11);
33-
34-
// PSRAM
3532
common_hal_never_reset_pin(&pin_GPIO9);
3633
common_hal_never_reset_pin(&pin_GPIO10);
34+
common_hal_never_reset_pin(&pin_GPIO11);
35+
3736
}

ports/espressif/tools/build_memory_info.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,12 @@ def find_region(start_address):
8282
elif subtype == "ota_0":
8383
ota = partition[4].strip()
8484
size = app if ota is None else ota
85-
if size[-1] not in ("k", "K"):
86-
raise RuntimeError("Unhandled partition size suffix")
87-
firmware_region = int(size[:-1]) * 1024
85+
if size[-1] in ("k", "K"):
86+
firmware_region = int(size[:-1]) * 1024
87+
elif size[-1] in ("m", "M"):
88+
firmware_region = int(size[:-1]) * 1024 * 1024
89+
else:
90+
raise RuntimeError("Unhandled partition size suffix:", size[-1])
8891

8992
regions = dict((name, 0) for name, _, _ in internal_memory[target])
9093

0 commit comments

Comments
 (0)