From 84a0b9a2e2a4df69882a19f0dd0ba731c9a81bb4 Mon Sep 17 00:00:00 2001 From: folkert van heusden Date: Sat, 20 Apr 2024 18:28:44 +0200 Subject: [PATCH 01/17] PSRAM with ESP32-ttgo-t-beam --- ESP32/main.ino | 21 +++++++++++---------- ESP32/platformio.ini | 15 +++++++++++++++ memory.cpp | 21 ++++++++++++++++++++- memory.h | 9 ++++++--- 4 files changed, 52 insertions(+), 14 deletions(-) diff --git a/ESP32/main.ino b/ESP32/main.ino index 3407eef..076d67c 100644 --- a/ESP32/main.ino +++ b/ESP32/main.ino @@ -256,9 +256,14 @@ void setup() { #endif #if !defined(BUILD_FOR_RP2040) - uint32_t free_heap = ESP.getFreeHeap(); - Serial.printf("Free RAM before init: %d decimal bytes (or %d pages (value for the ramsize command in the debugger))", free_heap, std::min(int(free_heap / 8192l), DEFAULT_N_PAGES)); - Serial.println(F("")); + Serial.print(F("Free RAM after init (decimal bytes): ")); + Serial.println(ESP.getFreeHeap()); + + if (psramFound()) { + uint32_t free_psram = ESP.getFreePsram(); + Serial.printf("Free PSRAM: %d decimal bytes (or %d pages (see 'ramsize' in the debugger))", free_psram, free_psram / 8192l); + Serial.println(F("")); + } #endif Serial.println(F("Init bus")); @@ -307,13 +312,9 @@ void setup() { #endif #if !defined(BUILD_FOR_RP2040) - Serial.print(F("Free RAM after init (decimal bytes): ")); - Serial.println(ESP.getFreeHeap()); - - if (psramFound()) { - Serial.print(F("Free PSRAM: ")); - Serial.println(ESP.getFreePsram()); - } + uint32_t free_heap = ESP.getFreeHeap(); + Serial.printf("Free RAM after init: %d decimal bytes", free_heap); + Serial.println(F("")); #endif #if !defined(SHA2017) diff --git a/ESP32/platformio.ini b/ESP32/platformio.ini index 3cb932b..84f18b8 100644 --- a/ESP32/platformio.ini +++ b/ESP32/platformio.ini @@ -35,3 +35,18 @@ lib_deps = greiman/SdFat@^2.1.2 build_flags = -std=gnu++17 -DESP32=1 -DSHA2017 -ggdb3 -D_GLIBCXX_USE_C99 -ISHAdisplay/Arduino/libraries/epd2in9-badge -ISHAdisplay/Arduino/libraries/epdpaint -ISHAdisplay/components/epaper-29-dke build_unflags = -std=gnu++11 upload_protocol = esptool + +[env:ESP32-ttgo-t-beam] +build_src_filter = +<*> -<.git/> -<.svn/> - - - - - - - - +platform = espressif32 +board = ttgo-t-beam +framework = arduino +monitor_speed = 115200 +upload_speed = 1000000 +board_build.filesystem = littlefs +lib_deps = greiman/SdFat@^2.1.2 + adafruit/Adafruit NeoPixel + bblanchon/ArduinoJson@^6.19.4 +build_flags = -std=gnu++17 -DESP32=1 -ggdb3 -D_GLIBCXX_USE_C99 +build_unflags = -std=gnu++11 +extra_scripts = pre:prepare.py diff --git a/memory.cpp b/memory.cpp index e58851c..0f17e34 100644 --- a/memory.cpp +++ b/memory.cpp @@ -13,14 +13,33 @@ memory::memory(const uint32_t size) : size(size) #if defined(ESP32) Serial.print(F("Memory size (in bytes, decimal): ")); Serial.println(size); -#endif + if (size > 12 * 8192) { + Serial.println(F("Using PSRAM")); + is_psram = true; + + m = reinterpret_cast(ps_malloc(size)); + + reset(); + } + else { + m = new uint8_t[size](); + } +#else m = new uint8_t[size](); +#endif } memory::~memory() { +#if defined(ESP32) + if (is_psram) + free(m); + else + delete [] m; +#else delete [] m; +#endif } void memory::reset() diff --git a/memory.h b/memory.h index 5942078..5a03be4 100644 --- a/memory.h +++ b/memory.h @@ -1,4 +1,4 @@ -// (C) 2018-2023 by Folkert van Heusden +// (C) 2018-2024 by Folkert van Heusden // Released under MIT license #pragma once @@ -9,8 +9,11 @@ class memory { private: - const uint32_t size { 0 }; - uint8_t *m { nullptr }; + const uint32_t size { 0 }; + uint8_t *m { nullptr }; +#ifdef ESP32 + bool is_psram { false }; +#endif public: memory(const uint32_t size); From f18fd1097dedc861e55a05f3e6e4826c75954859 Mon Sep 17 00:00:00 2001 From: folkert van heusden Date: Fri, 26 Apr 2024 20:33:39 +0200 Subject: [PATCH 02/17] missing file --- ESP32/disk_device.h | 1 + 1 file changed, 1 insertion(+) create mode 120000 ESP32/disk_device.h diff --git a/ESP32/disk_device.h b/ESP32/disk_device.h new file mode 120000 index 0000000..dbcee94 --- /dev/null +++ b/ESP32/disk_device.h @@ -0,0 +1 @@ +../disk_device.h \ No newline at end of file From 75b50a450637c84e2684f942d65127b213beb0a9 Mon Sep 17 00:00:00 2001 From: folkert van heusden Date: Fri, 26 Apr 2024 20:43:45 +0200 Subject: [PATCH 03/17] added "-DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue" to build flags --- ESP32/main.ino | 2 +- ESP32/platformio.ini | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ESP32/main.ino b/ESP32/main.ino index 9bb78b4..1ffa6fc 100644 --- a/ESP32/main.ino +++ b/ESP32/main.ino @@ -256,7 +256,7 @@ void setup() { Serial.print(F("Free RAM after init (decimal bytes): ")); Serial.println(ESP.getFreeHeap()); - if (psramFound()) { + if (psramInit()) { uint32_t free_psram = ESP.getFreePsram(); Serial.printf("Free PSRAM: %d decimal bytes (or %d pages (see 'ramsize' in the debugger))", free_psram, free_psram / 8192l); Serial.println(F("")); diff --git a/ESP32/platformio.ini b/ESP32/platformio.ini index 3938d19..fee90e9 100644 --- a/ESP32/platformio.ini +++ b/ESP32/platformio.ini @@ -17,7 +17,7 @@ board_build.filesystem = littlefs lib_deps = greiman/SdFat@^2.1.2 adafruit/Adafruit NeoPixel bblanchon/ArduinoJson@^6.19.4 -build_flags = -std=gnu++2a -DESP32=1 -ggdb3 -D_GLIBCXX_USE_C99 +build_flags = -std=gnu++2a -DESP32=1 -ggdb3 -D_GLIBCXX_USE_C99 -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue build_unflags = -std=gnu++11 -std=gnu++17 extra_scripts = pre:prepare.py From d155af831529b47b55e09529431764523087cc36 Mon Sep 17 00:00:00 2001 From: folkert van heusden Date: Fri, 26 Apr 2024 21:21:27 +0200 Subject: [PATCH 04/17] comment --- gen.h | 1 + 1 file changed, 1 insertion(+) diff --git a/gen.h b/gen.h index 8629ac9..291e32b 100644 --- a/gen.h +++ b/gen.h @@ -28,5 +28,6 @@ typedef enum { rm_prev, rm_cur } rm_selection_t; // see also https://github.com/espressif/esp-idf/issues/1934 #define DEFAULT_N_PAGES 12 #else +// more requires unibusmap support #define DEFAULT_N_PAGES 31 #endif From 59fc3fcddc8a106f1af1dc2918b583721932e20c Mon Sep 17 00:00:00 2001 From: folkert van heusden Date: Fri, 26 Apr 2024 23:56:40 +0200 Subject: [PATCH 05/17] required platformio.ini setting --- ESP32/platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ESP32/platformio.ini b/ESP32/platformio.ini index fee90e9..88edc7f 100644 --- a/ESP32/platformio.ini +++ b/ESP32/platformio.ini @@ -47,6 +47,6 @@ board_build.filesystem = littlefs lib_deps = greiman/SdFat@^2.1.2 adafruit/Adafruit NeoPixel bblanchon/ArduinoJson@^6.19.4 -build_flags = -std=gnu++17 -DESP32=1 -ggdb3 -D_GLIBCXX_USE_C99 +build_flags = -std=gnu++17 -DESP32=1 -ggdb3 -D_GLIBCXX_USE_C99 -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue -DCONFIG_SPIRAM_USE_MALLOC build_unflags = -std=gnu++11 extra_scripts = pre:prepare.py From c18b9f307b3cd9dde198c8fb1f498d4702ec0419 Mon Sep 17 00:00:00 2001 From: folkert van heusden Date: Sat, 27 Apr 2024 20:52:49 +0200 Subject: [PATCH 06/17] missing define --- ESP32/platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ESP32/platformio.ini b/ESP32/platformio.ini index 88edc7f..e533a3d 100644 --- a/ESP32/platformio.ini +++ b/ESP32/platformio.ini @@ -17,7 +17,7 @@ board_build.filesystem = littlefs lib_deps = greiman/SdFat@^2.1.2 adafruit/Adafruit NeoPixel bblanchon/ArduinoJson@^6.19.4 -build_flags = -std=gnu++2a -DESP32=1 -ggdb3 -D_GLIBCXX_USE_C99 -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue +build_flags = -std=gnu++2a -DESP32=1 -ggdb3 -D_GLIBCXX_USE_C99 -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue -DCONFIG_SPIRAM_USE_MALLOC build_unflags = -std=gnu++11 -std=gnu++17 extra_scripts = pre:prepare.py From d74e54342d3417100f4d6df1111efc6484b23205 Mon Sep 17 00:00:00 2001 From: folkert van heusden Date: Sat, 27 Apr 2024 20:53:08 +0200 Subject: [PATCH 07/17] spaces --- bus.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bus.cpp b/bus.cpp index 5d73884..8ac8d26 100644 --- a/bus.cpp +++ b/bus.cpp @@ -629,9 +629,9 @@ uint32_t bus::calculate_physical_address(const int run_mode, const uint16_t a, c uint32_t m_offset = a; if (mmu_->is_enabled() || (is_write && (mmu_->getMMR0() & (1 << 8 /* maintenance check */)))) { - const uint8_t apf = a >> 13; // active page field + uint8_t apf = a >> 13; // active page field - bool d = space == d_space && mmu_->get_use_data_space(run_mode) ? space == d_space : false; + bool d = space == d_space && mmu_->get_use_data_space(run_mode) ? space == d_space : false; uint16_t p_offset = a & 8191; // page offset From 5683a21dbb36b130eecbe720a68e2d5061961293 Mon Sep 17 00:00:00 2001 From: folkert van heusden Date: Sat, 27 Apr 2024 20:54:31 +0200 Subject: [PATCH 08/17] date --- memory.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/memory.cpp b/memory.cpp index 6a9f1cf..c4fafc4 100644 --- a/memory.cpp +++ b/memory.cpp @@ -1,4 +1,4 @@ -// (C) 2018-2023 by Folkert van Heusden +// (C) 2018-2024 by Folkert van Heusden // Released under MIT license #if defined(ESP32) @@ -8,7 +8,7 @@ #include "memory.h" -memory::memory(const uint32_t size) : size(size) +memory::memory(const uint32_t size): size(size) { #if defined(ESP32) Serial.print(F("Memory size (in bytes, decimal): ")); From 8106dc4683987e2054a48dd0b351b2b00b08da62 Mon Sep 17 00:00:00 2001 From: folkert van heusden Date: Sat, 27 Apr 2024 21:46:01 +0200 Subject: [PATCH 09/17] only use psram when available --- memory.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/memory.cpp b/memory.cpp index c4fafc4..64fa1ba 100644 --- a/memory.cpp +++ b/memory.cpp @@ -14,7 +14,7 @@ memory::memory(const uint32_t size): size(size) Serial.print(F("Memory size (in bytes, decimal): ")); Serial.println(size); - if (size > 12 * 8192) { + if (size > 12 * 8192 && psramFound()) { Serial.println(F("Using PSRAM")); is_psram = true; From 6201f8006e3c6a027fd2ca0a27a0b02f19e4e048 Mon Sep 17 00:00:00 2001 From: folkert van heusden Date: Sat, 27 Apr 2024 21:50:15 +0200 Subject: [PATCH 10/17] code reduction --- memory.cpp | 14 +++----------- memory.h | 3 --- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/memory.cpp b/memory.cpp index 64fa1ba..ab3d526 100644 --- a/memory.cpp +++ b/memory.cpp @@ -16,30 +16,22 @@ memory::memory(const uint32_t size): size(size) if (size > 12 * 8192 && psramFound()) { Serial.println(F("Using PSRAM")); - is_psram = true; m = reinterpret_cast(ps_malloc(size)); reset(); } else { - m = new uint8_t[size](); + m = reinterpret_cast(calloc(1, size)); } #else - m = new uint8_t[size](); + m = reinterpret_cast(calloc(1, size)); #endif } memory::~memory() { -#if defined(ESP32) - if (is_psram) - free(m); - else - delete [] m; -#else - delete [] m; -#endif + free(m); } void memory::reset() diff --git a/memory.h b/memory.h index 5bf11e6..7a43089 100644 --- a/memory.h +++ b/memory.h @@ -13,9 +13,6 @@ class memory private: const uint32_t size { 0 }; uint8_t *m { nullptr }; -#ifdef ESP32 - bool is_psram { false }; -#endif public: memory(const uint32_t size); From f2f418fe643ce8bf175ef7179e6217ebe4f93b86 Mon Sep 17 00:00:00 2001 From: folkert van heusden Date: Sat, 27 Apr 2024 21:57:09 +0200 Subject: [PATCH 11/17] static -> constexpr const --- loaders.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/loaders.cpp b/loaders.cpp index 8752141..3c89805 100644 --- a/loaders.cpp +++ b/loaders.cpp @@ -30,7 +30,7 @@ void loadbin(bus *const b, uint16_t base, const char *const file) void set_boot_loader(bus *const b, const bootloader_t which) { - cpu *const c = b->getCpu(); + cpu *const c = b->getCpu(); uint16_t offset = 0; uint16_t start = 0; @@ -40,7 +40,7 @@ void set_boot_loader(bus *const b, const bootloader_t which) if (which == BL_RK05) { start = offset = 01000; - static uint16_t rk05_code[] = { + constexpr const uint16_t rk05_code[] = { 0012700, 0177406, 0012710, @@ -92,7 +92,7 @@ void set_boot_loader(bus *const b, const bootloader_t which) start = offset = 01000; /* from https://www.pdp-11.nl/peripherals/disk/rl-info.html - static uint16_t rl02_code[] = { + constexpr const uint16_t rl02_code[] = { 0012701, 0174400, 0012761, @@ -120,7 +120,7 @@ void set_boot_loader(bus *const b, const bootloader_t which) */ // from http://gunkies.org/wiki/RL11_disk_controller - static uint16_t rl02_code[] = { + constexpr const uint16_t rl02_code[] = { 0012700, 0174400, 0012760, From 53fcfe169b7a1b28aa5f7948d9b13754c5d46e45 Mon Sep 17 00:00:00 2001 From: folkert van heusden Date: Sat, 27 Apr 2024 22:01:13 +0200 Subject: [PATCH 12/17] old code --- debugger.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/debugger.cpp b/debugger.cpp index 9b5fcb9..c276cbe 100644 --- a/debugger.cpp +++ b/debugger.cpp @@ -37,13 +37,9 @@ #include "rp2040.h" #endif -void set_boot_loader(bus *const b); - -void configure_disk(console *const c); - -void configure_network(console *const c); -void check_network(console *const c); -void start_network(console *const c); +void configure_network(console *const cnsl); +void check_network(console *const cnsl); +void start_network(console *const cnsl); void set_tty_serial_speed(console *const c, const uint32_t bps); #endif From abd2ed85df93b4dcdaa2d7177d480d12ec80b8d9 Mon Sep 17 00:00:00 2001 From: folkert van heusden Date: Tue, 30 Apr 2024 09:05:56 +0200 Subject: [PATCH 13/17] ESP32 compile fail --- ESP32/console_esp32.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ESP32/console_esp32.cpp b/ESP32/console_esp32.cpp index 787733f..5cd328d 100644 --- a/ESP32/console_esp32.cpp +++ b/ESP32/console_esp32.cpp @@ -113,7 +113,7 @@ void console_esp32::panel_update_thread() uint16_t current_PC = c->getPC(); uint32_t full_addr = b->calculate_physical_address(run_mode, current_PC, false, false, true, i_space); - uint16_t current_instr = b->readWord(current_PC); + uint16_t current_instr = b->read_word(current_PC); uint32_t led_color = run_mode_led_color[run_mode]; From ff3e5ba60478116f7964b873b8bac1b75581cd59 Mon Sep 17 00:00:00 2001 From: folkert van heusden Date: Tue, 30 Apr 2024 19:42:35 +0200 Subject: [PATCH 14/17] moved neopixels configuration to esp32.h; note: make sure not to use the psram spi pins! --- ESP32/console_esp32.cpp | 5 ++--- ESP32/esp32.h | 4 +++- ESP32/main.ino | 1 - 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ESP32/console_esp32.cpp b/ESP32/console_esp32.cpp index 5cd328d..1d99941 100644 --- a/ESP32/console_esp32.cpp +++ b/ESP32/console_esp32.cpp @@ -7,12 +7,11 @@ #include "console_esp32.h" #include "cpu.h" +#include "esp32.h" #include "error.h" #include "utils.h" -#define NEOPIXELS_PIN 25 - console_esp32::console_esp32(std::atomic_uint32_t *const stop_event, std::vector & io_ports, const int t_width, const int t_height) : console(stop_event, t_width, t_height), io_ports(io_ports) @@ -62,7 +61,7 @@ void console_esp32::refresh_virtual_terminal() void console_esp32::panel_update_thread() { -#if !defined(BUILD_FOR_RP2040) +#if !defined(BUILD_FOR_RP2040) && defined(NEOPIXELS_PIN) Serial.println(F("panel task started")); cpu *const c = b->getCpu(); diff --git a/ESP32/esp32.h b/ESP32/esp32.h index d86ddca..08ee59e 100644 --- a/ESP32/esp32.h +++ b/ESP32/esp32.h @@ -1,4 +1,4 @@ -// (C) 2018-2023 by Folkert van Heusden +// (C) 2018-2024 by Folkert van Heusden // Released under MIT license #pragma once @@ -12,3 +12,5 @@ #define SD_FAT_TYPE 1 #include #endif + +// #define NEOPIXELS_PIN 24 diff --git a/ESP32/main.ino b/ESP32/main.ino index b70f523..395dc84 100644 --- a/ESP32/main.ino +++ b/ESP32/main.ino @@ -323,7 +323,6 @@ void setup() { rl02_dev->begin(); b->add_rl02(rl02_dev); - Serial.println(F("Init TTY")); tty_ = new tty(cnsl, b); Serial.println(F("Connect TTY to bus")); From 848ea620259fc63c9bdb27ec2259ac9be73f9281 Mon Sep 17 00:00:00 2001 From: folkert van heusden Date: Tue, 30 Apr 2024 20:22:47 +0200 Subject: [PATCH 15/17] tweaks to make PSRAM work --- ESP32/esp32.h | 3 +++ ESP32/main.ino | 12 ++++++++---- ESP32/platformio.ini | 15 +++++++++++++++ debugger.cpp | 4 ++++ memory.cpp | 2 +- 5 files changed, 31 insertions(+), 5 deletions(-) diff --git a/ESP32/esp32.h b/ESP32/esp32.h index 08ee59e..39e0813 100644 --- a/ESP32/esp32.h +++ b/ESP32/esp32.h @@ -14,3 +14,6 @@ #endif // #define NEOPIXELS_PIN 24 + +// #define CONSOLE_SERIAL_RX 16 +// #define CONSOLE_SERIAL_TX 17 diff --git a/ESP32/main.ino b/ESP32/main.ino index 395dc84..f11b4b5 100644 --- a/ESP32/main.ino +++ b/ESP32/main.ino @@ -52,7 +52,7 @@ constexpr const char SERIAL_CFG_FILE[] = "/serial.json"; #if defined(BUILD_FOR_RP2040) #define Serial_RS232 Serial1 -#else +#elif defined(CONSOLE_SERIAL_RX) HardwareSerial Serial_RS232(1); #endif @@ -202,6 +202,7 @@ void recall_configuration(console *const cnsl) } #endif +#if defined(CONSOLE_SERIAL_RX) void set_tty_serial_speed(console *const c, const uint32_t bps) { Serial_RS232.begin(bps); @@ -209,6 +210,7 @@ void set_tty_serial_speed(console *const c, const uint32_t bps) if (save_serial_speed_configuration(bps) == false) c->put_string_lf("Failed to store configuration file with serial settings"); } +#endif #if defined(ESP32) void heap_caps_alloc_failed_hook(size_t requested_size, uint32_t caps, const char *function_name) @@ -296,14 +298,16 @@ void setup() { Serial.print(bitrate); Serial.println(F("bps")); -#if !defined(BUILD_FOR_RP2040) - Serial_RS232.begin(bitrate, hwSerialConfig, 16, 17); +#if !defined(BUILD_FOR_RP2040) && defined(CONSOLE_SERIAL_RX) + Serial_RS232.begin(bitrate, hwSerialConfig, CONSOLE_SERIAL_RX, CONSOLE_SERIAL_TX); Serial_RS232.setHwFlowCtrlMode(0); -#endif Serial_RS232.println(F("\014Console enabled on TTY")); std::vector serial_ports { &Serial_RS232, &Serial }; +#else + std::vector serial_ports { &Serial }; +#endif #if defined(SHA2017) cnsl = new console_shabadge(&stop_event, serial_ports); #elif defined(ESP32) || defined(BUILD_FOR_RP2040) diff --git a/ESP32/platformio.ini b/ESP32/platformio.ini index e44c199..edc8d7a 100644 --- a/ESP32/platformio.ini +++ b/ESP32/platformio.ini @@ -50,3 +50,18 @@ lib_deps = greiman/SdFat@^2.1.2 build_flags = -std=gnu++17 -DESP32=1 -ggdb3 -D_GLIBCXX_USE_C99 -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue -DCONFIG_SPIRAM_USE_MALLOC build_unflags = -std=gnu++11 extra_scripts = pre:prepare.py + +[env:adafruit_qtpy_esp32s3_n4r2] +platform = espressif32 +board = adafruit_qtpy_esp32s3_n4r2 +build_src_filter = +<*> -<.git/> -<.svn/> - - - - - - - - +framework = arduino +monitor_speed = 115200 +upload_speed = 1000000 +board_build.filesystem = littlefs +lib_deps = greiman/SdFat@^2.1.2 + adafruit/Adafruit NeoPixel + bblanchon/ArduinoJson@^6.19.4 +build_flags = -std=gnu++17 -DESP32=1 -ggdb3 -D_GLIBCXX_USE_C99 -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue -DCONFIG_SPIRAM_USE_MALLOC +build_unflags = -std=gnu++11 +extra_scripts = pre:prepare.py diff --git a/debugger.cpp b/debugger.cpp index ba3cd07..129c446 100644 --- a/debugger.cpp +++ b/debugger.cpp @@ -843,6 +843,7 @@ void debugger(console *const cnsl, bus *const b, std::atomic_uint32_t *const sto continue; } +#if defined(CONSOLE_SERIAL_RX) else if (parts.at(0) == "serspd") { if (parts.size() == 2) { uint32_t speed = std::stoi(parts.at(1), nullptr, 10); @@ -856,6 +857,7 @@ void debugger(console *const cnsl, bus *const b, std::atomic_uint32_t *const sto continue; } +#endif #endif else if (cmd == "stats") { show_run_statistics(cnsl, c); @@ -1022,7 +1024,9 @@ void debugger(console *const cnsl, bus *const b, std::atomic_uint32_t *const sto "cfgnet - configure network (e.g. WiFi)", "startnet - start network", "chknet - check network status", +#if defined(CONSOLE_SERIAL_RX) "serspd - set serial speed in bps (8N1 are default)", +#endif "debug - debugging info", #endif "cfgdisk - configure disk", diff --git a/memory.cpp b/memory.cpp index 6d205f3..d50beb5 100644 --- a/memory.cpp +++ b/memory.cpp @@ -14,7 +14,7 @@ memory::memory(const uint32_t size): size(size) Serial.print(F("Memory size (in bytes, decimal): ")); Serial.println(size); - if (size > 12 * 8192 && psramFound()) { + if (psramFound()) { Serial.println(F("Using PSRAM")); m = reinterpret_cast(ps_malloc(size)); From 8e081ac852e8626b0e8f6007149000ade72f0907 Mon Sep 17 00:00:00 2001 From: folkert van heusden Date: Tue, 30 Apr 2024 20:26:21 +0200 Subject: [PATCH 16/17] allocated PSRAM size calculation fix --- debugger.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debugger.cpp b/debugger.cpp index 129c446..213b2e7 100644 --- a/debugger.cpp +++ b/debugger.cpp @@ -868,7 +868,7 @@ void debugger(console *const cnsl, bus *const b, std::atomic_uint32_t *const sto if (parts.size() == 2) b->set_memory_size(std::stoi(parts.at(1))); else { - int n_pages = b->getRAM()->get_memory_size(); + int n_pages = b->getRAM()->get_memory_size() / 8192; cnsl->put_string_lf(format("Memory size: %u pages or %u kB (decimal)", n_pages, n_pages * 8192 / 1024)); } From 9e57f3e1c88b2f677b3c3862b1ba2b66af0cd8ad Mon Sep 17 00:00:00 2001 From: folkert van heusden Date: Tue, 30 Apr 2024 21:09:19 +0200 Subject: [PATCH 17/17] "tricks" to make wifi work on de esp32 s3 --- ESP32/main.ino | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ESP32/main.ino b/ESP32/main.ino index f11b4b5..911e3a5 100644 --- a/ESP32/main.ino +++ b/ESP32/main.ino @@ -125,9 +125,11 @@ void set_hostname() void configure_network(console *const c) { + WiFi.disconnect(); + WiFi.persistent(true); WiFi.setAutoReconnect(true); - + WiFi.useStaticBuffers(true); WiFi.mode(WIFI_STA); c->put_string_lf("Scanning for wireless networks..."); @@ -159,7 +161,7 @@ void wait_network(console *const c) int i = 0; - while (WiFi.waitForConnectResult() != WL_CONNECTED && i < timeout) { + while (WiFi.status() != WL_CONNECTED && i < timeout) { c->put_string("."); delay(1000 / 3); @@ -184,7 +186,7 @@ void start_network(console *const c) set_hostname(); WiFi.mode(WIFI_STA); - + WiFi.useStaticBuffers(true); WiFi.begin(); wait_network(c);