RISC‑V firmware and tools for a UART‑over‑ESP8266 chat demo using a robust framed protocol (CRC16‑CCITT + byte stuffing). Includes a Python client for interacting over telnet.
Prereqs:
- RISC‑V toolchain (
riscv32-unknown-elf-*) dtekv-runand Inteljtagd
Commands:
make(ormake release) →build/main.binmake debug→ no optimizations, with symbolsmake run→ build + upload
Use the single protocol client:
python3 chat_client_protocol.py 192.168.4.1 [port]Notes:
- Frame:
[0xAA 0xAA][LEN][STUFFED_DATA]; unstuffed:[USER_ID][MESSAGE][CRC16](CRC over USER_ID+MESSAGE) - User IDs:
0x00= board,0x02= client (default) - Client drops frames with its own
USER_ID
src/boot.S— boot and trap handlerssrc/dtekv-lib.c— JTAG UART I/O, exceptions, interrupts, delaysrc/devices.c— LEDs, switches, button, 7‑seg, GPIOsrc/uart.c— bit‑banged UART: TX (busy‑wait + accurate timer), RX ISR + ring buffersrc/chat_protocol.c— CRC16‑CCITT and byte stuffingsrc/chat_framer.c— frame collection state machine (+timeout)src/main.c— app glue: use framer, validate, echo; BTN1 sends messageinclude/— headersPROTOCOL.md— protocol details (concise)chat_client_protocol.py— Python telnet client (protocol)
Client tips:
- Set user id:
--user-id 0x02(default). Use--user-id 0x00to act as board: send plaintext and let the board encrypt before echoing.