Skip to content

Embed cmds#1271

Merged
xushiwei merged 25 commits intogoplus:mainfrom
cpunion:embed-cmds
Sep 8, 2025
Merged

Embed cmds#1271
xushiwei merged 25 commits intogoplus:mainfrom
cpunion:embed-cmds

Conversation

@cpunion
Copy link
Collaborator

@cpunion cpunion commented Sep 6, 2025

  • Outputs specify file format:
    • llgo build -target esp32 -o hello [-obin, -oimg, -ohex, -ouf2, -ozip]
  • Run on emulator:
    • llgo run -target esp32 -emulator
  • Run and monitor on device:
    • llgo run -target esp32 -port /dev/cu.usbserial-110
  • Install on device:
    • llgo install -target esp32 -port /dev/cu.usbserial-110
  • Show logs and panic address:
    • llgo monitor -target esp32 -port /dev/cu.usbserial-110
  • Refactor link, convert, run, monitor workflow
    • Fix llgo run output to GOPATH/bin
    • Convert elf to esp32 hex when binary-format is "esp32*", otherwise intel hex
    • Auto scan serial port

Examples

# Native development
llgo build hello.go                              # -> hello
llgo build -o myapp hello.go                     # -> myapp
llgo run hello.go                                # run locally
llgo install hello.go                            # install to bin

# Cross-compilation
llgo build -target esp32 .                       # -> hello.elf (ELF)
llgo build -target esp32 -obin -oimg.            # -> hello.elf, hello.bin, hello.img
llgo run -target esp32 .                         # run on ESP32 (guess a port)
llgo run -target esp32 -emulator .               # run in emulator
llgo test -target esp32 -port /dev/ttyUSB0 .     # run tests on device (just workflow)
llgo test -target esp32 -emulator .              # run tests in emulator (just workflow)
llgo cmptest -target esp32 -port /dev/ttyUSB0 .  # run tests on device (just workflow)
llgo cmptest -target esp32 -emulator .           # run tests in emulator (just workflow)
llgo install -target esp32 -port /dev/ttyUSB0 .  # flash to specific port
llgo monitor -target esp32 -port /dev/ttyUSB0 .  # show logs and panic address

cpunion and others added 3 commits September 6, 2025 10:35
Add support for -file-format flag to llgo build command allowing users to specify output format independently of target configuration.

Changes:
- Add -file-format flag supporting bin, hex, elf, uf2, zip formats
- Implement two-stage conversion: firmware format → file format
- Add ConvertOutput function with hex format conversion support
- Update build logic to handle different modes (build vs run/install)
- Add verbose logging for conversion operations

For build command: only convert firmware when -file-format is specified
For run/install commands: always convert firmware when target requires it

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

Co-Authored-By: Claude <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Sep 6, 2025

Codecov Report

❌ Patch coverage is 88.39286% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.16%. Comparing base (7de4137) to head (d46a3f2).
⚠️ Report is 26 commits behind head on main.

Files with missing lines Patch % Lines
internal/shellparse/shellparse.go 86.53% 6 Missing and 1 partial ⚠️
internal/env/utils.go 79.31% 4 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1271      +/-   ##
==========================================
- Coverage   90.19%   90.16%   -0.03%     
==========================================
  Files          40       42       +2     
  Lines       11714    11786      +72     
==========================================
+ Hits        10565    10627      +62     
- Misses       1018     1026       +8     
- Partials      131      133       +2     

☔ 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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is migrated from tinygo, can skip review.

Copy link
Contributor

@MeteorsLiu MeteorsLiu Sep 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOTE: The implements of QEMU or other toolchain downloading move to outside.

@xushiwei xushiwei merged commit 1556b29 into goplus:main Sep 8, 2025
37 of 40 checks passed
luoliwoshang pushed a commit to luoliwoshang/llgo that referenced this pull request Sep 8, 2025
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.

3 participants