Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
180 changes: 180 additions & 0 deletions .github/workflows/targets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@

name: Targets

on:
push:
branches: ["**"]
pull_request:
branches: ["**"]

jobs:
llgo:
continue-on-error: true
strategy:
matrix:
os:
- macos-latest
- ubuntu-24.04
llvm: [19]
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Install dependencies
uses: ./.github/actions/setup-deps
with:
llvm-version: ${{matrix.llvm}}

- name: Set up Go for build
uses: ./.github/actions/setup-go
with:
go-version: "1.24.2"

- name: Install
run: |
go install ./...
echo "LLGO_ROOT=$GITHUB_WORKSPACE" >> $GITHUB_ENV

- name: Build targets
run: |
cd _demo/empty
for target in \
ae-rp2040 \
arduino-leonardo \
arduino-mega1280 \
arduino-mega2560 \
arduino-mkr1000 \
arduino-mkrwifi1010 \
arduino-nano-new \
arduino-nano \
arduino-nano33 \
arduino-zero \
arduino \
atmega1280 \
atmega1284p \
atmega2560 \
atmega328p \
atmega328pb \
atmega32u4 \
atsamd21e18a \
atsamd21g18a \
atsamd51g19a \
atsamd51j19a \
atsamd51j20a \
atsamd51p19a \
atsamd51p20a \
atsame51j19a \
atsame54-xpro \
atsame54p20a \
attiny1616 \
attiny85 \
badger2040-w \
badger2040 \
bluepill-clone \
bluepill \
btt-skr-pico \
challenger-rp2040 \
circuitplay-express \
cortex-m-qemu \
cortex-m0 \
cortex-m0plus \
cortex-m3 \
cortex-m33 \
cortex-m4 \
cortex-m7 \
digispark \
elecrow-rp2040 \
elecrow-rp2350 \
esp-c3-32s-kit \
esp32-c3-devkit-rust-1 \
esp32c3-12f \
esp32c3-supermini \
esp32c3 \
fe310 \
feather-m0-express \
feather-m0 \
feather-m4-can \
feather-m4 \
feather-rp2040 \
feather-stm32f405 \
gameboy-advance \
gemma-m0 \
gnse \
gobadge \
gopher-badge \
gopherbot \
grandcentral-m4 \
hifive1b \
itsybitsy-m0 \
itsybitsy-m4 \
k210 \
kb2040 \
lgt92 \
lorae5 \
m5stamp-c3 \
macropad-rp2040 \
maixbit \
makerfabs-esp32c3spi35 \
matrixportal-m4 \
metro-m4-airlift \
mksnanov3 \
nano-rp2040 \
nintendoswitch \
nucleo-f103rb \
nucleo-f722ze \
nucleo-l031k6 \
nucleo-l432kc \
nucleo-l476rg \
nucleo-l552ze \
nucleo-wl55jc \
p1am-100 \
pga2350 \
pico-plus2 \
pico-w \
pico \
pico2-w \
pico2 \
pybadge \
pygamer \
pyportal \
qtpy-esp32c3 \
qtpy-rp2040 \
qtpy \
riscv-qemu \
riscv32 \
riscv64 \
rp2040 \
rp2350 \
rp2350b \
simavr \
stm32f469disco \
stm32f4disco-1 \
stm32f4disco \
stm32l0x2 \
stm32wl5x_cm4 \
stm32wle5 \
swan \
teensy36 \
teensy40 \
teensy41 \
thingplus-rp2040 \
thumby \
tiny2350 \
tkey \
trinket-m0 \
trinkey-qt2040 \
tufty2040 \
wasip2 \
wasm-unknown \
waveshare-rp2040-tiny \
waveshare-rp2040-zero \
wioterminal \
xiao-esp32c3 \
xiao-rp2040 \
xiao; do
../../llgo.sh build -v -target $target -o hello.out . >/dev/null 2>&1
if [ $? -eq 0 ]; then
echo ✅ $target `file hello.out`
else
echo ❌ $target
fi
done
4 changes: 4 additions & 0 deletions _demo/empty/empty.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package main

func main() {
}
3 changes: 2 additions & 1 deletion cmd/internal/build/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (

// llgo build
var Cmd = &base.Command{
UsageLine: "llgo build [-o output] [build flags] [packages]",
UsageLine: "llgo build [-o output] [-target platform] [build flags] [packages]",
Short: "Compile packages and dependencies",
}

Expand All @@ -50,6 +50,7 @@ func runCmd(cmd *base.Command, args []string) {
conf.Tags = flags.Tags
conf.Verbose = flags.Verbose
conf.OutFile = flags.OutputFile
conf.Target = flags.Target

args = cmd.Flag.Args()

Expand Down
2 changes: 2 additions & 0 deletions cmd/internal/flags/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ func AddOutputFlags(fs *flag.FlagSet) {
var Verbose bool
var BuildEnv string
var Tags string
var Target string

func AddBuildFlags(fs *flag.FlagSet) {
fs.BoolVar(&Verbose, "v", false, "Verbose mode")
fs.StringVar(&Tags, "tags", "", "Build tags")
fs.StringVar(&BuildEnv, "buildenv", "", "Build environment")
fs.StringVar(&Target, "target", "", "Target platform (e.g., rp2040, wasi)")
}

var Gen bool
Expand Down
7 changes: 4 additions & 3 deletions cmd/internal/run/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var (

// llgo run
var Cmd = &base.Command{
UsageLine: "llgo run [build flags] package [arguments...]",
UsageLine: "llgo run [-target platform] [build flags] package [arguments...]",
Short: "Compile and run Go program",
}

Expand All @@ -54,11 +54,11 @@ func init() {
}

func runCmd(cmd *base.Command, args []string) {
runCmdEx(cmd, args, build.ModeRun)
runCmdEx(cmd, args, build.ModeRun) // support target
}

func runCmpTest(cmd *base.Command, args []string) {
runCmdEx(cmd, args, build.ModeCmpTest)
runCmdEx(cmd, args, build.ModeCmpTest) // no target support
}

func runCmdEx(cmd *base.Command, args []string, mode build.Mode) {
Expand All @@ -71,6 +71,7 @@ func runCmdEx(cmd *base.Command, args []string, mode build.Mode) {
conf.Tags = flags.Tags
conf.Verbose = flags.Verbose
conf.GenExpect = flags.Gen
conf.Target = flags.Target

args = cmd.Flag.Args()
args, runArgs, err := parseRunArgs(args)
Expand Down
3 changes: 2 additions & 1 deletion cmd/internal/test/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

// llgo test
var Cmd = &base.Command{
UsageLine: "llgo test [build flags] package [arguments...]",
UsageLine: "llgo test [-target platform] [build flags] package [arguments...]",
Short: "Compile and run Go test",
}

Expand All @@ -29,6 +29,7 @@ func runCmd(cmd *base.Command, args []string) {
conf := build.NewDefaultConf(build.ModeTest)
conf.Tags = flags.Tags
conf.Verbose = flags.Verbose
conf.Target = flags.Target

args = cmd.Flag.Args()
_, err := build.Do(args, conf)
Expand Down
Loading
Loading