Merge branch 'master' into RP06
This commit is contained in:
commit
f967d63913
5 changed files with 34 additions and 4 deletions
|
@ -108,7 +108,7 @@ void console_esp32::panel_update_thread()
|
||||||
pixels.show();
|
pixels.show();
|
||||||
|
|
||||||
while(!stop_panel) {
|
while(!stop_panel) {
|
||||||
vTaskDelay(20 / portTICK_PERIOD_MS);
|
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// note that these are approximately as there's no mutex on the emulation
|
// note that these are approximately as there's no mutex on the emulation
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#endif
|
#endif
|
||||||
#if defined(ESP32)
|
#if defined(ESP32)
|
||||||
|
#include "esp_clk.h"
|
||||||
#include "esp_heap_caps.h"
|
#include "esp_heap_caps.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -269,6 +270,8 @@ void setup() {
|
||||||
cs->println(format("GIT hash: %s", version_str));
|
cs->println(format("GIT hash: %s", version_str));
|
||||||
cs->println("Build on: " __DATE__ " " __TIME__);
|
cs->println("Build on: " __DATE__ " " __TIME__);
|
||||||
|
|
||||||
|
cs->println(format("# cores: %d, CPU frequency: %d Hz", SOC_CPU_CORES_NUM, esp_clk_cpu_freq()));
|
||||||
|
|
||||||
#if defined(ESP32)
|
#if defined(ESP32)
|
||||||
heap_caps_register_failed_alloc_callback(heap_caps_alloc_failed_hook);
|
heap_caps_register_failed_alloc_callback(heap_caps_alloc_failed_hook);
|
||||||
#endif
|
#endif
|
||||||
|
|
15
console.cpp
15
console.cpp
|
@ -290,6 +290,21 @@ void console::put_char(const char c)
|
||||||
debug_buffer.clear();
|
debug_buffer.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (timestamps) {
|
||||||
|
char buffer[32] { };
|
||||||
|
uint64_t timestamp = get_us() - start_ts;
|
||||||
|
uint64_t seconds = timestamp / 1000000;
|
||||||
|
|
||||||
|
int len = snprintf(buffer, sizeof buffer, "%02d:%02d:%02d.%06d ",
|
||||||
|
int(seconds / 3600),
|
||||||
|
int((seconds / 60) % 60),
|
||||||
|
int(seconds % 60),
|
||||||
|
int(timestamp % 1000000));
|
||||||
|
|
||||||
|
for(int i=0; i<len; i++)
|
||||||
|
put_char_ll(buffer[i]);
|
||||||
|
}
|
||||||
|
|
||||||
ty++;
|
ty++;
|
||||||
}
|
}
|
||||||
else if (c == 8) { // backspace
|
else if (c == 8) { // backspace
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
#include "win32.h"
|
#include "win32.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -48,6 +50,8 @@ protected:
|
||||||
char *screen_buffer { nullptr };
|
char *screen_buffer { nullptr };
|
||||||
uint8_t tx { 0 };
|
uint8_t tx { 0 };
|
||||||
uint8_t ty { 0 };
|
uint8_t ty { 0 };
|
||||||
|
std::atomic_bool timestamps { false };
|
||||||
|
const uint64_t start_ts { get_us() };
|
||||||
|
|
||||||
const size_t n_edit_lines_hist { 8 }; // maximum number of previous edit-lines
|
const size_t n_edit_lines_hist { 8 }; // maximum number of previous edit-lines
|
||||||
std::vector<std::string> edit_lines_hist;
|
std::vector<std::string> edit_lines_hist;
|
||||||
|
@ -75,6 +79,8 @@ public:
|
||||||
std::string read_line(const std::string & prompt);
|
std::string read_line(const std::string & prompt);
|
||||||
void flush_input();
|
void flush_input();
|
||||||
|
|
||||||
|
void enable_timestamp(const bool state) { timestamps = state; }
|
||||||
|
|
||||||
void emit_backspace();
|
void emit_backspace();
|
||||||
void put_char(const char c);
|
void put_char(const char c);
|
||||||
void put_string(const std::string & what);
|
void put_string(const std::string & what);
|
||||||
|
|
12
debugger.cpp
12
debugger.cpp
|
@ -71,7 +71,7 @@ std::optional<disk_backend *> select_nbd_server(console *const cnsl)
|
||||||
if (port_str.empty())
|
if (port_str.empty())
|
||||||
return { };
|
return { };
|
||||||
|
|
||||||
disk_backend *d = new disk_backend_nbd(hostname, atoi(port_str.c_str()));
|
disk_backend *d = new disk_backend_nbd(hostname, std::stoi(port_str));
|
||||||
if (d->begin(false) == false) {
|
if (d->begin(false) == false) {
|
||||||
cnsl->put_string_lf("Cannot initialize NBD client");
|
cnsl->put_string_lf("Cannot initialize NBD client");
|
||||||
delete d;
|
delete d;
|
||||||
|
@ -749,7 +749,7 @@ void debugger(console *const cnsl, bus *const b, std::atomic_uint32_t *const sto
|
||||||
single_step = true;
|
single_step = true;
|
||||||
|
|
||||||
if (parts.size() == 2)
|
if (parts.size() == 2)
|
||||||
n_single_step = atoi(parts[1].c_str());
|
n_single_step = std::stoi(parts[1]);
|
||||||
else
|
else
|
||||||
n_single_step = 1;
|
n_single_step = 1;
|
||||||
|
|
||||||
|
@ -915,7 +915,7 @@ void debugger(console *const cnsl, bus *const b, std::atomic_uint32_t *const sto
|
||||||
cnsl->put_string_lf("parameter missing");
|
cnsl->put_string_lf("parameter missing");
|
||||||
else {
|
else {
|
||||||
uint32_t addr = std::stoi(parts[1], nullptr, 8);
|
uint32_t addr = std::stoi(parts[1], nullptr, 8);
|
||||||
int n = parts.size() == 4 ? atoi(parts[3].c_str()) : 1;
|
int n = parts.size() == 4 ? std::stoi(parts[3]) : 1;
|
||||||
|
|
||||||
if (parts[2] != "p" && parts[2] != "v") {
|
if (parts[2] != "p" && parts[2] != "v") {
|
||||||
cnsl->put_string_lf("expected p (physical address) or v (virtual address)");
|
cnsl->put_string_lf("expected p (physical address) or v (virtual address)");
|
||||||
|
@ -1082,6 +1082,11 @@ void debugger(console *const cnsl, bus *const b, std::atomic_uint32_t *const sto
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
else if (parts[0] == "pts" && parts.size() == 2) {
|
||||||
|
cnsl->enable_timestamp(std::stoi(parts[1]));
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
else if (cmd == "qi") {
|
else if (cmd == "qi") {
|
||||||
show_queued_interrupts(cnsl, c);
|
show_queued_interrupts(cnsl, c);
|
||||||
|
|
||||||
|
@ -1183,6 +1188,7 @@ void debugger(console *const cnsl, bus *const b, std::atomic_uint32_t *const sto
|
||||||
"trace/t - toggle tracing",
|
"trace/t - toggle tracing",
|
||||||
"setll x,y - set loglevel: terminal,file",
|
"setll x,y - set loglevel: terminal,file",
|
||||||
"setsl x,y - set syslog target: requires a hostname and a loglevel",
|
"setsl x,y - set syslog target: requires a hostname and a loglevel",
|
||||||
|
"pts x - enable (1) / disable (0) timestamps",
|
||||||
"turbo - toggle turbo mode (cannot be interrupted)",
|
"turbo - toggle turbo mode (cannot be interrupted)",
|
||||||
"debug - enable CPU debug mode",
|
"debug - enable CPU debug mode",
|
||||||
"bt - show backtrace - need to enable debug first",
|
"bt - show backtrace - need to enable debug first",
|
||||||
|
|
Loading…
Add table
Reference in a new issue