3.1.13. Waf Tool TI ARM CGT¶
The tool is located in tools/waf-tools
.
3.1.13.1. Tool Documentation¶
Implements a waf tool to use TI ARM CGT (https://www.ti.com/tool/ARM-CGT).
-
f_ti_arm_cgt.
accept_node_to_link
(self, node)¶ filters which output files are not meant to be linked
-
f_ti_arm_cgt.
add_bingen_task
(self)¶ creates a task to create a bin file from the linker output (task
f_ti_arm_cgt.bingen
)
-
f_ti_arm_cgt.
add_copy_elf_task
(self)¶ creates a task to copy the elf file into the output root (task
f_ti_arm_cgt.copy_elf
)
-
f_ti_arm_cgt.
add_hexgen_task
(self)¶ creates a tasks to create a hex file from the linker output (task
f_ti_arm_cgt.hexgen
)
-
class
f_ti_arm_cgt.
armclFormatter
(*args: Any, **kwargs: Any)¶ Bases:
waflib.Logs.
Custom formatter for armcl output
warnings printed in yellow
errors printed in red
This formatter overwrites the default formatter in
f_ti_arm_cgt.options()
-
static
colorize
(txt)¶ Colorizes the input text for console output
-
format
(rec)¶ Overwrite the default formatter with the custom coloring formatter
-
class
f_ti_arm_cgt.
asm
(*args: Any, **kwargs: Any)¶ Bases:
waflib.Task.
class to run the TI ARM CGT compiler in compiler mode to create object files from assembler sources.
-
ext_in
= ['.h']¶ extensions that trigger a re-build
- Type
list of str
-
keyword
()¶ displayed keyword when assembler source files are compiled
-
run_str
= '${CC} ${CFLAGS} ${CC_COMPILE_ONLY} ${ASM_DIRECTORY}${TGT[0].parent.bldpath()} ${CPPPATH_ST:INCPATHS} ${DEFINES_ST:DEFINES} ${SRC} ${CC_TGT_F}${TGT[0].relpath()}'¶ string to be interpolated to create the command line to compile assembler files. See Fig. 3.6 for a simplified representation
- Type
str
-
scan
¶ function to be used as scanner method
- Type
fun
-
vars
= ['CCDEPS']¶ values that effect the signature calculation
- Type
list of str
-
-
f_ti_arm_cgt.
asm_hook
(self, node)¶ creates the compiled task for assembler sources
f_ti_arm_cgt.create_compiled_task_asm()
.
-
class
f_ti_arm_cgt.
bingen
(*args: Any, **kwargs: Any)¶ Bases:
waflib.Task.
Task create bin file from elf files
-
after
= ['link_task']¶ tasks after that hexgen task can be run
- Type
list of str
-
color
= 'CYAN'¶ color in which the command line is displayed in the terminal
- Type
str
-
keyword
()¶ displayed keyword when generating the bin file
-
run_str
= '${TIOBJ2BIN} ${SRC[0].abspath()} ${TGT[0].abspath()} ${ARMOFD} ${ARMHEX} ${MKHEX4BIN}'¶ string to be interpolated to create the command line to create a bin file from an elf file.
- Type
str
-
-
class
f_ti_arm_cgt.
c
(*args: Any, **kwargs: Any)¶ Bases:
waflib.Task.
This class implements the TI ARM CGT compiler in compiler mode to create object files from c sources. Additionally an aux file (user information file), a crl files (cross-reference listing file) and a rl file (output preprocessor listing) are generated.
These additional files are generated as in
conf/cc/cc-options.yaml
the options--gen_cross_reference_listing
,--gen_func_info_listing
and--gen_preprocessor_listing
are passed in the compile step. See CFLAGS.-
ext_in
= ['.h']¶ extensions that trigger a re-build
- Type
list of str
-
keyword
()¶ displayed keyword when source files are compiled
-
run_str
= '${CC} ${CFLAGS} ${CMD_FILES_ST:CMD_FILES} ${CFLAGS_COMPILE_ONLY} ${CC_COMPILE_ONLY} ${OBJ_DIRECTORY}${TGT[0].parent.bldpath()} ${CPPPATH_ST:INCPATHS} ${DEFINES_ST:DEFINES} ${SRC[0].abspath()} ${CC_TGT_F}${TGT[0].abspath()}'¶ string to be interpolated to create the command line to compile C files. See Fig. 3.7 for a simplified representation
- Type
str
-
scan
¶ function to be used as scanner method
- Type
fun
-
vars
= ['CCDEPS', 'CMD_FILES_HASH']¶ values that effect the signature calculation
- Type
list of str
-
-
f_ti_arm_cgt.
c_hook
(self, node)¶ creates all related task generators for C sources, which are
-
class
f_ti_arm_cgt.
c_pp
(*args: Any, **kwargs: Any)¶ Bases:
waflib.Task.
class to run the TI ARM CGT compiler in “preproc_only” mode, to have a pp file that includes the preprocess information
-
color
= 'CYAN'¶ color in which the command line is displayed in the terminal
- Type
str
-
ext_in
= ['.h']¶ extensions that trigger a re-build
- Type
list of str
-
keyword
()¶ displayed keyword when source files are parsed for pp information
-
run_str
= '${CC} ${CFLAGS} ${CMD_FILES_ST:CMD_FILES} ${PPO} ${CC_TGT_F}${TGT[0].abspath()} ${CPPPATH_ST:INCPATHS} ${DEFINES_ST:DEFINES} ${SRC[0].abspath()}'¶ string to be interpolated to create the command line to get include information from C files. See Fig. 3.8 for a simplified representation
- Type
str
-
scan
¶ function to be used as scanner method
- Type
fun
-
vars
= ['CCDEPS', 'CMD_FILES_HASH']¶ values that effect the signature calculation
- Type
list of str
-
-
class
f_ti_arm_cgt.
c_ppd
(*args: Any, **kwargs: Any)¶ Bases:
waflib.Task.
class to run the TI ARM CGT compiler in “preproc_dependency” mode, to have a ppd file that includes dependency information
-
color
= 'CYAN'¶ color in which the command line is displayed in the terminal
- Type
str
-
ext_in
= ['.h']¶ extensions that trigger a re-build
- Type
list of str
-
keyword
()¶ displayed keyword when source files are parsed for ppd information
-
run_str
= '${CC} ${CFLAGS} ${CMD_FILES_ST:CMD_FILES} ${PPD} ${CC_TGT_F}${TGT[0].abspath()} ${CPPPATH_ST:INCPATHS} ${DEFINES_ST:DEFINES} ${SRC[0].abspath()}'¶ string to be interpolated to create the command line to get dependency information from C files. See Fig. 3.9 for a simplified representation
- Type
str
-
scan
¶ function to be used as scanner method
- Type
fun
-
vars
= ['CCDEPS', 'CMD_FILES_HASH']¶ values that effect the signature calculation
- Type
list of str
-
-
class
f_ti_arm_cgt.
c_ppi
(*args: Any, **kwargs: Any)¶ Bases:
waflib.Task.
class to run the TI ARM CGT compiler in “preproc_includes” mode, to have a ppi file that includes the include information
-
color
= 'CYAN'¶ color in which the command line is displayed in the terminal
- Type
str
-
ext_in
= ['.h']¶ extensions that trigger a re-build
- Type
list of str
-
keyword
()¶ displayed keyword when source files are parsed for ppi information
-
run_str
= '${CC} ${CFLAGS} ${CMD_FILES_ST:CMD_FILES} ${PPI} ${CC_TGT_F}${TGT[0].abspath()} ${CPPPATH_ST:INCPATHS} ${DEFINES_ST:DEFINES} ${SRC[0].abspath()}'¶ string to be interpolated to create the command line to get include information from C files. See Fig. 3.10 for a simplified representation
- Type
str
-
scan
¶ function to be used as scanner method
- Type
fun
-
vars
= ['CCDEPS', 'CMD_FILES_HASH']¶ values that effect the signature calculation
- Type
list of str
-
-
class
f_ti_arm_cgt.
c_ppm
(*args: Any, **kwargs: Any)¶ Bases:
waflib.Task.
class to run the TI ARM CGT compiler in “preproc_macros” mode, to have a ppm file that includes all compile time macros
-
color
= 'CYAN'¶ color in which the command line is displayed in the terminal
- Type
str
-
ext_in
= ['.h']¶ extensions that trigger a re-build
- Type
list of str
-
keyword
()¶ displayed keyword when source files are parsed for ppm information
-
run_str
= '${CC} ${CFLAGS} ${CMD_FILES_ST:CMD_FILES} ${PPM} ${CC_TGT_F}${TGT[0].abspath()} ${CPPPATH_ST:INCPATHS} ${DEFINES_ST:DEFINES} ${SRC[0].abspath()}'¶ string to be interpolated to create the command line to get macro information from C files. See Fig. 3.11 for a simplified representation
- Type
str
-
scan
¶ function to be used as scanner method
- Type
fun
-
vars
= ['CCDEPS', 'CMD_FILES_HASH']¶ values that effect the signature calculation
- Type
list of str
-
-
f_ti_arm_cgt.
cgt_flags
(conf)¶ sets flags and related configuration options of the compiler.
-
f_ti_arm_cgt.
check_duplicate_and_not_existing_includes
(self)¶ Check if include directories are included more than once and if they really exist on the file system. If include directories do not exist, or they are included twice, raise an error.
-
class
f_ti_arm_cgt.
clean_pp_file
(*args: Any, **kwargs: Any)¶ Bases:
waflib.Task.
Task to remove some information from the preprocessed files
-
color
= 'PINK'¶ color in which the command line is displayed in the terminal
- Type
str
-
keyword
()¶ displayed keyword when post-processing the pre-processed files
-
remove_str
= ('#define', '#pragma', '# pragma', '_Pragma')¶ strings that need to be removed from the preprocessed file
- Type
tuple
-
replace_str
= [('__attribute__\\(.*\\)', '')]¶ regular expressions that should be removed with a certain string
- Type
list
-
run
()¶ Removes empty lines and strips some intrinsics that should not be included in the postprocessed file
-
-
f_ti_arm_cgt.
configure
(conf)¶ configuration step of the TI ARM CGT compiler tool
-
class
f_ti_arm_cgt.
copy_elf
(*args: Any, **kwargs: Any)¶ Bases:
waflib.Task.
This class implements the copying of the elf file to another location in the build tree
-
after
= ['link_task']¶ tasks after that hexgen task can be run
- Type
list of str
-
color
= 'CYAN'¶ color in which the command line is displayed in the terminal
- Type
str
-
keyword
()¶ displayed keyword when copying the elf file
-
run
()¶ copy the generated elf file to build directory of the variant
-
-
class
f_ti_arm_cgt.
cprogram
(*args: Any, **kwargs: Any)¶ Bases:
waflib.Tools.ccroot.
class to run the TI ARM CGT compiler in linker mode to create the target
-
ext_out
= ['.elf']¶ extensions that trigger a re-build
- Type
list of str
-
keyword
()¶ displayed keyword when black is linking the target
-
static
parse_output
(pull_config, obj_path, std)¶ parses the output of the linker
-
vars
= ['LINKDEPS', 'CMD_FILES_HASH']¶ values that effect the signature calculation
- Type
list of str
-
-
f_ti_arm_cgt.
create_compiled_task_asm
(self, name, node)¶ creates the assembler task and binds it to the
f_ti_arm_cgt.asm
class.The created tasks are appended to the list of
compiled_tasks
.
-
f_ti_arm_cgt.
create_compiled_task_c
(self, name, node)¶ Creates the assembler task and binds it to the
f_ti_arm_cgt.c
class.The created tasks are appended to the list of
compiled_tasks
.
-
f_ti_arm_cgt.
create_compiled_task_c_pp
(self, name, node)¶ Creates the pp task and binds it to the
f_ti_arm_cgt.c_pp
class.
-
f_ti_arm_cgt.
create_compiled_task_c_ppd
(self, name, node)¶ Creates the ppd task and binds it to the
f_ti_arm_cgt.c_ppd
class.
-
f_ti_arm_cgt.
create_compiled_task_c_ppi
(self, name, node)¶ Creates the ppi task and binds it to the
f_ti_arm_cgt.c_ppi
class.
-
f_ti_arm_cgt.
create_compiled_task_c_ppm
(self, name, node)¶ Creates the ppm task and binds it to the
f_ti_arm_cgt.c_ppm
class.
-
f_ti_arm_cgt.
create_version_file
(self)¶ Task generator for version information file
-
class
f_ti_arm_cgt.
create_version_source
(*args: Any, **kwargs: Any)¶ Bases:
waflib.Task.
creates the version information file
-
before
= ['c']¶ specifies task, that this task needs to run before
- Type
list of str
-
color
= 'BLUE'¶ color in which the command line is displayed in the terminal
- Type
str
-
ext_out
= ['.h']¶ extensions that trigger a re-build
- Type
list of str
-
get_remote
()¶ returns the git remote
-
get_repo_dirty_from_git
()¶ returns a boolean marking if the project’s working directory is dirty (which means it contains unstaged changes)
-
get_version_from_git
()¶ returns a version string that is extracted directly from the underlying git repository
-
run
()¶ Created the version information files
-
sig_explicit_deps
()¶ Defines how to get signature of this task (and thus when to rerun it)
-
weight
= 1¶ priority of the task
- Type
int
-
-
class
f_ti_arm_cgt.
cstlib
(*args: Any, **kwargs: Any)¶ Bases:
waflib.Tools.ccroot.
c static library
-
f_ti_arm_cgt.
find_armar
(conf)¶ configures the archive tool
-
f_ti_arm_cgt.
find_armcl
(conf)¶ configures the compiler, determines the compiler version, and sets the default include paths.
-
f_ti_arm_cgt.
find_tools
(conf)¶ configures additional tools related to the compiler
-
f_ti_arm_cgt.
get_defines
(self, *k, **kw)¶ Wrapper function to get all predefined compiler defines. Based on
waflib.Tools.c_config.check()
. This function usesrun_build_for_defines()
to perform the actual buildThis implementation is based on
waflib.Tools.c_config.check
: We do the same, as in c_config.check, except, that we userun_build_for_defines()
, which is based on waf’s run_build to create a persistent build directory. This is required as we need to parse the testbuild output in order to get the list of predefined defines of the compiler. We could have also used waf’s default –confcache option and set –confcache’s default to 1, but this would create a really cluttered output directory (Every test build of a configure command would be persistent). With this implementation we can still use waf’s default check(…) feature along with it’s option –confcache to have a good debug experience on the build process while not cluttering the output directory.
-
f_ti_arm_cgt.
get_swi_aliases
(self)¶ Find all swi aliases
-
f_ti_arm_cgt.
hash_cmd_files
(self)¶ calculate hashes for command files, before running the c-related tasks, as c-related tasks might rely on these files
-
class
f_ti_arm_cgt.
hexgen
(*args: Any, **kwargs: Any)¶ Bases:
waflib.Task.
Task create hex file from elf files
-
after
= ['link_task']¶ tasks after that hexgen task can be run
- Type
list of str
-
color
= 'YELLOW'¶ color in which the command line is displayed in the terminal
- Type
str
-
keyword
()¶ displayed keyword when generating the hex file
-
run_str
= '${ARMHEX} -q ${HEXGENFLAGS} --map=${TGT[1].abspath()} ${LINKER_SCRIPT_HEX} ${SRC[0].abspath()} -o ${TGT[0].abspath()}'¶ string to be interpolated to create the command line to create a hex file from an elf file.
- Type
str
-
-
f_ti_arm_cgt.
make_ti_paths_absolute
(self)¶ Vendor includes (TI) are passed as absolute paths
-
class
f_ti_arm_cgt.
nm
(*args: Any, **kwargs: Any)¶ Bases:
waflib.Task.
Task to run armnm on all input files
-
color
= 'PINK'¶ color in which the command line is displayed in the terminal
- Type
str
-
keyword
()¶ displayed keyword when armnm is run on object files
-
run_str
= '${ARMNM} ${NMFLAGS} --output=${TGT} ${SRC}'¶ string to be interpolated to create the command line to create a nm file from an
*.obj
,*.a
or*.elf
file.- Type
str
-
-
f_ti_arm_cgt.
options
(opt)¶ Configurable options of the
f_ti_arm_cgt
tool. The options are--cc-options=conf/cc/cc-options.yaml
Furthermore the default formatter gets replaced by
f_ti_arm_cgt.armclFormatter
.
-
class
f_ti_arm_cgt.
print_swi
(*args: Any, **kwargs: Any)¶ Bases:
waflib.Task.
gathers all swi information in one file
-
run
()¶ combines all swi information in one file
-
-
f_ti_arm_cgt.
print_swi_aliases
(self)¶ Find all swi aliases
-
f_ti_arm_cgt.
process_nm
(self)¶ creates nm tasks for generated object files
-
f_ti_arm_cgt.
process_sizes
(self)¶ creates size tasks for generated object and object-like files
-
f_ti_arm_cgt.
remove_stuff_from_pp
(self)¶ creates nm tasks for generated object files
-
f_ti_arm_cgt.
remove_targets
(task)¶ General helper function to remove targets
-
f_ti_arm_cgt.
run_build_for_defines
(self, *k, **kw)¶ Runs a build during configuration time. The build is based on
waflib.Configure.run_build()
. In contrast to a test build during configuration the output is persistent. This output is used to determine the predefined compiler defines.This implementation is based on
waflib.Configure.run_build
: We do the same as in run_build, except, that we hard code the output directory and change the return value to return the build success/failure and the path of the build directory- Parameters
out_name (string) – name of the output directory. Needs to be passed as kw.
- Returns
A tuple containing the success of the build and the path to the output directory
- Return type
tuple
-
class
f_ti_arm_cgt.
search_swi
(*args: Any, **kwargs: Any)¶ Bases:
waflib.Task.
Searches for swi aliases based on a regular expression
-
keyword
()¶ displayed keyword when this check is run
-
run
()¶ does the search check
-
-
class
f_ti_arm_cgt.
size
(*args: Any, **kwargs: Any)¶ Bases:
waflib.Task.
Task to run size on all input files
-
color
= 'BLUE'¶ color in which the command line is displayed in the terminal
- Type
str
-
keyword
()¶ displayed keyword when size is run on object files
-
run
()¶ implements the actual behavior of size and pipes the output into a file.
-
-
class
f_ti_arm_cgt.
stlink_task
(*args: Any, **kwargs: Any)¶ Bases:
waflib.Tools.ccroot.
static link task
-
keyword
()¶ displayed keyword when linking
-
-
f_ti_arm_cgt.
tiprogram
(bld, *k, **kw)¶ wrapper for bld.program for simpler target configuration. The linker script is added as env input/output dependency for the target. Based on the target name all related targets are created:
binary: <target>.<format>
linker information: <target>.<format>.xml
map information: <target>.<format>.map