Frequently asked questions¶
What is Goose?¶
Goose is a compiled, statically typed programming language with no heap and no garbage collector. Dynamic data lives on compiler-managed data stacks, and its compiler writes a single C file. MicroGoose is a separate project that takes that C file to microcontrollers. It is not affiliated with Goose's authors.
What is MicroGoose?¶
A command-line tool and library, installed with pip install microgoose,
that compiles an unmodified Goose program, builds it into firmware with the
board's own toolchain (ESP-IDF or STM32Cube with FreeRTOS), flashes it, and
shows its output. It adds hardware access (import mcu;) and networking
(import net;). See How it works.
Which microcontrollers does it support?¶
The ESP32-S3, the classic ESP32 (WROOM-32 and WROVER-E modules) and the STM32H743. Other 32-bit chips with about 64 KB of flash and RAM are candidates for a port; Adding a board lists what a port provides. 8-bit AVR chips such as the Arduino Nano's are not feasible.
Do I need a board to try it?¶
No. microgoose run main.goose --target esp32 --emulate runs the same
firmware image in Espressif's QEMU, --target h7 --emulate in Renode, and
--target pico2w --emulate in picoem.
Each is a separate install, and each has programs it can't run:
Boards lists them. microgoose velxio
builds for the Velxio browser simulator,
where you can watch LEDs, buttons and servos.
How fast is it compared with C?¶
Level with C on double-precision float loops and multicore scaling, faster
than C on CRC-32 and on typed queues on the ESP32s, 1.3 to 1.4 times
slower on f32 matrix multiply on the ESP32s, and about 2 times slower on
heapsort. Every number,
with its raw data, is in Benchmark results, and
the benchmark report sums them up.
How does it compare with Rust, TinyGo and MicroPython?¶
All four, plus C, run the same benchmark suite on the same boards; see Results and Benchmark findings. In short: MicroGoose is 10 to 579 times faster than MicroPython 1.29 on the compute benchmarks on the ESP32-S3. Rust on Embassy is faster than MicroGoose at spawning tasks and passing messages. TinyGo is faster at CRC-32 and slower on floating point on the STM32H7.
How much memory does a program use?¶
The compiler counts the data stacks a program needs, and MicroGoose prints
the total before it builds. Each stack is --reserve bytes (16 KB by
default). Each thread_spawn worker adds a native stack (16 KB, or what
--worker-stack gives it), its own data stacks (--worker-reserve sets
their size) and a copy of the globals it uses. A program built with
--stack-report prints how much of each stack it used. In flash, the benchmark suite's image is 39 KB larger than C's
on the STM32H7 and 70 to 75 KB larger on the ESP32s. See
Sizing data stacks.
What happens when a program runs out of memory or writes out of bounds?¶
A data stack overflow is trapped by a hardware watchpoint (ESP32) or MPU region (STM32H7) at the first store past the end, and the program stops with the same message it gives on a PC. An out-of-bounds write in a worker thread ends that worker only, and the thread that started it is told.
Is MicroGoose ready for production?¶
It is alpha software (version 0.2). It suits prototypes, internal tools, test fixtures and connected devices where you can update the firmware. It is not certified for safety-critical use, and its APIs may change before 1.0. For engineering teams lists what is ready and what is not.
Can I use it in a commercial, closed-source product?¶
Yes. MicroGoose is licensed under Apache-2.0, as is the Goose compiler. Keep MicroGoose's NOTICE file when you redistribute it, and review the licences of what the firmware also contains (ESP-IDF, STM32Cube, FreeRTOS, LittleFS, Monocypher). See Licensing.
Can devices be updated in the field?¶
On the ESP32s, yes: over WiFi, with signed images, two app slots, and rollback when new firmware can't come up. See Updates over WiFi and Security.
Does it support CAN bus?¶
Yes, on all three boards: TWAI on the ESP32s and FDCAN on the STM32H7, with loopback modes for testing without a transceiver. See CAN.
Can I call my existing C drivers?¶
Yes. Goose's extern fn is a direct C call with no marshalling. Write the
C function, declare it in one line of Goose, and pass the header with
--include. See Adding a binding.
Does MicroGoose change the Goose compiler?¶
No. It uses an official Goose release, checked by SHA-256, and applies two documented fixes to the C it writes: one for Goose's 64-bit struct layout on 32-bit chips, and one for an Xtensa GCC calling-convention bug this project found. See The two source fixes.