268 Commits

Author SHA1 Message Date
xgopilot
d17ff2592a build: improve error handling and code quality
- Fix missing error handling in exportObject function
- Add explicit warning for non-string variable rewrites
- Improve documentation for maxRewriteValueLength constant

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: cpunion <8459+cpunion@users.noreply.github.com>
2025-11-14 11:37:09 +00:00
Li Jie
3a1d8693e9 rewrite: address review feedback 2025-11-14 17:57:05 +08:00
Li Jie
8ba8ec71b5 build: write exports into temp files 2025-11-14 16:58:33 +08:00
Li Jie
1e4616a758 build: don't replace ExportFile 2025-11-14 16:58:33 +08:00
Li Jie
22a43622a0 cl: fix global var rewrite in alt pkg 2025-11-14 16:58:30 +08:00
Li Jie
e2bb68489d build: override vars in alt pkg 2025-11-14 14:37:39 +08:00
Li Jie
9b76be9e9e support ldflags rewrites for initialized globals 2025-11-14 11:59:13 +08:00
xushiwei
9e1b321ce6 Merge pull request #1308 from visualfc/cabi_riscv
internal/cabi: support risc-v specific target-abi
2025-09-26 16:30:43 +08:00
visualfc
62d0ee39de runtime: math/big use math_big_pure_go 2025-09-24 10:32:57 +08:00
luoliwoshang
c562f05b51 fix:GenLL correct compile 2025-09-17 14:17:17 +08:00
visualfc
db28648d29 internal/cabi: support riscv64/riscv32 target-abi 2025-09-16 12:42:30 +08:00
visualfc
8bfe133bee internal/cabi: support target esp32c3 2025-09-14 20:50:13 +08:00
xushiwei
897f944760 Merge pull request #1296 from visualfc/cabi_esp32
internal/cabi: support target esp32
2025-09-14 10:32:20 +08:00
visualfc
6170c1dcb9 internal/cabi: support target esp32 2025-09-12 11:16:25 +08:00
Li Jie
3605eeeef7 export c header file for build library 2025-09-11 14:07:58 +08:00
Li Jie
a2742a9de4 set buildmode to exe for non-build mode 2025-09-11 08:53:17 +08:00
Li Jie
68947bfc1f Fix library mode linking by optimizing genMainModuleFile
- For library modes (c-archive, c-shared), only generate minimal code with __llgo_argc/__llgo_argv globals
- For executable mode, generate full main function with runtime initialization
- This fixes undefined symbol errors when linking libraries that reference these globals
2025-09-11 08:53:17 +08:00
Li Jie
e05c8b9f46 Implement llgo build mode support (#1197)
- Add BuildMode type with three build modes: exe, c-archive, c-shared
- Restrict buildmode flag to llgo build command only (not run/install/test)
- Implement build mode specific linker arguments:
  - c-shared: use -shared -fPIC flags
  - c-archive: use ar tool to create static archive
  - exe: default executable mode
- Add normalizeOutputPath function for platform-specific file naming conventions
- Generate C header files for library modes
- Fix buildmode flag conflict by removing from PassArgs
- Add comprehensive test coverage for all build modes
- Resolve duplicate logic between defaultAppExt and normalizeOutputPath

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-11 08:53:17 +08:00
visualfc
dd50d4dff0 internal/cabi: option optimize 2025-09-09 21:10:53 +08:00
Li Jie
d46a3f2f49 Merge commit '7de4137d4678a3bcbd735f887028489f97f1e479' into embed-cmds
# Conflicts:
#	internal/build/build.go
2025-09-08 15:22:48 +08:00
Li Jie
3ecf9b35f3 refine: safe shell cmd line parse 2025-09-07 16:37:38 +08:00
Li Jie
df07513a37 refine: reduce unnecessary format conversion 2025-09-07 16:37:34 +08:00
Li Jie
16c8402065 refactor: multi format generation and llgo build flags 2025-09-07 16:23:31 +08:00
Li Jie
c0afe199c2 refactor: move device types definition into flash 2025-09-07 16:23:31 +08:00
Li Jie
4e590d42be feat: auto guess port for monitoring 2025-09-07 16:23:30 +08:00
Li Jie
a2c9c7f10a feat: llgo run -target target -port port auto start monitor 2025-09-07 16:23:30 +08:00
Li Jie
1a3bca40bc feat: implement flash functionality 2025-09-06 20:53:28 +08:00
Li Jie
549beeb101 test output format for all target/emuator/flash-method 2025-09-06 19:46:33 +08:00
Li Jie
7cad146013 refactor build/install/run pipeline 2025-09-06 19:45:48 +08:00
Li Jie
1033452e8f extract run from linkMainPkg, add flash scaffold 2025-09-06 16:16:04 +08:00
Li Jie
5e5d5c2a83 Build and run for embeded 2025-09-06 10:35:58 +08:00
Li Jie
df8f67db5a remove debug log 2025-09-06 10:35:58 +08:00
Li Jie
e9170e4cef feat: add -file-format flag for flexible output formats
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>
2025-09-06 10:35:58 +08:00
Li Jie
62fc21e22b Merge commit '6588f36123eababf6e24564b49e5af374285d2b5' into optional-esp-clang
# Conflicts:
#	internal/crosscompile/crosscompile.go
#	internal/crosscompile/crosscompile_test.go
2025-09-03 09:32:38 +08:00
xushiwei
6588f36123 Merge pull request #1246 from MeteorsLiu/esp-libc
feat: support libc/compiler-rt for small places
2025-09-03 07:05:51 +08:00
Haolan
53e22488c8 fix: remove debug compiler options 2025-08-29 17:54:08 +08:00
Haolan
3f2fe83718 fix: check needStart by libc name 2025-08-29 16:02:23 +08:00
Haolan
4639ee13e7 feat: support compiler-rt 2025-08-29 11:30:25 +08:00
Haolan
f3ecce86ee feat: support libc for small devices 2025-08-28 20:11:13 +08:00
visualfc
ab57a13eb1 internal/build: fix warning duplicate -rpath 2025-08-26 13:54:15 +08:00
Li Jie
f361d195f0 clean debug log 2025-08-25 10:52:22 +08:00
Li Jie
11e1348a2c add force-espclang to force using esp-clang for dev mode 2025-08-24 17:31:57 +08:00
Li Jie
ca30338066 optional use esp clang for non-cross-compilation 2025-08-24 17:28:42 +08:00
xushiwei
3bfedb2588 Merge pull request #1228 from visualfc/dev_check
build: dev support checkLinkArgs/CheckLLFiles/GenLLFiles
2025-08-24 08:42:38 +08:00
Li Jie
e40bdc196b binary-format supports uf2, nrf-dfu 2025-08-23 17:45:20 +08:00
Li Jie
ecaf7c8ac6 supports binary-format, only esp* supported for now 2025-08-22 21:05:29 +08:00
Li Jie
1f193c8533 refine internal/clang: don't depends internal/crosscompile 2025-08-22 09:08:26 +08:00
Li Jie
c8eb871252 report error if extra file not exist 2025-08-22 08:42:29 +08:00
Li Jie
c9c703dfe6 remove duplicated CCFLSGS args 2025-08-22 06:57:20 +08:00
Li Jie
6e20a435af targets supports extra-files 2025-08-21 21:55:42 +08:00