builder

package
v0.0.0-...-1686c67 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const BUILD_NAME_APP = "app"
View Source
const BUILD_NAME_LOADER = "loader"
View Source
const CMAKELISTS_FILENAME string = "CMakeLists.txt"

Variables

This section is empty.

Functions

func AppBinPath

func AppBinPath(targetName string, buildName string, appName string) string

func AppElfPath

func AppElfPath(targetName string, buildName string, appName string) string

func AppImgPath

func AppImgPath(targetName string, buildName string, appName string) string

func ArchivePath

func ArchivePath(targetName string, buildName string, pkgName string,
	pkgType interfaces.PackageType) string

func BasicEnvVars

func BasicEnvVars(binBase string, bspPkg *pkg.BspPackage) map[string]string

BasicEnvVars calculates the basic set of environment variables passed to all external scripts. `binBase` is the result of calling `binBasePath()`, or "" if you don't need the "BIN_BASENAME" setting.

func BinDir

func BinDir(targetName string, buildName string) string

func BinRoot

func BinRoot() string

func CMakeTargetGenerate

func CMakeTargetGenerate(target *target.Target) error

func CmakeCompilerInfoWrite

func CmakeCompilerInfoWrite(w io.Writer, archiveFile string, bpkg *BuildPackage,
	cj toolchain.CompilerJob, otherIncludes []string)

func CmakeCompilerWrite

func CmakeCompilerWrite(w io.Writer, c *toolchain.Compiler)

func CmakeHeaderWrite

func CmakeHeaderWrite(w io.Writer, c *toolchain.Compiler, targetName string)

func CmakeListsPath

func CmakeListsPath() string

func CmakeSourceObjectWrite

func CmakeSourceObjectWrite(w io.Writer, cj toolchain.CompilerJob,
	includeDirs *[]string, linkFlags *[]string)

func Contains

func Contains(elements []string, val string) bool

func DepGraphText

func DepGraphText(graph DepGraph) string

func DepGraphViz

func DepGraphViz(graph DepGraph) string

func EscapePkgName

func EscapePkgName(name string) string

func ExtractLibraryName

func ExtractLibraryName(filepath string) string

func FeatureString

func FeatureString(settings *cfgv.Settings) string

FeatureString converts a syscfg map to a string. The string is a space-separate list of "enabled" settings.

func FileBinDir

func FileBinDir(targetName string, buildName string, pkgName string) string

func GeneratedBaseDir

func GeneratedBaseDir(targetName string) string

func GeneratedBinDir

func GeneratedBinDir(targetName string) string

func GeneratedIncludeDir

func GeneratedIncludeDir(targetName string) string

func GeneratedSrcDir

func GeneratedSrcDir(targetName string) string

func Load

func Load(binBasePath string, bspPkg *pkg.BspPackage,
	extraEnvSettings map[string]string) error

func ManifestPath

func ManifestPath(targetName string, buildName string, pkgName string) string

func MfgBinDir

func MfgBinDir(mfgPkgName string) string

func MfgBootDir

func MfgBootDir(mfgPkgName string) string

func ParseMapFileSizes

func ParseMapFileSizes(fileName string) (map[string]*PkgSize, error)

* Go through GCC generated mapfile, and collect info about symbol sizes

func PkgBinDir

func PkgBinDir(targetName string, buildName string, pkgName string,
	pkgType interfaces.PackageType) string

func PkgSyscfgPath

func PkgSyscfgPath(pkgPath string) string

func PrintSizes

func PrintSizes(libs map[string]*PkgSize) error

* Return a printable string containing size data for the libraries

func ProjectRoot

func ProjectRoot() string

func RevdepGraphText

func RevdepGraphText(graph DepGraph) string

func RevdepGraphViz

func RevdepGraphViz(graph DepGraph) string

func RunOptionalCheck

func RunOptionalCheck(checkScript string, env map[string]string) error

func SettingsEnvVars

func SettingsEnvVars(settings *cfgv.Settings) map[string]string

SettingsEnvVars calculates the syscfg set of environment variables required by image loading scripts.

func SizeReport

func SizeReport(elfFilePath, srcBase string, sectionName string, diffFriendly bool) error

func SlotEnvVars

func SlotEnvVars(bspPkg *pkg.BspPackage,
	imageSlot int) (map[string]string, error)

SlotEnvVars calculates the image-slot set of environment variables required by image loading scripts. Pass a negative `imageSlot` value if the target is a boot loader.

func SortDepEntries

func SortDepEntries(entries []DepEntry)

func SysinitArchivePath

func SysinitArchivePath(targetName string) string

func TargetBinDir

func TargetBinDir(targetName string) string

func TestExePath

func TestExePath(targetName string, buildName string, pkgName string,
	pkgType interfaces.PackageType) string

func TestTargetName

func TestTargetName(testPkgName string) string

func ToolchainEnvVars

func ToolchainEnvVars(c *toolchain.Compiler) map[string]string

func UserBaseDir

func UserBaseDir(targetName string) string

func UserEnvVars

func UserEnvVars(params UserEnvParams) map[string]string

UserEnvVars calculates the set of environment variables required by external user scripts.

func UserPreBuildDir

func UserPreBuildDir(targetName string) string

func UserPreBuildIncludeDir

func UserPreBuildIncludeDir(targetName string) string

func UserPreBuildSrcDir

func UserPreBuildSrcDir(targetName string) string

func UserPreLinkDir

func UserPreLinkDir(targetName string) string

func UserPreLinkSrcDir

func UserPreLinkSrcDir(targetName string) string

func UserTempIncludeDir

func UserTempIncludeDir(tempDir string) string

func UserTempSrcDir

func UserTempSrcDir(tempDir string) string

Types

type BuildPackage

type BuildPackage struct {
	SourceDirectories []string
	SourceFiles       []string
	// contains filtered or unexported fields
}

func NewBuildPackage

func NewBuildPackage(rpkg *resolve.ResolvePackage) *BuildPackage

func (*BuildPackage) BuildProfile

func (bpkg *BuildPackage) BuildProfile(b *Builder) string

Retrieves the build package's build profile override, as specified in its `pkg.yml` file. If the package does not override the build profile, "" is returned.

func (*BuildPackage) CompilerInfo

func (bpkg *BuildPackage) CompilerInfo(
	b *Builder) (*toolchain.CompilerInfo, error)

type Builder

type Builder struct {
	PkgMap map[*resolve.ResolvePackage]*BuildPackage
	// contains filtered or unexported fields
}

func NewBuilder

func NewBuilder(
	t *TargetBuilder,
	buildName string,
	rpkgs []*resolve.ResolvePackage,
	apiMap map[string]*resolve.ResolvePackage,
	cfg syscfg.Cfg) (*Builder, error)

func (*Builder) AddCompilerInfo

func (b *Builder) AddCompilerInfo(info *toolchain.CompilerInfo)

func (*Builder) AppBinBasePath

func (b *Builder) AppBinBasePath() string

func (*Builder) AppBinPath

func (b *Builder) AppBinPath() string

func (*Builder) AppElfPath

func (b *Builder) AppElfPath() string

func (*Builder) AppHexPath

func (b *Builder) AppHexPath() string

func (*Builder) AppImgPath

func (b *Builder) AppImgPath() string

func (*Builder) AppLinkerElfPath

func (b *Builder) AppLinkerElfPath() string

func (*Builder) AppMapPath

func (b *Builder) AppMapPath() string

func (*Builder) AppPath

func (b *Builder) AppPath() string

func (*Builder) AppTentativeElfPath

func (b *Builder) AppTentativeElfPath() string

func (*Builder) AppendModifiedRepos

func (b *Builder) AppendModifiedRepos(modifiedRepos []string)

func (*Builder) ArchivePath

func (b *Builder) ArchivePath(bpkg *BuildPackage) string

Generates the path+filename of the specified package's .a file.

func (*Builder) BinDir

func (b *Builder) BinDir() string

func (*Builder) Build

func (b *Builder) Build() error

func (*Builder) CMakeBuildPackageWrite

func (b *Builder) CMakeBuildPackageWrite(w io.Writer, bpkg *BuildPackage,
	linkFlags *[]string, libraries *[]string) (*BuildPackage, error)

func (*Builder) CMakeTargetWrite

func (b *Builder) CMakeTargetWrite(w io.Writer, targetCompiler *toolchain.Compiler) error

func (*Builder) CleanArtifacts

func (b *Builder) CleanArtifacts()

Deletes files that should never be reused for a subsequent build. This list includes:

<app>.img
<app>.elf.bin
manifest.json

func (*Builder) CollectCompileEntriesBpkg

func (b *Builder) CollectCompileEntriesBpkg(bpkg *BuildPackage) (
	[]toolchain.CompilerJob, error)

func (*Builder) CompileCmdsPath

func (b *Builder) CompileCmdsPath() string

func (*Builder) CopySymbols

func (b *Builder) CopySymbols(sm *symbol.SymbolMap) error

func (*Builder) Debug

func (b *Builder) Debug(extraJtagCmd string, reset bool, noGDB bool, binBase string) error

func (*Builder) EnvVars

func (b *Builder) EnvVars(imageSlot int) (map[string]string, error)

EnvVars calculates the full set of environment variables passed to external scripts.

func (*Builder) ExtractSymbolInfo

func (b *Builder) ExtractSymbolInfo() (error, *symbol.SymbolMap)

func (*Builder) FetchSymbolMap

func (b *Builder) FetchSymbolMap() (error, *symbol.SymbolMap)

func (*Builder) FileBinDir

func (b *Builder) FileBinDir(pkgName string) string

func (*Builder) FindPkgNameByArName

func (b *Builder) FindPkgNameByArName(arName string) string

func (*Builder) GetAutogeneratedLinkerIncludeDir

func (b *Builder) GetAutogeneratedLinkerIncludeDir() (string, error)

func (*Builder) GetCompilerInfo

func (b *Builder) GetCompilerInfo() *toolchain.CompilerInfo

func (*Builder) GetModifiedRepos

func (b *Builder) GetModifiedRepos() []string

func (*Builder) GetTarget

func (b *Builder) GetTarget() *target.Target
func (b *Builder) KeepLink(linkerScripts []string, keepMap *symbol.SymbolMap,
	extraADirs []string) error
func (b *Builder) Link(linkerScripts []string, extraADirs []string) error

func (*Builder) Load

func (b *Builder) Load(imageSlot int, extraJtagCmd string, imgFilename string) error

func (*Builder) ManifestPath

func (b *Builder) ManifestPath() string

func (*Builder) ParseObjectElf

func (b *Builder) ParseObjectElf(elf_file string) (error, *symbol.SymbolMap)

func (*Builder) ParseObjectLibrary

func (b *Builder) ParseObjectLibrary(bp *BuildPackage) (
	error, *symbol.SymbolMap)

func (*Builder) ParseObjectLibraryFile

func (b *Builder) ParseObjectLibraryFile(bp *BuildPackage,
	file string, textDataOnly bool) (error, *symbol.SymbolMap)

func (*Builder) PkgBinDir

func (b *Builder) PkgBinDir(bpkg *BuildPackage) string

func (*Builder) PrepBuild

func (b *Builder) PrepBuild() error

Populates the builder with all the packages that need to be built and configures each package's build settings. After this function executes, packages are ready to be built.

func (*Builder) RemovePackages

func (b *Builder) RemovePackages(cmn map[string]bool) error

func (*Builder) SelfTestExecute

func (b *Builder) SelfTestExecute(testRpkg *resolve.ResolvePackage) error
func (b *Builder) SelfTestLink(rpkg *resolve.ResolvePackage) error

func (*Builder) Size

func (b *Builder) Size() error

func (*Builder) SizeReport

func (b *Builder) SizeReport(sectionName string, diffFriendly bool) error

func (*Builder) SortedRpkgs

func (b *Builder) SortedRpkgs() []*resolve.ResolvePackage
func (b *Builder) TentativeLink(linkerScripts []string,
	extraADirs []string) error

func (*Builder) TestExePath

func (b *Builder) TestExePath() string

type DepEntry

type DepEntry struct {
	PkgName string
	// Expressions that enable the dependency.
	DepExprs parse.ExprSet
	// Required APIs and their enabling expressions.
	ReqApiExprs parse.ExprMap
	// Satisfied APIs and their enabling expressions.
	ApiExprs parse.ExprMap
}

type DepGraph

type DepGraph map[string][]DepEntry

Key=parent, Value=slice of children For normal dependency graph: parent=depender, children=dependees. For reverse dependency graph: parent=dependee, children=dependers.

func FilterDepGraph

func FilterDepGraph(dg DepGraph, parents []*resolve.ResolvePackage) (
	DepGraph, []*resolve.ResolvePackage)

Extracts a new dependency graph containing only the specified parents.

@param dg The source graph to filter. @param parents The parent nodes to keep.

@return DepGraph Filtered dependency graph.

[]*ResolvePackage    Specified packages that were not parents in
                         original graph.

type File

type File struct {
	Name    string
	Symbols map[string]*Symbol
}

type Folder

type Folder struct {
	Name    string
	Files   map[string]*File
	Folders map[string]*Folder
}

func (*Folder) ToString

func (f *Folder) ToString(total uint64, diffFriendly bool) string

type MemSection

type MemSection struct {
	Name   string
	Offset uint64
	EndOff uint64
}

* These are different memory regions as specified in linker script.

func MakeMemSection

func MakeMemSection(name string, off uint64, size uint64) *MemSection

func (*MemSection) PartOf

func (m *MemSection) PartOf(addr uint64) bool

type MemSectionArray

type MemSectionArray []*MemSection

func (MemSectionArray) Len

func (array MemSectionArray) Len() int

func (MemSectionArray) Less

func (array MemSectionArray) Less(i, j int) bool

func (MemSectionArray) Swap

func (array MemSectionArray) Swap(i, j int)

type MemoryRegion

type MemoryRegion struct {
	Name         string
	Offset       uint64
	EndOff       uint64
	TotalSize    uint64
	SectionNames map[string]struct{}
	NamesSizes   map[string]uint64
}

func MakeMemoryRegion

func MakeMemoryRegion() *MemoryRegion

func (*MemoryRegion) PartOf

func (m *MemoryRegion) PartOf(addr uint64) bool

type PkgSize

type PkgSize struct {
	Name  string
	Sizes map[string]uint32      /* Sizes indexed by mem section name */
	Syms  map[string]*SymbolData /* Symbols indexed by symbol name */
}

* We accumulate the size of libraries to elements in this.

func MakePkgSize

func MakePkgSize(name string) *PkgSize

type PkgSizeArray

type PkgSizeArray []*PkgSize

func (PkgSizeArray) Len

func (array PkgSizeArray) Len() int

func (PkgSizeArray) Less

func (array PkgSizeArray) Less(i, j int) bool

func (PkgSizeArray) Swap

func (array PkgSizeArray) Swap(i, j int)

type Symbol

type Symbol struct {
	Name    string
	Section string
	Size    uint64
}

func MakeSymbol

func MakeSymbol(name string, section string, size uint64) *Symbol

type SymbolData

type SymbolData struct {
	Name    string
	ObjName string            /* Which object file it came from */
	Sizes   map[string]uint32 /* Sizes indexed by mem section name */
}

* Info about specific symbol size

func MakeSymbolData

func MakeSymbolData(name string, objName string) *SymbolData

type SymbolDataArray

type SymbolDataArray []*SymbolData

func (SymbolDataArray) Len

func (array SymbolDataArray) Len() int

func (SymbolDataArray) Less

func (array SymbolDataArray) Less(i, j int) bool

func (SymbolDataArray) Swap

func (array SymbolDataArray) Swap(i, j int)

type TargetBuilder

type TargetBuilder struct {
	AppBuilder *Builder
	AppList    interfaces.PackageList

	LoaderBuilder *Builder
	LoaderList    interfaces.PackageList
	// contains filtered or unexported fields
}

func NewTargetBuilder

func NewTargetBuilder(target *target.Target) (*TargetBuilder, error)

func NewTargetTester

func NewTargetTester(target *target.Target,
	testPkg *pkg.LocalPackage) (*TargetBuilder, error)

func (*TargetBuilder) BspPkg

func (t *TargetBuilder) BspPkg() *pkg.BspPackage

func (*TargetBuilder) Build

func (t *TargetBuilder) Build() error

func (*TargetBuilder) CMakeTargetBuilderWrite

func (t *TargetBuilder) CMakeTargetBuilderWrite(w io.Writer, targetCompiler *toolchain.Compiler) error

func (*TargetBuilder) CreateDepGraph

func (t *TargetBuilder) CreateDepGraph() (DepGraph, error)

func (*TargetBuilder) CreateRevdepGraph

func (t *TargetBuilder) CreateRevdepGraph() (DepGraph, error)

func (*TargetBuilder) Debug

func (t *TargetBuilder) Debug(extraJtagCmd string, reset bool, noGDB bool, elfFileOverride string) error

Debug runs gdb on the .elf file corresponding to what is running on a device. If elfFileOverride is not empty, it specifies the path of the .elf file to debug. If it is empty, the .elf file in the target's `bin` directory is loaded.

func (*TargetBuilder) GetTarget

func (t *TargetBuilder) GetTarget() *target.Target

func (*TargetBuilder) GetTestPkg

func (t *TargetBuilder) GetTestPkg() *pkg.LocalPackage

func (*TargetBuilder) InjectSetting

func (t *TargetBuilder) InjectSetting(key string, value string)

func (*TargetBuilder) Load

func (t *TargetBuilder) Load(extraJtagCmd string, imgFileOverride string) error

Load loads a .img file onto a device. If imgFileOverride is not empty, it specifies the path of the image file to load. If it is empty, the image in the target's `bin` directory is loaded.

func (*TargetBuilder) MaxImgSizes

func (t *TargetBuilder) MaxImgSizes() []int

Calculates the size of the largest image that can be written to each image slot.

func (*TargetBuilder) NewCompiler

func (t *TargetBuilder) NewCompiler(dstDir string, buildProfile string) (
	*toolchain.Compiler, error)

func (*TargetBuilder) PrepBuild

func (t *TargetBuilder) PrepBuild() error

func (*TargetBuilder) RelinkLoader

func (t *TargetBuilder) RelinkLoader() (error, map[string]bool,
	*symbol.SymbolMap)

* This function re-links the loader adding symbols from libraries * shared with the app. Returns a list of the common packages shared * by the app and loader

func (*TargetBuilder) Resolve

func (t *TargetBuilder) Resolve() (*resolve.Resolution, error)

func (*TargetBuilder) SelfTestCreateExe

func (t *TargetBuilder) SelfTestCreateExe() error

func (*TargetBuilder) SelfTestDebug

func (t *TargetBuilder) SelfTestDebug() error

func (*TargetBuilder) SelfTestExecute

func (t *TargetBuilder) SelfTestExecute() error

func (*TargetBuilder) Size

func (t *TargetBuilder) Size() error

func (*TargetBuilder) SizeReport

func (t *TargetBuilder) SizeReport(sectionName string, diffFriendly bool) error

type UserEnvParams

type UserEnvParams struct {
	Lpkg         *pkg.LocalPackage
	TargetName   string // Short name
	BuildProfile string
	AppName      string
	BuildName    string // "app" or "loader"
	UserSrcDir   string // "" if none
	UserIncDir   string // "" if none
	WorkDir      string
	GeneratedDir string
	TergetBinDir string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL