Skip to content

Pico Computer 3 - Fuzix v0.19 - networking, and room to breathe

Choose a tag to compare

@UKTailwind UKTailwind released this 21 Aug 14:44
· 0 commits to master since this release

The machine has networking, the CORE0 STALLED lockup is fixed, every
program has more room, and it boots itself. (v0.18 was tagged but never
announced; everything since v0.17 is described here.)

The machine has networking

Wi-Fi through the CYW43 radio, DHCP, TCP/IP, DNS, and TLS that checks
certificates. Built on Fuzix's own socket layer with lwIP under it. Put
your network in /etc/wifi.conf, run wifi -f, and the machine is on
the internet.

wifi join, report, disconnect
ping ICMP, with round-trip times
ntpdate set the clock from the internet
dig look up a name
htget fetch over HTTP
tlsget fetch over TLS
tlsca load the CA bundle, so TLS authenticates
httpd serve a directory

lwIP's memory lives in PSRAM, so the packet buffers cost the process
pool nothing. What every program does pay is one 4 KB block, for
the larger kernel stack a TLS handshake needs. Loopback works, so a
program can talk to a server on the same board.

TLS is encrypted but not authenticated until you load a bundle. Run
tlsca /etc/ca.pem — ten roots ship on the card, covering Let's
Encrypt, Google, DigiCert, Amazon, SSL.com and Sectigo (including the
older SSL.com ECC root that Cloudflare's 1.1.1.1 actually chains to).
Set the clock first: certificate validity is checked against it, and a
machine that thinks it is 1970 rejects everything on the internet.

One kernel. Networking is always built in; whether a machine gets
on a network is a question for /etc/wifi.conf. On a Pico
Computer 2
the radio is never powered — those pins are that board's
SD chip select and LED — and wifi says no radio (Pico Computer 2).

BASIC cannot reach the network yet. mmbc does not translate
MMBasic's WEB commands in this release; that is the next piece of
work. Everything above is available from the # prompt and from C.

The CORE0 STALLED lockup is fixed — in these binaries

The long-standing hard lockup, where the machine stops dead and core1
reports CORE0 STALLED with the reset button the only way out, is
fixed here. It was a deadlock in the console output path: lineedit's
put() spun waiting for room in the transmit ring from inside the
timer tick, with interrupts masked — so the only things that could
drain the ring could never run. Any echo or redraw burst bigger than
256 bytes hung the machine; a long history line and two arrow keys
reproduced it every time. The write-up is in
Kernel/platform/platform-rpipico/NOTES-CORE0-STALL.md.

Every program has about 24 KB more room

bcrun — the shared floor under every compiled program, BASIC and C
alike — lost a fifth of its size. The runtime families that are pure
computation (SORT, whole-array operations and MATH(),
LONGSTRING, DATA/READ, date and time, GOSUB, and friends) now
compile into the program that uses them, the way the drawing
primitives always have. Nothing a program can observe changed — the
test suite is byte-identical on the hardware.

Recompile old .bc files. One built by an earlier mmbc is
refused by name at load (no runtime function "mm_..."); mmbc prog.bas then cc prog.c and it runs — and a freshly built program
also runs on older systems, so the constraint only points backwards.

The machine boots itself

The bootdev: prompt had exactly one sensible answer, so the kernel
now gives it: power on and the machine arrives at login:. Hold any
key during boot to get the prompt back; if the automatic mount fails,
it appears by itself.

The flash filesystem is gone

It was never a release asset, and it pinned kernel RAM in place —
code cannot execute from a device it is erasing. The SD card is hda
now (root hda2), where it used to be hdb: if you kept scripts or
notes that name hdb, they mean hda now. Swap is a PSRAM disc and
costs the card nothing.

Three older bugs, none of them networking bugs

  • SIGTERM was never delivered to a process looping in the
    kernel — and killall leaving processes alive is why the filesystem
    kept going down dirty.
  • A socket inode never recorded which socket it was. Any program
    holding two at once destroyed its own listener on the first
    connection: every server was broken, and every client worked by luck.
  • htget saved chunked replies with the HTTP framing still in the
    file.

The first two are in Fuzix's core, shared with every port, and are
upstream candidates.

Documentation

Both manuals gain a Networking chapter — the user manual on setting a
machine up and using it, the C manual on sockets, the radio ioctls and
TLS. The C manual also documents the new per-family runtime headers.

Installing

Flash fuzix.uf2 (hold BOOT, tap RESET, copy) and write
pc3-sd-cc.img.gz (decompressed) to an SD card of 1 GB or more.
Both together — the card's binaries are statically linked, and a
kernel and card of different releases refuse each other outright
rather than misreading. Both manuals are attached.