环境搭建可以参考http://blog.sina.com.cn/s/blog_ed2e19900102xi2j.html

1. 先从mcsdk导入工程,helloworld例程

2. 提示有错误,估计是库找不到的原因。

3. 打开CCS的配置页面,add加入需要的库,分别是NDK,PDK,其中NDK就是网络Network Developer's Kit开发包,如果CCS添加NDK失败的话,可能是NDK的版本太旧了,去下载个新的,下载地址:http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/ndk/index.html,自己选个版本即可

4. 看下工程源码,其实想找个简单的入门例程研究,可惜找了个网络TCP/IP协议栈的,研究研究吧

  1. /*
  2. * helloWorld_bios6.c
  3. * TCP/IP Stack 'Hello World!' Example ported to use BIOS6 OS.
  4. */
  5.  
  6. //--------------------------------------------------------------------------
  7. // IP Stack 'Hello World!' Example
  8. // To test it as is, use with helloWorld.exe from \winapps directory
  9. //
  10.  
  11. #include <stdio.h>
  12. #include <ti/ndk/inc/netmain.h>
  13.  
  14. /* BIOS6 include */
  15. #include <ti/sysbios/BIOS.h>
  16.  
  17. /* Platform utilities include */
  18. #include "ti/platform/platform.h"
  19. #include "ti/platform/resource_mgr.h"
  20.  
  21. /* Platform Information - we will read it form the Platform Library */
  22. platform_info gPlatformInfo;
  23.  
  24. //---------------------------------------------------------------------------
  25. // Title String
  26. //
  27. char *VerStr = "\nTCP/IP Stack 'Hello World!' Application\n\n";
  28.  
  29. // Our NETCTRL callback functions
  30. static void NetworkOpen();
  31. static void NetworkClose();
  32. static void NetworkIPAddr( IPN IPAddr, uint IfIdx, uint fAdd );
  33.  
  34. // Fun reporting function
  35. static void ServiceReport( uint Item, uint Status, uint Report, HANDLE hCfgEntry );
  36.  
  37. // External references
  38. extern int dtask_udp_hello();
  39.  
  40. //---------------------------------------------------------------------------
  41. // Configuration
  42. //
  43. char *HostName = "tidsp";
  44. char *LocalIPAddr = "192.168.2.100";
  45. char *LocalIPMask = "255.255.255.0"; // Not used when using DHCP
  46. char *GatewayIP = "192.168.2.101"; // Not used when using DHCP
  47. char *DomainName = "demo.net"; // Not used when using DHCP
  48. char *DNSServer = "0.0.0.0"; // Used when set to anything but zero
  49.  
  50. /*************************************************************************
  51. * @b EVM_init()
  52. *
  53. * @n
  54. *
  55. * Initializes the platform hardware. This routine is configured to start in
  56. * the evm.cfg configuration file. It is the first routine that BIOS
  57. * calls and is executed before Main is called. If you are debugging within
  58. * CCS the default option in your target configuration file may be to execute
  59. * all code up until Main as the image loads. To debug this you should disable
  60. * that option.
  61. *
  62. * @param[in] None
  63. *
  64. * @retval
  65. * None
  66. ************************************************************************/
  67. void EVM_init()
  68. {
  69. int i;
  70. platform_init_flags sFlags;
  71. platform_init_config sConfig;
  72. /* Status of the call to initialize the platform */
  73. Int32 pform_status;
  74. /* Platform Information - we will read it form the Platform Library */
  75. platform_info sPlatformInfo;
  76.  
  77. /*
  78. * You can choose what to initialize on the platform by setting the following
  79. * flags. We will initialize everything.
  80. */
  81. memset( (void *) &sFlags, , sizeof(platform_init_flags));
  82. memset( (void *) &sConfig, , sizeof(platform_init_config));
  83.  
  84. sFlags.pll = ;
  85. sFlags.ddr = ;
  86. sFlags.tcsl = ; /* Time stamp counter */
  87. sFlags.phy = ; /* Ethernet */
  88. sFlags.ecc = ;
  89.  
  90. sConfig.pllm = ;
  91.  
  92. pform_status = platform_init(&sFlags, &sConfig);
  93.  
  94. /* If we initialized the platform okay */
  95. if (pform_status == Platform_EOK) {
  96. /* Get information about the platform so we can use it in various places */
  97. memset( (void *) &sPlatformInfo, , sizeof(platform_info));
  98. (void) platform_get_info(&sPlatformInfo);
  99. }
  100. else {
  101. /* Intiialization of the platform failed... die */
  102. printf("Platform failed to initialize. Error code %d \n", pform_status);
  103. printf("We will die in an infinite loop... \n");
  104. while () {
  105. (void) platform_led(, PLATFORM_LED_ON, (LED_CLASS_E) PLATFORM_USER_LED_CLASS);
  106. (void) platform_delay();
  107. (void) platform_led(, PLATFORM_LED_OFF, (LED_CLASS_E) PLATFORM_USER_LED_CLASS);
  108. (void) platform_delay();
  109. };
  110. }
  111.  
  112. platform_write_configure(PLATFORM_WRITE_PRINTF);
  113. platform_uart_init();
  114. platform_uart_set_baudrate();
  115.  
  116. /* Check to see that we are running on the Master Core */
  117. if (platform_get_coreid() != ) {
  118. /* We are not on the Master Core... die */
  119. printf("You must run this application on Core 0. \n");
  120. printf("We will die in an infinite loop... \n");
  121. while () {
  122. (void) platform_led(, PLATFORM_LED_ON, (LED_CLASS_E) PLATFORM_USER_LED_CLASS);
  123. (void) platform_delay();
  124. (void) platform_led(, PLATFORM_LED_OFF, (LED_CLASS_E) PLATFORM_USER_LED_CLASS);
  125. (void) platform_delay();
  126. };
  127. }
  128.  
  129. /* Clear the state of the LEDs to OFF */
  130. for (i=; i < sPlatformInfo.led[].count; i++) {
  131. platform_led(i, PLATFORM_LED_OFF, (LED_CLASS_E) PLATFORM_USER_LED_CLASS);
  132. }
  133.  
  134. return;
  135. }
  136.  
  137. //---------------------------------------------------------------------
  138. // Main Entry Point
  139. //---------------------------------------------------------------------
  140. int main()
  141. {
  142. /* Start the BIOS 6 Scheduler */
  143. BIOS_start ();
  144. }
  145.  
  146. //
  147. // Main Thread
  148. //
  149. int StackTest()
  150. {
  151. int rc;
  152. int i;
  153. HANDLE hCfg;
  154.  
  155. //
  156. // THIS MUST BE THE ABSOLUTE FIRST THING DONE IN AN APPLICATION before
  157. // using the stack!!
  158. //
  159. rc = NC_SystemOpen( NC_PRIORITY_LOW, NC_OPMODE_INTERRUPT );
  160. if( rc )
  161. {
  162. platform_write("NC_SystemOpen Failed (%d)\n",rc);
  163. for(;;);
  164. }
  165.  
  166. // Print out our banner
  167. platform_write(VerStr);
  168.  
  169. //
  170. // Create and build the system configuration from scratch.
  171. //
  172.  
  173. // Create a new configuration
  174. hCfg = CfgNew();
  175. if( !hCfg )
  176. {
  177. platform_write("Unable to create configuration\n");
  178. goto main_exit;
  179. }
  180.  
  181. // We better validate the length of the supplied names
  182. if( strlen( DomainName ) >= CFG_DOMAIN_MAX ||
  183. strlen( HostName ) >= CFG_HOSTNAME_MAX )
  184. {
  185. printf("Names too long\n");
  186. goto main_exit;
  187. }
  188.  
  189. // Add our global hostname to hCfg (to be claimed in all connected domains)
  190. CfgAddEntry( hCfg, CFGTAG_SYSINFO, CFGITEM_DHCP_HOSTNAME, ,
  191. strlen(HostName), (UINT8 *)HostName, );
  192.  
  193. // If the IP address is specified, manually configure IP and Gateway
  194. if (!platform_get_switch_state())
  195. {
  196. CI_IPNET NA;
  197. CI_ROUTE RT;
  198. IPN IPTmp;
  199.  
  200. // Setup manual IP address
  201. bzero( &NA, sizeof(NA) );
  202. NA.IPAddr = inet_addr(LocalIPAddr);
  203. NA.IPMask = inet_addr(LocalIPMask);
  204. strcpy( NA.Domain, DomainName );
  205. NA.NetType = ;
  206.  
  207. // Add the address to interface 1
  208. CfgAddEntry( hCfg, CFGTAG_IPNET, , ,
  209. sizeof(CI_IPNET), (UINT8 *)&NA, );
  210.  
  211. // Add the default gateway. Since it is the default, the
  212. // destination address and mask are both zero (we go ahead
  213. // and show the assignment for clarity).
  214. bzero( &RT, sizeof(RT) );
  215. RT.IPDestAddr = ;
  216. RT.IPDestMask = ;
  217. RT.IPGateAddr = inet_addr(GatewayIP);
  218.  
  219. // Add the route
  220. CfgAddEntry( hCfg, CFGTAG_ROUTE, , ,
  221. sizeof(CI_ROUTE), (UINT8 *)&RT, );
  222.  
  223. // Manually add the DNS server when specified
  224. IPTmp = inet_addr(DNSServer);
  225. if( IPTmp )
  226. CfgAddEntry( hCfg, CFGTAG_SYSINFO, CFGITEM_DHCP_DOMAINNAMESERVER,
  227. , sizeof(IPTmp), (UINT8 *)&IPTmp, );
  228. }
  229. // Else we specify DHCP
  230. else
  231. {
  232. CI_SERVICE_DHCPC dhcpc;
  233.  
  234. // Specify DHCP Service on IF-1
  235. bzero( &dhcpc, sizeof(dhcpc) );
  236. dhcpc.cisargs.Mode = CIS_FLG_IFIDXVALID;
  237. dhcpc.cisargs.IfIdx = ;
  238. dhcpc.cisargs.pCbSrv = &ServiceReport;
  239. CfgAddEntry( hCfg, CFGTAG_SERVICE, CFGITEM_SERVICE_DHCPCLIENT, ,
  240. sizeof(dhcpc), (UINT8 *)&dhcpc, );
  241. }
  242.  
  243. //
  244. // Configure IPStack/OS Options
  245. //
  246.  
  247. // We don't want to see debug messages less than WARNINGS
  248. rc = DBG_WARN;
  249. CfgAddEntry( hCfg, CFGTAG_OS, CFGITEM_OS_DBGPRINTLEVEL,
  250. CFG_ADDMODE_UNIQUE, sizeof(uint), (UINT8 *)&rc, );
  251.  
  252. //
  253. // This code sets up the TCP and UDP buffer sizes
  254. // (Note 8192 is actually the default. This code is here to
  255. // illustrate how the buffer and limit sizes are configured.)
  256. //
  257.  
  258. // UDP Receive limit
  259. rc = ;
  260. CfgAddEntry( hCfg, CFGTAG_IP, CFGITEM_IP_SOCKUDPRXLIMIT,
  261. CFG_ADDMODE_UNIQUE, sizeof(uint), (UINT8 *)&rc, );
  262.  
  263. //
  264. // Boot the system using this configuration
  265. //
  266. // We keep booting until the function returns 0. This allows
  267. // us to have a "reboot" command.
  268. //
  269. do
  270. {
  271. rc = NC_NetStart( hCfg, NetworkOpen, NetworkClose, NetworkIPAddr );
  272. } while( rc > );
  273.  
  274. // Delete Configuration
  275. CfgFree( hCfg );
  276.  
  277. // Close the OS
  278. main_exit:
  279. NC_SystemClose();
  280. return();
  281. }
  282.  
  283. //
  284. // System Task Code [ Server Daemon Servers ]
  285. //
  286. static HANDLE hHello=;
  287.  
  288. //
  289. // NetworkOpen
  290. //
  291. // This function is called after the configuration has booted
  292. //
  293. static void NetworkOpen()
  294. {
  295. // Create our local server
  296. hHello = DaemonNew( SOCK_DGRAM, , , dtask_udp_hello,
  297. OS_TASKPRINORM, OS_TASKSTKNORM, , );
  298. }
  299.  
  300. //
  301. // NetworkClose
  302. //
  303. // This function is called when the network is shutting down,
  304. // or when it no longer has any IP addresses assigned to it.
  305. //
  306. static void NetworkClose()
  307. {
  308. DaemonFree( hHello );
  309. }
  310.  
  311. //
  312. // NetworkIPAddr
  313. //
  314. // This function is called whenever an IP address binding is
  315. // added or removed from the system.
  316. //
  317. static void NetworkIPAddr( IPN IPAddr, uint IfIdx, uint fAdd )
  318. {
  319. IPN IPTmp;
  320.  
  321. if( fAdd )
  322. printf("Network Added: ");
  323. else
  324. printf("Network Removed: ");
  325.  
  326. // Print a message
  327. IPTmp = ntohl( IPAddr );
  328. printf("If-%d:%d.%d.%d.%d\n", IfIdx,
  329. (UINT8)(IPTmp>>)&0xFF, (UINT8)(IPTmp>>)&0xFF,
  330. (UINT8)(IPTmp>>)&0xFF, (UINT8)IPTmp&0xFF );
  331. }
  332.  
  333. //
  334. // Service Status Reports
  335. //
  336. // Here's a quick example of using service status updates
  337. //
  338. static char *TaskName[] = { "Telnet","HTTP","NAT","DHCPS","DHCPC","DNS" };
  339. static char *ReportStr[] = { "","Running","Updated","Complete","Fault" };
  340. static char *StatusStr[] = { "Disabled","Waiting","IPTerm","Failed","Enabled" };
  341. static void ServiceReport( uint Item, uint Status, uint Report, HANDLE h )
  342. {
  343. printf( "Service Status: %-9s: %-9s: %-9s: %03d\n",
  344. TaskName[Item-], StatusStr[Status],
  345. ReportStr[Report/], Report&0xFF );
  346.  
  347. //
  348. // Example of adding to the DHCP configuration space
  349. //
  350. // When using the DHCP client, the client has full control over access
  351. // to the first 256 entries in the CFGTAG_SYSINFO space.
  352. //
  353. // Note that the DHCP client will erase all CFGTAG_SYSINFO tags except
  354. // CFGITEM_DHCP_HOSTNAME. If the application needs to keep manual
  355. // entries in the DHCP tag range, then the code to maintain them should
  356. // be placed here.
  357. //
  358. // Here, we want to manually add a DNS server to the configuration, but
  359. // we can only do it once DHCP has finished its programming.
  360. //
  361. if( Item == CFGITEM_SERVICE_DHCPCLIENT &&
  362. Status == CIS_SRV_STATUS_ENABLED &&
  363. (Report == (NETTOOLS_STAT_RUNNING|DHCPCODE_IPADD) ||
  364. Report == (NETTOOLS_STAT_RUNNING|DHCPCODE_IPRENEW)) )
  365. {
  366. IPN IPTmp;
  367.  
  368. // Manually add the DNS server when specified
  369. IPTmp = inet_addr(DNSServer);
  370. if( IPTmp )
  371. CfgAddEntry( , CFGTAG_SYSINFO, CFGITEM_DHCP_DOMAINNAMESERVER,
  372. , sizeof(IPTmp), (UINT8 *)&IPTmp, );
  373. }
  374. }

5. 刚开始这些代码看的不是很明白。main函数里面为啥只有一个BIOS_start();函数?不是应该创建任务之类的?

  1. int main()
  2. {
  3. /* Start the BIOS 6 Scheduler */
  4. BIOS_start ();
  5. }

6. 下面函数怎么运行的?

  1. int StackTest()

7. 是不是BIOS的图形配置界面搞定的?去看下图形配置界面。图形配置界面应该有个.tcf文件,但是工程没找到?

8. 下面的是使用协议栈必须首先调用的函数

  1. rc = NC_SystemOpen( NC_PRIORITY_LOW, NC_OPMODE_INTERRUPT );

9. 接着是配置网络参数的函数

  1. CfgAddEntry( hCfg, CFGTAG_SYSINFO, CFGITEM_DHCP_HOSTNAME, ,
  2. strlen(HostName), (UINT8 *)HostName, );

10. 这次疑问很多,RTSC是德州仪器提出的嵌入式组件,我理解就是把代码模块化,这个模块化的工作交给CCS去管理,比如需要一个ADC模块,在CCS里面配置就可以,CCS会把代码加入你的工程,XDCTools 是完成上面的工具,RTSC是一种理念。

dsp6657的helloworld例程测试-第一篇的更多相关文章

  1. dsp6657的helloworld例程测试-第二篇-CFG文件

    1. 上一篇疑问,int StackTest()这个函数是怎么运行的,后来在.cfg文件找到了答案,.cfg包含丰富的信息,对于用惯C语言的,确实不太习惯 var Memory = xdc.useMo ...

  2. 创龙DSP6748开发板上电测试-第一篇

    1. 创龙DSP6748开发板测试.2980元的售价很高,我估计新的1200元比较合适,当然创龙定价是按照供需关系的.仿真器XDS100V2卖598元,真是狮子大张口. 2. 上电是5V-2A的电源. ...

  3. 天嵌IMX6开发板测试-第一篇

    1.看下开发板介绍 品牌: 天嵌 CPU型号: NXP i.MX6Q 架构: Cortex_A9 主频: *1GHz 内存: 2GB DDR3 存储: 8GB eMMC FLA(64GB可扩) 2. ...

  4. 使用cnblogs发布第一篇文章,HelloWorld

    HelloWorld! 瞅瞅源码的样式,嗯,语法高亮还是可以的,辨识度还是挺高的. <!DOCTYPE html> <html> <head> <meta c ...

  5. LARK BOARD开发板试用第一篇-上电测试学习

    1. 先看下板子外观,做工很不错 2. 主芯片的型号是,SoC 为 Cyclone V SX 系列的 5CSXFC6D6F31,不仅在芯片中包含传统的 FPGA 架构,还集成了基于 ARM Corte ...

  6. go [第一篇]初识

    [第一篇] 简介 Go 是一个开源的编程语言,它能让构造简单.可靠且高效的软件变得容易. Go是从2007年末由Robert Griesemer, Rob Pike, Ken Thompson主持开发 ...

  7. 第一篇 入门必备 (Android学习笔记)

    第一篇 入门必备 第1章 初识Android 第2章 搭建你的开发环境 第3章 创建第一个程序--HelloWorld 第4章 使用Android工具   ●Android之父 Android安迪·罗 ...

  8. 深入学习jQuery选择器系列第一篇——基础选择器和层级选择器

    × 目录 [1]id选择器 [2]元素选择器 [3]类选择器[4]通配选择器[5]群组选择器[6]后代选择器[7]兄弟选择器 前面的话 选择器是jQuery的根基,在jQuery中,对事件处理.遍历D ...

  9. 前端工程师技能之photoshop巧用系列第一篇——准备篇

    × 目录 [1]作用 [2]初始化 [3]常用工具[4]快捷键 前面的话 photoshop是前端工程师无法回避的一个软件,这个软件本身很强大,但我们仅仅需要通过这个工具来完成基本的切图工作即可.本文 ...

随机推荐

  1. xss实现获取内网ip

    前提得浏览器支持webRTC,测试的时候google浏览器测试成功,火狐浏览器不支持webRTC, 再在xss平台直接复制如下js代码: function form_ip(ip,port){ var ...

  2. 解决windows7无法连接CentOS7系统中oracle问题:ORA-12514 TNS 监听程序当前无法识别

    linux开启后终端按下面输入(容易忘记,记录下): [oracle@localhost ~]$ lsnrctl stop                #先关闭监听服务 [oracle@localh ...

  3. 《metasploit渗透测试魔鬼训练营》学习笔记第三章----情报搜集

    Kali渗透测试系统集成了metasploit开源的漏洞测试框架,是渗透测试必备的神器.下面是我在学习metasploit的笔记,有什么错误的地方请指出来,我会立即纠正的~ 一.情报搜集     1. ...

  4. jquery Mobile入门—多页面切换示例学习

    1.在JQuery Mobile中,多个页面的切换是通过<a>元素.并将<href>属性设置为#+对应的id号的方式进行的. 2.多页面切换示例代码: 复制代码代码如下: &l ...

  5. translate动画实例

    <!doctype html> <html lang="en"> <head> <meta name="viewport&quo ...

  6. 卢卡斯定理Lucas

    卢卡斯定理Lucas 在数论中,\(Lucas\)定理用于快速计算\(C^m_n ~ \% ~p\),即证明\(C^m_n = \prod_{i = 0} ^kC^{m_i}_{n_i}\)其中\(m ...

  7. 错误的另一个常见原因是默认的安全组规则。default security group默认情况下不允许ICMP(ping命令使用的协议)

    可以在openstack horizon界面中添加ICMP和ssh(TCP)规则,也可以通过命令行.命令行方式给默认安全组添加规则的方法如下: $ nova secgroup-add-rule def ...

  8. 如何在localStorage中存取数组

    默认localStorage只能存取字符串 那么如何存取数组呢 let newlist = [] localStorage.setItem('recent', JSON.stringify(newli ...

  9. JDK的跳表源码分析

    JDK源码中的跳表实现类: ConcurrentSkipListMap和ConcurrentSkipListSet. 其中ConcurrentSkipListSet的实现是基于ConcurrentSk ...

  10. 【腾讯敏捷转型No.7】QQ邮箱如何通过敏捷成为行业第一

    前几篇文章讲到2006年的腾讯是如何开始敏捷转型的,接下来这篇文章,我将向大家讲述,腾讯开始敏捷转型之后,QQ邮箱是如何通过敏捷成为行业第一. 众所周知,张小龙是“微信之父”,对他熟悉的人,应该也知道 ...