From 8432ba3ea11174446fde21e05c4210a5a47cf29d Mon Sep 17 00:00:00 2001 From: folkert van heusden Date: Sat, 8 Apr 2023 00:45:00 +0200 Subject: [PATCH] /dev/ttyACM0 appears --- ESP32/console_esp32.cpp | 3 ++- ESP32/main.ino | 25 +++++++++++++++++-------- RP2040/console_esp32.cpp | 1 + RP2040/console_esp32.h | 1 + RP2040/platformio.ini | 12 +++++------- 5 files changed, 26 insertions(+), 16 deletions(-) create mode 120000 RP2040/console_esp32.cpp create mode 120000 RP2040/console_esp32.h diff --git a/ESP32/console_esp32.cpp b/ESP32/console_esp32.cpp index d4026dd..3bd5de3 100644 --- a/ESP32/console_esp32.cpp +++ b/ESP32/console_esp32.cpp @@ -3,7 +3,6 @@ #include #include -#include #include #include "console_esp32.h" @@ -62,6 +61,7 @@ void console_esp32::refresh_virtual_terminal() void console_esp32::panel_update_thread() { +#if !defined(BUILD_FOR_RP2040) Serial.println(F("panel task started")); cpu *const c = b->getCpu(); @@ -140,4 +140,5 @@ void console_esp32::panel_update_thread() put_string_lf("Unknown exception in panel thread"); } } +#endif } diff --git a/ESP32/main.ino b/ESP32/main.ino index 5d2794d..72a9c2d 100644 --- a/ESP32/main.ino +++ b/ESP32/main.ino @@ -4,7 +4,9 @@ #include #include #include +#if !defined(BUILD_FOR_RP2040) #include +#endif #include #if defined(BUILD_FOR_RP2040) #include @@ -12,7 +14,9 @@ #include #include #include -#if !defined(BUILD_FOR_RP2040) +#if defined(BUILD_FOR_RP2040) +//#include +#else #include #include #include @@ -21,7 +25,7 @@ #if defined(SHA2017) #include "console_shabadge.h" -#elif !defined(BUILD_FOR_RP2040) +#else #include "console_esp32.h" #endif #include "cpu.h" @@ -51,7 +55,7 @@ constexpr const char SERIAL_CFG_FILE[] = "/serial.json"; StaticJsonDocument json_doc; #if defined(BUILD_FOR_RP2040) -#define Serial_RS232 Serial2 +#define Serial_RS232 Serial1 #else HardwareSerial Serial_RS232(1); #endif @@ -506,10 +510,14 @@ void set_tty_serial_speed(console *const c, const uint32_t bps) c->put_string_lf("Failed to store configuration file with serial settings"); } -void setup() -{ +void setup() { Serial.begin(115200); + while(!Serial) + delay(100); + + Serial.println("..."); + Serial.println(F("This PDP-11 emulator is called \"kek\" (reason for that is forgotten) and was written by Folkert van Heusden.")); Serial.println(F("Build on: " __DATE__ " " __TIME__)); @@ -563,10 +571,8 @@ void setup() std::vector serial_ports { &Serial_RS232, &Serial }; #if defined(SHA2017) cnsl = new console_shabadge(&stop_event, b, serial_ports); -#elif defined(ESP32) +#elif defined(ESP32) || defined(BUILD_FOR_RP2040) cnsl = new console_esp32(&stop_event, b, serial_ports, 80, 25); -#elif defined(BUILD_FOR_RP2040) - // FIXME #endif Serial.println(F("Start line-frequency interrupt")); @@ -579,9 +585,12 @@ void setup() Serial.println(F("Connect TTY to bus")); b->add_tty(tty_); +#if !defined(BUILD_FOR_RP2040) // FIXME: led ring Serial.println(F("Starting panel")); xTaskCreate(&console_thread_wrapper_panel, "panel", 2048, cnsl, 1, nullptr); +#endif + Serial.println(F("Starting I/O")); xTaskCreate(&console_thread_wrapper_io, "c-io", 2048, cnsl, 1, nullptr); #if !defined(BUILD_FOR_RP2040) diff --git a/RP2040/console_esp32.cpp b/RP2040/console_esp32.cpp new file mode 120000 index 0000000..eccd018 --- /dev/null +++ b/RP2040/console_esp32.cpp @@ -0,0 +1 @@ +../ESP32/console_esp32.cpp \ No newline at end of file diff --git a/RP2040/console_esp32.h b/RP2040/console_esp32.h new file mode 120000 index 0000000..1c28338 --- /dev/null +++ b/RP2040/console_esp32.h @@ -0,0 +1 @@ +../ESP32/console_esp32.h \ No newline at end of file diff --git a/RP2040/platformio.ini b/RP2040/platformio.ini index e2f24c4..85aead2 100644 --- a/RP2040/platformio.ini +++ b/RP2040/platformio.ini @@ -9,10 +9,8 @@ platform = https://github.com/maxgerhardt/platform-raspberrypi.git board = pico framework = arduino board_build.core = earlephilhower -monitor_speed = 115200 -upload_speed = 1000000 -lib_deps = adafruit/Adafruit NeoPixel@^1.10.4 - bblanchon/ArduinoJson@^6.19.4 -build_flags = -std=gnu++17 -Ofast -DBUILD_FOR_RP2040=1 -ggdb3 -DPIO_FRAMEWORK_ARDUINO_ENABLE_EXCEPTIONS -#-D_GLIBCXX_USE_C99 -build_unflags = -std=gnu++14 -Os +board_build.filesystem_size = 0.2m +lib_deps = bblanchon/ArduinoJson@^6.19.4 + adafruit/Adafruit NeoPixel@^1.10.4 +build_flags = -Ofast -DBUILD_FOR_RP2040=1 -DPIO_FRAMEWORK_ARDUINO_ENABLE_EXCEPTIONS -DPICO_STDIO_USB=1 -DDEBUG_RP2040_PORT=Serial -DDEBUG_RP2040_CORE +build_unflags = -Os