Metadata-Version: 2.4
Name: picolan
Version: 1.0.0
Summary: Update, find and monitor RP2350 + W5500 boards that run the picolan library, over Ethernet
Author: Avi Raviv
License-Expression: MIT
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: Microsoft :: Windows
Classifier: Topic :: Software Development :: Embedded Systems
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: tools/LICENSE
Dynamic: license-file

# picolan command-line tool

The `picolan` command finds, updates and monitors boards that run the picolan firmware library, over Ethernet. You do not need the source code, PlatformIO or a GitHub account.

## Install

Requirement: Python 3.9 or later. The tool uses only the Python standard library.

```sh
pip install picolan
```

Update: `pip install -U picolan`. Check the version: `picolan --version`.

| System | Status |
|---|---|
| Linux | Tested. All network interfaces are used. |
| Windows | Supported. Not yet tested on hardware. |
| macOS | Default network interface only. Not tested. |

## Connect the PC

1. Connect the PC to the network of the boards.
2. Give the PC an IP address in the subnet of the boards. Example: boards on 192.168.1.x/24, PC on 192.168.1.50/24.
3. Run `picolan nodes`.

`picolan nodes` also finds boards in another subnet. An update needs an IP route to the board.

## Update a system from a release bundle

A bundle is a zip file. It holds one firmware image per product and a manifest with the SHA-256 of each image.

1. Copy the bundle to the PC, for example `release-v6.4.0.zip`.
2. Run `picolan nodes`. Make sure that each product of the bundle appears once.
3. Run `picolan push release-v6.4.0.zip`.

For each image, the tool:

1. Finds the one board that runs the product of the image.
2. Sends the image. The board restarts on the new firmware.
3. Waits until the new firmware has run for 10 s, then confirms it.
4. Checks that the board runs the new firmware.

The tool updates the boards one at a time. It stops at the first failure. At the end it prints one result line per board.

| Situation | Result |
|---|---|
| A product of the bundle has no board, or more than one board | Nothing is installed. |
| An image was changed after the bundle was made | Nothing is installed. |
| A board already runs the image | Skipped. Use `--reinstall` to install again. |
| The new firmware fails | The board restores its previous firmware by itself. The tool stops. |

## Commands

| Command | Use |
|---|---|
| `picolan nodes` | List the boards: product, chip ID, IP, build, state. |
| `picolan push <files>` | Update boards from `.bin` files or bundles. |
| `picolan logs` | Show the log of a board. Ctrl+C to stop. |
| `picolan wipe` | Erase the stored data of a board (LittleFS and EEPROM). The firmware stays. |
| `picolan reboot` | Restart a board. |
| `picolan blink [seconds]` | Blink the LED of a board, if the firmware has one configured. |
| `picolan bundle -o <zip> <files>` | Make a bundle from `.bin` files. |

## Select a board

`logs`, `wipe`, `reboot` and `blink` act on one board. With one board on the network, no option is necessary. Otherwise add `--node`:

```sh
picolan --node motor-controller logs      # product name
picolan --node 192.168.1.4 reboot
picolan --node 5C82 wipe                  # chip ID or a unique prefix of it
```

The value must match exactly one board, or the tool stops.

## Install log

The tool adds one line per board to an install log:

| System | File |
|---|---|
| Linux | `~/.local/state/picolan/install.log` |
| Windows | `%LOCALAPPDATA%\picolan\install.log` |

Example line:

```
2026-11-14T19:02:58+0200 result=OK chip=5C829BF5E4BF9E53 ip=192.168.1.33 product=sensor-hub from=a1b2c3d/2B393BC5 to=d4e5f6a/585622FA release=my-system/v6.4.0 source=release-v6.4.0.zip:sensor-hub.bin
```

`result` is `OK`, `FAILED`, `SKIPPED` or `UNCONFIRMED`. Use `--log <file>` or the environment variable `PICOLAN_LOG` for another file, and `--no-log` for none.

## Network options

| Option | Use |
|---|---|
| `--iface <name or IP>` | Use only this network interface. Linux: interface name, for example `eth0`. Any system: a local IPv4 address. Repeatable. |
| `PICOLAN_IFACE=eth0,eth1` | The same, as an environment variable. |

Port: 8208, UDP (discovery, commands, log) and TCP (firmware transfer).
