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.

IWR6843: Migrating project from armcl to tiarmclang using own build system, xdctools configuro issue

Part Number: IWR6843
Other Parts Discussed in Thread: SYSBIOS

I am trying to migrate a project from using the armcl compiler to tiarmclang. We have our own build system so I had to do the migration manually (not using an IDE). I am using configuro to configure the RTSC package like so:

rtsc: $(R4_CFG)
    @echo 'Configuring RTSC packages...'
    $(XS) --xdcpath="$(XDCPATH)" xdc.tools.configuro $(R4F_XSFLAGS) -o $(APPLICATION_CONFIGPKG) $(APPLICATION_CFG)

R4F_XSFLAGS is defined like so:
R4F_XSFLAGS = -t ti.targets.arm.elf.R4F -p ti.platforms.cortexR:$(XDC_PLATFORM_DEFINE):false:200   \
              -r release -c $(R4F_CODEGEN_INSTALL_PATH) -DMMWAVE_SDK_DEVICE_TYPE=$(MMWAVE_SDK_DEVICE_TYPE) \
              $(R4F_XSFLAGS_ENUM_TYPE)
Inside bios_6_73_01_01/packages/ti/targets/arm/elf/R4F.xdc I have configured the target to use tiarmclang like so: 
override readonly config xdc.bld.ITarget2.Command cc = {
cmd: "tiarmclang -c",
opts: "-mfpu=vfpv3-d16 -mlittle-endian -march=armv7-r -mcpu=cortex-r4 -mfloat-abi=hard"
};

override readonly config xdc.bld.ITarget2.Command asm = {
cmd: "tiarmclang -c",
opts: "-mfpu=vfpv3-d16 -mlittle-endian -march=armv7-r -mcpu=cortex-r4 -mfloat-abi=hard"
};
 

But still I  am getting this error: 


cler4f package/cfg/mss_mmw_per4f.c ...
gmake: /opt/ti/tiarmclang_03_00_00/bin/armcl: Command not found
gmake: *** [package/cfg/mss_mmw_per4f.oer4f] Error 127

and also my compiler.opt file still has the old flags: 

--float_support=vfpv3d16 --endian=little -mv7R4 --abi=eabi -I"/opt/ti/bios_6_73_01_01/packages" -I"/opt/ti/mmwave_sdk_03_04_00_03/packages" -I"/opt/ti/xdctools_3_50_08_24_core/packages" -I"/mnt/c/2001_p01_radar_sw_lib/out/BackRadar_mss/mss_mmw_configPkg/.." -I/opt/ti/tiarmclang_03_00_00/include  -Dxdc_target_types__="ti/targets/arm/elf/std.h" -Dxdc_target_name__=R4F -Dxdc_cfg__xheader__="\"/mnt/c/2001_p01_radar_sw_lib/out/BackRadar_mss/mss_mmw_configPkg/package/cfg/mss_mmw_per4f.h\""

I have tried make clean and then make app but it didn't help. Are the old configurations maybe cached somewhere? 

I am using xdc tools version 3.50.08.24, sysbios verison 6.73.01.01 and mmwave_sdk version 03.04.00.03

I've been stuck on this for a while so any help is very much appreciated.

  • Hi, 

    We are looking into your issue and will get back to you soon.

    Best Regards,

    Josh

  • Bojan,

    XDCTools has its own compiler settings.  I am not an expert on this but I will try to point you in the right direction

    I am on a mac so I don;t have the Radar SDK but the issue is likely with the "target" setting for XDCTools.  Near the bottom of the capture below there is a Target field with a value of ti.targets.arm.elf.M3

    Based on that XDCTools will be invoking the armcl compiler with a specific set of options.  The "arm" part needs to change.  Looking at a different project that uses clang I see this as ti.targets.arm.clang.M4F

    I found another reference here as well:

    https://e2e.ti.com/support/wireless-connectivity/wi-fi-group/wifi/f/wi-fi-forum/1018013/cc3235modasf-migration-to-clang

    The Radar team should be able to comment on if the version of the SDK you are using is supported with clang as each version would have a set of supported compilers.  They may have ideas on how best to migrate as well.

    Regards,

    John

  • Dear John, 

    Thank you for your response. The problem with this solution is that there is no R4F target inside the ti/target/arm/clang folder, there is only an M33F target. As you can see in the screenshot

    The only instance of R4F is in the ti/target/arm/elf folder and that is where I tried to reconfigure the target as I explained in my original question.

    I tried to create an R4F target inside ti/target/arm/clang by adding 3 files R4F.h , R4F.xdc and R4F.xs  like so: 

    R4F.h content:

    /*
     *  Copyright 2018 by Texas Instruments Incorporated.
     *
     */
    
    /*
     *  ======== R4F.h ========
     *  DO NOT MODIFY: This header is generated from stddef.xdt
     *
     *  This header contains target-specific definitions of target-independent
     *  macros required by the ITarget interface.  These definitions allow C/C++
     *  sources to portably compile for multiple targets (using #ifdef ...).
     */
    #ifndef xdc_target_macros_include__
    #define xdc_target_macros_include__    1
    
    /*
     *  ======== ti_targets_arm_clang_R4F ========
     *  This macro identifies the specific target being used.  This macro should
     *  probably be avoided in portable sources.
     */
    #define ti_targets_arm_clang_R4F  1
    
    /*
     *  ======== xdc_target__arraytype_VaList ========
     *  The following macro specifies whether or not a VaList is an 
     *  array type; e.g., struct __va_list_tag (*)[1] verses a simple char *.  
     *  This affects how va_list variables are passed to functions (by value
     *  or by address).
     */
    #define xdc_target__arraytype_VaList 0
    
    /*
     *  ======== xdc_target__isaCompatible_* macros ========
     *  The following definitions enable clients to conditionally compile for any
     *  compatible subset of the actual target ISA.
     */
    #define xdc_target__isaCompatible_470  1
    #define xdc_target__isaCompatible_v4T  1
    #define xdc_target__isaCompatible_v5T  1
    #define xdc_target__isaCompatible_v6  1
    #define xdc_target__isaCompatible_v7R  1
    
    /*
     *  ======== xdc_target__isa_v7R ========
     *  This macro identifies the specific target ISA for which we are being
     *  compiled.
     */
    #define xdc_target__isa_v7R  1
    
    /*
     *  ======== xdc_target__{big|little}Endian ========
     *  The following macro enables clients to portably compile for big or little
     *  endian targets.
     */
    #define xdc_target__littleEndian   1
    
    /*
     *  ======== xdc_target__os_undefined ========
     *  The following macro enables clients to portably compile for target specific
     *  OS; e.g., Linux, Solaris, Windows, undefined.
     */
    #define xdc_target__os_undefined    1
    
    /*
     *  ======== xdc_target__sizeof_ ========
     *  The following macros enable clients to portably determine type sizes
     *  within #ifdef blocks; sizeof() can't be used and the definitions in
     *  stdint.h are not available to C++ clients (unless the special macro
     *  __STDC_LIMIT_MACROS is defined).
     */
    #define  xdc_target__sizeof_IArg 4
    #define  xdc_target__sizeof_Char 1
    #define  xdc_target__sizeof_Double 8
    #define  xdc_target__sizeof_Float 4
    #define  xdc_target__sizeof_Fxn 4
    #define  xdc_target__sizeof_Int 4
    #define  xdc_target__sizeof_Int8 1
    #define  xdc_target__sizeof_Int16 2
    #define  xdc_target__sizeof_Int32 4
    #define  xdc_target__sizeof_Int64 8
    #define  xdc_target__sizeof_Long 4
    #define  xdc_target__sizeof_LDouble 8
    #define  xdc_target__sizeof_LLong 8
    #define  xdc_target__sizeof_Ptr 4
    #define  xdc_target__sizeof_Short 2
    #define  xdc_target__sizeof_Size 4
    
    /*
     *  ======== xdc_target__alignof_ ========
     *  The following macros enable clients to portably determine type alignment
     *  within #ifdef blocks; even if provided by the compiler, alignof() can't
     *  be used in pre-processor statements.
     */
    #define  xdc_target__alignof_IArg 4
    #define  xdc_target__alignof_Char 1
    #define  xdc_target__alignof_Double 8
    #define  xdc_target__alignof_Float 4
    #define  xdc_target__alignof_Fxn 4
    #define  xdc_target__alignof_Int 4
    #define  xdc_target__alignof_Int8 1
    #define  xdc_target__alignof_Int16 2
    #define  xdc_target__alignof_Int32 4
    #define  xdc_target__alignof_Int64 8
    #define  xdc_target__alignof_Long 4
    #define  xdc_target__alignof_LDouble 8
    #define  xdc_target__alignof_LLong 8
    #define  xdc_target__alignof_Ptr 4
    #define  xdc_target__alignof_Short 2
    #define  xdc_target__alignof_Size 4
    
    /*
     *  ======== xdc_target__bitsPerChar ========
     *  The number of bits in a char.  This macro allow one to determine the
     *  precise number of bits in any of the standard types (whose sizes are
     *  expressed as a number of chars).
     */
    #define  xdc_target__bitsPerChar 8
    
    #endif  /* end multi-include guard */
    /*
     *  @(#) ti.targets.arm.elf; 1, 0, 0,0; 7-20-2018 13:59:04; /db/ztree/library/trees/xdctargets/xdctargets-r09/src/ xlibrary
    
     */
    
    

    R4F.xdc content: 

    /*
     *  Copyright 2018 by Texas Instruments Incorporated.
     *
     */
    
    /*
     * Copyright (c) 2018, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     */
    
    /*!
     *  ======== R4F.xdc ========
     *  Cortex R4F with floating point unit, little endian thumb2 (ELF)
     */
    metaonly module M33F inherits ti.targets.arm.elf.IArm {
        override readonly config string name        = "R4F";
        override readonly config string suffix      = "er4f";
        override readonly config string isa         = "v7R";
        override readonly config string rts         = "ti.targets.arm.rtsarm";
        override config string platform   = "ti.platforms.cortexR:IWR68XX:false:200";
        override config String stdInclude = "ti/targets/arm/clang/std.h";
    
        override readonly config xdc.bld.ITarget.Model model = {
            endian: "little",
            codeModel: "thumb2",
            shortEnums: true
        };
    
        override readonly config xdc.bld.ITarget2.Command cc = {
            cmd:  "tiarmclang -c",
            opts: "-mcpu=cortex-r4 -mfloat-abi=hard -mfpu=vfpv3-d16"
        };
    
        override readonly config xdc.bld.ITarget2.Command asm = {
            cmd:  "tiarmclang -c -x assembler-with-cpp -mno-default-build-attributes",
            opts: "-mcpu=cortex-r4 -mfloat-abi=hard -mfpu=vfpv3-d16"
        };
    
        override readonly config xdc.bld.ITarget2.Command lnk = {
            cmd:  "tiarmclang",
            opts: "-mcpu=cortex-r4 -mfloat-abi=hard -mfpu=vfpv3-d16"
        };
    
        /*!
         *  ======== ccOpts ========
         *  User configurable compiler options.
         */
        override config xdc.bld.ITarget2.Options ccOpts = {
            prefix: "",
            suffix: ""
        };
    
        /*!
         *  ======== ccConfigOpts ========
         *  User configurable compiler options for the generated config C file.
         */
        override config xdc.bld.ITarget2.Options ccConfigOpts = {
            prefix: "$(ccOpts.prefix)",
            suffix: "$(ccOpts.suffix)"
        };
    
        /*!
         *  ======== asmOpts ========
         *  User configurable assembler options.
         */
        override config xdc.bld.ITarget2.Options asmOpts = {
            prefix: "",
            suffix: ""
        };
    
        /*!
         *  ======== lnkOpts ========
         *  Linker options
         */
        override config xdc.bld.ITarget2.Options lnkOpts = {
            prefix: "-Wl,-q -Wl,-u,_c_int00",
            suffix: "-Wl,-w -Wl,-c -Wl,-m,$(XDCCFGDIR)/$@.map -l $(rootDir)/lib/generic/libc.a"
        };
    
        override readonly config xdc.bld.ITarget2.Command vers = {
            cmd:  "tiarmclang",
            opts: "--version"
        };
    
        override config string includeOpts = "";
    
        /*
         *  ======== profiles ========
         */
        /*
         * The compiler option -gdwarf-3 needs to be passed to workaround a
         * known bug in TI LLVM compiler generation of debug information.
         * See JIRA CODEGEN-4536 for more info.
         */
        override config xdc.bld.ITarget.OptionSet profiles[string] = [
            ["debug", {
                compileOpts: {
                    copts: "-gdwarf-3",
                    defs:  "-D_DEBUG_=1",
                },
                linkOpts: "-gdwarf-3",
            }],
    
            ["release", {
                compileOpts: {
                    copts: " -O2 ",
                },
                linkOpts: " ",
            }],
        ];
    }
    /*
     *  @(#) ti.targets.arm.clang; 1, 0, 0,0; 7-20-2018 13:59:43; /db/ztree/library/trees/xdctargets/xdctargets-r09/src/ xlibrary
    
     */
    
    

    R4F.xs content: 

    /*
     *  Copyright 2018 by Texas Instruments Incorporated.
     *
     */
    
    /*
     * Copyright (c) 2018, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     */
    
    /*
     *  ======== R4F.genConstCustom ========
     *
     *  This function is invoked at the config time, therefore we can check the
     *  build profile.
     */
    function genConstCustom(names, types)
    {
        if (xdc.om.$name != 'cfg') {
            return (null);
        }
    
        var sb = new java.lang.StringBuilder();
        for (var i = 0; i < names.length; i++) {
            var adjName = names[i];
            if (names[i].match(/.*__A$/)) {
                adjName += "[]";
            }
            sb.append('const ' + types[i] + ' ' + adjName
                + " __attribute__ ((section (\".const:" + names[i]
                + "\")));\n");
        }
        return (sb.toString() + "");
    }
    /*
     *  @(#) ti.targets.arm.clang; 1, 0, 0,0; 7-20-2018 13:59:43; /db/ztree/library/trees/xdctargets/xdctargets-r09/src/ xlibrary
    
     */
    
    

    I've created these files based on M33F.h M33F.xs and M33F.xdc.

    This resulted in an error : 

    js: "./config.bld", line 11: Error: Can't find the target named 'ti.targets.arm.clang.R4F' along the path '/opt/ti/bios_6_73_01_01/packages;/opt/ti/mmwave_sdk_03_04_00_03/packages;/opt/ti/xdctools_3_50_08_24_core/packages;..;': please check the spelling of the target's name and that it exists along this path.
    making package.mak (because of package.bld) ...
    js: "./config.bld", line 11: Error: Can't find the target named 'ti.targets.arm.clang.R4F' along the path '/opt/ti/bios_6_73_01_01/packages;/opt/ti/mmwave_sdk_03_04_00_03/packages;/opt/ti/xdctools_3_50_08_24_core/packages;..;': please check the spelling of the target's name and that it exists along this path.
    gmake: *** No rule to make target `.configuro'.  Stop.

    It seems that my new files aren't recognized.

    Is there a better way of adding a target? 

    Also I've found that my target (R4F) might not be supported via this document https://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/rtsc/3_61_02_27/exports/docs/xdctools_3_61_02_27_supported_targets.html. This is for XDCtools 3.61.00.16. version, but it's almost the same for my version. Either way the R4F target is not supported. 

    So my question is, is there a way to create an R4F target inside ti/targets/arm/clang and if yes how can I do that?

    Kind regards, 

    Bojan

  • Bojan,

    I would not recommend going down the path of creating your own target.  I am looking through the mmWave SDK users guide and I do not see any reference to the TI Arm Clang compiler.    I have sent this thread to the Radar team.  Hopefully they can provide clarification on if this is supported and if so how to migrate the xdctools portion of the build.

    Regards,

    John

  • Hello Bojan.

    In terms of what you are trying to do, is there any way you can utilize CCS to build/compile your project?   CCS uses tiarmclang so using this might help in migrating from one compiler to another, and simplify the process as well.  In addition, there is a guide here that shows how to migrate from armcl to tiarmclang, which I have linked here.

    Sincerely,

    Santosh

  • Hello Santosh, 

    As i mentioned above we are using our own build system, so I cannot build/compile my project in CCS. I have seen the guide you linked and have already done everything it describes (changed all of the flags and so on ). The problem I am facing is that there is no R4F target inside the clang folder. 

    Sincerely, 

    Bojan

  • Hello Bojan.

    This SDK does not support TI Arm Clang, so you will not be able to migrate to TI ARM Clang and will have to use armcl as there is no XDCTools or SYS/BIOS that is compatible with this SDK.  This SDK uses TI Arm Compiler so you could try to migrate to that compiler instead.

    Sincerely,

    Santosh

  • Hello Santosh, 

    Thank you for clarifying this.

    Sincerely, 

    Bojan

  • Sorry, just to be certain. Did you mean the version of the mmwave sdk I am using doesn't support Ti Arm Clang or mmwave sdk in general doesn't support Ti Arm Clang? 

    Sincerely, 

    Bojan

  • The mmwave sdk in general does not support Ti Arm Clang as it uses the Ti Arm Compiler.

    Sincerely,

    Santosh