Repository navigation
Studio Template Authoring
The Templates dialog of MicroCS Studio (Alt+T) lists the files in these
folders. One folder per category, numbered in the order Studio shows them:
templates/
01-getting-started/
templates.txt describes every file of the folder
hello.cs
loop.cs
02-boot-and-startup/
templates.txt
boot.cs
main_safe_mode.cs "save as: main.cs" in templates.txt
jobs.cfg not only C#: any text file works
...
# comment lines start with #
category: Boot and startup
requires: none
[boot.cs] boot.cs - first script at power-up
requires: Board
Runs first at every boot: hardware setup and a banner.
Save as /boot.cs.
[main_safe_mode.cs] main.cs with safe mode
requires: GPIO, Filesystem
save as: main.cs
Hold a button at boot to skip the application.
-
category:— the name in Studio's category list (once, before the first block). -
requires:— mandatory folder default, or per-file override before the description. Exact, case-sensitive names frominclude/mcs_capabilities.def, comma-separated;nonemeans no extra requirements..csfiles also needCompiler. Use operation flags such asWifi.AP,Ble.Central,GPIO.IRQorSPI.Configurewhen the example uses them. -
[file] Display name— a file of this folder; blocks are listed in this order. -
save as:(optional, right after the header) — the file name Studio suggests when several templates of a folder are meant to become the same file (main.cs,boot.cs). -
min firmware:(optional, before the description) — an explicitly known minimummajor.minor.patch, for example1.17.0for the rotary encoder API. Do not guess a version from a platform name. - The lines after it are the description (joined into one paragraph).
Every file of the folder must be described and every described file must exist.
- Write the script into the right folder (or a new
NN-name/folder with its owntemplates.txt). Keep it runnable: CI compiles and runs every C# template on the simulated board with a time budget; persistent services should remain alive until Stop, yield withThread.Sleep/ native Poll, and clean up withusing/finally. Radio examples must checkHal.Hasbefore using optional classes, so a copied script also exits with a useful message on a board without the required radio or role. -
python3 tools/studio/gen_templates.py— rebuildstools/studio/templates.js, the bundle the page loads (Studio is a static page that also runs fromfile://, where it cannot read folders).--checkverifies it is current,--listprints everything. -
node tests/studio/test_templates.js ./mcs— runs them all (make mcsfirst).
Studio derives the tags it shows (Wi-Fi, OLED, files, jobs, DMA …) from the code and links each preview to its file here.
Studio sends the allocation-free shell command caps after connecting. The
Supported only toggle is on by default and remembered locally. When connected,
it shows only examples with confirmed exact capabilities and minimum firmware;
missing features (for example Wi-Fi) and unknown legacy requirements are hidden.
Turn it off to show every example with supported, unknown or unsupported badges.
Offline, every example remains visible and is marked not checked.
The preview lists missing/unreported requirements and any declared minimum firmware.
Older firmware without caps can still use the gallery: turn off Supported only to
browse/adapt unverified examples. Only explicitly reported feature bits are used;
a HAL/network build bit does not prove a particular peripheral. Reconnecting refreshes
support and clears cached compile-check availability. Opening the gallery does not
start new capability polling or runtime work. For FileStream examples, declare the
exact Filesystem.Streams capability, not only Filesystem.
Templates can always be copied or opened for adaptation; adding one does not run it. Studio does not probe buses or start radios to discover support. A supported bus does not mean the external sensor/display/actuator is attached. Pins, wiring, credentials and API details still need checking. Tags are search labels, not support guarantees.
Generated from the MicroCS repository (source branch · revision 37bd1f1). Edit the source files, not the wiki.
Start here
Step-by-step guides
- Guides
- Guide PC Simulator
- Guide ESP32
- Guide ESP32 C3 OLED
- Guide Raspberry Pi Pico
- Guide STM32
- Guide Arduino
- Guide Zephyr
- Guide Peripheral Settings
- Guide DMA
Hardware
- Hardware API
- Power Management
- Bluetooth LE
- CAN Bus
- Rotary Encoders
- Peripheral Configuration
- DMA
- Device Drivers
- Wi Fi and Networking
- U8g2 Displays
- LVGL Graphics
- Filesystem
- Threads
- Scheduler
Ports
- Porting and Build Systems
- Port ESP32
- Port RP2040 RP2350
- Port STM32
- Port STM32 Firmware
- Port Zephyr
- Port NuttX
- Port Arduino
C# and the runtime
- Language
- Standard Library
- JSON
- Standalone Firmware
- MicroCS Studio
- Web Flasher
- Studio Template Authoring
- Examples
- LVGL Examples
Embedding and tuning
- Embedding
- Configuration
- Small MCUs
- Memory Budgets
- Low RAM Firmware Example
- Performance
- Runtime Benchmark Comparison
- Lua Host Benchmark
Internals
Project