Skip to content

Commit

Permalink
Feature: Added support for boards with 16MB flash and PSRAM
Browse files Browse the repository at this point in the history
  • Loading branch information
tbnobody committed Feb 2, 2024
1 parent e81a280 commit 7e2064e
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 2 deletions.
6 changes: 6 additions & 0 deletions partitions_custom_16mb.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000
otadata, data, ota, 0xE000, 0x2000
app0, app, ota_0, 0x10000, 0x7E0000
app1, app, ota_1, 0x7F0000, 0x7E0000
spiffs, data, spiffs, 0xFD0000, 0x30000
File renamed without changes.
12 changes: 11 additions & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ extra_scripts =
pre:pio-scripts/patch_apply.py
post:pio-scripts/create_factory_bin.py

board_build.partitions = partitions_custom.csv
board_build.partitions = partitions_custom_4mb.csv
board_build.filesystem = littlefs
board_build.embed_files =
webapp_dist/index.html.gz
Expand All @@ -75,6 +75,16 @@ board = esp32dev
build_flags = ${env.build_flags}


[env:generic_esp32_16mb_psram]
board = esp32dev
board_build.flash_mode = qio
board_build.partitions = partitions_custom_16mb.csv
board_upload.flash_size = 16MB
build_flags = ${env.build_flags}
-DBOARD_HAS_PSRAM
-mfix-esp32-psram-cache-issue


[env:generic_esp32c3]
board = esp32-c3-devkitc-02
custom_patches = ${env.custom_patches},esp32c3
Expand Down
2 changes: 2 additions & 0 deletions src/WebApi_sysstatus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ void WebApiSysstatusClass::onSystemStatus(AsyncWebServerRequest* request)
root["heap_used"] = ESP.getHeapSize() - ESP.getFreeHeap();
root["heap_max_block"] = ESP.getMaxAllocHeap();
root["heap_min_free"] = ESP.getMinFreeHeap();
root["psram_total"] = ESP.getPsramSize();
root["psram_used"] = ESP.getPsramSize() - ESP.getFreePsram();
root["sketch_total"] = ESP.getFreeSketchSpace();
root["sketch_used"] = ESP.getSketchSize();
root["littlefs_total"] = LittleFS.totalBytes();
Expand Down
4 changes: 4 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,13 @@
#include <Arduino.h>
#include <LittleFS.h>
#include <TaskScheduler.h>
#include <esp_heap_caps.h>

void setup()
{
// Move all dynamic allocations >512byte to psram (if available)
heap_caps_malloc_extmem_enable(512);

// Initialize serial output
Serial.begin(SERIAL_BAUDRATE);
#if ARDUINO_USB_CDC_ON_BOOT
Expand Down
2 changes: 2 additions & 0 deletions webapp/src/components/MemoryInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
<tbody>
<FsInfo :name="$t('memoryinfo.Heap')" :total="systemStatus.heap_total"
:used="systemStatus.heap_used" />
<FsInfo :name="$t('memoryinfo.PsRam')" :total="systemStatus.psram_total"
:used="systemStatus.psram_used" />
<FsInfo :name="$t('memoryinfo.LittleFs')" :total="systemStatus.littlefs_total"
:used="systemStatus.littlefs_used" />
<FsInfo :name="$t('memoryinfo.Sketch')" :total="systemStatus.sketch_total"
Expand Down
1 change: 1 addition & 0 deletions webapp/src/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@
"Used": "Benutzt",
"Size": "Größe",
"Heap": "Heap",
"PsRam": "PSRAM",
"LittleFs": "LittleFs",
"Sketch": "Sketch"
},
Expand Down
1 change: 1 addition & 0 deletions webapp/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@
"Used": "Used",
"Size": "Size",
"Heap": "Heap",
"PsRam": "PSRAM",
"LittleFs": "LittleFs",
"Sketch": "Sketch"
},
Expand Down
1 change: 1 addition & 0 deletions webapp/src/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@
"Used": "Utilisée",
"Size": "Taille",
"Heap": "Heap",
"PsRam": "PSRAM",
"LittleFs": "LittleFs",
"Sketch": "Sketch"
},
Expand Down
4 changes: 3 additions & 1 deletion webapp/src/types/SystemStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export interface SystemStatus {
heap_min_free: number;
littlefs_total: number;
littlefs_used: number;
psram_total: number;
psram_used: number;
sketch_total: number;
sketch_used: number;
// RadioInfo
Expand All @@ -33,4 +35,4 @@ export interface SystemStatus {
nrf_pvariant: boolean;
cmt_configured: boolean;
cmt_connected: boolean;
}
}

0 comments on commit 7e2064e

Please sign in to comment.