summaryrefslogtreecommitdiff
path: root/README.md
blob: 2982e559896987e40a878d9b528e8d2ff9bdd2ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# Building

Building requires cmake, make, an "arm-none-eabi" toolchain (including
newlib), and picotool (including the .cmake files;
eg. /usr/lib/cmake/picotool/*.cmake).

At the time of this writing, on Parabola GNU/Linux-libre that means:

 - make 4.4.1-2
 - cmake 3.30.3-1
 - arm-none-eabi-binutils 2.42-1
 - arm-none-eabi-gcc 14.1.0-1
 - arm-none-eabi-newlib 4.4.0.20231231-1
 - picotool 2.0.0-2

```bash
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Debug ..
make
```
# Debugging

UART:
- pin1: gpio0: TX (so connect it to your FTDI's RX)
- pin2: gpio1: RX (so connect it to your FTDI's TX)
- pin3: gnd (so connect it to your FTDI's GND)
- picocom --baud=115200 /dev/ttyUSB0

# Usage

The harness uses DHCP to acquire an IPv4 address, then serves the 9P
protocol over TCP:

 - TCP port: 564 (9P does not have a standard TCP port number, but
   this is the default port number used by most 9P-over-TCP clients,
   including the Linux kernel's v9fs driver).
 - Supported protocol versions:
   - `9P2000` (base protocol): Yes
   - `9P2000.u` (Unix extension): Yes, with Linux kernel
     architecture-"generic" errnos.  This will match the Linux kernel
     errnos on most architectures (but, as of Linux v6.7, not on
     Alpha, MIPS, PA-RISC, PowerPC, or SPARC; I am unsure whether on
     these platforms the kernel's v9fs filesystem driver will map the
     "generic" errnos to the architecture-specific errnos for you).
   - `9P2000.L` (Linux extension): No, it's an abomination and
     unlikely to ever be supported
   - `9P2000.e` (Erlang extension): No, but if you want it and ask
     nicely I'd be happy to add it (I'm not sure why you'd want it
     though).
 - Authentication: None

There are lots of 9P clients that you can use.  9P is a filesystem
protocol; and you can mount it directly with the the Linux kernel's
v9fs filesystem driver, with plan9port's `9pfuse`; or interact with it
without mounting it using the shell commands `9p` (from plan9port),
`wmiir`, `ixpc`; or interact with it without mounting it by using a
library for your programming language of choice.

Some notes on choosing a client:
 - On x86-32, the Linux kernel v9fs driver is known to drop entries
   from directory listings; I advise using 9pfuse instead of you want
   to mount it on 32-bit systems.
 - I generally like mounting it as a real filesystem, but this means
   that you only get errno errors, and the more-helpful error strings
   are discarded.
 - The sbc-harness only supports 8 concurrent connections to the 9P
   server, so while shell commands are handy for poking around, for
   real use where you're doing things in parallel you'll likely want
   to mount it or use a library that can reuse existing connections.

# Bugs/Limitations

 - Only supports 8 concurrent TCP connectsions to the 9P server (due
   to limitations in the W5500 TCP-offload chip; TODO: investigate
   using a software TCP/IP stack with the W5500 in MAC-raw mode)
 - Only supports 16 concurrent 9P requests (I wanted a static limit,
   and "connections*2" seemed reasonable)
 - Only supports IPv4, not IPv6 (due to limitations in the W5500
   TCP-offload chip; TODO: investigate upgrading to the W6100 or using
   a software TCP/IP stack with the W5500 in MAC-raw mode)