Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
3ac881b
feat(crosscompile): add wasi-libc support with LLGoROOT priority
cpunion Aug 2, 2025
deea875
feat(crosscompile): add ESP Clang multi-platform support
cpunion Aug 4, 2025
7c4c8b8
use prebuilt esp-llvm
cpunion Aug 5, 2025
87f4f61
feat(crosscompile): use versioned cache directory for ESP Clang
cpunion Aug 5, 2025
e580ecc
fix sysroot on macos with esp clang
cpunion Aug 16, 2025
b650a54
supports linkerscript
cpunion Aug 16, 2025
21174e4
fix wasi-libc caching path
cpunion Aug 16, 2025
b831952
build native/wasi with clang++ and keep embed building with clang
cpunion Aug 16, 2025
b2b407c
upgrade to prebuilt esp-clang 19.1.2_20250819
cpunion Aug 20, 2025
3431354
refactor clang command
cpunion Aug 16, 2025
e8bae52
decision _start generation by target, add some fake variables
cpunion Aug 16, 2025
1b8b500
add esp-clang download prompts
cpunion Aug 20, 2025
246278f
add tinygo device files
cpunion Aug 20, 2025
50a2650
upgrade to esp-clang prebuilt 19.1.2_20250820
cpunion Aug 21, 2025
7e8df05
fix cross compilation
cpunion Aug 21, 2025
49e5963
Merge commit '6de3bdcdd9b3959d244e7b3b7e97fc4e3408cd78' into esp-llvm
cpunion Aug 21, 2025
93ca632
fix rpath for libc++
cpunion Aug 21, 2025
7bf0146
add file lock to avoid parallel downloading
cpunion Aug 21, 2025
d8122d1
fix lld -target
cpunion Aug 21, 2025
9a90eae
fix ldflags
cpunion Aug 21, 2025
21189f3
fix libunwind include path
cpunion Aug 21, 2025
5cfd996
fix cross compilation tests
cpunion Aug 21, 2025
06568da
expand template vars in targets config
cpunion Aug 21, 2025
372a09d
inspired compiler and linker args from tinygo
cpunion Aug 21, 2025
c414add
update targets tests
cpunion Aug 21, 2025
2eb7d54
targets supports code-model, target-abi, relocation-model
cpunion Aug 21, 2025
6e20a43
targets supports extra-files
cpunion Aug 21, 2025
87c50cf
_demo/empty exports Reset_Handler and handleHardFault (to compatible …
cpunion Aug 21, 2025
2f8f85a
filter out failed targets in ci
cpunion Aug 21, 2025
c9c703d
remove duplicated CCFLSGS args
cpunion Aug 21, 2025
2508674
report target error if llvm-target not set
cpunion Aug 21, 2025
077f114
_demo/empty -> _demo/targetsbuild
cpunion Aug 21, 2025
ea6266c
add _demo/targetsbuld/build-all.sh to check all targets
cpunion Aug 21, 2025
90a16e8
add handleInterrupt into _demo/targetsbuild
cpunion Aug 21, 2025
d0f89e4
allow clang unused parameters
cpunion Aug 21, 2025
44cb4f2
report error if target cpu is not set
cpunion Aug 21, 2025
d3d3987
report llvm-target/cpu empty warning in all targets check
cpunion Aug 21, 2025
ad8aa6a
add __dynamic_loader into targetsbuild for nintendo switch
cpunion Aug 22, 2025
c8eb871
report error if extra file not exist
cpunion Aug 22, 2025
50d8dbe
fix targets extra files
cpunion Aug 22, 2025
3ce6396
refine build.sh and CI
cpunion Aug 22, 2025
1f193c8
refine internal/clang: don't depends internal/crosscompile
cpunion Aug 22, 2025
ecaf7c8
supports binary-format, only esp* supported for now
cpunion Aug 22, 2025
59e1df5
don't collect test coverage of internal/firmware
cpunion Aug 23, 2025
b718159
hide unused arguments warnings
cpunion Aug 23, 2025
508b23a
refine and test internal/crosscompile
cpunion Aug 23, 2025
e40bdc1
binary-format supports uf2, nrf-dfu
cpunion Aug 23, 2025
4a02b1f
test internal/clang
cpunion Aug 23, 2025
96001ce
disable incompatible tests for llgo test
cpunion Aug 23, 2025
ddc61ad
test compiler downloading of crosscompile
cpunion Aug 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ coverage:
- "internal/packages"
- "internal/typepatch"
- "internal/github"
- "internal/firmware"
- "xtool"
144 changes: 2 additions & 142 deletions .github/workflows/targets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,145 +36,5 @@ jobs:

- 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
cd _demo/targetsbuild
bash build.sh
4 changes: 0 additions & 4 deletions _demo/empty/empty.go

This file was deleted.

21 changes: 21 additions & 0 deletions _demo/targetsbuild/C/c.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package C

func XhandleHardFault() {

}

func Reset_Handler() {

}

func XhandleInterrupt() {

}

type dyn64 struct {
// Fields for dynamic loader
}

// For nintendo switch
func X__dynamic_loader(base uintptr, dyn *dyn64) {
}
180 changes: 180 additions & 0 deletions _demo/targetsbuild/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
#!/bin/bash

# Function to display usage information
show_usage() {
cat << EOF
Usage: $(basename "$0") [OPTIONS] [TARGET_FILE]

Build targets for llgo across multiple platforms.

OPTIONS:
-h, --help Show this help message and exit

ARGUMENTS:
TARGET_FILE Optional. A text file containing target names, one per line.
Lines starting with # are treated as comments and ignored.
Empty lines are also ignored.

BEHAVIOR:
Without TARGET_FILE:
- Automatically discovers all targets from ../../targets/*.json files
- Extracts target names from JSON filenames

With TARGET_FILE:
- Reads target names from the specified file
- Supports comments (lines starting with #)
- Ignores empty lines and whitespace

IGNORED TARGETS:
The following targets are automatically ignored and not built:
atmega1280, atmega2560, atmega328p, atmega32u4, attiny85,
fe310, k210, riscv32, riscv64, rp2040

RESULT CATEGORIES:
✅ Successful: Build completed successfully
🔕 Ignored: Target is in the ignore list
⚠️ Warned: Build failed with configuration warnings
❌ Failed: Build failed with errors

EXIT CODES:
0 All builds successful, ignored, or warned only
1 One or more builds failed with errors

EXAMPLES:
$(basename "$0") # Build all targets from JSON files
$(basename "$0") my-targets.txt # Build targets from file
$(basename "$0") --help # Show this help

TARGET FILE FORMAT:
# This is a comment
esp32
cortex-m4

# Another comment
riscv64
EOF
}

# Check for help flag
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
show_usage
exit 0
fi

# Check for invalid number of arguments
if [ $# -gt 1 ]; then
echo "Error: Too many arguments."
echo "Use '$(basename "$0") --help' for usage information."
exit 1
fi

# Initialize arrays to store results
successful_targets=()
ignored_targets=()
warned_targets=()
failed_targets=()
targets_to_build=()

# Define ignore list
ignore_list=(
"atmega1280"
"atmega2560"
"atmega328p"
"atmega32u4"
"attiny85"
"fe310"
"k210"
"riscv32"
"riscv64"
"rp2040"
)

# Build the targets list based on input method
if [ $# -eq 1 ]; then
# Read targets from file
target_file="$1"
if [ ! -f "$target_file" ]; then
echo "Error: Target file '$target_file' not found."
echo "Use '$(basename "$0") --help' for usage information."
exit 1
fi

while IFS= read -r target || [[ -n "$target" ]]; do
# Skip empty lines and comments
if [[ -z "$target" || "$target" =~ ^[[:space:]]*# ]]; then
continue
fi

# Trim whitespace
target=$(echo "$target" | xargs)
targets_to_build+=("$target")
done < "$target_file"
else
# Use targets from *.json files
for target_file in ../../targets/*.json; do
# Extract target name from filename (remove path and .json extension)
target=$(basename "$target_file" .json)
targets_to_build+=("$target")
done
fi

# Process each target
for target in "${targets_to_build[@]}"; do
# Check if target is in ignore list
if [[ " ${ignore_list[@]} " =~ " ${target} " ]]; then
echo 🔕 $target "(ignored)"
ignored_targets+=("$target")
continue
fi

output=$(../../llgo.sh build -target $target -o hello.out . 2>&1)
if [ $? -eq 0 ]; then
echo ✅ $target `file hello.out`
successful_targets+=("$target")
else
# Check if output contains warning messages
if echo "$output" | grep -q "does not have a valid LLVM target triple\|does not have a valid CPU configuration"; then
echo ⚠️ $target
echo "$output"
warned_targets+=("$target")
else
echo ❌ $target
echo "$output"
failed_targets+=("$target")
fi
fi
done

echo ""
echo "----------------------------------------"

# Output successful targets
echo "Successful targets (${#successful_targets[@]} total):"
for target in "${successful_targets[@]}"; do
echo "$target"
done

echo ""
echo "Ignored targets (${#ignored_targets[@]} total):"
for target in "${ignored_targets[@]}"; do
echo "$target"
done

echo ""
echo "Warned targets (${#warned_targets[@]} total):"
for target in "${warned_targets[@]}"; do
echo "$target"
done

echo ""
echo "Failed targets (${#failed_targets[@]} total):"
for target in "${failed_targets[@]}"; do
echo "$target"
done

# Exit with error code if there are any failed targets
if [ ${#failed_targets[@]} -gt 0 ]; then
echo ""
echo "Build failed with ${#failed_targets[@]} failed targets."
exit 1
fi
6 changes: 6 additions & 0 deletions _demo/targetsbuild/empty.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package main

import _ "github.com/goplus/llgo/_demo/targetsbuild/C"

func main() {
}
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ require (
golang.org/x/tools v0.36.0
)

require github.com/sigurn/crc16 v0.0.0-20240131213347-83fcde1e29d1

require (
golang.org/x/mod v0.27.0 // indirect
golang.org/x/sync v0.16.0 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ github.com/goplus/mod v0.17.1 h1:ITovxDcc5zbURV/Wrp3/SBsYLgC1KrxY6pq1zMM2V94=
github.com/goplus/mod v0.17.1/go.mod h1:iXEszBKqi38BAyQApBPyQeurLHmQN34YMgC2ZNdap50=
github.com/qiniu/x v1.15.1 h1:avE+YQaowp8ZExjylOeSM73rUo3MQKBAYVxh4NJ8dY8=
github.com/qiniu/x v1.15.1/go.mod h1:AiovSOCaRijaf3fj+0CBOpR1457pn24b0Vdb1JpwhII=
github.com/sigurn/crc16 v0.0.0-20240131213347-83fcde1e29d1 h1:NVK+OqnavpyFmUiKfUMHrpvbCi2VFoWTrcpI7aDaJ2I=
github.com/sigurn/crc16 v0.0.0-20240131213347-83fcde1e29d1/go.mod h1:9/etS5gpQq9BJsJMWg1wpLbfuSnkm8dPF6FdW2JXVhA=
golang.org/x/mod v0.27.0 h1:kb+q2PyFnEADO2IEF935ehFUXlWiNjJWtRNgBLSfbxQ=
golang.org/x/mod v0.27.0/go.mod h1:rWI627Fq0DEoudcK+MBkNkCe0EetEaDSwJJkCcjpazc=
golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw=
Expand Down
Loading
Loading