Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion esp32/fatfs/src/drivers/sflash_diskio.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ static bool sflash_write (void) {
DRESULT sflash_disk_init (void) {
if (!sflash_init_done) {
// this is how we diferentiate flash sizes in Pycom modules
if (esp_get_revision() > 0) {
if (spi_flash_get_chip_size() > (4 * 1024 * 1024)) {
sflash_start_address = SFLASH_START_ADDR_8MB;
sflash_fs_sector_count = SFLASH_FS_SECTOR_COUNT_8MB;
} else {
Expand Down
4 changes: 3 additions & 1 deletion esp32/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
#include "mperror.h"
#include "machtimer.h"

#include "esp_spi_flash.h"


TaskHandle_t mpTaskHandle;
TaskHandle_t svTaskHandle;
Expand Down Expand Up @@ -121,7 +123,7 @@ void app_main(void) {
mperror_pre_init();

// differentiate the Flash Size (either 8MB or 4MB) based on ESP32 rev id
micropy_hw_flash_size = (esp_get_revision() > 0 ? 0x800000 : 0x400000);
micropy_hw_flash_size = (spi_flash_get_chip_size() > (4 * 1024 * 1024) ? 0x800000 : 0x400000);

// propagating the Flash Size in the global variable (used in multiple IDF modules)
g_rom_flashchip.chip_size = micropy_hw_flash_size;
Expand Down