Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
481d6cd
ci:validate package compile
luoliwoshang Sep 12, 2025
1b3ef57
move tinygo src/device
luoliwoshang Sep 12, 2025
f55f602
get the embed clang
luoliwoshang Sep 12, 2025
f67704d
validate compile with output
luoliwoshang Sep 12, 2025
a1beb4a
github.com/goplus/lib/emb/device/arm
luoliwoshang Sep 12, 2025
9f228bc
emb/device/emb*:remove .ld .s .c
luoliwoshang Sep 15, 2025
12ad655
emb/device/emb*:Asm,AsmFull -> llgo.asm
luoliwoshang Sep 15, 2025
4b867ed
go build ignore emb
luoliwoshang Sep 15, 2025
6475f18
ci:demo with empty handleHardFault,Reset_Handler
luoliwoshang Sep 15, 2025
c9ed38f
emb/device/emb*:temp resolution for https://github.com/goplus/lib/iss…
luoliwoshang Sep 15, 2025
83222bb
ci:only check llgo valid target
luoliwoshang Sep 15, 2025
e65aff6
ci:valide nogc
luoliwoshang Sep 15, 2025
1eb4559
todo:https://github.com/goplus/lib/issues/18
luoliwoshang Sep 15, 2025
1770e96
emb/device/arm:DisableInterrupts/EnableInterrupts
luoliwoshang Sep 15, 2025
124b0a0
ignore device/renesas
luoliwoshang Sep 15, 2025
dba834c
callHandlers runtime/interrupt.callHandlers
luoliwoshang Sep 15, 2025
58e80dc
ci:ignore:device/riscv
luoliwoshang Sep 15, 2025
ac8cacb
verify emb/device/arm64 by esp target
luoliwoshang Sep 15, 2025
7a389e1
update package validate
luoliwoshang Sep 15, 2025
321077e
update device/avr check target
luoliwoshang Sep 15, 2025
70b4a0e
ci:refine device check
luoliwoshang Sep 19, 2025
e3202b1
ci:install goplus/llgo
luoliwoshang Sep 25, 2025
10a11a9
ci:with size reduce llgo
luoliwoshang Sep 26, 2025
cf192e8
emb/device:basic gen device
luoliwoshang Sep 29, 2025
2af5e82
ci:verify device autogen script
luoliwoshang Sep 29, 2025
66aaa70
gen-device-avr:runtime->goplus/runtime,callHandlers placeholder
luoliwoshang Sep 29, 2025
4334da2
ci:verify reproduce generate for gen-avr
luoliwoshang Sep 29, 2025
05dd7ac
emb/device/avr:callhandler space
luoliwoshang Sep 29, 2025
f97e71b
gen-device-avr:avoid asm code generate
luoliwoshang Sep 29, 2025
de5a86b
gen-device-avr:avoid ld code generate
luoliwoshang Sep 29, 2025
df09fbd
gen-device-svd:basic logic
luoliwoshang Sep 30, 2025
3440b32
emb/device/avr:callhandler space
luoliwoshang Sep 30, 2025
1acf051
gen-device-svd:runtime/volatile & callhanlder
luoliwoshang Sep 30, 2025
2b76f2e
verify device-nrf
luoliwoshang Sep 30, 2025
95f8836
verify device-nxf
luoliwoshang Sep 30, 2025
1bd1330
verify device-sam
luoliwoshang Sep 30, 2025
eaf287c
verify device-sifive
luoliwoshang Sep 30, 2025
64ad60e
verify device kendryte,stm32
luoliwoshang Sep 30, 2025
ebe1263
verify device rp,renesas
luoliwoshang Sep 30, 2025
cdae0f8
emb/machine:sync tinygo 0.39.0
luoliwoshang Sep 16, 2025
7fb843b
emb/machine:import 'device/' -> 'github.com/goplus/lib/emb/devive'
luoliwoshang Sep 16, 2025
2170fa0
emb/machine/_usb:sync tinygo 0.39
luoliwoshang Sep 16, 2025
a7c45df
emb/machine:runtime/volatile -> github.com/goplus/lib/emb/runtime/vol…
luoliwoshang Sep 16, 2025
8fdc7b0
emb/runtime/interrupt:sync from tinygo 0.39.0 & update import
luoliwoshang Sep 16, 2025
05db458
emb/machine:runtime/interrupt -> github.com/goplus/lib/emb/runtime/in…
luoliwoshang Sep 16, 2025
438e612
emb/machine:machine/usb -> github.com/goplus/lib/emb/machine/_usb
luoliwoshang Sep 16, 2025
2eaf799
fix: volatile symbol not found https://github.com/goplus/lib/pull/13
luoliwoshang Sep 16, 2025
c9b85c8
ci:validate package machine with all board target
luoliwoshang Sep 16, 2025
94faaf6
emb/runtime/interrupt/interrupt_cortexm.go:github.com/goplus/lib/emb/…
luoliwoshang Sep 16, 2025
9dcb73e
ci:compile with nogc to verify machine
luoliwoshang Sep 16, 2025
529e75f
emb/runtime/interrupt:device import
luoliwoshang Sep 16, 2025
c886490
emb/runtime/interrupt:Checkpoint.Save
luoliwoshang Sep 16, 2025
84ceef8
emb/runtime/interrupt:interrupt.New
luoliwoshang Sep 16, 2025
99ae3a2
ci:machine:ignore tkey
luoliwoshang Sep 16, 2025
708bcc8
emb/internal/binary,emb/internal/bytealg
luoliwoshang Sep 16, 2025
1289f52
emb/machine: add export handlers to validation script
luoliwoshang Sep 16, 2025
5b99773
emb/internal/itoa from go1.24
luoliwoshang Sep 16, 2025
8ad8dca
emb/machine/machine_rp2040/rp2050_rom.go:Cgo to llgo c
luoliwoshang Sep 19, 2025
ccb1ee3
emb/machine/machine_avg.go:placeholder for adjustMonotonicTimer,initM…
luoliwoshang Sep 19, 2025
0c65161
ci:ignore some target:stm32l0x1,metro-rp2350,gameboy-advance
luoliwoshang Sep 19, 2025
493c303
emb/runtime/interrupt:remove handleInterrupt with comment
luoliwoshang Sep 19, 2025
a5aafea
ci:ignore some avr、esp32、nodemcu target
luoliwoshang Sep 19, 2025
3ee779e
emb/runtime/interrupt/interrupt_esp32c3.go:comment defer use
luoliwoshang Sep 19, 2025
16cf8e7
ci:with same check emb sh
luoliwoshang Sep 19, 2025
26b6e35
ci:device with same sh
luoliwoshang Sep 19, 2025
72f9194
ci:ignore some espc3 target
luoliwoshang Sep 19, 2025
5b53386
ci:refine format
luoliwoshang Sep 19, 2025
34e4fd6
ci:install goplus/llgo
luoliwoshang Sep 25, 2025
584b097
ci:with size reduce llgo & check esp32
luoliwoshang Sep 26, 2025
bd3f7ee
ci:fix conflict
luoliwoshang Sep 30, 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
  •  
  •  
  •  
32 changes: 32 additions & 0 deletions .github/actions/setup-llgo/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: "Setup LLGO"
description: "Checkout and build LLGO from specific commit hash"
inputs:
commit-hash:
description: "Commit hash to checkout"
required: true
platform:
description: "Platform to download for"
required: false
default: "linux-amd64"
runs:
using: "composite"
steps:
- name: Setup LLGo Dependencies
uses: goplus/llgo/.github/actions/setup-deps@c4223df0877e2a85d361cdcc73076cdcf312a3b0
- name: Checkout LLGo Repository
uses: actions/checkout@v4
with:
repository: goplus/llgo
ref: ${{ inputs.commit-hash }}
path: llgo-source
- name: Setup LLGO
shell: bash
run: |
echo "Setting up LLGO from commit hash ${{ inputs.commit-hash }}..."
cd llgo-source
# Install LLGO from source
bash ./install.sh
# Set LLGO_ROOT to the source directory
echo "LLGO_ROOT=$PWD" >> $GITHUB_ENV
# Verify LLGO is available
llgo version || echo "Failed to get LLGO version"
329 changes: 329 additions & 0 deletions .github/scripts/device-gen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,329 @@
#!/bin/bash
set -e

# .ld,.s current not need generate at emb/device/avr,they are in llgo

declare_avr_config() {
name="avr"
repo="https://github.com/avr-rust/avr-mcu"
lib_path="lib/avr"
git_hash="6624554c02b237b23dc17d53e992bf54033fc228"
tasks=(
"lib/avr/packs/atmega"
"lib/avr/packs/tiny"
)
ignore_list="avr.go avr_tiny85.go"
target="emb/device/avr"
generator="gen-device-avr"
}

declare_esp_config() {
name="esp"
repo="https://github.com/cmsis-svd/cmsis-svd-data"
lib_path="lib/cmsis-svd"
git_hash="05a9562ec59b87945a8d7177a4b08b7aa2f2fd58"
tasks=(
"-source=https://github.com/posborne/cmsis-svd/tree/master/data/Espressif-Community -interrupts=software lib/cmsis-svd/data/Espressif-Community/"
"-source=https://github.com/posborne/cmsis-svd/tree/master/data/Espressif -interrupts=software lib/cmsis-svd/data/Espressif/"
)
ignore_list=""
target="emb/device/esp"
generator="gen-device-svd"
}

declare_nrf_config() {
name="nrf"
repo="https://github.com/NordicSemiconductor/nrfx"
lib_path="lib/nrfx"
git_hash="d779b49fc59c7a165e7da1d7cd7d57b28a059f16"
tasks=(
"-source=https://github.com/NordicSemiconductor/nrfx/tree/master/mdk lib/nrfx/mdk/"
)
ignore_list="README.markdown"
target="emb/device/nrf"
generator="gen-device-svd"
}

declare_nxp_config() {
name="nxp"
repo="https://github.com/cmsis-svd/cmsis-svd-data"
lib_path="lib/cmsis-svd"
git_hash="05a9562ec59b87945a8d7177a4b08b7aa2f2fd58"
tasks=(
"-source=https://github.com/posborne/cmsis-svd/tree/master/data/NXP lib/cmsis-svd/data/NXP/"
)
ignore_list="hardfault.go mimxrt1062_clock.go mimxrt1062_hardfault.go mimxrt1062_mpu.go"
target="emb/device/nxp"
generator="gen-device-svd"
}

declare_sam_config() {
name="sam"
repo="https://github.com/cmsis-svd/cmsis-svd-data"
lib_path="lib/cmsis-svd"
git_hash="05a9562ec59b87945a8d7177a4b08b7aa2f2fd58"
tasks=(
"-source=https://github.com/posborne/cmsis-svd/tree/master/data/Atmel lib/cmsis-svd/data/Atmel/"
)
ignore_list="atsamd51x-bitfields.go atsame5x-bitfields.go"
target="emb/device/sam"
generator="gen-device-svd"
}

declare_sifive_config() {
name="sifive"
repo="https://github.com/cmsis-svd/cmsis-svd-data"
lib_path="lib/cmsis-svd"
git_hash="05a9562ec59b87945a8d7177a4b08b7aa2f2fd58"
tasks=(
"-source=https://github.com/posborne/cmsis-svd/tree/master/data/SiFive-Community -interrupts=software lib/cmsis-svd/data/SiFive-Community/"
)
ignore_list=""
target="emb/device/sifive"
generator="gen-device-svd"
}

declare_kendryte_config() {
name="kendryte"
repo="https://github.com/cmsis-svd/cmsis-svd-data"
lib_path="lib/cmsis-svd"
git_hash="05a9562ec59b87945a8d7177a4b08b7aa2f2fd58"
tasks=(
"-source=https://github.com/posborne/cmsis-svd/tree/master/data/Kendryte-Community -interrupts=software lib/cmsis-svd/data/Kendryte-Community/"
)
ignore_list=""
target="emb/device/kendryte"
generator="gen-device-svd"
}

declare_stm32_config() {
name="stm32"
repo="https://github.com/tinygo-org/stm32-svd"
lib_path="lib/stm32-svd"
git_hash="e6db8e32d5d42293a528434ec12e7f88479a8649"
tasks=(
"-source=https://github.com/tinygo-org/stm32-svd lib/stm32-svd/svd"
)
ignore_list=""
target="emb/device/stm32"
generator="gen-device-svd"
}

declare_rp_config() {
name="rp"
repo="https://github.com/cmsis-svd/cmsis-svd-data"
lib_path="lib/cmsis-svd"
git_hash="05a9562ec59b87945a8d7177a4b08b7aa2f2fd58"
tasks=(
"-source=https://github.com/posborne/cmsis-svd/tree/master/data/RaspberryPi lib/cmsis-svd/data/RaspberryPi/"
)
ignore_list="rp2040-extra.go rp2350-extra.go"
target="emb/device/rp"
generator="gen-device-svd"
}

declare_renesas_config() {
name="renesas"
repo="https://github.com/cmsis-svd/cmsis-svd-data"
lib_path="lib/cmsis-svd"
git_hash="05a9562ec59b87945a8d7177a4b08b7aa2f2fd58"
tasks=(
"-source=https://github.com/cmsis-svd/cmsis-svd-data/tree/master/data/Renesas lib/cmsis-svd/data/Renesas/"
)
ignore_list=""
target="emb/device/renesas"
generator="gen-device-svd"
}

# List of device configuration functions
DEVICE_CONFIGS=(
"declare_avr_config"
"declare_esp_config"
"declare_nrf_config"
"declare_nxp_config"
"declare_sam_config"
"declare_sifive_config"
"declare_kendryte_config"
"declare_stm32_config"
"declare_rp_config"
"declare_renesas_config"
)

# Generate device files from all tasks to specified directory
generate_device_files() {
local device_name="$1"
shift
local generator="${@: -2:1}"
local target_dir="${@: -1}"
# Remove generator and target_dir from args to get tasks
set -- "${@:1:$#-2}"
local tasks_array=("$@")

echo "[$device_name] Processing ${#tasks_array[@]} tasks..."
for task in "${tasks_array[@]}"; do
echo "[$device_name] Processing task: $task"
"$generator" $task "$target_dir/"
echo "[$device_name] Generated to $target_dir"
done
echo "[$device_name] All tasks processed successfully"

# Format Go files in target directory
echo "[$device_name] Formatting Go files in $target_dir..."
(cd "$target_dir" && GO111MODULE=off ${GO:-go} fmt .)
echo "[$device_name] Go formatting completed"
}

# Generate devices for a specific device configuration
generate_devices() {
local config_func="$1"
local mode="$2"

# Call the configuration function to set variables
$config_func

# Validate configuration
if [[ -z "$repo" || -z "$lib_path" || -z "$git_hash" || -z "$generator" || -z "$target" || ${#tasks[@]} -eq 0 ]]; then
echo "Error: Missing configuration for device '$name'"
return 1
fi

# Use target directory from configuration
local target_dir="$target"
case "$mode" in
generate)
echo "[$name] Running in generation mode - will clean and generate to $target_dir"
;;
verify)
echo "[$name] Running in verification mode - will verify generated content matches $target_dir"
;;
*)
echo "[$name] Running in default mode - will generate to $target_dir"
;;
esac

# Clone and setup repository
echo "[$name] Setting up repository..."
rm -rf "$lib_path"
git clone "$repo" "$lib_path"
cd "$lib_path"
git checkout "$git_hash"
cd ../../

# Create target directory
mkdir -p "$target_dir"

# Handle verification mode
if [ "$mode" = "verify" ]; then
echo "[$name] Starting verification process..."

# Check if target directory exists and has content
if [ ! -d "$target_dir" ] || [ -z "$(ls -A "$target_dir" 2>/dev/null)" ]; then
echo "[$name] Verification failed: target directory is empty or does not exist"
return 1
fi

# Create temporary directory with same structure
temp_target=".verify/$target"
echo "[$name] Creating temporary directory: $temp_target"
mkdir -p "$temp_target"

# Generate files to temporary directory
echo "[$name] Generating files to temporary directory..."
generate_device_files "$name" "${tasks[@]}" "$generator" "$temp_target"

# Copy ignore list files to temporary directory
if [ -n "$ignore_list" ]; then
echo "[$name] Copying ignore list files to temporary directory: $ignore_list"
for file in $ignore_list; do
if [ -f "$target_dir/$file" ]; then
cp "$target_dir/$file" "$temp_target/"
echo "[$name] Copied: $file"
fi
done
fi

# Compare directories
echo "[$name] Comparing original directory with generated directory..."
if diff -u -r "$target_dir" "$temp_target" > /dev/null 2>&1; then
echo "[$name] Verification passed: generated files match existing files"
VERIFY_RESULT=0
else
echo "[$name] Verification failed: differences found"
echo "[$name] Detailed differences:"
diff -u -r "$target_dir" "$temp_target" || true
VERIFY_RESULT=1
fi

return $VERIFY_RESULT
fi

# Clean target directory if in generation mode
if [ "$mode" = "generate" ] && [ -n "$ignore_list" ]; then
echo "[$name] Cleaning $target_dir (preserving ignore list: $ignore_list)"

# Create temp directory to store ignored files
TEMP_DIR=$(mktemp -d)

# Backup ignored files if they exist
for file in $ignore_list; do
if [ -f "$target_dir/$file" ]; then
cp "$target_dir/$file" "$TEMP_DIR/"
echo "[$name] Backed up: $file"
fi
done

# Remove all files from target directory
rm -rf "$target_dir"/*

# Restore ignored files
for file in $ignore_list; do
if [ -f "$TEMP_DIR/$file" ]; then
cp "$TEMP_DIR/$file" "$target_dir/"
echo "[$name] Restored: $file"
fi
done

# Clean up temp directory
rm -rf "$TEMP_DIR"
fi

# Generate device files from all tasks
generate_device_files "$name" "${tasks[@]}" "$generator" "$target_dir"
}

# Parse command line arguments
MODE=""
case "$1" in
generate)
MODE="generate"
;;
verify)
MODE="verify"
;;
*)
MODE="default"
;;
esac

# Initialize verification tracking
VERIFICATION_FAILED=0

# Process all enabled devices
for config_func in "${DEVICE_CONFIGS[@]}"; do
if ! generate_devices "$config_func" "$MODE"; then
if [ "$MODE" = "verify" ]; then
VERIFICATION_FAILED=1
fi
fi
done

if [ "$MODE" = "verify" ]; then
if [ $VERIFICATION_FAILED -eq 0 ]; then
echo "All device verifications passed"
else
echo "Device verification failed: inconsistencies found"
exit 1
fi
else
echo "All device generations completed!"
fi
Loading
Loading