Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Target identification
Name string `json:"-"`
// LLVM configuration
LLVMTarget string `json:"llvm-target"`
CPU string `json:"cpu"`
Features string `json:"features"`
// Build configuration
BuildTags []string `json:"build-tags"`
GOOS string `json:"goos"`
GOARCH string `json:"goarch"`
// WasmProfile identifies the memory/host ABI pair. WasmProvider selects the
// concrete host implementation without creating another source profile.
WasmProfile string `json:"wasm-profile"`
WasmProvider string `json:"wasm-provider"`
// Compiler and linker configuration
Libc string `json:"libc"`
RTLib string `json:"rtlib"`
Linker string `json:"linker"`
LinkerScript string `json:"linkerscript"`
CFlags []string `json:"cflags"`
LDFlags []string `json:"ldflags"`
ExtraFiles []string `json:"extra-files"`
// Code generation configuration
CodeModel string `json:"code-model"`
TargetABI string `json:"target-abi"`
RelocationModel string `json:"relocation-model"`
// Binary and firmware configuration
BinaryFormat string `json:"binary-format"`
// UF2 configuration
UF2FamilyID string `json:"uf2-family-id"`
// Flash and deployment configuration
FlashMethod string `json:"flash-method"` // values: command, openocd, msd
FlashCommand string `json:"flash-command"` // used when FlashMethod == "command"
Flash1200BpsReset string `json:"flash-1200-bps-reset"`
// Serial configuration
Serial string `json:"serial"` // Serial communication type (e.g., "usb")
SerialPort []string `json:"serial-port"` // Serial port identifiers (e.g., vendor:product IDs)
// Mass storage device configuration
MSDVolumeName []string `json:"msd-volume-name"`
MSDFirmwareName string `json:"msd-firmware-name"`
// Device-specific configuration
RP2040BootPatch bool `json:"rp2040-boot-patch"`
// Debug and emulation configuration
Emulator string `json:"emulator"`
GDB []string `json:"gdb"`
// OpenOCD configuration
OpenOCDInterface string `json:"openocd-interface"`
OpenOCDTransport string `json:"openocd-transport"`
OpenOCDTarget string `json:"openocd-target"`
}
Config represents a complete target configuration after inheritance resolution
func (*Config) FormatDetail ¶
type Loader ¶
type Loader struct {
// contains filtered or unexported fields
}
Loader handles loading and parsing target configurations
func (*Loader) GetTargetsDir ¶
GetTargetsDir returns the targets directory path
func (*Loader) ListTargets ¶
ListTargets returns a list of all available target names
type RawConfig ¶
RawConfig represents the raw JSON configuration before inheritance resolution
func (*RawConfig) GetInherits ¶
GetInherits returns the list of configs this config inherits from
func (*RawConfig) HasInheritance ¶
HasInheritance returns true if this config inherits from other configs
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
Resolver provides high-level interface for target configuration resolution
func NewDefaultResolver ¶
func NewDefaultResolver() *Resolver
NewDefaultResolver creates a resolver with default targets directory
func NewResolver ¶
NewResolver creates a new target resolver
func (*Resolver) GetTargetsDirectory ¶
GetTargetsDirectory returns the path to the targets directory
func (*Resolver) ListAvailableTargets ¶
ListAvailableTargets returns a list of all available target names
Example ¶
resolver := NewDefaultResolver()
targets, err := resolver.ListAvailableTargets()
if err != nil {
log.Fatal(err)
}
// Show first 10 targets
sort.Strings(targets)
fmt.Printf("Available targets (first 10 of %d):\n", len(targets))
for i, target := range targets[:10] {
fmt.Printf("%d. %s\n", i+1, target)
}
func (*Resolver) Resolve ¶
Resolve resolves a target configuration by name
Example ¶
resolver := NewDefaultResolver()
// Resolve a specific target
config, err := resolver.Resolve("rp2040")
if err != nil {
log.Fatal(err)
}
fmt.Printf("Target: %s\n", config.Name)
fmt.Printf("LLVM Target: %s\n", config.LLVMTarget)
fmt.Printf("CPU: %s\n", config.CPU)
fmt.Printf("GOOS: %s\n", config.GOOS)
fmt.Printf("GOARCH: %s\n", config.GOARCH)
if len(config.BuildTags) > 0 {
fmt.Printf("Build Tags: %v\n", config.BuildTags)
}
if len(config.CFlags) > 0 {
fmt.Printf("C Flags: %v\n", config.CFlags)
}
if len(config.LDFlags) > 0 {
fmt.Printf("LD Flags: %v\n", config.LDFlags)
}
func (*Resolver) ResolveAll ¶
ResolveAll resolves all available target configurations
Example ¶
resolver := NewDefaultResolver()
configs, err := resolver.ResolveAll()
if err != nil {
log.Fatal(err)
}
// Count targets by GOOS
goosCounts := make(map[string]int)
for _, config := range configs {
if config.GOOS != "" {
goosCounts[config.GOOS]++
}
}
fmt.Printf("Loaded %d target configurations\n", len(configs))
fmt.Printf("GOOS distribution:\n")
for goos, count := range goosCounts {
fmt.Printf(" %s: %d targets\n", goos, count)
}