环境搭建可以参考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协议栈的,研究研究吧

/** helloWorld_bios6.c* TCP/IP Stack 'Hello World!' Example ported to use BIOS6 OS.
*///--------------------------------------------------------------------------
// IP Stack 'Hello World!' Example
// To test it as is, use with helloWorld.exe from \winapps directory
//

#include <stdio.h>
#include <ti/ndk/inc/netmain.h>/* BIOS6 include */
#include <ti/sysbios/BIOS.h>/* Platform utilities include */
#include "ti/platform/platform.h"
#include "ti/platform/resource_mgr.h"/* Platform Information - we will read it form the Platform Library */
platform_info  gPlatformInfo;//---------------------------------------------------------------------------
// Title String
//
char *VerStr = "\nTCP/IP Stack 'Hello World!' Application\n\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 );// External references
extern int dtask_udp_hello();//---------------------------------------------------------------------------
// 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/**************************************************************************  @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()
{int i;platform_init_flags  sFlags;platform_init_config sConfig;/* Status of the call to initialize the platform */Int32 pform_status;/* Platform Information - we will read it form the Platform Library */platform_info       sPlatformInfo;/** You can choose what to initialize on the platform by setting the following* flags. We will initialize everything.*/memset( (void *) &sFlags,  0, sizeof(platform_init_flags));memset( (void *) &sConfig, 0, sizeof(platform_init_config));sFlags.pll = 0;sFlags.ddr = 0;sFlags.tcsl = 0;    /* Time stamp counter   */sFlags.phy  = 1;    /* Ethernet                     */sFlags.ecc = 0;sConfig.pllm = 0;pform_status = platform_init(&sFlags, &sConfig);/* If we initialized the platform okay */if (pform_status == Platform_EOK) {/* Get information about the platform so we can use it in various places */memset( (void *) &sPlatformInfo, 0, sizeof(platform_info));(void) platform_get_info(&sPlatformInfo);}else {/* Intiialization of the platform failed... die */printf("Platform failed to initialize. Error code %d \n", pform_status);printf("We will die in an infinite loop... \n");while (1) {(void) platform_led(1, PLATFORM_LED_ON, (LED_CLASS_E) PLATFORM_USER_LED_CLASS);(void) platform_delay(50000);(void) platform_led(1, PLATFORM_LED_OFF, (LED_CLASS_E) PLATFORM_USER_LED_CLASS);(void) platform_delay(50000);};}platform_write_configure(PLATFORM_WRITE_PRINTF);platform_uart_init();platform_uart_set_baudrate(19200);/* Check to see that we are running on the Master Core */if (platform_get_coreid() != 0) {/* We are not on the Master Core... die */printf("You must run this application on Core 0. \n");printf("We will die in an infinite loop... \n");while (1) {(void) platform_led(1, PLATFORM_LED_ON, (LED_CLASS_E) PLATFORM_USER_LED_CLASS);(void) platform_delay(50000);(void) platform_led(1, PLATFORM_LED_OFF, (LED_CLASS_E) PLATFORM_USER_LED_CLASS);(void) platform_delay(50000);};}/* Clear the state of the LEDs to OFF */for (i=0; i < sPlatformInfo.led[1].count; i++) {platform_led(i, PLATFORM_LED_OFF, (LED_CLASS_E) PLATFORM_USER_LED_CLASS);}return;
}//---------------------------------------------------------------------
// Main Entry Point
//---------------------------------------------------------------------
int main()
{/* Start the BIOS 6 Scheduler */BIOS_start ();
}//
// Main Thread
//
int StackTest()
{int             rc;int        i;HANDLE          hCfg;//// 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 configurationhCfg = CfgNew();if( !hCfg ){platform_write("Unable to create configuration\n");goto main_exit;}// We better validate the length of the supplied namesif( strlen( DomainName ) >= CFG_DOMAIN_MAX ||strlen( HostName ) >= CFG_HOSTNAME_MAX ){printf("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 Gatewayif (!platform_get_switch_state(1)){CI_IPNET NA;CI_ROUTE RT;IPN      IPTmp;// Setup manual IP addressbzero( &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 1CfgAddEntry( 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 routeCfgAddEntry( hCfg, CFGTAG_ROUTE, 0, 0,sizeof(CI_ROUTE), (UINT8 *)&RT, 0 );// Manually add the DNS server when specifiedIPTmp = inet_addr(DNSServer);if( IPTmp )CfgAddEntry( hCfg, CFGTAG_SYSINFO, CFGITEM_DHCP_DOMAINNAMESERVER,0, sizeof(IPTmp), (UINT8 *)&IPTmp, 0 );}// Else we specify DHCPelse{CI_SERVICE_DHCPC dhcpc;// Specify DHCP Service on IF-1bzero( &dhcpc, sizeof(dhcpc) );dhcpc.cisargs.Mode   = CIS_FLG_IFIDXVALID;dhcpc.cisargs.IfIdx  = 1;dhcpc.cisargs.pCbSrv = &ServiceReport;CfgAddEntry( hCfg, CFGTAG_SERVICE, CFGITEM_SERVICE_DHCPCLIENT, 0,sizeof(dhcpc), (UINT8 *)&dhcpc, 0 );}//// Configure IPStack/OS Options//// We don't want to see debug messages less than WARNINGSrc = DBG_WARN;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.)//// UDP Receive limitrc = 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.//
    do{rc = NC_NetStart( hCfg, NetworkOpen, NetworkClose, NetworkIPAddr );} while( rc > 0 );// Delete Configuration
    CfgFree( hCfg );// Close the OS
main_exit:NC_SystemClose();return(0);
}//
// System Task Code [ Server Daemon Servers ]
//
static HANDLE hHello=0;//
// NetworkOpen
//
// This function is called after the configuration has booted
//
static void NetworkOpen()
{// Create our local serverhHello = DaemonNew( SOCK_DGRAM, 0, 7, dtask_udp_hello,OS_TASKPRINORM, OS_TASKSTKNORM, 0, 1 );
}//
// 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( hHello );
}//
// 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 )
{IPN IPTmp;if( fAdd )printf("Network Added: ");elseprintf("Network Removed: ");// Print a messageIPTmp = ntohl( IPAddr );printf("If-%d:%d.%d.%d.%d\n", IfIdx,(UINT8)(IPTmp>>24)&0xFF, (UINT8)(IPTmp>>16)&0xFF,(UINT8)(IPTmp>>8)&0xFF, (UINT8)IPTmp&0xFF );
}//
// Service Status Reports
//
// Here's a quick example of using service status updates
//
static char *TaskName[]  = { "Telnet","HTTP","NAT","DHCPS","DHCPC","DNS" };
static char *ReportStr[] = { "","Running","Updated","Complete","Fault" };
static char *StatusStr[] = { "Disabled","Waiting","IPTerm","Failed","Enabled" };
static void ServiceReport( uint Item, uint Status, uint Report, HANDLE h )
{printf( "Service Status: %-9s: %-9s: %-9s: %03d\n",TaskName[Item-1], StatusStr[Status],ReportStr[Report/256], Report&0xFF );//// Example of adding to the DHCP configuration space//// When using the DHCP client, the client has full control over access// to the first 256 entries in the CFGTAG_SYSINFO space.//// Note that the DHCP client will erase all CFGTAG_SYSINFO tags except// CFGITEM_DHCP_HOSTNAME. If the application needs to keep manual// entries in the DHCP tag range, then the code to maintain them should// be placed here.//// Here, we want to manually add a DNS server to the configuration, but// we can only do it once DHCP has finished its programming.//
    if( Item == CFGITEM_SERVICE_DHCPCLIENT &&Status == CIS_SRV_STATUS_ENABLED &&(Report == (NETTOOLS_STAT_RUNNING|DHCPCODE_IPADD) ||Report == (NETTOOLS_STAT_RUNNING|DHCPCODE_IPRENEW)) ){IPN IPTmp;// Manually add the DNS server when specifiedIPTmp = inet_addr(DNSServer);if( IPTmp )CfgAddEntry( 0, CFGTAG_SYSINFO, CFGITEM_DHCP_DOMAINNAMESERVER,0, sizeof(IPTmp), (UINT8 *)&IPTmp, 0 );}
}

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. 接着是配置网络参数的函数

CfgAddEntry( hCfg, CFGTAG_SYSINFO, CFGITEM_DHCP_HOSTNAME, 0,strlen(HostName), (UINT8 *)HostName, 0 );

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

转载于:https://www.cnblogs.com/429512065qhq/p/8080165.html

dsp6657的helloworld例程测试-第一篇相关推荐

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

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

  2. B站黑马测试第一篇P182视频数据库SQL语句查询数据准备代码

    drop table if exists goods; create table goods(id int unsigned primary key auto_increment,goodsName ...

  3. 初识测开/测试- 第一篇 - 测开/测试方向

    前言 在进入软件测试的正式讲解之前,我们需要对这个行业有一个整体的了解. 当我们从软件开发转向软件测试的时候,多数公司是欢迎的,而且难度也小. 反之,当我们从软件测试转向软件开发的时候,难度将会变得很 ...

  4. APM32F103 RTC内部时钟源报警中断例程测试

    APM32F103 RTC内部时钟源报警中断例程测试 ✨相关篇推荐<[开源电路]STM32F103VCT6开发板>

  5. APM32F103 RTC内部时钟源秒中断例程测试

    APM32F103 RTC内部时钟源秒中断例程测试 ✨相关篇推荐<[开源电路]STM32F103VCT6开发板>

  6. 个人注册CSDN后第一篇分享关于测试工程师工作心得的文章

    测试工程师叫得好听,其实就是测试小白. 测试小白一般做什么呢? 对,就是日常点点点.而日常点点点带给测试小白的感受就是下面这张图片表达的心情. 你可能关注过测试的薪酬对比:你可能面试的时候被面试官调侃 ...

  7. 「零门槛多语言 Python/C/C# 通用思想学习系列」第一篇:经典HelloWorld

    环境说明 操作系统:Windows7 SP1 编辑器说明: Python:notepad++ C:devc C sharp(C#):Visual Studio2019 注意: 标点:在编程中要使用英文 ...

  8. 《C语言编程魔法书:基于C11标准》——第一篇 预备知识篇 第1章 C魔法概览1.1 例说编程语言...

    本节书摘来自华章计算机<C语言编程魔法书:基于C11标准>一书中的第1章,第1.1节,作者: 陈轶 更多章节内容可以访问云栖社区"华章计算机"公众号查看. 第一篇 预备 ...

  9. 手把手教你玩转网络编程模型之完成例程(Completion Routine)篇(下)-转

    续 手把手教你玩转网络编程模型之完成例程(Completion Routine)篇(上) 四.         完成例程的实现步骤 基础知识方面需要知道的就是这么多,下面我们配合代码,来一步步的讲解如 ...

最新文章

  1. mysql 唯一性约束报错_怪异的MySQL Online DDL报错Duplicate entry
  2. 计算机视觉与图像处理相关的国内外重要期刊汇总
  3. 如何写Java文档注释(Java Doc Comments)
  4. 东南亚下半年做什么产品好?解读Lazadashopee服装类热销及需求品类
  5. Java进阶:ArrayList线程安全问题和解决方案
  6. Github 上热门的 Spring Boot 项目实战推荐
  7. jquery tablelist Tablesorter 表格控件
  8. 【clickhouse】Clickhouse的MySQL引擎同步数据不准确 Decimal
  9. 关于sources.list和apt-get [转载]
  10. python selenium 点击 报错v_python菜鸟初学selenium+chromedrive,简单点击出错,请指教...
  11. Win10下Pytorch的安装和使用[斗之力三段]
  12. Okhttp之CallServerInterceptor简单分析
  13. 计算机视觉论文-2021-04-06
  14. 通过AWS了解云计算系列——云计算的核心技术体系
  15. Guideline 2.3.3 -- We noticed that your screenshots do not sufficiently reflect your app in use
  16. 用Python下载巨潮资讯农业上市企业的年报PDF文件(二)
  17. 【完美解决】用python自带IDLE 进行turtle画图时,老是报错 AttributeError: module 'turtle' has no attribute 'fd'等问题
  18. 【Python习题】简易英汉字典(project-ssss)(题目的坑解析+实现代码)
  19. 区块链:7 个步骤入门区块链
  20. 在Ubuntu16.04 + ROS kinetic环境下安装TurtleBot3

热门文章

  1. LAN9252采用外部阻容复位的时候,RESET引脚一直为低的原因以及对应解决办法。
  2. element-ui前端页面消息提示框
  3. Unity 游戏入门 九、 精灵动画 Sprite Animation
  4. RISC 和CISC
  5. wetool企业微信营销管理系统开发
  6. qmp32下载_U盘歌曲播放顺序调整教程
  7. android自定义View之(四)------一键清除动画
  8. android 设置文本加粗,如何在Android中将文本更改为粗体?
  9. 获取当前的时间是第几周
  10. STM32程序烧录方式总结