wip fixes

This commit is contained in:
Dan Halbert 2022-06-28 18:32:08 -04:00
parent 55784c93de
commit ca64950503
8 changed files with 28 additions and 21 deletions

View File

@ -388,8 +388,9 @@ BINARY_BLOBS += esp-idf/components/xtensa/$(IDF_TARGET)/libxt_hal.a
ESP_IDF_COMPONENTS_EXPANDED += esp-idf/components/xtensa/$(IDF_TARGET)/libxt_hal.a
endif
# BOOTLOADER_OFFSET is determined by chip type, based on the ROM bootloader, and is not changeable.
ifeq ($(IDF_TARGET),esp32)
BOOTLOADER_OFFSET = 0x0
BOOTLOADER_OFFSET = 0x1000
else ifeq ($(IDF_TARGET),esp32c3)
BOOTLOADER_OFFSET = 0x0
else ifeq ($(IDF_TARGET),esp32s3)
@ -412,7 +413,7 @@ ESP_AUTOGEN_LD = $(BUILD)/esp-idf/esp-idf/$(IDF_TARGET)/$(IDF_TARGET)_out.ld $(B
FLASH_FLAGS = --flash_mode $(CIRCUITPY_ESP_FLASH_MODE) --flash_freq $(CIRCUITPY_ESP_FLASH_FREQ) --flash_size $(CIRCUITPY_ESP_FLASH_SIZE)
ESPTOOL_FLAGS ?= --before=default_reset --after=no_reset
ESPTOOL_FLAGS ?= --before=default_reset --after=no_reset --baud 460800
ifeq ($(UF2_BOOTLOADER),1)
all: $(BUILD)/firmware.bin $(BUILD)/firmware.uf2

View File

@ -46,3 +46,6 @@
// Explanation of how a user got into safe mode
#define BOARD_USER_SAFE_MODE_ACTION translate("pressing SW38 button at start up.\n")
#define CIRCUITPY_DEBUG_UART_TX (&pin_GPIO8)
#define CIRCUITPY_DEBUG_UART_RX (&pin_GPIO7)

View File

@ -33,7 +33,7 @@ CONFIG_PARTITION_TABLE_FILENAME="esp-idf-config/partitions-8MB-no-uf2.csv"
#
# ESP32-specific
#
# CONFIG_ESP32_SPIRAM_SUPPORT is not set
CONFIG_ESP32_SPIRAM_SUPPORT=y
# end of ESP32-specific
#
@ -43,9 +43,3 @@ CONFIG_LWIP_LOCAL_HOSTNAME="Adafruit-Feather-ESP32-V2"
# end of LWIP
# end of Component config
#
# Deprecated options for backward compatibility
#
# CONFIG_SPIRAM_SUPPORT is not set
# end of Deprecated options for backward compatibility

View File

@ -132,11 +132,11 @@ void alarm_touch_touchalarm_set_alarm(const bool deep_sleep, const size_t n_alar
#if defined(CONFIG_IDF_TARGET_ESP32)
uint16_t touch_value;
touch_pad_read(touch_channel, &touch_value);
touch_pad_set_thresh(touch_channel, touch_value * 0.1); // 10%
touch_pad_set_thresh(touch_channel, touch_value / 10); // 10%
#else
uint32_t touch_value;
touch_pad_read_benchmark(touch_channel, &touch_value);
touch_pad_set_threshold(touch_channel, touch_value * 0.1); // 10%
touch_pad_set_thresh(touch_channel, touch_value / 10); // 10%
#endif
}
}

View File

@ -33,6 +33,10 @@
#include "components/driver/include/driver/gpio.h"
#include "components/hal/include/hal/gpio_hal.h"
#include "esp_log.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
STATIC uint32_t never_reset_pins[2];
STATIC uint32_t in_use[2];
@ -57,7 +61,7 @@ MP_WEAK bool espressif_board_reset_pin_number(gpio_num_t pin_number) {
STATIC void _reset_pin(gpio_num_t pin_number) {
// Never ever reset pins used for flash and RAM.
#if defined(CONFIG_IDF_TARGET_ESP32)
if (pin_number == 6 || pin_number == 11 || pin_number == 9 || pin_number == 10) {
if (pin_number == 1 || pin_number == 6 || pin_number == 11 || pin_number == 9 || pin_number == 10 || pin_number == 17 || pin_number == 23) {
return;
}
#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) {
}
void reset_all_pins(void) {
ESP_LOGI("Pin.c", "reset_all_pins");
for (uint8_t i = 0; i < GPIO_PIN_COUNT; i++) {
uint32_t iomux_address = GPIO_PIN_MUX_REG[i];
if (iomux_address == 0 ||
(never_reset_pins[i / 32] & (1 << i % 32)) != 0) {
continue;
}
ESP_LOGI("Pin.c", "about to reset pin %d", i);
vTaskDelay(100);
_reset_pin(i);
}
in_use[0] = never_reset_pins[0];

View File

@ -4,6 +4,6 @@
# partition table,, 0x8000, 4K
nvs, data, nvs, 0x9000, 20K,
otadata, data, ota, 0xe000, 8K,
ota_0, 0, ota_0, 0x10000, 2048K,
ota_1, 0, ota_1, 0x210000, 2048K,
ota_0, app, ota_0, 0x10000, 2048K,
ota_1, app, ota_1, 0x210000, 2048K,
user_fs, data, fat, 0x410000, 4032K,

1 # ESP-IDF Partition Table
4 # partition table,, 0x8000, 4K
5 nvs, data, nvs, 0x9000, 20K,
6 otadata, data, ota, 0xe000, 8K,
7 ota_0, 0, ota_0, 0x10000, 2048K, ota_0, app, ota_0, 0x10000, 2048K,
8 ota_1, 0, ota_1, 0x210000, 2048K, ota_1, app, ota_1, 0x210000, 2048K,
9 user_fs, data, fat, 0x410000, 4032K,

View File

@ -27,11 +27,10 @@
#include "modules/module.h"
void never_reset_module_internal_pins(void) {
// SPI Flash
// SPI Flash and PSRAM
common_hal_never_reset_pin(&pin_GPIO6);
common_hal_never_reset_pin(&pin_GPIO11);
// PSRAM
common_hal_never_reset_pin(&pin_GPIO9);
common_hal_never_reset_pin(&pin_GPIO10);
common_hal_never_reset_pin(&pin_GPIO11);
}

View File

@ -82,9 +82,12 @@ with open(sys.argv[2], "r") as f:
elif subtype == "ota_0":
ota = partition[4].strip()
size = app if ota is None else ota
if size[-1] not in ("k", "K"):
raise RuntimeError("Unhandled partition size suffix")
firmware_region = int(size[:-1]) * 1024
if size[-1] in ("k", "K"):
firmware_region = int(size[:-1]) * 1024
elif size[-1] in ("m", "M"):
firmware_region = int(size[:-1]) * 1024 * 1024
else:
raise RuntimeError("Unhandled partition size suffix:", size[-1])
regions = dict((name, 0) for name, _, _ in internal_memory[target])