feat: implement target configuration system for issue #1176

Add comprehensive target configuration parsing and inheritance system:

- Create internal/targets package with config structures
- Support JSON configuration loading with inheritance resolution
- Implement multi-level inheritance (e.g., rp2040 → cortex-m0plus → cortex-m)
- Add 206 target configurations from TinyGo for embedded platforms
- Support core fields: name, llvm-target, cpu, features, build-tags, goos, goarch, cflags, ldflags
- Provide high-level resolver interface for target lookup
- Include comprehensive unit tests with 100% target parsing coverage

This foundation enables future -target parameter support for cross-compilation
to diverse embedded platforms beyond current GOOS/GOARCH limitations.

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Li Jie
2025-07-26 10:49:35 +10:00
parent 5eb833a984
commit b80a54eb0f
277 changed files with 8202 additions and 0 deletions

43
targets/avrtiny.S Normal file
View File

@@ -0,0 +1,43 @@
#define __tmp_reg__ r16
#define __zero_reg__ r17
; Startup code
.section .text.__vector_RESET
.global __vector_RESET
__vector_RESET:
clr __zero_reg__ ; this register is expected to be 0 by the C calling convention
; Keep the stack pointer at the default location, which is RAMEND.
; Initialize .data section.
.section .text.__do_copy_data,"ax",@progbits
.global __do_copy_data
__do_copy_data:
ldi xl, lo8(__data_start)
ldi xh, hi8(__data_start)
ldi yl, lo8(__data_end)
ldi yh, hi8(__data_end)
ldi zl, lo8(__data_load_start)
ldi zh, hi8(__data_load_start)
1: ; loop
cp xl, yl ; if x == y
cpc xh, yh
breq 2f ; goto end
ld r16, Z+ ; r0 = *(z++)
st X+, r16 ; *(x++) = r0
rjmp 1b ; goto loop
2: ; end
; Initialize .bss section.
.section .text.__do_clear_bss,"ax",@progbits
.global __do_clear_bss
__do_clear_bss:
ldi xl, lo8(__bss_start)
ldi xh, hi8(__bss_start)
ldi yl, lo8(__bss_end)
1: ; loop
cp xl, yl ; if x == y
breq 2f ; goto end
st X+, __zero_reg__ ; *(x++) = 0
rjmp 1b ; goto loop
2: ; end