feat: add target name design

This commit is contained in:
Haolan
2025-08-29 19:25:09 +08:00
parent 53e22488c8
commit 1b3889ebc9
6 changed files with 22 additions and 25 deletions

View File

@@ -11,7 +11,7 @@ import (
// GetCompileConfigByName retrieves libc compilation configuration by name
// Returns compilation file lists and corresponding cflags
func getLibcCompileConfigByName(baseDir, libcName string) (*compile.CompileConfig, error) {
func getLibcCompileConfigByName(baseDir, libcName, target string) (*compile.CompileConfig, error) {
if libcName == "" {
return nil, fmt.Errorf("libc name cannot be empty")
}
@@ -19,15 +19,15 @@ func getLibcCompileConfigByName(baseDir, libcName string) (*compile.CompileConfi
switch libcName {
case "picolibc":
return libc.GetPicolibcConfig(libcDir), nil
return libc.GetPicolibcConfig(libcDir, target), nil
case "newlib-esp32":
return libc.GetNewlibESP32Config(libcDir, "xtensa"), nil
return libc.GetNewlibESP32Config(libcDir, target), nil
default:
return nil, fmt.Errorf("unsupported libc: %s", libcName)
}
}
func getRTCompileConfigByName(baseDir, rtName string) (*compile.CompileConfig, error) {
func getRTCompileConfigByName(baseDir, rtName, target string) (*compile.CompileConfig, error) {
if rtName == "" {
return nil, fmt.Errorf("rt name cannot be empty")
}
@@ -35,7 +35,7 @@ func getRTCompileConfigByName(baseDir, rtName string) (*compile.CompileConfig, e
switch rtName {
case "compiler-rt":
return rtlib.GetCompilerRTConfig(rtDir, "xtensa"), nil
return rtlib.GetCompilerRTConfig(rtDir, target), nil
default:
return nil, fmt.Errorf("unsupported rt: %s", rtName)
}