# 3.1.9. HALCoGen

Note

A documentation of the tool HALCoGen can be found in HALCoGen tool documentation, the waf-tool wrapper for this project in this section, information on configuring HALCoGen in the context of the toolchain of this project in HALCoGen and an example on how to use a pre-generated HAL instead of generating it in the compilation step in How to Use Generated Sources from HALCoGen.

The tool is located in tools/waf-tools.

Implements a waf tool to use TI HALCoGen (https://www.ti.com/tool/HALCOGEN)

class f_hcg.NodeStructure(xml_file_path)

Bases: object

Holds all relevant information on generated files based on a HALCoGen configuration file

parse_xml()

Parses information on generated files from the HALCoGen configuration file.

f_hcg.configure(conf)

configuration step of the TI HALCoGen Code Generator.

1. checks whether the platform is Win32 or not, as HALCoGen is only supported on Win32.

2. searches for the HALCoGen program

3. Adds the include path of the F021 Flash API to INCLUDES

class f_hcg.hcg_compiler(*args: Any, **kwargs: Any)

Bases: waflib.Task.Task

Class to implement running the HALCoGen code generator

color = 'PINK'

color in which the command line is displayed in the terminal

Type

str

ext_out = ['.h', '.c', '.asm']

Type

list of string

keyword()

displayed keyword when generating sources from a HALCoGen project

run()

Runs the HALCoGen code generator

1. Copy the HALCoGen sources to the build directory

2. Run HALCoGen

3. Get CPU clock frequency that is set by HALCoGen from FreeRTOSConfig.h and copy it to our configuration file

4. Copy the HALCoGen sources again to the output directory. This needs to be done, as HALCoGen re-writes the timestamp of the HALCoGen file when the tool is run. With this step the sources and build directory are synchronized.

vars = ['HALCOGEN', 'HALCOGEN_SRC_INPUT']