Skip to content

Build Target Task 2: Multi-Platform LLVM Support and Bootable Code Generation#1203

Merged
xushiwei merged 50 commits intogoplus:mainfrom
cpunion:esp-llvm
Aug 24, 2025
Merged

Build Target Task 2: Multi-Platform LLVM Support and Bootable Code Generation#1203
xushiwei merged 50 commits intogoplus:mainfrom
cpunion:esp-llvm

Conversation

@cpunion
Copy link
Collaborator

@cpunion cpunion commented Aug 4, 2025

Summary

Implements ESP Clang multi-platform support for cross-compilation to embedded platforms. This is part of Task 2 (#1201) from the cross-platform compilation design.

Task 2 Implementation TODO

Multi-Platform LLVM Support

  • ESP Clang integration foundation
  • Prebuilt compiler distribution system

Target Configuration Support

  • Integration with Task 1 target system
    • Always uses esp-clang
    • GOOS/GOARCH uses clang++ to compatible with c++
    • -target=xxx uses clang so doesn't compatible with c++ (without libc++ for embed platform)
  • Code generation config (code-model, target-abi, relocation-model)
    - [ ] Stack configuration (default-stack-size, automatic-stack-size)

Bootable Code Generation

  • Linker script integration
  • Extra files support (startup code)
  • Binary format output (esp32, esp32c3, esp8266)
    • uf2, nrf-dfu
  • llgo build -target supports binary-format

Related

Compiler integration

  • How to embed clang?
  • Release
  • Homebrew
  • Linux pkgs

Runtime Integration

  • compiler-rt
  • libc
  • CMSIS, nrfx mdk
  • Embeded GC

Flash Programming

  • Flash methods (openocd, msd, command)
  • Flash command templates
  • MSD programming support
  • OpenOCD integration

Command Integration

  • llgo run -target (emulator)
  • llgo install -target (build + flash)
  • llgo monitor?

Related Issues

🤖 Generated with Claude Code

cpunion and others added 2 commits August 2, 2025 20:18
- Check LLGoROOT/crosscompile/wasi-libc first before downloading
- Fallback to cached wasi-sdk download if not found locally
- Update downloadAndExtract to return wasiSdkRoot path directly

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add ESP Clang download and extraction for cross-compilation
- Support multiple platforms: darwin/amd64, darwin/arm64, linux/amd64, linux/arm64, windows/amd64
- Integrate ESP Clang with target-based configuration system
- Add ClangRoot and ClangBinPath fields to Export struct
- Support .tar.xz extraction for ESP Clang packages
- Prioritize LLGoROOT clang installation over cached downloads
- Update build system to use custom clang for embedded platforms

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@cpunion cpunion changed the title feat(crosscompile): ESP Clang multi-platform support for embedded development Build Target Task 2: Multi-Platform LLVM Support and Bootable Code Generation Aug 4, 2025
@codecov
Copy link

codecov bot commented Aug 5, 2025

Codecov Report

❌ Patch coverage is 72.34848% with 146 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.79%. Comparing base (6de3bdc) to head (ddc61ad).
⚠️ Report is 51 commits behind head on main.

Files with missing lines Patch % Lines
internal/crosscompile/crosscompile.go 63.77% 75 Missing and 17 partials ⚠️
internal/crosscompile/fetch.go 60.00% 25 Missing and 15 partials ⚠️
internal/clang/clang.go 94.78% 4 Missing and 2 partials ⚠️
internal/targets/config.go 0.00% 5 Missing ⚠️
internal/targets/loader.go 94.44% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1203      +/-   ##
==========================================
- Coverage   88.15%   87.79%   -0.37%     
==========================================
  Files          34       35       +1     
  Lines        8470     8928     +458     
==========================================
+ Hits         7467     7838     +371     
- Misses        934      979      +45     
- Partials       69      111      +42     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@xushiwei xushiwei merged commit 76e4f4a into goplus:main Aug 24, 2025
32 of 34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants