tweaks to make PSRAM work

This commit is contained in:
folkert van heusden 2024-04-30 20:22:47 +02:00
parent ff3e5ba604
commit 848ea62025
Signed by untrusted user who does not match committer: folkert
GPG key ID: 6B6455EDFEED3BD1
5 changed files with 31 additions and 5 deletions

View file

@ -14,3 +14,6 @@
#endif
// #define NEOPIXELS_PIN 24
// #define CONSOLE_SERIAL_RX 16
// #define CONSOLE_SERIAL_TX 17

View file

@ -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<Stream *> serial_ports { &Serial_RS232, &Serial };
#else
std::vector<Stream *> serial_ports { &Serial };
#endif
#if defined(SHA2017)
cnsl = new console_shabadge(&stop_event, serial_ports);
#elif defined(ESP32) || defined(BUILD_FOR_RP2040)

View file

@ -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/> -<example/> -<examples/> -<test/> -<tests/> -<build> -<player.cpp> -<SHAdisplay/> -<console_shabadge.cpp>
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

View file

@ -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",

View file

@ -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<uint8_t *>(ps_malloc(size));