From 8d20af475edcaff55d1a700b3ec13f40ec0c92f4 Mon Sep 17 00:00:00 2001 From: Rob Emery Date: Wed, 28 Oct 2026 11:23:14 +0000 Subject: [PATCH] Adding some instructions for using the sim, also improving the --help output to be more consistent --- README.md | 32 ++++++++++++++++++++++++++++---- tools/httpd_sim.py | 8 ++++---- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 25c0a02d..29a7061f 100644 --- a/README.md +++ b/README.md @@ -103,11 +103,11 @@ Build host tools only: docker run --rm -v $(pwd):/workspace rtlplayground-dev make -C tools ``` -Run the web-interface simulator locally: +Run the web-interface simulator through docker: ``` -docker run --rm -p 8080:8080 -v $(pwd):/workspace rtlplayground-dev \ - tools/output/httpd_sim /workspace/html +docker run --rm -p 8081:8081 -v $(pwd):/workspace rtlplayground-dev \ + tools/output/httpd_sim.py /workspace/html ``` Edit `config.txt` on your host, then re-run `make` — the @@ -362,7 +362,31 @@ session xxxx = Web session timeout in seconds (default 200) Enjoy playing! -## (11) Other documents +## (13) HTTP Simulator for front-end development + +The simulator is available in tools as `./httpd_sim.py` +By default it will serve the content in the current working directory so the easiest way to run this is to: +``` +cd ./html +../tools/httpd_sim.py +``` +And the simulator will be available on http://127.0.0.1:8081 + +There are commandline options available: +``` +usage: httpd_sim.py [-h] [--machine MACHINE] [--port PORT] [--bindaddr BINDADDR] [--verbose] + +options: + -h, --help show this help message and exit + --machine MACHINE path to machine.c or .h file to parse (optional) + --port PORT port to bind to (default 8081) + --bindaddr BINDADDR address to bind (default 127.0.0.1) + --verbose enable verbose output +``` + +The machine parsing is somewhat experimental. + +## (12) Other documents The following documents give further documentation on specific features of the RTL837x SoCs: - [Adding a new device](doc/adding-a-device.md) diff --git a/tools/httpd_sim.py b/tools/httpd_sim.py index f8b43b35..dc6816d1 100755 --- a/tools/httpd_sim.py +++ b/tools/httpd_sim.py @@ -707,10 +707,10 @@ def loadMachineConfig(filename): if __name__ == "__main__": parser = argparse.ArgumentParser() - parser.add_argument("--machine", default=None, help="Path to machine.c or .h file to parse") - parser.add_argument("--port", default=8081, type=int, help="Port to bind to") - parser.add_argument("--bindaddr", default="127.0.0.1", help="Address to bind") - parser.add_argument("--verbose", action="store_true", help="Enable verbose output") + parser.add_argument("--machine", default=None, help="path to machine.c or .h file to parse (optional)") + parser.add_argument("--port", default=8081, type=int, help="port to bind to (default 8081)") + parser.add_argument("--bindaddr", default="127.0.0.1", help="address to bind (default 127.0.0.1)") + parser.add_argument("--verbose", action="store_true", help="enable verbose output") args = parser.parse_args()