Please note as of Wednesday, August 15th, 2018 this wiki has been set to read only. If you are a TI Employee and require Edit ability please contact x0211426 from the company directory.
Rebuilding The NDK Core Using Gmake
Note: These instructions apply to NDK version 2.21 (and higher) only. For instructions on how to (re)build NDK 2.20x, please refer to http://processors.wiki.ti.com/index.php/Rebuilding_the_NDK_Core
The Network Developer's Kit (NDK) version 2.21.00.32 includes source files and a makefile that allow you to modify the stack sources and rebuild its libraries. You can rebuild the NDK core in order to modify, update, or add functionality. If you edit the NDK source code, an NDK project file, and/or an NDK RTSC build script, you must also rebuild the NDK core in order to create new libraries containing these modifications.
The instructions on this page are intended for rebuilding the NDK on Microsoft Windows or Linux using Gmake.
Warning: This appendix provides details about rebuilding the NDK stack source code. We strongly recommend that you copy the NDK installation to a directory with a different name and rebuild that copy, rather than rebuilding the original installation.
In order to rebuild the NDK, the SYS/BIOS and XDCtools products must both be installed. It is important to build SYS/BIOS with a compatible version of XDCtools. To find out which versions are compatible, see the “Compatibility Information” section of the Release Notes in the top-level directory of your SYS/BIOS installation.
Note: You should generally avoid installing the various Texas Instruments tools and source distributions in directories that have spaces in their paths.
Rebuilding The NDK Core Using The ndk.mak Makefile
Rebuilding the NDK itself from the provided source files is straightforward using the provided makefile ndk.mak.
The NDK ships with a ndk.mak file in the top-level installation directory. This makefile enables you to easily (re)build the NDK core using your choice of compilers and desired "targets". A target incorporates a particular ISA and a runtime model; for example, cortex-M3 and the TI compiler with specific options.
The instructions in this section can be used to (re)build core libraries on Windows or Linux. If you are using a Windows machine, you can use the regular DOS command shell provided with Windows. However, you may want to install a Unix-like shell, such as Cygwin. For Windows users, the XDCtools top-level installation directory contains gmake.exe, which is used in the commands that follow to run the Makefile. The gmake utility is a Windows version of the standard GNU "make" utility provided with Linux.
If you are using Linux, change the "gmake" command to "make" in the commands that follow.
For these instructions, suppose you have the following directories:
- $BASE/ndk/ndk_2_21_00_32 — The location where you installed NDK.
- $BASE/ndk/copy-ndk_2_21_00_32 — The location of a copy of the NDK installation.
- $BASE/sysbios/bios_6_32_03_43 — The location where you installed SYS/BIOS.
- $BASE/xdctools_3_22_03_41 — The location where you installed XDCtools.
The following steps refer to the top-level directory of the XDCtools installation as <xdc_install_dir>. They refer to the top-level directory of the copy of the NDK installation as <ndkcopy_install_dir>.
Follow these steps to rebuild the NDK:
- If you have not already done so, install the NDK, XDCtools and SYS/BIOS.
- Make a copy of the NDK installation that you will use when rebuilding. This leaves you with an unmodified installation as a backup. For example, use commands similar to the following on Windows:
Or, use the a command similar to the following on Linux:
cp -r $BASE/ndk/ndk_2_21_00_32/* $BASE/ndk/copy-ndk_2_21_00_32
- Make sure you have access to compilers for any targets for which you want to be able be able to build applications using the rebuilt NDK. Note the path to the directory containing the executable for each compiler. These compilers can include Texas Instruments compilers as well as any other command-line compilers for any targets supported by NDK.
- If you are using Windows and the gmake utility provided in the top-level directory of the XDCtools installation, you should add the <xdc_install_dir> to your PATH environment variable so that the gmake executable can be found.
- You may remove the top-level doc directory located in <ndkcopy_install_dir>/docs if you need to save disk space.
- At this point, you may want to add the remaining files in the NDK installation tree to your Software Configuration Management (SCM) system.
- Open the <ndkcopy_install_dir>/ndk.mak file with a text editor, and make the following changes for any options you want to hard code in the file. (You can also set these options on the command line if you want to override the settings in the ndk.mak file.) Ignore the following lines near the beginning of the file. These definitions are used internally, but few users will have a need to change them.
Specify the location of XDCtools. For example:
XDC_INSTALL_DIR ?= $(BASE)/xdctools_3_22_03_41
— Specify the location of the compiler executable for all targets you want to be able to build NDK for. Use only the directory path; do not include the name of the executable file. Any targets for which you do not specify a compiler location will be skipped during the build. For example, on Linux you might specify the following:
ti.targets.C674 ?= /opt/ti/ccsv5/tools/compiler/c6000 ti.targets.arm.elf.M3 ?= /opt/ti/ccsv5/tools/compiler/tms470
— Similarly, on Windows you might specify the following compiler locations:
ti.targets.C674 ?= c:/ti/ccsv5/tools/compiler/c6000 ti.targets.arm.elf.M3 ?= c:/ti/ccsv5/tools/compiler/tms470
— If you need to add any repositories to your XDCPATH (for example, to reference the packages directory of another component), you should edit the XDCPATH definition.
— You can uncomment the line that sets XDCOPTIONS to “v” if you want more information output during the build.
- Clean the NDK installation with the following commands. (If you are running the build on Linux, change all "gmake" commands to "make".)
gmake -f ndk.mak clean
- Run the ndk.mak file to build SYS/BIOS as follows. (Remember, if you are running the build on Linux, change all "gmake" commands to "make".)
gmake -f ndk.mak
- If you want to build NDK in debug mode, you have to uncomment a couple of lines in ndk.bld
/* Uncomment the following lines to build libraries for debug mode: */
// Pkg.attrs.profile = "debug";
// c6xOpts += " -g -o0 ";
// armOpts += " -g -o0 ";
// gnuOpts += " -g ";
- If you want to specify options on the command line to override the settings in ndk.mak, use a command similar to the following.
gmake -f ndk.mak XDC_INSTALL_DIR=<xdc_install_dir> ti.targets.C674=<compiler_path>