- USB CDC 경로 복원: #define Serial Serial1 우회 제거 - rp2040js/avr8js/codemirror/xterm/monaco-editor vendor화 - /vendor 정적 라우팅 추가 (Express 5 catch-all 우회) - 부팅 완료 타임아웃 감지 (Serial 출력 없어도 8초 후 RAF 전환) - 리셋 시 Simulator 재생성으로 주변 장치 상태 초기화 - 시리얼 패널의 내부 메시지를 console.log로 이동
31 lines
1.0 KiB
JavaScript
31 lines
1.0 KiB
JavaScript
import { createServer } from 'net';
|
|
import { GDBConnection } from './gdb-connection.js';
|
|
import { GDBServer } from './gdb-server.js';
|
|
export class GDBTCPServer extends GDBServer {
|
|
constructor(target, port = 3333) {
|
|
super(target);
|
|
this.port = port;
|
|
this.socketServer = createServer();
|
|
this.socketServer.listen(port);
|
|
this.socketServer.on('connection', (socket) => this.handleConnection(socket));
|
|
}
|
|
handleConnection(socket) {
|
|
this.info('GDB connected');
|
|
socket.setNoDelay(true);
|
|
const connection = new GDBConnection(this, (data) => {
|
|
socket.write(data);
|
|
});
|
|
socket.on('data', (data) => {
|
|
connection.feedData(data.toString('utf-8'));
|
|
});
|
|
socket.on('error', (err) => {
|
|
this.removeConnection(connection);
|
|
this.error(`GDB socket error ${err}`);
|
|
});
|
|
socket.on('close', () => {
|
|
this.removeConnection(connection);
|
|
this.info('GDB disconnected');
|
|
});
|
|
}
|
|
}
|