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.

How can I build two binaries from same source, that have different -D option passed in?

Hi,

I am using CCS version 5.4.0.00091.

I have an application that we need to build twice (once for our end product, and once for manufacturing test).  Both builds are from the same source code.

The two versions will differ only by a pre-compiler "-D" option.  I can add the -D option from the Project Properties, CCS Build, ARM Compiler, Advanced Options, Predefined Symbols.

What I have not been able to figure out, is how to setup two projects, one for each binary, that utilize the same source code.  The two projects would differ only in their names, and the -D option passed to the compiler.

I don't have to do this from two project files, though, if there is a better way.

Main thing I'm trying to do, is to build two different images from same source, with different -D option passed to compiler.

thanks,

Steve

  • Hi Steve,

    Instead of two projects, why not have one project with two different build configurations - one that has the -D option and the other that does not? That is the purpose of build configurations - to maintain different sets of build options for a project:

    http://processors.wiki.ti.com/index.php/Projects_and_Build_Handbook_for_CCS#Build_Configurations

    Thanks

    ki

  • Hi Ki,

    Thanks for the good idea.

    I created a new build configuration, based on the Debug configuration.

    I build both the Debug and New Configuration (with a "clean" in between them).  Both built fine.

    Then, I edited the New Configuration, to add a -D option (the new defined value isn't in any source files yet).

    When I do that, it fails to build.  If I remove the -D, it will build again. I've renamed the -D value I'm using, but, no change.  The error I get, is the compiler can't find an XDC file:

    "C:/ti/mcusdk_1_00_01_74/products/xdctools_3_23_05_61/packages/xdc/cfg/global.h", line 39: fatal error #5: could not open source file.

    I added this path to my -I options, under Project, Properties, CCS Build, ARM Compiler, Include Options, as : "${COM_TI_RTSC_MCUSDK_INSTALL_DIR}/products/xdctools_3_23_05_61/packages/xdc/cfg"

    I still get the same error.  Does this make any sense?

    Thanks,

    Steve

  • I mis-read the error message. The compiler is finding global.h alright, it's not finding a file being refered to.

    The full error message is:

    C:/ti/ccsv5/tools/compiler/arm_4.9.7/bin/cl470" -mv7M4 --code_state=16 --float_support=FPv4SPD16 --abi=eabi -me -g --optimize_with_debug --include_path="C:/ti/ccsv5/tools/compiler/arm_4.9.7/include" --include_path="C:/ti/mcusdk_1_00_01_74/products/StellarisWare_9107" --include_path="C:/ti/mcusdk_1_00_01_74/products/xdctools_3_23_05_61/packages/xdc/cfg" --gcc --define=PART_LM4F110E5QR --define=TARGET_IS_BLIZZARD_RA1 --define=BUILD_DQV --diag_warning=225 --display_error_number --emit_warnings_as_errors --gen_func_subsections=on --preproc_with_compile --preproc_dependency="hal/hal_gpio.pp" --obj_directory="hal" --cmd_file="./configPkg/compiler.opt"  "../hal/hal_gpio.c"

    "C:/ti/mcusdk_1_00_01_74/products/xdctools_3_23_05_61/packages/xdc/cfg/global.h", line 39: fatal error #5: could not open source file "C:<MyPathRemoved>/red/1/configPkg/package/cfg/Sonoma_pem4f.h"

    1 fatal error detected in the compilation of "../hal/boot_loader.c".

    >> Compilation failure

    Compilation terminated.

    The directory "C:<MyPathRemoved>/red/1/" doesn't exist.  The file it's looking for, is in C:<MyPathRemoved>/red\BUILD_DQV\configPkg\package.

    BUILD_DQV is the new -D Option.  It's as if the compiler is being told to substitute BUILD_DQV for 1 in the path name.

    Any idea how to fix this?  Looking for location to specify this, but have not been able to find.

    Thanks,

    Steve

     

  • Hi,

    Resolved this, by changing the defintion of the new defined value to itself:

    --define=BUILD_DQV=BUILD_DQV

    Thanks,

    Steve