Documentation
¶
Overview ¶
Package build turns compiled Volt C into firmware: it generates a per-project build directory against the read-only framework and runs the chip's native build, reporting progress the way the IDE shows it.
Index ¶
- Constants
- func Artifact(dir, chip, name string) string
- func CrashTools(dir, chip string, env []string) (elf, addr2line string)
- func DeviceDirs(shared, project string) string
- func ESP32(p Project, r *Reporter) (string, error)
- func ESP32IDF(p Project, profile string, r *Reporter) (string, error)
- func FirmwareName(s string) string
- func FlashESP32(dir, chip, port string, baud int, full bool, env []string, r *Reporter) error
- func VoltSources(project, framework, devices, code string) ([]string, error)
- type CError
- type Event
- type Project
- type Reporter
- type Size
Constants ¶
const DefaultFlashBaud = 460800
DefaultFlashBaud is the stub's write rate unless overridden; a failing write falls back to lower rates on its own.
Variables ¶
This section is empty.
Functions ¶
func CrashTools ¶
CrashTools returns the project's built ELF and the chip's addr2line, for decoding panic backtraces. Either is "" when not found.
func DeviceDirs ¶
DeviceDirs joins the shared device library and a project's own devices folder (when it exists) into one Project.Devices value.
func ESP32 ¶
ESP32 builds the project with the installed ESP-IDF pack (see package sdk): it writes <project>/build/<chip>/main/main.c, compiles it with the runtime and the drivers the program uses, links against the pack and makes the app image, returning its path. Builds are incremental.
func ESP32IDF ¶
ESP32IDF generates <project>/build/<chip>/ as an ESP-IDF project over the read-only framework, with profile as its sdkconfig, and builds it with idf.py, returning the app image path. Only `volt sdk build` uses it: the reference build a pack is harvested from, and the builds packs are verified against. A build that fails on a stale CMake cache is retried once from a clean cache.
func FirmwareName ¶
FirmwareName makes a CMake project name from a project name.
func FlashESP32 ¶
FlashESP32 writes the built project to the board on port: the pack's bootloader and partition table, then the app image. Images flash already holds are skipped unless full is set.
func VoltSources ¶
VoltSources lists the C files ESP-IDF compiles into the app component for a program, in its order: main.c (under project), the runtime from volt.cmake, then the drivers the program uses.
Types ¶
type CError ¶
CError is an error the C compiler reports for the code made from a Volt program, at the Volt line it came from (Line 0: not tied to a line).
func SyntaxCheck ¶
SyntaxCheck compiles the generated C on this computer, syntax only, against the framework headers and the device library headers the firmware build force-includes. It takes well under a second and catches C the firmware build would reject even though the Volt checks passed. The generated code carries #line directives, so errors point at the Volt source. ran is false when there is no C compiler here (nothing checked).
type Event ¶
type Event struct {
Stage string `json:"stage"`
Message string `json:"message"`
Percent int `json:"percent"`
Artifact string `json:"artifact,omitempty"` // on done
Size *Size `json:"size,omitempty"` // on done, when known
}
Event is one progress report. With --json each is printed as a line; the shape matches the IDE's build:progress IPC message. Stage is compile, build, flash or done (progress), or info, warn or error (messages).
type Project ¶
type Project struct {
Dir string // project directory (holds volt.toml)
Name string // firmware name; the app image is <Name>.bin
Chip string
Code string // compiled C
Framework string // SDK framework dir (holds esp32/, include/)
Devices string // device libraries (hold <prefix>/driver.c): the shared one, then the project's (see DeviceDirs)
Env []string
Optimize string // "debug", "size", "speed", or "" for the pack's default
}
Project is one program to build for one chip.
type Reporter ¶
type Reporter struct {
Verbose bool // show every tool output line
Size *Size // footprint to report with Done, if known
// contains filtered or unexported fields
}
Reporter prints events as JSON lines or for a terminal.
func NewReporter ¶
NewReporter returns a Reporter writing to stdout.
func (*Reporter) Progress ¶
Progress reports frequent progress (ninja steps), throttled to 5/s. Terminals show it on one line that is rewritten in place.
type Size ¶
type Size struct {
Flash int64 `json:"flash"` // app image
FlashMax int64 `json:"flash_max,omitempty"` // app partition
RAM int64 `json:"ram,omitempty"` // static DRAM (data + bss)
}
Size is the firmware's footprint in bytes.