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

56
targets/avr.ld Normal file
View File

@@ -0,0 +1,56 @@
MEMORY
{
FLASH_TEXT (rw) : ORIGIN = 0, LENGTH = __flash_size - _bootloader_size
RAM (xrw) : ORIGIN = 0x800000 + __ram_start, LENGTH = __ram_size
}
ENTRY(main)
SECTIONS
{
.text :
{
KEEP(*(.vectors))
KEEP(*(.text.__vector_RESET))
KEEP(*(.text.main)) /* main must follow the reset handler */
*(.text)
*(.text.*)
*(.progmem)
*(.progmem.*)
. = ALIGN(16); /* needed with ld.lld for some reasoon */
}
.stack (NOLOAD) :
{
. += _stack_size;
_stack_top = .;
} >RAM
_sidata = LOADADDR(.data);
.data :
{
_sdata = .; /* used by startup code */
*(.rodata)
*(.rodata.*)
*(.data)
*(.data*)
_edata = .; /* used by startup code */
} >RAM AT>FLASH_TEXT
.bss :
{
_sbss = .; /* used by startup code */
*(.bss)
*(.bss*)
*(COMMON)
_ebss = .; /* used by startup code */
} >RAM
}
/* For the memory allocator. */
_heap_start = _ebss;
_heap_end = ORIGIN(RAM) + LENGTH(RAM);
_globals_start = _sdata;
_globals_end = _ebss;