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.

Linking Errors when combining NDK Client project and OpenMP project

Other Parts Discussed in Thread: MATHLIB, FFTLIB, SYSBIOS

I'm unable to combine two projects (Telnet and OMP) that I have working independently. The Telnet is heavily based on the "client" example from the NDK examples in the MCSDK package. My other project is a custom project based on the OMP HelloWorld project. The OMP project runs on 8 cores and the Telnet project runs on 1 core. 

I tried adding the source files from the OMP project to the Telnet project, adding all the package dependencies, include paths, linker paths, etc. I get the project to build to an extent, but it doesn't recognize the #pragma for OMP. I believe this is because the CFG file doesn't have the content from the OMP project. If I try adding some of the OMP CFG file's content to the Telnet CFG, I get a slew of errors. 

I'm not sure the CFG file is the culprit or not, but I'll share both CFG files and hopefully someone can understand why these errors occur, or suggest how to combine the CFG files.

Below are the build results when making a call to the OpenMP function processFrame() in dsp.c:

**** Build of configuration Debug for project avm_telnetd_rfr ****

C:\ti\ccsv5\utils\bin\gmake -k all
'Building file: ../client.cfg'
'Invoking: XDCtools'
"C:/ti/xdctools_3_24_06_63/xs" --xdcpath="C:/ti/pdk_C6678_1_1_2_6/packages;C:/ti/ndk_2_22_03_20/packages;C:/ti/bios_6_33_06_50/packages;C:/ti/dsplib_c66x_3_1_0_0/packages;C:/ti/ipc_1_24_03_32/packages;C:/ti/mathlib_c66x_3_0_1_1/packages;C:/ti/mcsdk_2_01_02_06/demos;C:/ti/omp_1_02_00_05/packages;C:/Users/rradjabi/Downloads/8838.evm6678;" xdc.tools.configuro -o configPkg -t ti.targets.elf.C66 -p test_6678 -r release -c "C:/ti/ccsv5/tools/compiler/c6000_7.4.2" "../client.cfg"
making package.mak (because of package.bld) ...
generating interfaces for package configPkg (because package/package.xdc.inc is older than package.xdc) ...
configuring client.xe66 from package/cfg/client_pe66.cfg ...
cle66 package/cfg/client_pe66.c ...
'Finished building: ../client.cfg'
' '
'Building file: ../avmConsole.c'
'Invoking: C6000 Compiler'
"C:/ti/ccsv5/tools/compiler/c6000_7.4.2/bin/cl6x" -mv6600 --abi=eabi -g --include_path="C:/ti/ccsv5/tools/compiler/c6000_7.4.2/include" --include_path="C:/ti/ccsv5/tools/compiler/c6000_7.4.2/include" --include_path="C:/ti/xdctools_3_24_06_63/packages" --include_path="C:/ti/pdk_C6678_1_1_2_6/packages/ti/drv/qmss" --include_path="C:/ti/pdk_C6678_1_1_2_6/packages/ti/drv/cppi" --include_path="C:/ti/stk-med-03.00.00/miAlgos" --include_path="C:/ti/bios_6_33_06_50/packages" --display_error_number --diag_warning=225 --preproc_with_compile --preproc_dependency="avmConsole.pp" --cmd_file="./configPkg/compiler.opt" "../avmConsole.c"
'Finished building: ../avmConsole.c'
' '
'Building file: ../avm_command.c'
'Invoking: C6000 Compiler'
"C:/ti/ccsv5/tools/compiler/c6000_7.4.2/bin/cl6x" -mv6600 --abi=eabi -g --include_path="C:/ti/ccsv5/tools/compiler/c6000_7.4.2/include" --include_path="C:/ti/ccsv5/tools/compiler/c6000_7.4.2/include" --include_path="C:/ti/xdctools_3_24_06_63/packages" --include_path="C:/ti/pdk_C6678_1_1_2_6/packages/ti/drv/qmss" --include_path="C:/ti/pdk_C6678_1_1_2_6/packages/ti/drv/cppi" --include_path="C:/ti/stk-med-03.00.00/miAlgos" --include_path="C:/ti/bios_6_33_06_50/packages" --display_error_number --diag_warning=225 --preproc_with_compile --preproc_dependency="avm_command.pp" --cmd_file="./configPkg/compiler.opt" "../avm_command.c"
'Finished building: ../avm_command.c'
' '
'Building file: ../client.c'
'Invoking: C6000 Compiler'
"C:/ti/ccsv5/tools/compiler/c6000_7.4.2/bin/cl6x" -mv6600 --abi=eabi -g --include_path="C:/ti/ccsv5/tools/compiler/c6000_7.4.2/include" --include_path="C:/ti/ccsv5/tools/compiler/c6000_7.4.2/include" --include_path="C:/ti/xdctools_3_24_06_63/packages" --include_path="C:/ti/pdk_C6678_1_1_2_6/packages/ti/drv/qmss" --include_path="C:/ti/pdk_C6678_1_1_2_6/packages/ti/drv/cppi" --include_path="C:/ti/stk-med-03.00.00/miAlgos" --include_path="C:/ti/bios_6_33_06_50/packages" --display_error_number --diag_warning=225 --preproc_with_compile --preproc_dependency="client.pp" --cmd_file="./configPkg/compiler.opt" "../client.c"
'Finished building: ../client.c'
' '
'Building file: ../dsp.c'
'Invoking: C6000 Compiler'
"C:/ti/ccsv5/tools/compiler/c6000_7.4.2/bin/cl6x" -mv6600 --abi=eabi -g --include_path="C:/ti/ccsv5/tools/compiler/c6000_7.4.2/include" --include_path="C:/ti/ccsv5/tools/compiler/c6000_7.4.2/include" --include_path="C:/ti/xdctools_3_24_06_63/packages" --include_path="C:/ti/pdk_C6678_1_1_2_6/packages/ti/drv/qmss" --include_path="C:/ti/pdk_C6678_1_1_2_6/packages/ti/drv/cppi" --include_path="C:/ti/stk-med-03.00.00/miAlgos" --include_path="C:/ti/bios_6_33_06_50/packages" --display_error_number --diag_warning=225 --preproc_with_compile --preproc_dependency="dsp.pp" --cmd_file="./configPkg/compiler.opt" "../dsp.c"
"../dsp.c", line 82: warning #225-D: function declared implicitly
"../dsp.c", line 110: warning #163-D: unrecognized #pragma
"../dsp.c", line 132: warning #225-D: function declared implicitly
"../dsp.c", line 228: warning #179-D: variable "j" was declared but never referenced
'Finished building: ../dsp.c'
' '
'Building file: ../gen_twiddle_fft16x32.c'
'Invoking: C6000 Compiler'
"C:/ti/ccsv5/tools/compiler/c6000_7.4.2/bin/cl6x" -mv6600 --abi=eabi -g --include_path="C:/ti/ccsv5/tools/compiler/c6000_7.4.2/include" --include_path="C:/ti/ccsv5/tools/compiler/c6000_7.4.2/include" --include_path="C:/ti/xdctools_3_24_06_63/packages" --include_path="C:/ti/pdk_C6678_1_1_2_6/packages/ti/drv/qmss" --include_path="C:/ti/pdk_C6678_1_1_2_6/packages/ti/drv/cppi" --include_path="C:/ti/stk-med-03.00.00/miAlgos" --include_path="C:/ti/bios_6_33_06_50/packages" --display_error_number --diag_warning=225 --preproc_with_compile --preproc_dependency="gen_twiddle_fft16x32.pp" --cmd_file="./configPkg/compiler.opt" "../gen_twiddle_fft16x32.c"
'Finished building: ../gen_twiddle_fft16x32.c'
' '
'Building file: ../main.c'
'Invoking: C6000 Compiler'
"C:/ti/ccsv5/tools/compiler/c6000_7.4.2/bin/cl6x" -mv6600 --abi=eabi -g --include_path="C:/ti/ccsv5/tools/compiler/c6000_7.4.2/include" --include_path="C:/ti/ccsv5/tools/compiler/c6000_7.4.2/include" --include_path="C:/ti/xdctools_3_24_06_63/packages" --include_path="C:/ti/pdk_C6678_1_1_2_6/packages/ti/drv/qmss" --include_path="C:/ti/pdk_C6678_1_1_2_6/packages/ti/drv/cppi" --include_path="C:/ti/stk-med-03.00.00/miAlgos" --include_path="C:/ti/bios_6_33_06_50/packages" --display_error_number --diag_warning=225 --preproc_with_compile --preproc_dependency="main.pp" --cmd_file="./configPkg/compiler.opt" "../main.c"
'Finished building: ../main.c'
' '
'Building file: ../platform_osal.c'
'Invoking: C6000 Compiler'
"C:/ti/ccsv5/tools/compiler/c6000_7.4.2/bin/cl6x" -mv6600 --abi=eabi -g --include_path="C:/ti/ccsv5/tools/compiler/c6000_7.4.2/include" --include_path="C:/ti/ccsv5/tools/compiler/c6000_7.4.2/include" --include_path="C:/ti/xdctools_3_24_06_63/packages" --include_path="C:/ti/pdk_C6678_1_1_2_6/packages/ti/drv/qmss" --include_path="C:/ti/pdk_C6678_1_1_2_6/packages/ti/drv/cppi" --include_path="C:/ti/stk-med-03.00.00/miAlgos" --include_path="C:/ti/bios_6_33_06_50/packages" --display_error_number --diag_warning=225 --preproc_with_compile --preproc_dependency="platform_osal.pp" --cmd_file="./configPkg/compiler.opt" "../platform_osal.c"
'Finished building: ../platform_osal.c'
' '
'Building file: ../resourcemgr.c'
'Invoking: C6000 Compiler'
"C:/ti/ccsv5/tools/compiler/c6000_7.4.2/bin/cl6x" -mv6600 --abi=eabi -g --include_path="C:/ti/ccsv5/tools/compiler/c6000_7.4.2/include" --include_path="C:/ti/ccsv5/tools/compiler/c6000_7.4.2/include" --include_path="C:/ti/xdctools_3_24_06_63/packages" --include_path="C:/ti/pdk_C6678_1_1_2_6/packages/ti/drv/qmss" --include_path="C:/ti/pdk_C6678_1_1_2_6/packages/ti/drv/cppi" --include_path="C:/ti/stk-med-03.00.00/miAlgos" --include_path="C:/ti/bios_6_33_06_50/packages" --display_error_number --diag_warning=225 --preproc_with_compile --preproc_dependency="resourcemgr.pp" --cmd_file="./configPkg/compiler.opt" "../resourcemgr.c"
'Finished building: ../resourcemgr.c'
' '
'Building file: ../tsc_h.asm'
'Invoking: C6000 Compiler'
"C:/ti/ccsv5/tools/compiler/c6000_7.4.2/bin/cl6x" -mv6600 --abi=eabi -g --include_path="C:/ti/ccsv5/tools/compiler/c6000_7.4.2/include" --include_path="C:/ti/ccsv5/tools/compiler/c6000_7.4.2/include" --include_path="C:/ti/xdctools_3_24_06_63/packages" --include_path="C:/ti/pdk_C6678_1_1_2_6/packages/ti/drv/qmss" --include_path="C:/ti/pdk_C6678_1_1_2_6/packages/ti/drv/cppi" --include_path="C:/ti/stk-med-03.00.00/miAlgos" --include_path="C:/ti/bios_6_33_06_50/packages" --display_error_number --diag_warning=225 --preproc_with_compile --preproc_dependency="tsc_h.pp" --cmd_file="./configPkg/compiler.opt" "../tsc_h.asm"
'Finished building: ../tsc_h.asm'
' '
'Building file: ../webpage.c'
'Invoking: C6000 Compiler'
"C:/ti/ccsv5/tools/compiler/c6000_7.4.2/bin/cl6x" -mv6600 --abi=eabi -g --include_path="C:/ti/ccsv5/tools/compiler/c6000_7.4.2/include" --include_path="C:/ti/ccsv5/tools/compiler/c6000_7.4.2/include" --include_path="C:/ti/xdctools_3_24_06_63/packages" --include_path="C:/ti/pdk_C6678_1_1_2_6/packages/ti/drv/qmss" --include_path="C:/ti/pdk_C6678_1_1_2_6/packages/ti/drv/cppi" --include_path="C:/ti/stk-med-03.00.00/miAlgos" --include_path="C:/ti/bios_6_33_06_50/packages" --display_error_number --diag_warning=225 --preproc_with_compile --preproc_dependency="webpage.pp" --cmd_file="./configPkg/compiler.opt" "../webpage.c"
'Finished building: ../webpage.c'
' '
'Building target: avm_telnetd_rfr.out'
'Invoking: C6000 Linker'
"C:/ti/ccsv5/tools/compiler/c6000_7.4.2/bin/cl6x" -mv6600 --abi=eabi -g --display_error_number --diag_warning=225 -z -m"avm_telnetd_rfr.map" -i"C:/ti/ccsv5/tools/compiler/c6000_7.4.2/lib" -i"C:/ti/dsplib_c66x_3_1_0_0/lib" -i"C:/ti/mathlib_c66x_3_0_1_1/lib" -i"C:/ti/stk-med-03.00.00/miAlgos/fft/make_c66_lib/fftlib/Release" -i"C:/ti/stk-med-03.00.00/miAlgos/util/make_c66_lib/utillib/Release" -i"C:/ti/ccsv5/tools/compiler/c6000_7.4.2/include" --reread_libs --warn_sections --display_error_number --rom_model -o "avm_telnetd_rfr.out" -l"./configPkg/linker.cmd" "./webpage.obj" "./tsc_h.obj" "./resourcemgr.obj" "./platform_osal.obj" "./main.obj" "./gen_twiddle_fft16x32.obj" "./dsp.obj" "./client.obj" "./avm_command.obj" "./avmConsole.obj" -l"libc.a" -ldsplib.ae66 -lmathlib.ae66 -lfft.lib -lutil.lib
<Linking>
warning #10247-D: creating output section ".ddr" without a SECTIONS
specification

undefined first referenced
symbol in file
--------- ----------------
omp_get_thread_num ./dsp.obj
omp_set_num_threads ./dsp.obj

error #10234-D: unresolved symbols remain
error #10010: errors encountered during linking; "avm_telnetd_rfr.out" not
built

>> Compilation failure
gmake: *** [avm_telnetd_rfr.out] Error 1
gmake: Target `all' not remade because of errors.

**** Build Finished ****

OMP .CFG file:

/*
* Copyright (c) 2012, Texas Instruments Incorporated
* http://www.ti.com
* 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.
* --/COPYRIGHT--*/

// allocate out of this shared region heap after IPC has been started.


var ti_sysbios_family_c64p_EventCombiner = xdc.useModule('ti.sysbios.family.c64p.EventCombiner');
var ti_sysbios_family_c66_tci66xx_CpIntc = xdc.useModule('ti.sysbios.family.c66.tci66xx.CpIntc');

var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');

// Configure HeapOMP for the shared memory heap
// HeapOMP created in ti/omp/common.cfg.xs

var HeapOMP = xdc.useModule('ti.omp.utils.HeapOMP');


var Exception = xdc.useModule('ti.sysbios.family.c64p.Exception');
Exception.enablePrint = true;

var Log = xdc.useModule('xdc.runtime.Log');
var LoggerSys = xdc.useModule('xdc.runtime.LoggerSys');
var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');
var Agent = xdc.useModule('ti.sysbios.rta.Agent');
HeapOMP.sharedRegionId = 2;
HeapOMP.localHeapSize = 0x20000;
HeapOMP.sharedHeapSize = 0x1000000;

// Specify the Shared Region
SharedRegion.setEntryMeta( HeapOMP.sharedRegionId,
{ base: 0x90000000,
len: HeapOMP.sharedHeapSize,
ownerProcId: 0,
cacheEnable: true,
createHeap: true,
isValid: true,
name: "heapomp",
}

);

/* load the common configuration file */
xdc.loadCapsule('ti/omp/common.cfg.xs');

var System = xdc.useModule('xdc.runtime.System');
System.extendedFormats = "%$S";

var OpenMP = xdc.useModule('ti.omp.utils.OpenMP');
OpenMP.setNumProcessors( 8 );


Program.sectMap[".ddr"] = new Program.SectionSpec();
Program.sectMap[".ddr"].loadSegment = "DDR3";

Program.sectMap[".threadprivate"] = new Program.SectionSpec();
Program.sectMap[".threadprivate"].loadSegment = "L2SRAM";


// Enable Cache Write-back for HEAPOMP
var Cache = xdc.useModule('ti.sysbios.family.c66.Cache');
Cache.setMarMeta(0x80000000, 0x20000000, Cache.PC | Cache.WTE);

/* ===================== Optional ============================= */
/* Advance User settings */
/* The default settings are commented out. */
/* Uncomment the same and modify, if different setting is desired */
/* =============================================================================*/

//OpenMP.qmssInit = true ;
//OpenMP.qmssMemRegion = -1;
//OpenMP.qmssStartIndex = 0;
//OpenMP.qmssDestQueueNum = -1;
//OpenMP.stackRegionId = -1;
//OpenMP.internalOsal = true;
//OpenMP.cppiHwSem = 3;
//OpenMP.qmssHwSem = 4;
//OpenMP.ompHwSem = 5;
//OpenMP.mpaxIndex = 3;

var loggerBuf0Params = new LoggerBuf.Params();
loggerBuf0Params.instance.name = "loggerBuf0";
loggerBuf0Params.numEntries = 200;
Program.global.loggerBuf0 = LoggerBuf.create(loggerBuf0Params);
var loggerSys0Params = new LoggerSys.Params();
loggerSys0Params.instance.name = "loggerSys0";
Program.global.loggerSys0 = LoggerSys.create(loggerSys0Params);

TELNET .CFG file:

/*
* client.cfg
*
* Memory Map and Program intiializations for the client example Utility
*
* Copyright (C) 2010-2011 Texas Instruments Incorporated - http://www.ti.com/
*
* 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.
*
*/

/*
* @file client.cfg
*
* @brief
* Memory Map and Program intiializations for the HPDSP Utility.
*
*/

/********************************************************************************************************************
* Specify all needed RTSC MOudles and ocnfigure them. *
********************************************************************************************************************/

var Memory = xdc.useModule('xdc.runtime.Memory');

var BIOS = xdc.useModule('ti.sysbios.BIOS');

var Task = xdc.useModule('ti.sysbios.knl.Task');

var HeapBuf = xdc.useModule('ti.sysbios.heaps.HeapBuf');

var Log = xdc.useModule('xdc.runtime.Log');

/*
** Allow storing of task names. By default if you name a task with a friendly display name it will not be saved
** to conserve RAM. This must be set to true to allow it. We use friendly names on the Task List display.
*/
//Defaults.common$.namedInstance = true;
Task.common$.namedInstance = true;

var Clock = xdc.useModule ('ti.sysbios.knl.Clock');

/*
** Interface with IPC. Depending on the version of BIOS you are using the
** module name may have changed.
*/
/* Use this for pre BIOS 6.30 */
/* var Sem = xdc.useModule ('ti.sysbios.ipc.Semaphore'); */

/* Use this for BIOS 6.30 plus to get the IPC module */
var Sem = xdc.useModule ('ti.sysbios.knl.Semaphore');

var Hwi = xdc.useModule ('ti.sysbios.hal.Hwi');

var Ecm = xdc.useModule ('ti.sysbios.family.c64p.EventCombiner');

/*
** Configure this to turn on the CPU Load Module for BIOS.
**
*/
/*
var Load = xdc.useModule('ti.sysbios.utils.Load');
Load.common$.diags_USER4 = Diags.ALWAYS_ON;
*/

var Diags = xdc.useModule('xdc.runtime.Diags');


/* Load the CSL package */
var Csl = xdc.useModule('ti.csl.Settings');

/* Load the CPPI package */
var Cppi = xdc.loadPackage('ti.drv.cppi');

/* Load the QMSS package */
var Qmss = xdc.loadPackage('ti.drv.qmss');

/* Load the PA package */
var Pa = xdc.useModule('ti.drv.pa.Settings');

/* Load the Platform/NDK Transport packages */
var PlatformLib = xdc.loadPackage('ti.platform.evmc6678l');
var NdkTransport = xdc.loadPackage('ti.transport.ndk');

/*
** Sets up the exception log so you can read it with ROV in CCS
*/
var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');
var Exc = xdc.useModule('ti.sysbios.family.c64p.Exception');
Exc.common$.logger = LoggerBuf.create();
Exc.enablePrint = true; /* prints exception details to the CCS console */

/*
** Give the Load module it's own LoggerBuf to make sure the
** events are not overwritten.
*/
/* var loggerBufParams = new LoggerBuf.Params();
loggerBufParams.exitFlush = true;
loggerBufParams.numEntries = 64;
Load.common$.logger = LoggerBuf.create(loggerBufParams);
*/

/*
** Use this load to configure NDK 2.2 and above using RTSC. In previous versions of
** the NDK RTSC configuration was not supported and you should comment this out.
*/
var Global = xdc.useModule('ti.ndk.config.Global');

/*
** This allows the heart beat (poll function) to be created but does not generate the stack threads
**
** Look in the cdoc (help files) to see what CfgAddEntry items can be configured. We tell it NOT
** to create any stack threads (services) as we configure those ourselves in our Main Task
** thread hpdspuaStart.
*/
Global.enableCodeGeneration = false;


/* Define a variable to set the MAR mode for MSMCSRAM as all cacheable */
var Cache = xdc.useModule('ti.sysbios.family.c66.Cache');
//Cache.MAR224_255 = 0x0000000f;

var Startup = xdc.useModule('xdc.runtime.Startup');

var System = xdc.useModule('xdc.runtime.System');

/*
** Create a Heap.
*/
var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
var heapMemParams = new HeapMem.Params();
heapMemParams.size = 0x300000;
heapMemParams.sectionName = "systemHeap";
Program.global.heap0 = HeapMem.create(heapMemParams);

/* This is the default memory heap. */
Memory.defaultHeapInstance = Program.global.heap0;
Program.sectMap["sharedL2"] = "DDR3";
Program.sectMap["systemHeap"] = "DDR3";
Program.sectMap[".sysmem"] = "DDR3";
Program.sectMap[".args"] = "DDR3";
Program.sectMap[".cio"] = "DDR3";
Program.sectMap[".far"] = "DDR3";
Program.sectMap[".rodata"] = "DDR3";
Program.sectMap[".neardata"]= "DDR3";
Program.sectMap[".cppi"] = "DDR3";
Program.sectMap[".init_array"] = "DDR3";
Program.sectMap[".qmss"] = "DDR3";
Program.sectMap[".cinit"] = "DDR3";
Program.sectMap[".bss"] = "DDR3";
Program.sectMap[".const"] = "DDR3";
Program.sectMap[".text"] = "DDR3";
Program.sectMap[".code"] = "DDR3";
Program.sectMap[".switch"] = "DDR3";
Program.sectMap[".data"] = "DDR3";
Program.sectMap[".fardata"] = "DDR3";
Program.sectMap[".args"] = "DDR3";
Program.sectMap[".cio"] = "DDR3";
Program.sectMap[".vecs"] = "DDR3";
Program.sectMap["platform_lib"] = "DDR3";
Program.sectMap[".DbgSection"] = "DDR3";
Program.sectMap[".far:taskStackSection"] = "L2SRAM";
Program.sectMap[".stack"] = "L2SRAM";
Program.sectMap[".nimu_eth_ll2"] = "L2SRAM";
Program.sectMap[".resmgr_memregion"] = {loadSegment: "L2SRAM", loadAlign:128}; /* QMSS descriptors region */
Program.sectMap[".resmgr_handles"] = {loadSegment: "L2SRAM", loadAlign:16}; /* CPPI/QMSS/PA Handles */
Program.sectMap[".resmgr_pa"] = {loadSegment: "L2SRAM", loadAlign:8}; /* PA Memory */
Program.sectMap[".far:IMAGEDATA"] = {loadSegment: "L2SRAM", loadAlign: 8};
Program.sectMap[".far:NDK_OBJMEM"] = {loadSegment: "L2SRAM", loadAlign: 8};
Program.sectMap[".far:NDK_PACKETMEM"] = {loadSegment: "L2SRAM", loadAlign: 128};

/* Required if using System_printf to output on the console */
SysStd = xdc.useModule('xdc.runtime.SysStd');
System.SupportProxy = SysStd;

/********************************************************************************************************************
* Define hooks and static tasks that will always be running. *
********************************************************************************************************************/

/*
** Register an EVM Init handler with BIOS. This will initialize the hardware. BIOS calls before it starts.
**
** If yuo are debugging with CCS, then this function will execute as CCS loads it if the option in your
** Target Configuraiton file (.ccxml) has the option set to execute all code before Main. That is the
** default.
*/
Startup.lastFxns.$add('&EVM_init');

/*
** Create the stack Thread Task for our application.
*/
var tskNdkStackTest = Task.create("&StackTest");
tskNdkStackTest.stackSize = 0x1400;
tskNdkStackTest.priority = 0x5;


/*
** Create a Periodic task to handle all NDK polling functions.
** If you are using RTSC configuration with NDK 2.2 and above, this is done by default and
** you do not need to do this.
*/
/*var prdNdkClkParams = new Clock.Params ();
prdNdkClkParams.period = 0x64;
prdNdkClkParams.startFlag = true;
Program.global.clockInst1 = Clock.create("&llTimerTick", 5, prdNdkClkParams);
*/

/*
** If you are using RTSC configuration with NDK 2.2 and above, this is done by default, else
** register hooks so that the stack can track all Task creation
Task.common$.namedInstance = true;
Task.addHookSet ({ registerFxn: '&NDK_hookInit', createFxn: '&NDK_hookCreate', });

/* Enable BIOS Task Scheduler */
BIOS.taskEnabled = true;

/*
* Enable Event Groups here and registering of ISR for specific GEM INTC is done
* using EventCombiner_dispatchPlug() and Hwi_eventMap() APIs
*/

Ecm.eventGroupHwiNum[0] = 7;
Ecm.eventGroupHwiNum[1] = 8;
Ecm.eventGroupHwiNum[2] = 9;
Ecm.eventGroupHwiNum[3] = 10;

  • Hi Ryan

    In project properties, did you place a check-mark next to the 'Enable support for OpenMP' checkbox under Build --> C6000 Compiler --> Advanced Options ?

    If the above suggestion is something you already have set, could you please attach the project where you've combined the source and cfg files?

  • Uday,

    I've never seen that setting. Thank you. It looks like it removed the warning about #pragma omp, but it created some more errors in linking. See the text below:

    'Building target: avm_telnetd_rfr.out'
    'Invoking: C6000 Linker'
    "C:/ti/ccsv5/tools/compiler/c6000_7.4.2/bin/cl6x" -mv6600 --abi=eabi -g --display_error_number --diag_warning=225 --openmp -z -m"avm_telnetd_rfr.map" -i"C:/ti/ccsv5/tools/compiler/c6000_7.4.2/lib" -i"C:/ti/dsplib_c66x_3_1_0_0/lib" -i"C:/ti/mathlib_c66x_3_0_1_1/lib" -i"C:/ti/stk-med-03.00.00/miAlgos/fft/make_c66_lib/fftlib/Release" -i"C:/ti/stk-med-03.00.00/miAlgos/util/make_c66_lib/utillib/Release" -i"C:/ti/ccsv5/tools/compiler/c6000_7.4.2/include" --reread_libs --warn_sections --display_error_number --rom_model -o "avm_telnetd_rfr.out" -l"./configPkg/linker.cmd" "./webpage.obj" "./tsc_h.obj" "./resourcemgr.obj" "./platform_osal.obj" "./main.obj" "./gen_twiddle_fft16x32.obj" "./dsp.obj" "./client.obj" "./avm_command.obj" "./avmConsole.obj" -l"libc.a" -ldsplib.ae66 -lmathlib.ae66 -lfft.lib -lutil.lib
    <Linking>
    warning #10247-D: creating output section ".TI.tls" without a SECTIONS
    specification
    warning #10247-D: creating output section ".TI.tls_init" without a SECTIONS
    specification
    warning #10247-D: creating output section ".ddr" without a SECTIONS
    specification

    undefined first referenced
    symbol in file
    --------- ----------------
    GOMP_parallel_end ./dsp.obj
    GOMP_parallel_start ./dsp.obj
    omp_get_thread_num ./dsp.obj
    omp_set_num_threads ./dsp.obj

    error #10234-D: unresolved symbols remain
    error #10010: errors encountered during linking; "avm_telnetd_rfr.out" not
    built

    >> Compilation failure
    gmake: *** [avm_telnetd_rfr.out] Error 1
    gmake: Target `all' not remade because of errors.

    **** Build Finished ****

  • Ryan, 

    In project properties --> RTSC, is the OMP package selected?

    Also could you try with compiler version 7.4.0 instead of 7.4.2.

  • Yes, OpenMP is enabled in that setting. 

    Any other ideas? I don't want to try using a different compiler version, that doesn't seem like a good fix for this problem.

    Ryan

  • May I have some more assistance please?

    My project is the NDK client example project and in the main function, I have added the code from the OpenMP helloWorld example. My main function is below:

    int main()
    {

    int NTHREADS = 4;

    int nthreads, tid;
    nthreads = 4;
    omp_set_num_threads(NTHREADS);

    /* Fork a team of threads giving them their own copies of variables */
    #pragma omp parallel private(nthreads, tid)
    {

    /* Obtain thread number */
    tid = omp_get_thread_num();
    printf("Hello World from thread = %d\n", tid);

    if (tid == 0)
    {
    nthreads = omp_get_num_threads();
    printf("Number of threads = %d\n", nthreads);
    }

    } /* All threads join master thread and disband */

    /* Start the BIOS 6 Scheduler */
    BIOS_start();
    }

    My build output is listed below. As you can see, it has a problem with symbols from platform_osal.c being rediscovered in the OMP package.

    **** Build of configuration Debug for project avm_telnetd ****

    C:\ti\ccsv5\utils\bin\gmake -k all
    'Building file: ../client.cfg'
    'Invoking: XDCtools'
    "C:/ti/xdctools_3_24_06_63/xs" --xdcpath="C:/ti/bios_6_33_06_50/packages;C:/ti/mcsdk_2_01_02_06/demos;C:/ti/ipc_1_24_03_32/packages;C:/ti/omp_1_02_00_05/packages;C:/ti/ndk_2_22_03_20/packages;C:/ti/pdk_C6678_1_1_2_6/packages;" xdc.tools.configuro -o configPkg -t ti.targets.elf.C66 -p ti.omp.examples.platforms.evm6678 -r release -c "C:/ti/ccsv5/tools/compiler/c6000_7.4.2" "../client.cfg"
    making package.mak (because of package.bld) ...
    generating interfaces for package configPkg (because package/package.xdc.inc is older than package.xdc) ...
    configuring client.xe66 from package/cfg/client_pe66.cfg ...
    cle66 package/cfg/client_pe66.c ...
    'Finished building: ../client.cfg'
    ' '
    'Building file: ../avmConsole.c'
    'Invoking: C6000 Compiler'
    "C:/ti/ccsv5/tools/compiler/c6000_7.4.2/bin/cl6x" -mv6600 --abi=eabi -g --include_path="C:/ti/ccsv5/tools/compiler/c6000_7.4.2/include" --display_error_number --diag_warning=225 --diag_wrap=off --openmp --preproc_with_compile --preproc_dependency="avmConsole.pp" --cmd_file="./configPkg/compiler.opt" "../avmConsole.c"
    'Finished building: ../avmConsole.c'
    ' '
    'Building file: ../avm_command.c'
    'Invoking: C6000 Compiler'
    "C:/ti/ccsv5/tools/compiler/c6000_7.4.2/bin/cl6x" -mv6600 --abi=eabi -g --include_path="C:/ti/ccsv5/tools/compiler/c6000_7.4.2/include" --display_error_number --diag_warning=225 --diag_wrap=off --openmp --preproc_with_compile --preproc_dependency="avm_command.pp" --cmd_file="./configPkg/compiler.opt" "../avm_command.c"
    'Finished building: ../avm_command.c'
    ' '
    'Building file: ../client.c'
    'Invoking: C6000 Compiler'
    "C:/ti/ccsv5/tools/compiler/c6000_7.4.2/bin/cl6x" -mv6600 --abi=eabi -g --include_path="C:/ti/ccsv5/tools/compiler/c6000_7.4.2/include" --display_error_number --diag_warning=225 --diag_wrap=off --openmp --preproc_with_compile --preproc_dependency="client.pp" --cmd_file="./configPkg/compiler.opt" "../client.c"
    'Finished building: ../client.c'
    ' '
    'Building file: ../platform_osal.c'
    'Invoking: C6000 Compiler'
    "C:/ti/ccsv5/tools/compiler/c6000_7.4.2/bin/cl6x" -mv6600 --abi=eabi -g --include_path="C:/ti/ccsv5/tools/compiler/c6000_7.4.2/include" --display_error_number --diag_warning=225 --diag_wrap=off --openmp --preproc_with_compile --preproc_dependency="platform_osal.pp" --cmd_file="./configPkg/compiler.opt" "../platform_osal.c"
    'Finished building: ../platform_osal.c'
    ' '
    'Building file: ../resourcemgr.c'
    'Invoking: C6000 Compiler'
    "C:/ti/ccsv5/tools/compiler/c6000_7.4.2/bin/cl6x" -mv6600 --abi=eabi -g --include_path="C:/ti/ccsv5/tools/compiler/c6000_7.4.2/include" --display_error_number --diag_warning=225 --diag_wrap=off --openmp --preproc_with_compile --preproc_dependency="resourcemgr.pp" --cmd_file="./configPkg/compiler.opt" "../resourcemgr.c"
    'Finished building: ../resourcemgr.c'
    ' '
    'Building file: ../webpage.c'
    'Invoking: C6000 Compiler'
    "C:/ti/ccsv5/tools/compiler/c6000_7.4.2/bin/cl6x" -mv6600 --abi=eabi -g --include_path="C:/ti/ccsv5/tools/compiler/c6000_7.4.2/include" --display_error_number --diag_warning=225 --diag_wrap=off --openmp --preproc_with_compile --preproc_dependency="webpage.pp" --cmd_file="./configPkg/compiler.opt" "../webpage.c"
    "../webpage.c", line 205: warning #225-D: function declared implicitly
    "../webpage.c", line 211: warning #225-D: function declared implicitly
    "../webpage.c", line 217: warning #225-D: function declared implicitly
    "../webpage.c", line 223: warning #225-D: function declared implicitly
    "../webpage.c", line 288: warning #225-D: function declared implicitly
    "../webpage.c", line 446: warning #225-D: function declared implicitly
    "../webpage.c", line 549: warning #225-D: function declared implicitly
    "../webpage.c", line 618: warning #225-D: function declared implicitly
    'Finished building: ../webpage.c'
    ' '
    'Building target: avm_telnetd.out'
    'Invoking: C6000 Linker'
    "C:/ti/ccsv5/tools/compiler/c6000_7.4.2/bin/cl6x" -mv6600 --abi=eabi -g --display_error_number --diag_warning=225 --diag_wrap=off --openmp -z -m"avm_telnetd.map" -i"C:/ti/ccsv5/tools/compiler/c6000_7.4.2/lib" -i"C:/ti/ccsv5/tools/compiler/c6000_7.4.2/include" --reread_libs --warn_sections --display_error_number --diag_wrap=off --rom_model -o "avm_telnetd.out" -l"./configPkg/linker.cmd" "./webpage.obj" "./resourcemgr.obj" "./platform_osal.obj" "./client.obj" "./avm_command.obj" "./avmConsole.obj" -l"libc.a"
    <Linking>
    error #10056: symbol "Osal_cppiFree" redefined: first defined in "./platform_osal.obj"; redefined in "C:\ti\omp_1_02_00_05\packages\ti\omp\navigator\lib\release\ti.omp.navigatorOsal.C6678.ae66<Navigatorosal.oe66>"
    error #10056: symbol "Osal_cppiCsEnter" redefined: first defined in "./platform_osal.obj"; redefined in "C:\ti\omp_1_02_00_05\packages\ti\omp\navigator\lib\release\ti.omp.navigatorOsal.C6678.ae66<Navigatorosal.oe66>"
    error #10056: symbol "Osal_qmssFree" redefined: first defined in "./platform_osal.obj"; redefined in "C:\ti\omp_1_02_00_05\packages\ti\omp\navigator\lib\release\ti.omp.navigatorOsal.C6678.ae66<Navigatorosal.oe66>"
    error #10056: symbol "Osal_qmssBeginMemAccess" redefined: first defined in "./platform_osal.obj"; redefined in "C:\ti\omp_1_02_00_05\packages\ti\omp\navigator\lib\release\ti.omp.navigatorOsal.C6678.ae66<Navigatorosal.oe66>"
    error #10056: symbol "Osal_cppiMalloc" redefined: first defined in "./platform_osal.obj"; redefined in "C:\ti\omp_1_02_00_05\packages\ti\omp\navigator\lib\release\ti.omp.navigatorOsal.C6678.ae66<Navigatorosal.oe66>"
    error #10056: symbol "Osal_qmssMtCsEnter" redefined: first defined in "./platform_osal.obj"; redefined in "C:\ti\omp_1_02_00_05\packages\ti\omp\navigator\lib\release\ti.omp.navigatorOsal.C6678.ae66<Navigatorosal.oe66>"
    error #10056: symbol "Osal_cppiBeginMemAccess" redefined: first defined in "./platform_osal.obj"; redefined in "C:\ti\omp_1_02_00_05\packages\ti\omp\navigator\lib\release\ti.omp.navigatorOsal.C6678.ae66<Navigatorosal.oe66>"
    error #10056: symbol "Osal_cppiCsExit" redefined: first defined in "./platform_osal.obj"; redefined in "C:\ti\omp_1_02_00_05\packages\ti\omp\navigator\lib\release\ti.omp.navigatorOsal.C6678.ae66<Navigatorosal.oe66>"
    error #10056: symbol "Osal_cppiEndMemAccess" redefined: first defined in "./platform_osal.obj"; redefined in "C:\ti\omp_1_02_00_05\packages\ti\omp\navigator\lib\release\ti.omp.navigatorOsal.C6678.ae66<Navigatorosal.oe66>"
    error #10056: symbol "Osal_qmssCsEnter" redefined: first defined in "./platform_osal.obj"; redefined in "C:\ti\omp_1_02_00_05\packages\ti\omp\navigator\lib\release\ti.omp.navigatorOsal.C6678.ae66<Navigatorosal.oe66>"
    error #10056: symbol "Osal_qmssMalloc" redefined: first defined in "./platform_osal.obj"; redefined in "C:\ti\omp_1_02_00_05\packages\ti\omp\navigator\lib\release\ti.omp.navigatorOsal.C6678.ae66<Navigatorosal.oe66>"
    error #10056: symbol "Osal_qmssEndMemAccess" redefined: first defined in "./platform_osal.obj"; redefined in "C:\ti\omp_1_02_00_05\packages\ti\omp\navigator\lib\release\ti.omp.navigatorOsal.C6678.ae66<Navigatorosal.oe66>"
    error #10056: symbol "Osal_qmssMtCsExit" redefined: first defined in "./platform_osal.obj"; redefined in "C:\ti\omp_1_02_00_05\packages\ti\omp\navigator\lib\release\ti.omp.navigatorOsal.C6678.ae66<Navigatorosal.oe66>"
    error #10056: symbol "Osal_qmssCsExit" redefined: first defined in "./platform_osal.obj"; redefined in "C:\ti\omp_1_02_00_05\packages\ti\omp\navigator\lib\release\ti.omp.navigatorOsal.C6678.ae66<Navigatorosal.oe66>"
    "./configPkg/linker.cmd", line 132: error #10099-D: program will not fit into available memory. run placement with alignment fails for section ".localfar" size 0x2ec18 . Available memory ranges:
    L2SRAM size: 0x80000 unused: 0x2408e max hole: 0x24040
    warning #10281-D: Section ".bss" requires a STATIC_BASE relative relocation, but is located at 0x803aaa00, which is probably out of range of the STATIC_BASE. STATIC_BASE is located at 0x0c080000. Might be required to correct placement of ".bss" so it lies within 0x8000 of the STATIC_BASE.
    warning #10281-D: Section ".rodata" requires a STATIC_BASE relative relocation, but is located at 0x803aaa70, which is probably out of range of the STATIC_BASE. STATIC_BASE is located at 0x0c080000. Might be required to correct placement of ".rodata" so it lies within 0x8000 of the STATIC_BASE.
    warning #10281-D: Section ".bss" requires a STATIC_BASE relative relocation, but is located at 0x803aaa00, which is probably out of range of the STATIC_BASE. STATIC_BASE is located at 0x0c080000. Might be required to correct placement of ".bss" so it lies within 0x8000 of the STATIC_BASE.
    warning #10281-D: Section ".rodata" requires a STATIC_BASE relative relocation, but is located at 0x803aaa70, which is probably out of range of the STATIC_BASE. STATIC_BASE is located at 0x0c080000. Might be required to correct placement of ".rodata" so it lies within 0x8000 of the STATIC_BASE.
    error #10010: errors encountered during linking; "avm_telnetd.out" not built

    >> Compilation failure
    gmake: *** [avm_telnetd.out] Error 1
    gmake: Target `all' not remade because of errors.

    **** Build Finished ****

    Thank you,

    Ryan

  • Ryan

    From the new log you sent it looks like something related to symbols being defined more than once. I will look into this and recreate the project. WIll get back to you by the end of this week.

  • Uday,

    I've made some progress on this and I think I've eliminated many of the variables in the project. I will send you my zipped project with two versions of the CFG file. I believe the problem lies solely in the CFG file and how OMP is integrated into this project. I have actually stripped out any of the application code that uses OMP ( except including OMP ).

    If I use the original config file for the network client example, my project runs as expected, I can connect and send/receive packets. If I change to the combined config file that has the OMP module, it fails to set up the network server and crashes at runtime, here are the following things I note:

    1) It goes into auto-run mode (I don't understand why, but loading the program forces it to run)

    2) After the auto-run, the program is paused at main(), ti_omp_utils_OpenMP_mainTask_I(), ti_sysbios_knl_Task_exit_E(), and ti_omp_utils_OpenMP_mainTask_I()

    From the attached examples of the two different CFG files and using the attached Source file, can you understand why I'm having incorrect behavior when I include the OMP module? There are many settings in the properties for OpenMP, but I don't understand how they should be set. 

    Please let me know if you need some more information.

    Thanks,

    Ryan

    client.c

    #include <ti/omp/omp.h>

    #include <string.h>
    #include <assert.h>
    #include <stdio.h>
    #include <time.h>


    #define NTHREADS 1

    #include <stdio.h>
    #include <ti/ndk/inc/netmain.h>
    #include <ti/ndk/inc/_stack.h>
    #include <ti/ndk/inc/tools/servers.h>

    #include "client.h"
    #include "avmConsole.h"

    /* BIOS6 include */
    #include <ti/sysbios/BIOS.h>

    /* Platform utilities include */
    #include "ti/platform/platform.h"

    /* Resource manager for QMSS, PA, CPPI */
    #include "ti/platform/resource_mgr.h"

    // When USE_OLD_SERVERS set to zero, server daemon is used
    #define USE_OLD_SERVERS 0

    //---------------------------------------------------------------------------
    // Title String
    //
    char *VerStr = "\nTCP/IP Stack Example Client\n";

    // Our NETCTRL callback functions
    static void NetworkOpen();
    static void NetworkClose();
    static void NetworkIPAddr(IPN IPAddr, uint IfIdx, uint fAdd);

    // Fun reporting function
    //static void ServiceReport(uint Item, uint Status, uint Report, HANDLE hCfgEntry);

    /* Platform Information - we will read it form the Platform Library */
    platform_info gPlatformInfo;

    //---------------------------------------------------------------------------
    // Configuration
    //

    char *HostName = "tidsp";
    char *LocalIPAddr = "192.168.2.100";
    char *LocalIPMask = "255.255.255.0"; // Not used when using DHCP
    char *GatewayIP = "192.168.2.101"; // Not used when using DHCP
    char *DomainName = "demo.net"; // Not used when using DHCP
    char *DNSServer = "0.0.0.0"; // Used when set to anything but zero

    // Simulator EMAC Switch does not handle ALE_LEARN mode, so please configure the
    // MAC address of the PC where you want to launch the webpages and initiate PING to NDK */

    Uint8 clientMACAddress[6] = {0x5C, 0x26, 0x0A, 0x69, 0x44, 0x0B}; /* MAC address for my PC */

    UINT8 DHCP_OPTIONS[] = {DHCPOPT_SERVER_IDENTIFIER, DHCPOPT_ROUTER};

    #undef TEST_RAW_NC
    #undef TEST_RAW_SEND
    #undef TEST_RAW_RECV

    #define PACKET_SIZE 1000
    #define PACKET_COUNT 1

    /*************************************************************************
    * @b EVM_init()
    *
    * @n
    *
    * Initializes the platform hardware. This routine is configured to start in
    * the evm.cfg configuration file. It is the first routine that BIOS
    * calls and is executed before Main is called. If you are debugging within
    * CCS the default option in your target configuration file may be to execute
    * all code up until Main as the image loads. To debug this you should disable
    * that option.
    *
    * @param[in] None
    *
    * @retval
    * None
    ************************************************************************/
    void EVM_init()
    {
    platform_init_flags sFlags;
    platform_init_config sConfig;
    /* Status of the call to initialize the platform */
    int32_t pform_status;

    /*
    * You can choose what to initialize on the platform by setting the following
    * flags. Things like the DDR, PLL, etc should have been set by the boot loader.
    */
    memset((void *) &sFlags, 0, sizeof(platform_init_flags));
    memset((void *) &sConfig, 0, sizeof(platform_init_config));

    sFlags.pll = 0; /* PLLs for clocking */
    sFlags.ddr = 0; /* External memory */
    sFlags.tcsl = 1; /* Time stamp counter */
    #ifdef _SCBP6618X_
    sFlags.phy = 0; /* Ethernet */
    #else
    sFlags.phy = 1; /* Ethernet */
    #endif
    sFlags.ecc = 0; /* Memory ECC */

    sConfig.pllm = 0; /* Use libraries default clock divisor */

    pform_status = platform_init(&sFlags, &sConfig);

    /* If we initialized the platform okay */
    if (pform_status != Platform_EOK)
    {
    /* Initialization of the platform failed... die */
    while (1)
    {
    (void) platform_led(1, PLATFORM_LED_ON, PLATFORM_USER_LED_CLASS);
    (void) platform_delay(50000);
    (void) platform_led(1, PLATFORM_LED_OFF, PLATFORM_USER_LED_CLASS);
    (void) platform_delay(50000);
    }
    }
    }

    //---------------------------------------------------------------------
    // Main Entry Point
    //---------------------------------------------------------------------
    int main()
    {
    // int nthreads, tid;
    //
    // nthreads = NTHREADS;
    //
    // omp_set_num_threads(NTHREADS);
    //
    // /* Fork a team of threads giving them their own copies of variables */
    // #pragma omp parallel private(nthreads, tid)
    // {
    //
    // /* Obtain thread number */
    // tid = omp_get_thread_num();
    // printf("Hello World from thread = %d\n", tid);
    //
    // /* Only master thread does this */
    // if (tid == 0)
    // {
    // nthreads = omp_get_num_threads();
    // printf("Number of threads = %d\n", nthreads);
    // }
    //
    // } /* All threads join master thread and disband */

    /* Start the BIOS 6 Scheduler */
    BIOS_start();
    }

    //
    // Main Thread
    //
    //
    int StackTest()
    {
    int rc;
    int i;
    HANDLE hCfg;
    CI_SERVICE_TELNET telnet;
    QMSS_CFG_T qmss_cfg;
    CPPI_CFG_T cppi_cfg;

    /* Get information about the platform so we can use it in various places */
    memset((void *) &gPlatformInfo, 0, sizeof(platform_info));
    (void) platform_get_info(&gPlatformInfo);

    (void) platform_uart_init();
    (void) platform_uart_set_baudrate(115200);
    (void) platform_write_configure(PLATFORM_WRITE_ALL);

    /* Clear the state of the User LEDs to OFF */
    for (i = 0; i < gPlatformInfo.led[PLATFORM_USER_LED_CLASS].count; i++)
    {
    (void) platform_led(i, PLATFORM_LED_OFF, PLATFORM_USER_LED_CLASS);
    }

    // Instructions for Nuvation test engineer
    platform_write("\n*** Begin Instructions for Nuvation Test Engineer ***\n");
    platform_write("When first run, this app will raise an error and terminate.\n");
    platform_write("This is expected behavior.\n");
    platform_write("Following termination, follow these steps:\n");
    platform_write(" 1. From the toolbar, do a 'System Reset'\n");
    platform_write(" 2. Re-load the program from Run->Load->Reload Program, or Ctrl-Alt-R.\n");
    platform_write(" 3. Click 'Resume', or F8.\n");
    platform_write(" 4. Note the IP address for the Telnet server.\n");
    platform_write("*** End Instructions for Nuvation Test Engineer ***\n\n");

    /* Initialize the components required to run this application:
    * (1) QMSS
    * (2) CPPI
    * (3) Packet Accelerator
    */
    /* Initialize QMSS */
    if (platform_get_coreid() == 0)
    {
    qmss_cfg.master_core = 1;
    } else
    {
    qmss_cfg.master_core = 0;
    }
    qmss_cfg.max_num_desc = MAX_NUM_DESC;
    qmss_cfg.desc_size = MAX_DESC_SIZE;
    qmss_cfg.mem_region = Qmss_MemRegion_MEMORY_REGION0;
    if (res_mgr_init_qmss(&qmss_cfg) != 0)
    {
    platform_write("Failed to initialize the QMSS subsystem \n");
    goto main_exit;
    } else
    {
    platform_write("QMSS successfully initialized \n");
    }

    /* Initialize CPPI */
    if (platform_get_coreid() == 0)
    {
    cppi_cfg.master_core = 1;
    } else
    {
    cppi_cfg.master_core = 0;
    }
    cppi_cfg.dma_num = Cppi_CpDma_PASS_CPDMA;
    cppi_cfg.num_tx_queues = NUM_PA_TX_QUEUES;
    cppi_cfg.num_rx_channels = NUM_PA_RX_CHANNELS;
    if (res_mgr_init_cppi(&cppi_cfg) != 0)
    {
    platform_write("Failed to initialize CPPI subsystem \n");
    goto main_exit;
    } else
    {
    platform_write("CPPI successfully initialized \n");
    }

    if (res_mgr_init_pass() != 0)
    {
    platform_write("Failed to initialize the Packet Accelerator \n");
    goto main_exit;
    } else
    {
    platform_write("PA successfully initialized \n");
    }

    //
    // THIS MUST BE THE ABSOLUTE FIRST THING DONE IN AN APPLICATION before
    // using the stack!!
    //
    rc = NC_SystemOpen(NC_PRIORITY_LOW, NC_OPMODE_INTERRUPT);
    if (rc)
    {
    platform_write("NC_SystemOpen Failed (%d)\n", rc);
    for (;;)
    ;
    }

    // Print out our banner
    platform_write(VerStr);

    //
    // Create and build the system configuration from scratch.
    //

    // Create a new configuration
    hCfg = CfgNew();
    if (!hCfg)
    {
    platform_write("Unable to create configuration\n");
    goto main_exit;
    }

    //// We better validate the length of the supplied names
    if (strlen(DomainName) >= CFG_DOMAIN_MAX || strlen(HostName) >= CFG_HOSTNAME_MAX)
    {
    platform_write("Names too long\n");
    goto main_exit;
    }

    //// Add our global hostname to hCfg (to be claimed in all connected domains)
    CfgAddEntry(hCfg, CFGTAG_SYSINFO, CFGITEM_DHCP_HOSTNAME, 0, strlen(HostName),
    (UINT8 *) HostName, 0);
    //
    //// If the IP address is specified, manually configure IP and Gateway
    if (!platform_get_switch_state(1))
    {
    CI_IPNET NA;
    CI_ROUTE RT;
    IPN IPTmp;
    //
    // // Setup manual IP address
    bzero( &NA, sizeof(NA));
    NA.IPAddr = inet_addr(LocalIPAddr);
    NA.IPMask = inet_addr(LocalIPMask);
    strcpy(NA.Domain, DomainName);
    NA.NetType = 0;
    //
    // // Add the address to interface 1
    CfgAddEntry(hCfg, CFGTAG_IPNET, 1, 0, sizeof(CI_IPNET), (UINT8 *) &NA, 0);
    //
    // // Add the default gateway. Since it is the default, the
    // // destination address and mask are both zero (we go ahead
    // // and show the assignment for clarity).
    bzero( &RT, sizeof(RT));
    RT.IPDestAddr = 0;
    RT.IPDestMask = 0;
    RT.IPGateAddr = inet_addr(GatewayIP);
    //
    // // Add the route
    CfgAddEntry(hCfg, CFGTAG_ROUTE, 0, 0, sizeof(CI_ROUTE), (UINT8 *) &RT, 0);
    //
    // // Manually add the DNS server when specified
    IPTmp = inet_addr(DNSServer);
    if (IPTmp)
    CfgAddEntry(hCfg, CFGTAG_SYSINFO, CFGITEM_DHCP_DOMAINNAMESERVER, 0, sizeof(IPTmp),
    (UINT8 *) &IPTmp, 0);
    }
    //// Else we specify DHCP
    else
    {
    CI_SERVICE_DHCPC dhcpc;
    //
    platform_write("Configuring DHCP client\n");
    //
    // // Specify DHCP Service on IF-1
    bzero( &dhcpc, sizeof(dhcpc));
    dhcpc.cisargs.Mode = CIS_FLG_IFIDXVALID;
    dhcpc.cisargs.IfIdx = 1;
    // dhcpc.cisargs.pCbSrv = &ServiceReport;
    dhcpc.param.pOptions = DHCP_OPTIONS;
    dhcpc.param.len = 2;
    //
    CfgAddEntry(hCfg, CFGTAG_SERVICE, CFGITEM_SERVICE_DHCPCLIENT, 0, sizeof(dhcpc),
    (UINT8 *) &dhcpc, 0);
    }
    ////


    // Specify TELNET service for our Console example
    bzero( &telnet, sizeof(telnet));
    telnet.cisargs.IPAddr = INADDR_ANY;
    // telnet.cisargs.pCbSrv = &ServiceReport;
    telnet.param.MaxCon = 2;
    // telnet.param.Callback = &avmConsoleOpen; // TODO MvL
    telnet.param.Callback = &ConsoleOpen; // TODO OG
    CfgAddEntry(hCfg, CFGTAG_SERVICE, CFGITEM_SERVICE_TELNET, 0, sizeof(telnet), (UINT8 *) &telnet,
    0);

    //// We don't want to see debug messages less than WARNINGS
    rc = DBG_INFO;
    CfgAddEntry(hCfg, CFGTAG_OS, CFGITEM_OS_DBGPRINTLEVEL, CFG_ADDMODE_UNIQUE, sizeof(uint),
    (UINT8 *) &rc, 0);

    //
    ////
    //// This code sets up the TCP and UDP buffer sizes
    //// (Note 8192 is actually the default. This code is here to
    //// illustrate how the buffer and limit sizes are configured.)
    ////
    //
    //// TCP Transmit buffer size
    rc = 8192;
    CfgAddEntry(hCfg, CFGTAG_IP, CFGITEM_IP_SOCKTCPTXBUF, CFG_ADDMODE_UNIQUE, sizeof(uint),
    (UINT8 *) &rc, 0);
    //
    //// TCP Receive buffer size (copy mode)
    rc = 8192;
    CfgAddEntry(hCfg, CFGTAG_IP, CFGITEM_IP_SOCKTCPRXBUF, CFG_ADDMODE_UNIQUE, sizeof(uint),
    (UINT8 *) &rc, 0);
    //
    //// TCP Receive limit (non-copy mode)
    rc = 8192;
    CfgAddEntry(hCfg, CFGTAG_IP, CFGITEM_IP_SOCKTCPRXLIMIT, CFG_ADDMODE_UNIQUE, sizeof(uint),
    (UINT8 *) &rc, 0);
    //
    //// UDP Receive limit
    rc = 8192;
    CfgAddEntry(hCfg, CFGTAG_IP, CFGITEM_IP_SOCKUDPRXLIMIT, CFG_ADDMODE_UNIQUE, sizeof(uint),
    (UINT8 *) &rc, 0);
    //
    //
    // Boot the system using this configuration
    //
    // We keep booting until the function returns 0. This allows
    // us to have a "reboot" command.
    //
    platform_write( " debug #0 " );

    do
    {
    rc = NC_NetStart(hCfg, NetworkOpen, NetworkClose, NetworkIPAddr);
    } while (rc > 0);

    platform_write( " debug #1 " );
    //// Delete Configuration
    CfgFree(hCfg);
    platform_write( " debug #2 " );
    // Close the OS
    main_exit: NC_SystemClose();
    return (0);
    }

    //
    // System Task Code [ Server Daemon Servers ]
    //
    static HANDLE hEcho = 0, hEchoUdp = 0, hData = 0, hNull = 0, hOob = 0;

    //
    // NetworkOpen
    //
    // This function is called after the configuration has booted
    //
    static void NetworkOpen()
    {
    platform_write( " debug #networkOpen 0 " );

    // Create our local servers
    hEcho = DaemonNew(SOCK_STREAMNC, 0, 7, dtask_tcp_echo, OS_TASKPRINORM, OS_TASKSTKNORM, 0, 3);

    platform_write( " debug #networkOpen 1 " );

    hEchoUdp = DaemonNew(SOCK_DGRAM, 0, 7, dtask_udp_echo, OS_TASKPRINORM, OS_TASKSTKNORM, 0, 1);

    platform_write( " debug #networkOpen 2 " );

    hData = DaemonNew(SOCK_STREAM, 0, 1000, dtask_tcp_datasrv, OS_TASKPRINORM, OS_TASKSTKNORM, 0,
    3);

    platform_write( " debug #networkOpen 3 " );

    hNull = DaemonNew(SOCK_STREAMNC, 0, 1001, dtask_tcp_nullsrv, OS_TASKPRINORM, OS_TASKSTKNORM, 0,
    3);

    platform_write( " debug #networkOpen 4 " );

    hOob = DaemonNew(SOCK_STREAMNC, 0, 999, dtask_tcp_oobsrv, OS_TASKPRINORM, OS_TASKSTKNORM, 0, 3);

    platform_write( " debug #networkOpen 5 " );
    }

    //
    // NetworkClose
    //
    // This function is called when the network is shutting down,
    // or when it no longer has any IP addresses assigned to it.
    //
    static void NetworkClose()
    {
    DaemonFree(hOob);
    DaemonFree(hNull);
    DaemonFree(hData);
    DaemonFree(hEchoUdp);
    DaemonFree(hEcho);

    // Kill any active console
    ConsoleClose();
    }

    //
    // NetworkIPAddr
    //
    // This function is called whenever an IP address binding is
    // added or removed from the system.
    //
    static void NetworkIPAddr(IPN IPAddr, uint IfIdx, uint fAdd)
    {
    platform_write( " debug #3.1 " );

    static uint fAddGroups = 0;
    IPN IPTmp;

    if (fAdd)
    platform_write("Network Added: ");
    else
    platform_write("Network Removed: ");

    // Print a message
    IPTmp = ntohl( IPAddr );
    platform_write("If-%d:%d.%d.%d.%d\n", IfIdx, (UINT8) (IPTmp >> 24) & 0xFF,
    (UINT8) (IPTmp >> 16) & 0xFF, (UINT8) (IPTmp >> 8) & 0xFF, (UINT8) IPTmp & 0xFF);

    platform_write( " debug #3 " );


    // This is a good time to join any multicast group we require
    if (fAdd && !fAddGroups)
    {
    fAddGroups = 1;
    // IGMPJoinHostGroup( inet_addr("224.1.2.3"), IfIdx );
    }

    platform_write( " debug #4 " );

    }

    omp_config.cfg ( using OMP and crashes during runtime )

    /* 
    * Copyright (c) 2012, Texas Instruments Incorporated
    * http://www.ti.com
    * 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.
    * --/COPYRIGHT--*/

    /* load the common configuration file */
    xdc.loadCapsule('ti/omp/common.cfg.xs');

    var System = xdc.useModule('xdc.runtime.System');
    var Global = xdc.useModule('ti.ndk.config.Global');
    var Settings = xdc.useModule('ti.drv.pa.Settings');
    var Memory = xdc.useModule('xdc.runtime.Memory');

    var NdkTransport = xdc.loadPackage('ti.transport.ndk');
    System.extendedFormats = "%$S";

    var OpenMP = xdc.useModule('ti.omp.utils.OpenMP');
    OpenMP.setNumProcessors(1); // Set to MAX by default

    var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
    var heapMemParams = new HeapMem.Params();
    heapMemParams.size = 0x300000;
    heapMemParams.sectionName = "systemHeap";
    Program.global.heap0 = HeapMem.create(heapMemParams);
    Memory.defaultHeapInstance = Program.global.heap0;


    Program.sectMap["ddr"] = new Program.SectionSpec();
    Program.sectMap["ddr"].loadSegment = "DDR3";

    Program.sectMap[".threadprivate"] = new Program.SectionSpec();
    Program.sectMap[".threadprivate"].loadSegment = "L2SRAM";
    Program.sectMap["systemHeap"] = "DDR3";
    Program.sectMap[".nimu_eth_ll2"] = "L2SRAM";
    Program.sectMap[".resmgr_handles"] = {loadSegment: "L2SRAM", loadAlign:16}; /* CPPI/QMSS/PA Handles */
    Program.sectMap[".resmgr_memregion"] = {loadSegment: "L2SRAM", loadAlign:128}; /* QMSS descriptors region */
    Program.sectMap[".resmgr_pa"] = {loadSegment: "L2SRAM", loadAlign:8}; /* PA Memory */
    Program.sectMap["platform_lib"] = "DDR3";


    /* ===================== Optional ============================= */
    /* Advance User settings */
    /* The default settings are commented out. */
    /* Uncomment the same and modify, if different setting is desired */
    /* =============================================================================*/

    /*
    OpenMP.qmssInit = true ;
    OpenMP.qmssMemRegion = -1;
    OpenMP.qmssStartIndex = 0;
    OpenMP.qmssDestQueueNum = -1;
    OpenMP.stackRegionId = 1;
    OpenMP.internalOsal = true;
    OpenMP.cppiHwSem = 3;
    OpenMP.qmssHwSem = 4;
    OpenMP.ompHwSem = 5;
    OpenMP.ompHwSemMutex = 6;
    OpenMP.ompHwSemMem = 7;
    OpenMP.mpaxIndex = 3;
    */


    /* Load the CSL package */
    var Csl = xdc.useModule('ti.csl.Settings');

    /* Load the CPPI package */
    var Cppi = xdc.loadPackage('ti.drv.cppi');

    /* Load the QMSS package */
    var Qmss = xdc.loadPackage('ti.drv.qmss');

    /* Load the PA package */
    var Pa = xdc.useModule('ti.drv.pa.Settings');

    /* Load the Platform/NDK Transport packages */
    var PlatformLib = xdc.loadPackage('ti.platform.evmc6678l');
    var NdkTransport = xdc.loadPackage('ti.transport.ndk');

    /* 
    ** This allows the heart beat (poll function) to be created but does not generate the stack threads 
    **
    ** Look in the cdoc (help files) to see what CfgAddEntry items can be configured. We tell it NOT
    ** to create any stack threads (services) as we configure those ourselves in our Main Task
    ** thread hpdspuaStart.
    */ 
    Global.enableCodeGeneration = false;

    /********************************************************************************************************************
    * Define hooks and static tasks that will always be running. *
    ********************************************************************************************************************/
    var BIOS = xdc.useModule('ti.sysbios.BIOS');
    var Startup = xdc.useModule('xdc.runtime.Startup');
    var Task = xdc.useModule('ti.sysbios.knl.Task');
    var Ecm = xdc.useModule ('ti.sysbios.family.c64p.EventCombiner');

    /*
    ** Allow storing of task names. By default if you name a task with a friendly display name it will not be saved
    ** to conserve RAM. This must be set to true to allow it. We use friendly names on the Task List display.
    */
    //Defaults.common$.namedInstance = true; 
    Task.common$.namedInstance = true;

    var Clock = xdc.useModule ('ti.sysbios.knl.Clock');

    /* 
    ** Register an EVM Init handler with BIOS. This will initialize the hardware. BIOS calls before it starts. 
    **
    ** If yuo are debugging with CCS, then this function will execute as CCS loads it if the option in your 
    ** Target Configuraiton file (.ccxml) has the option set to execute all code before Main. That is the 
    ** default.
    */
    Startup.lastFxns.$add('&EVM_init');

    /* 
    ** Create the stack Thread Task for our application.
    */
    var tskNdkStackTest = Task.create("&StackTest");
    tskNdkStackTest.stackSize = 0x1400;
    tskNdkStackTest.priority = 0x5;


    /* 
    ** Create a Periodic task to handle all NDK polling functions. 
    ** If you are using RTSC configuration with NDK 2.2 and above, this is done by default and 
    ** you do not need to do this.
    */
    /*var prdNdkClkParams = new Clock.Params ();
    prdNdkClkParams.period = 0x64; 
    prdNdkClkParams.startFlag = true;
    Program.global.clockInst1 = Clock.create("&llTimerTick", 5, prdNdkClkParams);
    */

    /* 
    ** If you are using RTSC configuration with NDK 2.2 and above, this is done by default, else
    ** register hooks so that the stack can track all Task creation 
    Task.common$.namedInstance = true;
    Task.addHookSet ({ registerFxn: '&NDK_hookInit', createFxn: '&NDK_hookCreate', });

    /* Enable BIOS Task Scheduler */
    BIOS.taskEnabled = true;

    /*
    * Enable Event Groups here and registering of ISR for specific GEM INTC is done
    * using EventCombiner_dispatchPlug() and Hwi_eventMap() APIs
    */

    Ecm.eventGroupHwiNum[0] = 7;
    Ecm.eventGroupHwiNum[1] = 8;
    Ecm.eventGroupHwiNum[2] = 9;
    Ecm.eventGroupHwiNum[3] = 10;

    /*
    OpenMP.qmssInit = true;
    OpenMP.internalOsal = true;
    OpenMP.autoDnldCore = true;
    OpenMP.masterFxn = "&main";
    */


    omp_config.cfg ( works and doesn't have OMP module loaded )

    /*
    * client.cfg
    *
    * Memory Map and Program intiializations for the client example Utility
    *
    * Copyright (C) 2010-2011 Texas Instruments Incorporated - http://www.ti.com/ 

    * 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.
    *
    */

    /*
    * @file client.cfg
    *
    * @brief 
    * Memory Map and Program intiializations for the HPDSP Utility.
    *
    */

    /********************************************************************************************************************
    * Specify all needed RTSC MOudles and ocnfigure them. *
    ********************************************************************************************************************/

    var Memory = xdc.useModule('xdc.runtime.Memory');

    var BIOS = xdc.useModule('ti.sysbios.BIOS');

    var Task = xdc.useModule('ti.sysbios.knl.Task');

    var HeapBuf = xdc.useModule('ti.sysbios.heaps.HeapBuf');

    var Log = xdc.useModule('xdc.runtime.Log');

    /*
    ** Allow storing of task names. By default if you name a task with a friendly display name it will not be saved
    ** to conserve RAM. This must be set to true to allow it. We use friendly names on the Task List display.
    */
    //Defaults.common$.namedInstance = true; 
    Task.common$.namedInstance = true;

    var Clock = xdc.useModule ('ti.sysbios.knl.Clock');

    /* 
    ** Interface with IPC. Depending on the version of BIOS you are using the 
    ** module name may have changed.
    */
    /* Use this for pre BIOS 6.30 */
    /* var Sem = xdc.useModule ('ti.sysbios.ipc.Semaphore'); */

    /* Use this for BIOS 6.30 plus to get the IPC module */
    var Sem = xdc.useModule ('ti.sysbios.knl.Semaphore');

    var Hwi = xdc.useModule ('ti.sysbios.hal.Hwi');

    var Ecm = xdc.useModule ('ti.sysbios.family.c64p.EventCombiner');

    /*
    ** Configure this to turn on the CPU Load Module for BIOS.
    **
    */
    /*
    var Load = xdc.useModule('ti.sysbios.utils.Load');
    Load.common$.diags_USER4 = Diags.ALWAYS_ON;
    */

    var Diags = xdc.useModule('xdc.runtime.Diags');


    /* Load the CSL package */
    var Csl = xdc.useModule('ti.csl.Settings');

    /* Load the CPPI package */
    var Cppi = xdc.loadPackage('ti.drv.cppi');

    /* Load the QMSS package */
    var Qmss = xdc.loadPackage('ti.drv.qmss');

    /* Load the PA package */
    var Pa = xdc.useModule('ti.drv.pa.Settings');

    /* Load the Platform/NDK Transport packages */
    var PlatformLib = xdc.loadPackage('ti.platform.evmc6678l');
    var NdkTransport = xdc.loadPackage('ti.transport.ndk');

    /* 
    ** Sets up the exception log so you can read it with ROV in CCS 
    */
    var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');
    var Exc = xdc.useModule('ti.sysbios.family.c64p.Exception');
    Exc.common$.logger = LoggerBuf.create();
    Exc.enablePrint = true; /* prints exception details to the CCS console */

    /*
    ** Give the Load module it's own LoggerBuf to make sure the
    ** events are not overwritten.
    */
    /* var loggerBufParams = new LoggerBuf.Params();
    loggerBufParams.exitFlush = true;
    loggerBufParams.numEntries = 64;
    Load.common$.logger = LoggerBuf.create(loggerBufParams); 
    */

    /*
    ** Use this load to configure NDK 2.2 and above using RTSC. In previous versions of
    ** the NDK RTSC configuration was not supported and you should comment this out.
    */
    var Global = xdc.useModule('ti.ndk.config.Global');

    /* 
    ** This allows the heart beat (poll function) to be created but does not generate the stack threads 
    **
    ** Look in the cdoc (help files) to see what CfgAddEntry items can be configured. We tell it NOT
    ** to create any stack threads (services) as we configure those ourselves in our Main Task
    ** thread hpdspuaStart.
    */ 
    Global.enableCodeGeneration = false;


    /* Define a variable to set the MAR mode for MSMCSRAM as all cacheable */
    var Cache = xdc.useModule('ti.sysbios.family.c66.Cache');
    //Cache.MAR224_255 = 0x0000000f;

    var Startup = xdc.useModule('xdc.runtime.Startup');

    var System = xdc.useModule('xdc.runtime.System');

    /*
    ** Create a Heap. 
    */
    var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
    var heapMemParams = new HeapMem.Params();
    heapMemParams.size = 0x300000;
    heapMemParams.sectionName = "systemHeap";
    Program.global.heap0 = HeapMem.create(heapMemParams);

    /* This is the default memory heap. */
    Memory.defaultHeapInstance = Program.global.heap0;
    Program.sectMap["sharedL2"] = "DDR3"; 
    Program.sectMap["systemHeap"] = "DDR3";
    Program.sectMap[".sysmem"] = "DDR3";
    Program.sectMap[".args"] = "DDR3";
    Program.sectMap[".cio"] = "DDR3";
    Program.sectMap[".far"] = "DDR3";
    Program.sectMap[".rodata"] = "DDR3";
    Program.sectMap[".neardata"]= "DDR3";
    Program.sectMap[".cppi"] = "DDR3";
    Program.sectMap[".init_array"] = "DDR3";
    Program.sectMap[".qmss"] = "DDR3";
    Program.sectMap[".cinit"] = "DDR3";
    Program.sectMap[".bss"] = "DDR3";
    Program.sectMap[".const"] = "DDR3";
    Program.sectMap[".text"] = "DDR3";
    Program.sectMap[".code"] = "DDR3";
    Program.sectMap[".switch"] = "DDR3";
    Program.sectMap[".data"] = "DDR3";
    Program.sectMap[".fardata"] = "DDR3";
    Program.sectMap[".args"] = "DDR3";
    Program.sectMap[".cio"] = "DDR3";
    Program.sectMap[".vecs"] = "DDR3";
    Program.sectMap["platform_lib"] = "DDR3";
    Program.sectMap[".DbgSection"] = "DDR3";
    Program.sectMap[".far:taskStackSection"] = "L2SRAM";
    Program.sectMap[".stack"] = "L2SRAM";
    Program.sectMap[".nimu_eth_ll2"] = "L2SRAM";
    Program.sectMap[".resmgr_memregion"] = {loadSegment: "L2SRAM", loadAlign:128}; /* QMSS descriptors region */
    Program.sectMap[".resmgr_handles"] = {loadSegment: "L2SRAM", loadAlign:16}; /* CPPI/QMSS/PA Handles */
    Program.sectMap[".resmgr_pa"] = {loadSegment: "L2SRAM", loadAlign:8}; /* PA Memory */
    Program.sectMap[".far:IMAGEDATA"] = {loadSegment: "L2SRAM", loadAlign: 8};
    Program.sectMap[".far:NDK_OBJMEM"] = {loadSegment: "L2SRAM", loadAlign: 8};
    Program.sectMap[".far:NDK_PACKETMEM"] = {loadSegment: "L2SRAM", loadAlign: 128};

    /* Required if using System_printf to output on the console */
    SysStd = xdc.useModule('xdc.runtime.SysStd');
    System.SupportProxy = SysStd;

    /********************************************************************************************************************
    * Define hooks and static tasks that will always be running. *
    ********************************************************************************************************************/

    /* 
    ** Register an EVM Init handler with BIOS. This will initialize the hardware. BIOS calls before it starts. 
    **
    ** If yuo are debugging with CCS, then this function will execute as CCS loads it if the option in your 
    ** Target Configuraiton file (.ccxml) has the option set to execute all code before Main. That is the 
    ** default.
    */
    Startup.lastFxns.$add('&EVM_init');

    /* 
    ** Create the stack Thread Task for our application.
    */
    var tskNdkStackTest = Task.create("&StackTest");
    tskNdkStackTest.stackSize = 0x1400;
    tskNdkStackTest.priority = 0x5;


    /* 
    ** Create a Periodic task to handle all NDK polling functions. 
    ** If you are using RTSC configuration with NDK 2.2 and above, this is done by default and 
    ** you do not need to do this.
    */
    /*var prdNdkClkParams = new Clock.Params ();
    prdNdkClkParams.period = 0x64; 
    prdNdkClkParams.startFlag = true;
    Program.global.clockInst1 = Clock.create("&llTimerTick", 5, prdNdkClkParams);
    */

    /* 
    ** If you are using RTSC configuration with NDK 2.2 and above, this is done by default, else
    ** register hooks so that the stack can track all Task creation 
    Task.common$.namedInstance = true;
    Task.addHookSet ({ registerFxn: '&NDK_hookInit', createFxn: '&NDK_hookCreate', });

    /* Enable BIOS Task Scheduler */
    BIOS.taskEnabled = true;

    /*
    * Enable Event Groups here and registering of ISR for specific GEM INTC is done
    * using EventCombiner_dispatchPlug() and Hwi_eventMap() APIs
    */

    Ecm.eventGroupHwiNum[0] = 7;
    Ecm.eventGroupHwiNum[1] = 8;
    Ecm.eventGroupHwiNum[2] = 9;
    Ecm.eventGroupHwiNum[3] = 10;

    platform config settings

  • Hi Ryan

    For the auto-run issue you are facing, could you please try the following:

    1. Launch your target configuration for your 6678 EVM in CCS Debug perspective

    2. 'Connect Target'

    3. Now for each core, select the core, go to Tools--> Debugger Options --> Generic Debugger Options. This should bring up a window. Under 'Auto Run Options" uncheck the box that says, 'On a program load or restart.'

    4. After completing step #3 for all cores, click on 'Remember my settings'

    5. Now load your .out file on all cores. After loading is completed, all cores should be in suspend mode, and at the symbol __c_int00().

    6. Now run all cores

    Let us know what you see in your console log once you attempt the above.

  • This helps with the auto-load, but it doesn't keep the program from crashing at startup. See the console log below:

    [C66xx_0] When first run, this app will raise an error and terminate.
    [C66xx_0] This is expected behavior.
    [C66xx_0] Following termination, follow these steps:
    [C66xx_0] 1. From the toolbar, do a 'System Reset'
    [C66xx_0] 2. Re-load the program from Run->Load->Reload Program, or Ctrl-Alt-R.
    [C66xx_0] 3. Click 'Resume', or F8.
    [C66xx_0] 4. Note the IP address for the Telnet server.
    [C66xx_0] *** End Instructions for Nuvation Test Engineer ***
    [C66xx_0]
    [C66xx_0] QMSS successfully initialized
    [C66xx_0] CPPI successfully initialized
    [C66xx_0] PA successfully initialized
    [C66xx_0]
    [C66xx_0] TCP/IP Stack Example Client
    [C66xx_0] debug #0 PASS successfully initialized
    [C66xx_0] Ethernet subsystem successfully initialized
    [C66xx_0] Ethernet eventId : 48 and vectId (Interrupt) : 7
    [C66xx_0] Registration of the EMAC Successful, waiting for link up ..
    [C66xx_0] debug #3.1 Network Added: If-1:192.168.2.100
    [C66xx_0] A0=0x80008038 A1=0x1
    A2=0x0 A3=0x800aa4e0
    A4=0x80007fe4 A5=0xf8
    A6=0x8 A7=0xc0
    A8=0x804986d0 A9=0x400
    A10=0x0 A11=0x0
    A12=0x80407218 A13=0xa03c4138
    A14=0x8039a3b8 A15=0xa03c0278
    A16=0xa03c42b8 A17=0x0
    A18=0xa03c02b0 A19=0x4000
    A20=0x100 A21=0x0
    A22=0x0 A23[C66xx_0] =0x0
    A24=0x0 A25=0x0
    A26=0x0 A27=0x2005000
    A28=0x0 A29=0x43
    A30=0x80 A31=0x0
    B0=0x80007f90 B1=0x0
    B2=0x0 B3=0x803fff38
    B4=0x0 B5=0x804a95f8
    B6=0x80497a5c B7=0x0
    B8=0x8 B9=0x804ad7c4
    B10=0x0 B11=0xa03f70f0
    B12=0xa03c3c78 B13=0xa03f9760
    B14=0x804abb40 B15=0x[C66xx_0] 80008068
    B16=0x0 B17=0x804a84e8
    B18=0xa03f9880 B19=0x20
    B20=0x20 B21=0x2a6c800
    B22=0x2e20000 B23=0x0
    B24=0x0 B25=0x3000
    B26=0x3000 B27=0x0
    B28=0x0 B29=0x3
    B30=0x21 B31=0x63c
    NTSR=0x1000e
    ITSR=0xf
    IRP=0x804011ba
    SSR=0x0
    AMR=0x0
    RILC=0x0
    ILC=0x0
    Exception at[C66xx_0] 0x0
    EFR=0x2 NRP=0x0
    Internal exception: IERR=0x1
    Instruction fetch exception
    ti.sysbios.family.c64p.Exception: line 248: E_exceptionMin: pc = 0x00000000, sp = 0x80008068.
    To see more exception detail, use ROV or set 'ti.sysbios.family.c64p.Exception.enabl[C66xx_0] ePrint = true;'
    xdc.runtime.Error.raise: terminating execution

  • Your program tried to execute at address 0x0.  NRP=0x0

    I can't tell you precisely where your exception happened but the function return pointer B3=0x803fff38 so its probably near here.

    I wouldn't be suprise if the code did a branch through some register and the register happened to be 0.

    Judah

  • Judah,

    Okay, maybe that is where it crashed. How do I fix this?

    Ryan

  • Would someone please look at this project and attempt solving the crash? I recreated the project and zipped it up, so you'll notice addresses of the exception exist in different locations. All I'm trying to do is run the openMP hello world code at the top of main(), so it should just execute and print out like in the hello world example, and then resume the net client example.

    Thanks,

    Ryan3240.client_evmc6678l_omp_mod.zip

  • I'd like to clarify that in the above project I'm now using Compiler version 7.4.0 as suggested by Uday in a previous post.

    Ryan

  • I forgot to add the includes for openmp, please add the following lines to the top of client.c : 

    #include <ti/omp/omp.h>
    #include <ti/omp/libgomp_g.h>

    Ryan

  • Ryan,

    In general you need to debug further to pin point where the app is going off into the weeds.  No one really has that much amount of time to debug your app for you.  Furthermore, I don't know if I have the right setup to run your executable.

    Having said all that, I thought I'd give you app a try on my end.  I notice right off the bat that its causing an Exception in main() when BIOS_start() is called.  My question is...when using OpenMP, I believe there's an OpenMP task which already calls BIOS_start() so why are you calling BIOS_start() again in main()?  You should not be calling BIOS_start() in main().  I believe this is a result of merging two different apps into one.  You've got to take caution when doing this.

    Judah

  • The much simpler solution to combining OpenMP and the NDK demo was to use the MCSDK Image Processing with OpenMP demo. This had the appropriate CFG file off the bat and took care of all that I needed to do. 

    Ryan

  • Hi Ryan!
    Did you understood how correct to make .cfg file to use OpenMP and NDK together?
    I have a problem similar to yours.
    I use the MCSDK Image Processing with OpenMP demo like template, but my code does not work with this .cfg file.
    Maybe you know how to help me?
  • Nikolay,

    I'm sorry, but I don't remember the details of how I got this to work with the MCSDK demo. It has been over a year since I worked on the C6678, so I'm not of much use anymore. I suggest you post a new question to the forum using the demo NDK project from MCSDK.

    Ryan