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.
Tool/software: Code Composer Studio
I'm trying to manually configure my application using C code and Cfg*() functions (as described in spru523k, section 2.1), but when I ran my code, the console showed the message:
ti.sysbios.family.arm.m3.Hwi: line 143: E_alreadyDefined: Hwi already defined: intr# 56
00000.000 ExecStart: Already Open
00000.000 mmFree: Double Free
00000.000 mmFree: Double Free
00000.000 mmFree: Double Free
00000.000 mmFree: Double Free
00000.000 mmFree: Double Free
00000.000 mmFree: Double Free
00000.000 mmFree: Double Free
00000.000
NC_NetStart: WARNING: Boot thread has not completed!
00000.000 mmFree: Double Free
00000.000 mmFree: Double Free
00000.000 NodeTreeFree: Null endpoints
00000.000 mmFree: Double Free
00000.000 mmFree: Double Free
and the function NC_NetStart() returned -1. Can anyone help me to solve this?
I'm attaching a print of the ROV -> Hwi screen and my code:
#include <ti/sysbios/knl/Clock.h> #include <ti/ndk/inc/netmain.h> void initIP(void* hCfg); void initDHCP(void *hCfg); void networkOpen(); void networkClose(); void networkIPAddr(uint32_t IPAddr, uint32_t IfIdx, uint32_t fAdd); void serviceReport(uint32_t item, uint32_t status, uint32_t code, HANDLE hCfgEntry); extern void llTimerTick(); const char *hostName = "tisoc"; const char *LocalIPAddr = "192.168.1.14"; const char *LocalIPMask = "255.255.255.0"; const char *GatewayIP = "192.168.1.1"; const char *DomainName = "demo.net"; void NDKManagerTaskFxn() { HANDLE hCfg; int rc; Clock_Params clockParams; Clock_Handle ndkClockHandle; /* Create the NDK heart beat */ Clock_Params_init(&clockParams); clockParams.startFlag = TRUE; clockParams.period = 1000; ndkClockHandle = Clock_create((Clock_FuncPtr)llTimerTick, clockParams.period, &clockParams, NULL); if (ndkClockHandle == NULL) { return; } rc = NC_SystemOpen(NC_PRIORITY_LOW, NC_OPMODE_INTERRUPT); if(rc) { return; } hCfg = CfgNew(); if(!hCfg) { goto final; } initIP(hCfg); // initDHCP(void *hCfg); // Configure low priority task stack size rc = 2048; CfgAddEntry(hCfg, CFGTAG_OS, CFGITEM_OS_TASKSTKLOW, CFG_ADDMODE_UNIQUE, sizeof(uint32_t), (unsigned char *)&rc, NULL); // Configure normal priority task stack size rc = 2048; CfgAddEntry(hCfg, CFGTAG_OS, CFGITEM_OS_TASKSTKNORM, CFG_ADDMODE_UNIQUE, sizeof(uint32_t), (unsigned char *)&rc, NULL); // Configure high priority task stack size rc = 2048; CfgAddEntry(hCfg, CFGTAG_OS, CFGITEM_OS_TASKSTKHIGH, CFG_ADDMODE_UNIQUE, sizeof(uint32_t), (unsigned char *)&rc, NULL); // Boot system do { rc = NC_NetStart(hCfg, networkOpen, networkClose, networkIPAddr); } while(rc > 0); // Shutting down... CfgFree(hCfg); final: NC_SystemClose(); } void initIP(void* hCfg) { CI_IPNET NA; CI_ROUTE RT; // hostname CfgAddEntry(hCfg, CFGTAG_SYSINFO, CFGITEM_DHCP_HOSTNAME, 0, strlen(hostName), (unsigned char *)hostName, NULL); // Ip and mask bzero(&NA, sizeof(NA)); NA.IPAddr = inet_addr(LocalIPAddr); NA.IPMask = inet_addr(LocalIPMask); strcpy(NA.Domain, DomainName); NA.NetType = 0; CfgAddEntry(hCfg, CFGTAG_IPNET, 1, 0, sizeof(CI_IPNET), (UINT8 *)&NA, 0); // Gateway bzero(&RT, sizeof(RT)); RT.IPDestAddr = 0; RT.IPDestMask = 0; RT.IPGateAddr = inet_addr(GatewayIP); CfgAddEntry(hCfg, CFGTAG_ROUTE, 0, 0, sizeof(CI_ROUTE), (UINT8 *)&RT, 0); // DNS IPN IPTmp; IPTmp = inet_addr("8.8.8.8"); CfgAddEntry( hCfg, CFGTAG_SYSINFO, CFGITEM_DHCP_DOMAINNAMESERVER, 0, sizeof(IPTmp), (unsigned char *)&IPTmp, 0 ); } void initDHCP(void *hCfg) { CI_SERVICE_DHCPC dhcpc; unsigned char DHCP_OPTIONS[] = { DHCPOPT_SUBNET_MASK }; // hostname CfgAddEntry(hCfg, CFGTAG_SYSINFO, CFGITEM_DHCP_HOSTNAME, 0, strlen(hostName), (unsigned char *)hostName, NULL); // Usa DHCP para obter IP na interface 1 memset(&dhcpc, 0, sizeof(dhcpc)); dhcpc.cisargs.Mode = CIS_FLG_IFIDXVALID; dhcpc.cisargs.IfIdx = 1; dhcpc.cisargs.pCbSrv = &serviceReport; dhcpc.param.pOptions = DHCP_OPTIONS; dhcpc.param.len = 1; CfgAddEntry(hCfg, CFGTAG_SERVICE, CFGITEM_SERVICE_DHCPCLIENT, 0, sizeof(dhcpc), (unsigned char *)&dhcpc, NULL); } void networkOpen() { } void networkClose() { } void networkIPAddr(uint32_t IPAddr, uint32_t IfIdx, uint32_t fAdd) { } void serviceReport(uint32_t item, uint32_t status, uint32_t code, HANDLE hCfgEntry) { }
Thanks in advance,
Ronan
Hi Ronan,
When you use the .cfg to configure the NDK, it generates the Network Stack Task. Since you are providing it also, you are getting duplicates. I would simply remove the NDK related code from the .cfg. You'll need to add in the the NDK library also (since the .cfg does that for you also).
Todd
Hi Todd,
The only code related to NDK in my .cfg file is the following:
/* ================ NDK configuration ================ */ var Global = xdc.useModule('ti.ndk.config.Global'); Global.pktNumFrameBufs = 10;
I put these lines in order to solve another problem described in this thread: CCS/TM4C1294NCPDT: What's the correct way to manually link NDK libraries to a project? - Code Composer...
Do you know how can I set the pktNumFrameBufs value without use the .cfg file?
Thanks in advance,
Ronan
Ronan,
You need to supply the number of frames in source code. I've attached an example. The constant that interests you is PKT_NUM_FRAMEBUF. You'll need to provide all the buffers also.
/cfs-file/__key/communityserver-discussions-components-files/81/ndk_5F00_tirtos.c
Todd
Hi Todd,
Thank you so much, your example helped me a lot! Now, it seems that the program works when I set the static IP, but when I use the DHCP config (as shown in the example), I got these messages in the console:
Service Status: DHCPC : Enabled : : 000
00000.000 TaskGetEnv: FATAL: NDK_hookInit() must be set in DSP/BIOS Task module config (hookId == 0xffffffff)
00000.000 TaskSetEnv: FATAL: NDK_hookInit() must be set in BIOS Task module config (hookId == 0xffffffff)
Service Status: DHCPC : Enabled : Running : 000
00000.000 TaskGetEnv: FATAL: NDK_hookInit() must be set in DSP/BIOS Task module config (hookId == 0xffffffff)
Service Status: DHCPC : Enabled : Fault : 007
00000.000 TaskGetEnv: FATAL: NDK_hookInit() must be set in DSP/BIOS Task module config (hookId == 0xffffffff)
Service Status: DHCPC : Disabled : : 000
and then the CfgFree() and NC_SystemClose() are called. Do you know what these messages mean?
Thanks in advance,
Ronan
Hi Ronan,
The Task adaptation module in the OS library requires a hook to be able to save and load private environment pointers for the NDK. This is done by creating a SYS/BIOS hook. A hook module must be created to call the OS hook functions NDK_hookInit() and NDK_hookCreate().
If you use XGCONF to configure the NDK, these objects are all created automatically. Therefore, if you are not using this you have to manually create those objects. One thing you can do is create a new project and look at the way the configuration generates the needed objects and try to replicate it.
Thanks,
Gerardo