Main Content

代码编译自定义

自定义编译过程的编译阶段

如果安装支持的编译工具,您可以配置编译过程,在代码生成后生成可执行代码。您可以自定义编译过程的编译阶段。

对于工具链方法:

  • 使用 target 包,创建自定义 CMake 工具链定义。

  • 使用 ToolchainInfo 对象,注册并使用自定义工具链。

对于模板联编文件方法:

  • 自定义附带的模板联编文件。

  • 创建并运行代码生成后命令。

  • 在编译过程的特定点上创建和应用钩子方法。

  • 为 S-Function 自定义生成的联编文件。

target管理目标硬件和构建工具信息

全部展开

target.ToolchainCapture high-level information about toolchain
target.CMakeSpecify CMake installation for building generated code
target.CMakeBuildTypeDescribe CMake build type or build configuration
target.CMakeBuilder Configure how CMake builds generated code
target.CMakeCacheEntryConfigure a CMake cache entry
target.EnvironmentConfigurationConfigure system environment for toolchain
target.HardwareComponentSupportDescribe support for a hardware component

对象

全部展开

RTW.BuildInfoProvide information for compiling and linking generated code

函数

全部展开

addCompileFlagsAdd compiler options to build information
addDefinesAdd preprocessor macro definitions to build information
addIncludeFilesAdd include files to build information
addIncludePathsAdd include paths to build information
addLinkFlagsAdd link options to build information
addLinkObjectsAdd link objects to build information
addNonBuildFilesAdd nonbuild-related files to build information
addSourceFilesAdd source files to build information
addSourcePathsAdd source paths to build information
addTMFTokensAdd template makefile (TMF) tokens to build information
findBuildArgFind a specific build argument in build information
findIncludeFilesFind and add include (header) files to build information
getBuildArgsGet build arguments from build information
getCompileFlagsGet compiler options from build information
getDefinesGet preprocessor macro definitions from build information
getFullFileListGet list of files from build information
getIncludeFilesGet include files from build information
getIncludePathsGet include paths from build information
getLinkFlagsGet link options from build information
getNonBuildFilesGet nonbuild-related files from build information
getSourceFilesGet source files from build information
getSourcePathsGet source paths from build information
setTargetProvidesMainDisable inclusion of code generator provided (generated or static) main.c source file during build
updateFilePathsAndExtensionsUpdate files in build information with missing paths and file extensions
updateFileSeparatorUpdate file separator character for file lists in build information
codebuildCompile and link generated code

主题

编译器

库名称和位置

CMake 工具链方法

ToolchainInfo 方法

模板联编文件方法

S-Function 编译