debugging support :) over gdbstub
This commit is contained in:
parent
c8938f4b36
commit
1d7f2f368b
@ -35,8 +35,5 @@ upload_port = <IPADRESS>
|
||||
upload_flags =
|
||||
--port=8266
|
||||
--auth=admin
|
||||
|
||||
lib_deps =
|
||||
ottowinter/PCA9685 16-Channel PWM Driver Module Library @ 1.2.9
|
||||
```
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
import os, gzip
|
||||
# https://www.mischianti.org/2020/10/26/web-server-with-esp8266-and-esp32-byte-array-gzipped-pages-and-spiffs-2/
|
21
doku.md
21
doku.md
@ -2,3 +2,24 @@ Hardware Timer didnt work https://github.com/khoih-prog/ESP8266TimerInterrupt#wh
|
||||
|
||||
=> Software Timer https://ullisroboterseite.de/esp8266-timing.html#timer
|
||||
|
||||
|
||||
|
||||
|
||||
### __Zum aktivieren von GDBStub:__
|
||||
```c
|
||||
#include <GDBStub.h>
|
||||
|
||||
...
|
||||
|
||||
void setup() {
|
||||
Serial.begin(460800);
|
||||
gdbstub_init();
|
||||
```
|
||||
|
||||
### __Achtung !__
|
||||
GDB muss dafür compiled werden
|
||||
GDB-Version aus Arduino Toolchain hat Support
|
||||
|
||||
```sh
|
||||
$ ./start_xtensa_gdb_stub.sh
|
||||
```
|
37
include/httpserver.h
Normal file
37
include/httpserver.h
Normal file
@ -0,0 +1,37 @@
|
||||
#ifndef __HTTPSERVER_H
|
||||
#define __HTTPSERVER_H
|
||||
|
||||
#include <ESP8266WebServer.h>
|
||||
|
||||
class HTTPServer {
|
||||
private:
|
||||
int port;
|
||||
ESP8266WebServer* server;
|
||||
|
||||
public:
|
||||
HTTPServer(int port) {
|
||||
server = new ESP8266WebServer;
|
||||
|
||||
// server->on("/", handleRootGz);
|
||||
// server->on("/style.css", handleCssGz);
|
||||
// server->on("/favicon.png", handleFaviconGz);
|
||||
// server->onNotFound(handleNotFound);
|
||||
|
||||
server->begin(port);
|
||||
}
|
||||
~HTTPServer() {
|
||||
server->stop();
|
||||
delete server;
|
||||
}
|
||||
|
||||
void initialize() {
|
||||
server->begin(port);
|
||||
}
|
||||
|
||||
void handleClient() {
|
||||
server->handleClient();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#endif // __HTTPSERVER_H
|
17
scripts/gdboptions
Normal file
17
scripts/gdboptions
Normal file
@ -0,0 +1,17 @@
|
||||
set remote hardware-breakpoint-limit 1
|
||||
set remote hardware-watchpoint-limit 1
|
||||
set remote interrupt-on-connect on
|
||||
set remote kill-packet off
|
||||
set remote symbol-lookup-packet off
|
||||
set remote verbose-resume-packet off
|
||||
mem 0x20000000 0x3fefffff ro cache
|
||||
mem 0x3ff00000 0x3fffffff rw
|
||||
mem 0x40000000 0x400fffff ro cache
|
||||
mem 0x40100000 0x4013ffff rw cache
|
||||
mem 0x40140000 0x5fffffff ro cache
|
||||
mem 0x60000000 0x60001fff rw
|
||||
set serial baud 460800
|
||||
|
||||
file .pio/build/debug/firmware.elf
|
||||
target remote /dev/ttyUSB0
|
||||
thb loop
|
29
src/main.cpp
29
src/main.cpp
@ -1,17 +1,19 @@
|
||||
#include <Arduino.h>
|
||||
#ifdef WITH_GDB_STUB
|
||||
|
||||
// debugging support via GDBStub over UART
|
||||
#ifdef WITH_DEBUGGING_ON
|
||||
#include <GDBStub.h>
|
||||
#endif
|
||||
|
||||
// #include <Wire.h>
|
||||
#include "PCA9685.h"
|
||||
extern "C" {
|
||||
#include "user_interface.h"
|
||||
}
|
||||
|
||||
#define ESP12_LED 2
|
||||
#define NODEMCU_LED 16
|
||||
|
||||
extern "C" {
|
||||
#include "user_interface.h"
|
||||
}
|
||||
|
||||
os_timer_t Timer1; // Verwaltungsstruktur des Timers
|
||||
|
||||
int c;
|
||||
@ -46,9 +48,9 @@ void timerCallback(void *pArg)
|
||||
#include <ESP8266WebServer.h>
|
||||
#include <WiFiClient.h>
|
||||
|
||||
// #include "index.html.gz.h"
|
||||
// #include "style.css.gz.h"
|
||||
// #include "favicon.png.gz.h"
|
||||
#include "index.html.gz.h"
|
||||
#include "style.css.gz.h"
|
||||
#include "favicon.png.gz.h"
|
||||
// images are possible
|
||||
// maybe check out FS <- SPIFFS
|
||||
|
||||
@ -69,21 +71,18 @@ PCA9685 pwmController;
|
||||
void handleRootGz() {
|
||||
const char* dataType = "text/html";
|
||||
server.sendHeader(F("Content-Encoding"), F("gzip"));
|
||||
server.send(404, dataType, "debug");
|
||||
// server.send(200, dataType, (const char*)index_html_gz, index_html_gz_len);
|
||||
server.send(200, dataType, (const char*)index_html_gz, index_html_gz_len);
|
||||
}
|
||||
|
||||
void handleCssGz() {
|
||||
const char* dataType = "text/css";
|
||||
server.sendHeader(F("Content-Encoding"), F("gzip"));
|
||||
server.send(404, dataType, "debug");
|
||||
// server.send(200, dataType, (const char*)style_css_gz, style_css_gz_len);
|
||||
server.send(200, dataType, (const char*)style_css_gz, style_css_gz_len);
|
||||
}
|
||||
void handleFaviconGz() {
|
||||
const char* dataType = "image/png";
|
||||
server.sendHeader(F("Content-Encoding"), F("gzip"));
|
||||
server.send(404, dataType, "debug");
|
||||
// server.send(200, dataType, (const char*)favicon_png_gz, favicon_png_gz_len);
|
||||
server.send(200, dataType, (const char*)favicon_png_gz, favicon_png_gz_len);
|
||||
}
|
||||
|
||||
void handleNotFound() {
|
||||
@ -184,7 +183,7 @@ void setup_pwm_pca9685() {
|
||||
}
|
||||
|
||||
void setup() {
|
||||
#ifdef WITH_GDB_STUB
|
||||
#ifdef WITH_DEBUGGING_ON
|
||||
Serial.begin(460800);
|
||||
gdbstub_init();
|
||||
#else
|
||||
|
6
start_xtensa_gdb_stub.sh
Executable file
6
start_xtensa_gdb_stub.sh
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
GDB_PATH=~/.arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.0.0-newlib4.0.0-gnu23-48f7b08/bin/xtensa-lx106-elf-gdb
|
||||
|
||||
cd ..
|
||||
echo "Starting gdb"
|
||||
$GDB_PATH -x scripts/gdboptions
|
@ -8,14 +8,18 @@
|
||||
; Please visit documentation for the other options and examples
|
||||
; https://docs.platformio.org/page/projectconf.html
|
||||
|
||||
[env:esp01_1m]
|
||||
[env]
|
||||
platform = espressif8266
|
||||
board = esp01_1m
|
||||
board = nodemcuv2
|
||||
framework = arduino
|
||||
monitor_speed = 115200
|
||||
|
||||
extra_scripts = pre:extra_script.py
|
||||
|
||||
[env:serial]
|
||||
upload_protocol = esptool
|
||||
upload_speed = 921600
|
||||
|
||||
[env:ota]
|
||||
; stuff for OTA
|
||||
; https://docs.platformio.org/en/latest/platforms/espressif8266.html#over-the-air-ota-update
|
||||
upload_protocol = espota
|
||||
@ -24,5 +28,12 @@ upload_flags =
|
||||
--port=8266
|
||||
--auth=admin
|
||||
|
||||
lib_deps =
|
||||
ottowinter/PCA9685 16-Channel PWM Driver Module Library @ 1.2.9
|
||||
[env:debug]
|
||||
build_flags = -DWITH_DEBUGGING_ON -Os -g3 -ggdb3
|
||||
upload_protocol = esptool
|
||||
upload_speed = 921600
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user