esp32: Extend support for S2 series, and S3 where applicable.

Improvements made:
- PSRAM support for S2
- partition definition for 16MiB flash
- correct ADC and DAC pins
- correct GPIO and IRQ pins
- S3 components in CMakeLists

Based on original commit made by Seon Rozenblum aka @UnexpectedMaker.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2021-05-06 10:58:12 +10:00
parent 4cdcbdb753
commit 5093d49fae
9 changed files with 201 additions and 16 deletions

View File

@@ -42,6 +42,8 @@
#include "esp32/spiram.h"
#elif CONFIG_IDF_TARGET_ESP32S2
#include "esp32s2/spiram.h"
#elif CONFIG_IDF_TARGET_ESP32S3
#include "esp32s3/spiram.h"
#endif
#include "py/stackctrl.h"
@@ -104,6 +106,18 @@ void mp_task(void *pvParameter) {
mp_task_heap = malloc(mp_task_heap_size);
break;
}
#elif CONFIG_ESP32S2_SPIRAM_SUPPORT || CONFIG_ESP32S3_SPIRAM_SUPPORT
// Try to use the entire external SPIRAM directly for the heap
size_t mp_task_heap_size;
size_t esp_spiram_size = esp_spiram_get_size();
void *mp_task_heap = (void *)0x3ff80000 - esp_spiram_size;
if (esp_spiram_size > 0) {
mp_task_heap_size = esp_spiram_size;
} else {
// No SPIRAM, fallback to normal allocation
mp_task_heap_size = heap_caps_get_largest_free_block(MALLOC_CAP_8BIT);
mp_task_heap = malloc(mp_task_heap_size);
}
#else
// Allocate the uPy heap using malloc and get the largest available region
size_t mp_task_heap_size = heap_caps_get_largest_free_block(MALLOC_CAP_8BIT);