The console

A small shell on the board, not an interpreter.

Asmonite writes its console into the flash of the board (Prepare Board... in the Board Manager). From then on the board greets you with a prompt on its serial port, as a small computer would: it keeps files in its flash, starts programs by their names, connects to the WiFi and answers in the network. The console stays in the flash, is back after every program and every reset, and it is small: about 16 KB on the ESP32.

Asmonite itself works through the console: F9 loads your program into the RAM through it, the debugger stops it there, and the Board Manager asks it for the files and the WiFi.

A session

On an ESP32, in the tab Serial of Asmonite or in any terminal program (115200 baud). Network, address, name and MAC are replaced.

> info
Chip: ESP32 (Xtensa LX6), core at 160 MHz
Flash: 4 MB (JEDEC id 68 40 16)
MAC of the station: xx:xx:xx:xx:xx:xx
Console: Asmonite console 2
> ls
  help.txt                 960
  hello                   3424
  blink                   3776
  ping                   42400
  setclock               11424
5 file(s), 61984 bytes
> df
5 file(s), 69632 bytes in use, 2019328 bytes free
> run hello
Running hello
Hello, world!

Program ended (code 0).
> run blink
Running blink
blink: the LED of the board, every half second (Ctrl+C ends it)
Program stopped (Ctrl+C).
> setclock 240
the core runs at 240 MHz now, also after this program (until a reset)
> wlan
WiFi network: HomeNet (WPA2)
The WiFi is on and connected.
> name
The name of the board: esp32-lab (esp32-lab.local)
> boot
No autostart.

hello, blink, ping and setclock are not commands of the console: they are programs in its flash, compiled from aBelle (a Python-like programming language) by Asmonite. setclock 240 starts the program setclock with the argument 240.

Console or REPL?

MicroPython, CircuitPython or Espruino put an interpreter on the board: at their prompt (the REPL) you type lines of Python or JavaScript, and the board runs them at once. The Asmonite console is a shell instead.

A REPL (MicroPython)The Asmonite console
What you typelines of a programming languagecommands with arguments: ls, run blink, wlan set
What runsthe interpreter reads your program while it runsyour program, compiled for the chip (aBelle or assembly), at the full speed of the core
Filesusually through a tool on the PC (mpremote, Thonny)ls, cat, rm, df on the board; upload and download in the Board Manager
Programsscripts the interpreter runsfiles that are new commands: name arguments
Size on the boardthe firmware with the interpreter (several hundred KB to more than 1 MB)the console, about 16 KB on the ESP32; your program comes on top
Debuggingprintbreakpoints, steps, registers and variables in Asmonite, over the same USB cable

The commands

Filesls the files with their sizes · cat name shows a file · rm name removes one · df the room in the flash · format a new, empty file system (all files are lost)
Programsrun name starts a program · name arguments the same, with arguments · boot name starts it after every reset (boot alone: which one) · noboot none after a reset
Networkwlan the WiFi (wlan set network and password, wlan on, wlan off, wlan clear, wlan scan) · name the name of the board in the network, name.local · passwd the password for telnet
Systeminfo chip, clock, flash, MAC, the version of the console · reset starts the chip again · help the list of the commands (the file help.txt on the board)

Ctrl+C stops the program that runs (in the tab Serial: the button Stop); on the ESP32 even an endless loop with the interrupts off. After a reset the console waits a moment: a key in the terminal keeps it at the prompt, even with a program set to autostart; Reset in the Board Manager does that too.

Programs as commands

A program on the board has no extension: blink.abel becomes blink. A word the console does not know it looks for as a file; if there is one, it starts the program, and the rest of the line is its arguments. So the console grows without getting bigger: the network tools of the examples (ping, dns, ntp ...) and setclock are such programs. The program in the editor gets onto the board with Project > Compile and Upload (Ctrl+Shift+F9).

A program writes into the flash only through files. It cannot damage the console or the file system.

What it does in the background

It answers in the network

To ping and to name.local (mDNS), on most boards also while a program runs.

It is back after every program

When a program ends, by exit, by an exception (the console says where and why) or by Ctrl+C, the prompt is there again, with the files and the WiFi.

It starts after a reset

When boot names a program, it starts it after every reset: for a board that runs on its own.

How to reach it

What survives a reset

SurvivesIs gone
the files, the console itselfa program F9 loaded into the RAM
the autostart program (boot)the clock set by setclock (back to the start clock)
the WiFi network and its password, the name of the boardwhat a program did not write into a file

Which board can what

ESP32ESP32-S3Pico, Pico 2 (W)ESP32-C3ESP32-S31
Files, programs, boot, info, reset, help✓✓✓✓✓
run name arguments– (name arguments)– (name arguments)✓– (name arguments)– (name arguments)
wlan, wlan scan, name✓✓✓ (W)✓✓
passwd (telnet)✓✓✓ (W)––
answers ping while a program runs✓✓✓ (W)✓✓
name.local while a program runs– (at the prompt)– (at the prompt)✓ (W)✓✓

A Pico or Pico 2 without a WiFi chip has no network commands. The aim is the same on every board, as far as its hardware allows.

For programmers: the functions of the console

A program the console starts can call it: exit, put_char, get_char, poll_char, print, millis, file_size, file_read, file_write, flash_read, args (the Picos also led and wl_call). In aBelle, include "console.abel" brings them, with println, print_int and the other output functions; the example runs.abel counts in the file runs.txt how often it ran. In assembly they are a table of jumps at a fixed address, on the ESP32 from 0x4009C800: the ESP32, the other boards.

What it does not have (yet)

The full guide on GitHub →