设置完毕之后就可以编译并测试了。 硬件准备。一般情况不用做任何硬件设置。但是,在这个示例中,需要更多的硬件配置过程。 开发板的BootMode设置,在断电条件下(废话)拨动SW3~SW6各开关至No Boot模式其次是设置网络接口IP为静态的,这需要拨动SW9的第2个开关,具体如下 其实也很简单,就是把最靠左/右边的两个开关拨至OFF,其余均拨至ON即可。 测试过程记录。 为了能与PC进行通信,还需要设置IP为特定区段,即与PC处于同一个LAN区段。在PC上执行ipconfig /all可以查看到本机(PC)的IP为169.254.11.118
(掩码255.255.0.0)为了方便可以将C6678的IP设置为169.254.11.119注意这个IP地址在不同PC上肯定会不同,需要根据具体情况进行设置,要求就是两个IP处在同一网段能够直接通信。至于PC的MAC地址,通过上述命令也能看到,如果程序需要用到,直接填写即可。 IP地址修改后的代码片段如下char *HostName = "TMS320C6678";
char *LocalIPAddr = "169.254.11.119"; // My PC Local IP //......省略....../* MAC address for my PC */
Uint8 clientMACAddress[6] = {0x5C, 0x26, 0x0A, 0x69, 0x44, 0x0B}; //......省略......// If the IP address is specified
if (!platform_get_switch_state(1))
{
printf("IP address is specified.
");
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; //... }//......省略...... 在CCS中添加ccxml文件然后给core0添加gel文件启动调试,GEL配置后启动调试的部分输出如下C66xx_0: GEL Output: Setup_Memory_Map...
C66xx_0: GEL Output: Setup_Memory_Map... Done.
C66xx_0: GEL Output:
Connecting Target...
C66xx_0: GEL Output: DSP core #0
C66xx_0: GEL Output: C6678L GEL file Ver is 2.005
C66xx_0: GEL Output: Global Default Setup...
C66xx_0: GEL Output: Setup Cache...
C66xx_0: GEL Output: L1P = 32K
C66xx_0: GEL Output: L1D = 32K
C66xx_0: GEL Output: L2 = ALL SRAM
C66xx_0: GEL Output: Setup Cache... Done.
C66xx_0: GEL Output: Main PLL (PLL1) Setup ...
C66xx_0: GEL Output: PLL not in Bypass, Enable BYPASS in the PLL Controller...
C66xx_0: GEL Output: PLL1 Setup for DSP @ 1000.0 MHz.
C66xx_0: GEL Output: SYSCLK2 = 333.3333 MHz, SYSCLK5 = 200.0 MHz.
C66xx_0: GEL Output: SYSCLK8 = 15.625 MHz.
C66xx_0: GEL Output: PLL1 Setup... Done.
C66xx_0: GEL Output: Power on all PSC modules and DSP domains...
C66xx_0: GEL Output: Security Accelerator disabled!
C66xx_0: GEL Output: Power on all PSC modules and DSP domains... Done.
C66xx_0: GEL Output: PA PLL (PLL3) Setup ...
C66xx_0: GEL Output: PA PLL Setup... Done.
C66xx_0: GEL Output: DDR3 PLL (PLL2) Setup ...
C66xx_0: GEL Output: DDR3 PLL Setup... Done.
C66xx_0: GEL Output: DDR begin (1333 auto)
C66xx_0: GEL Output: XMC Setup ... Done
C66xx_0: GEL Output:
DDR3 initialization is complete.
C66xx_0: GEL Output: DDR done
C66xx_0: GEL Output: DDR3 memory test... Started
C66xx_0: GEL Output: DDR3 memory test... Passed
C66xx_0: GEL Output: PLL and DDR Initialization completed(0) ...
C66xx_0: GEL Output: configSGMIISerdes Setup... Begin
C66xx_0: GEL Output:
SGMII SERDES has been configured.
C66xx_0: GEL Output: Enabling EDC ...
C66xx_0: GEL Output: L1P error detection logic is enabled.
C66xx_0: GEL Output: L2 error detection/correction logic is enabled.
C66xx_0: GEL Output: MSMC error detection/correction logic is enabled.
C66xx_0: GEL Output: Enabling EDC ...Done
C66xx_0: GEL Output: Configuring CPSW ...
C66xx_0: GEL Output: Configuring CPSW ...Done
C66xx_0: GEL Output: Global Default Setup... Done.
C66xx_0: GEL Output: Invalidate All Cache...
C66xx_0: GEL Output: Invalidate All Cache... Done.
C66xx_0: GEL Output: GEL Reset...
C66xx_0: GEL Output: GEL Reset... Done.
C66xx_0: GEL Output: Disable all EDMA3 interrupts and events. 执行main函数之前会执行EVM_init()函数,随后继续,输出结果如下
此时等待PC操作,通过网线连接PC和C6678的ETH,然后在PC上执行helloWorld.exe(这个文件在D:/Texas/SDK/ndk_2_21_02_43/packages/ti/ndk/winapps目录下) 这是CCS的控制台窗口会有响应,在PC段多次执行这个测试程序,在CCS窗口中会有如下输出 测试了十几次都响应正常。其中TASK所在udpHello.c文件中,具体内容如下int dtask_udp_hello( SOCKET s, UINT32 unused )
{
static int counter=0;
printf("TASK execution %d
",++counter);
struct sockaddr_in sin1;
struct timeval to;
int i,tmp;
char *pBuf;
HANDLE hBuffer;
(void)unused;
// Configure our socket timeout to be 3 seconds
to.tv_sec = 3;
to.tv_usec = 0;
setsockopt( s, SOL_SOCKET, SO_SNDTIMEO, &to, sizeof( to ) );
setsockopt( s, SOL_SOCKET, SO_RCVTIMEO, &to, sizeof( to ) );
for(;;)
{
tmp = sizeof( sin1 );
i = (int)recvncfrom( s, (void **)&pBuf, 0, (PSA)&sin1, &tmp, &hBuffer );
// Spit any data back out
if( i >= 0 )
{
sendto( s, pBuf, i, 0, (PSA)&sin1, sizeof(sin1) );
recvncfree( hBuffer );
}
else
break;
}
// Since the socket is still open, return "1"
// (we need to leave UDP sockets open)
return(1);
}
每次执行时,counter自增,这样就能记录TASK执行的次数。 先记录到这里吧,内容有点多了。 本文原创,博文地址http://blog.csdn.net/fengyhack/article/details/43271795