This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[FAQ] TDA4VM: How to build custom examples in PDK

Part Number: TDA4VM

Hi,

I am trying to add custom examples in PDK. Can someone please share the details on how to add new example and integrate in with PDK build infrastructure.

  • Hi,

    This FAQ is an introduction to J7 PDK build infrastructure. This includes ways to build different components/examples in PDK, adding custom examples/components and overview of important makefiles.

    1. Build Procedure in PDK

    J7 PDK has a common build procedure to build all its components. All examples, tests and libraries can be built from <pdkInstallPath>/package/ti/build by using the command:

    gmake BOARD={BoardName} CORE={CoreName} TargetName

    Where:

    BoardName  j721e_evm or j7200_evm

    CORE: mpu1_0 mcu1_0 mcu1_1 mcu2_0 mcu2_1 mcu3_0 mcu3_1 c66xdsp_1 c66xdsp_2 c7x_1 mpu1_1 for j721e

    or

    mpu1_0 mcu1_0 mcu1_1 mcu2_0 mcu2_1 mpu1_1 for j7200

    TargetName : Can be derived from respective component.mk file depending on what you intent to build.

    1.1 Building a diagnostic example:

    Target name of all the board diagnostic tests can be found in <pdkInstallPath>/packages/ti/board/diag/board_diag_component.mk.  For example if you want to build led test you can use the following command:

    gmake BOARD=j721e_evm CORE=mcu1_0 board_diag_led

    1.2 Building a driver example:

    Target name for all the driver examples/tests can be found in drivers component.mk file. For example to build UART driver example,  target name can be found in <pdkInstallPath>\packages\ti\drv\uart\uart_component.mk

    gmake BOARD=j721e_evm CORE=mcu1_0 UART_Baremetal_DMA_TestApp

     

    1.3 Building Libraries

    Target names of all the libraries can be found in respective component’s component. For example to build board library,  you can find target name in <pdkInstallPath>\packages\ti\board\board_component.mk

    gmake BOARD=j721e_evm CORE=mcu1_0 board

    1.4 Building everything in PDK:

    gmake all

    1. PDK makefiles overview:

    This section provides a basic overview of makefiles present in J7 PDK and their use.

    ti/build/makefile

    This is the top level makefile. This is the makefile that actually runs the commands to build the target. This file will take care of building all the relevant dependencies that are needed before building the actual target. This makefile depends on other makefiles for locating the source files, build configuration, compiler level configurations etc.

    ti/build/comp_paths.mk

    comp_paths contains list of all the component paths available in PDK. Any new component added to the PDK needs to include its path in this file.

    ti/build/comp_top.mk

    comp_top is the top level makefile for the application specific makefiles. This file is included by components to build libraries/examples from within a component. This will eventually invoke ti/build/makefile with the correct SOC, CORE, BOARD combination

    ti/build/pdk_tools_path.mk

    pdk_tools_path.mk file contains paths to all the tools used in SDK, including the compiler toolchains. This file should be updated when a new tool is added or path to tool is modified.

    ti/build/makerules/component.mk

    component.mk file registers path to all the component specific component.mk files. This file also collects list of all the example, libraries and tests and pass it on to top level makefile. Any new component added to PDK needs to include it component.mk file path here.

    ti/build/makerules/rules_*.mk

    These files contain compiler specific configurations for the specific core. What compiler to be used to build a particular core, the level of options and other compile time options are taken care in this file.

     

    1. Customizing PDK build

    This section explains the procedure to add/remove a custom component or example in PDK and building it using PDK build infrastructure.

    • Adding a new example for existing component

    This section explains the procedure to add a custom example for an existing component by taking example of adding a new demo example for i2c driver.

     

    • Create a directory, say “demo_i2c_example” at <PDK_Install_Path>\packages\ti\drv\i2c\example
    • Add source files for the example in demo_i2c_example directory
    • Add makefile for with the application specific configuration. Define source file paths, target name.
    • Modify i2c_component.mk to add rules for demo example.

            See the patch 0001-demo_example.patch to see all the changes required.

    • Adding a new component in PDK

    This section explains the procedure to add a new component by taking example of adding a new demo component at <PDK_Install_Path>/packages/ti

     

    • Create a directory, say demo_component, at <PDK_Install_Path>/packages/ti
    • Add makefile which includes ti/build/comp_top.mk
    • Add source files, example, test based on use case, this example explains adding a hello world example.
    • Add demo_component.mk file at package/ti/demo.
    • Add component path for demo component in ti/build/comp_paths.mk
    • Modify ti/build/makerukes/component.mk to include demo rules.
    • Add an example as described in section 3.1

    See the patch 0001-demo_component.patch to see all the changes required.

    Please refer to section 3.1.3 Custom Board Addition in the document https://software-dl.ti.com/processor-sdk-rtos/esd/docs/latest/rtos/index_board.html  for reference on creating a custom board library in PDK.

    Regards,
    Parth