/dev/ttyACM0 appears

This commit is contained in:
folkert van heusden 2023-04-08 00:45:00 +02:00
parent 2b6de27c35
commit 8432ba3ea1
Signed by untrusted user who does not match committer: folkert
GPG key ID: 6B6455EDFEED3BD1
5 changed files with 26 additions and 16 deletions

View file

@ -3,7 +3,6 @@
#include <Adafruit_NeoPixel.h> #include <Adafruit_NeoPixel.h>
#include <stdio.h> #include <stdio.h>
#include <termios.h>
#include <unistd.h> #include <unistd.h>
#include "console_esp32.h" #include "console_esp32.h"
@ -62,6 +61,7 @@ void console_esp32::refresh_virtual_terminal()
void console_esp32::panel_update_thread() void console_esp32::panel_update_thread()
{ {
#if !defined(BUILD_FOR_RP2040)
Serial.println(F("panel task started")); Serial.println(F("panel task started"));
cpu *const c = b->getCpu(); cpu *const c = b->getCpu();
@ -140,4 +140,5 @@ void console_esp32::panel_update_thread()
put_string_lf("Unknown exception in panel thread"); put_string_lf("Unknown exception in panel thread");
} }
} }
#endif
} }

View file

@ -4,7 +4,9 @@
#include <Arduino.h> #include <Arduino.h>
#include <ArduinoJson.h> #include <ArduinoJson.h>
#include <atomic> #include <atomic>
#if !defined(BUILD_FOR_RP2040)
#include <HardwareSerial.h> #include <HardwareSerial.h>
#endif
#include <LittleFS.h> #include <LittleFS.h>
#if defined(BUILD_FOR_RP2040) #if defined(BUILD_FOR_RP2040)
#include <SD.h> #include <SD.h>
@ -12,7 +14,9 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#if !defined(BUILD_FOR_RP2040) #if defined(BUILD_FOR_RP2040)
//#include <pico/stdio_uart.h>
#else
#include <WiFi.h> #include <WiFi.h>
#include <sys/poll.h> #include <sys/poll.h>
#include <sys/socket.h> #include <sys/socket.h>
@ -21,7 +25,7 @@
#if defined(SHA2017) #if defined(SHA2017)
#include "console_shabadge.h" #include "console_shabadge.h"
#elif !defined(BUILD_FOR_RP2040) #else
#include "console_esp32.h" #include "console_esp32.h"
#endif #endif
#include "cpu.h" #include "cpu.h"
@ -51,7 +55,7 @@ constexpr const char SERIAL_CFG_FILE[] = "/serial.json";
StaticJsonDocument<MAX_CFG_SIZE> json_doc; StaticJsonDocument<MAX_CFG_SIZE> json_doc;
#if defined(BUILD_FOR_RP2040) #if defined(BUILD_FOR_RP2040)
#define Serial_RS232 Serial2 #define Serial_RS232 Serial1
#else #else
HardwareSerial Serial_RS232(1); HardwareSerial Serial_RS232(1);
#endif #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"); c->put_string_lf("Failed to store configuration file with serial settings");
} }
void setup() void setup() {
{
Serial.begin(115200); 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("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__)); Serial.println(F("Build on: " __DATE__ " " __TIME__));
@ -563,10 +571,8 @@ void setup()
std::vector<Stream *> serial_ports { &Serial_RS232, &Serial }; std::vector<Stream *> serial_ports { &Serial_RS232, &Serial };
#if defined(SHA2017) #if defined(SHA2017)
cnsl = new console_shabadge(&stop_event, b, serial_ports); 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); cnsl = new console_esp32(&stop_event, b, serial_ports, 80, 25);
#elif defined(BUILD_FOR_RP2040)
// FIXME
#endif #endif
Serial.println(F("Start line-frequency interrupt")); Serial.println(F("Start line-frequency interrupt"));
@ -579,9 +585,12 @@ void setup()
Serial.println(F("Connect TTY to bus")); Serial.println(F("Connect TTY to bus"));
b->add_tty(tty_); b->add_tty(tty_);
#if !defined(BUILD_FOR_RP2040) // FIXME: led ring
Serial.println(F("Starting panel")); Serial.println(F("Starting panel"));
xTaskCreate(&console_thread_wrapper_panel, "panel", 2048, cnsl, 1, nullptr); 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); xTaskCreate(&console_thread_wrapper_io, "c-io", 2048, cnsl, 1, nullptr);
#if !defined(BUILD_FOR_RP2040) #if !defined(BUILD_FOR_RP2040)

1
RP2040/console_esp32.cpp Symbolic link
View file

@ -0,0 +1 @@
../ESP32/console_esp32.cpp

1
RP2040/console_esp32.h Symbolic link
View file

@ -0,0 +1 @@
../ESP32/console_esp32.h

View file

@ -9,10 +9,8 @@ platform = https://github.com/maxgerhardt/platform-raspberrypi.git
board = pico board = pico
framework = arduino framework = arduino
board_build.core = earlephilhower board_build.core = earlephilhower
monitor_speed = 115200 board_build.filesystem_size = 0.2m
upload_speed = 1000000 lib_deps = bblanchon/ArduinoJson@^6.19.4
lib_deps = adafruit/Adafruit NeoPixel@^1.10.4 adafruit/Adafruit NeoPixel@^1.10.4
bblanchon/ArduinoJson@^6.19.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_flags = -std=gnu++17 -Ofast -DBUILD_FOR_RP2040=1 -ggdb3 -DPIO_FRAMEWORK_ARDUINO_ENABLE_EXCEPTIONS build_unflags = -Os
#-D_GLIBCXX_USE_C99
build_unflags = -std=gnu++14 -Os