让所有的单片机都能轻松接入internet(之一)

[复制链接]
2648|0
手机看帖
扫描二维码
随时随地手机跟帖
_yunyun_|  楼主 | 2008-11-3 14:56 | 显示全部楼层 |阅读模式
以前很少在这里混,很多功能都不熟悉。
还有几个附件,实在不知道如何上传.大家到这里看看好了.
http://www.**.com/bbs/bbs_content.jsp?bbs_sn=1570078&bbs_page_no=1&search_mode=3&search_text=34480016&bbs_id=9999
发个贴混个熟脸.
上传不了图片,看来得换ie上了.

让所有的单片机都能轻松接入internet(之一)一步一步教你移植uIP0.9到8051+RTL8019AS

1. google一下uip,点击进入主页 http://www.sics.se/~adam/uip/index.php/Main_Page
   当前最新的uIP版本是 1.0,这个版本比较复杂,所以还是移植历史版本吧.
   打开 http://www.sics.se/~adam/old-uip/ 下载0.9版:
   http://www.sics.se/~adam/download/?f=uip-0.9.tar.gz

2. 打开Keil新建项目uIP0.9.uv2, 设置项目属性.
   memory_model 设置为large 模式,这样默认的存储方式是xdata
         因为uIP0.9编译后占用20K rom, 所以必须选一个32K(>20K)的rom的单片机,
   比如Device可设置为SST89x58或者SST89x516xx,
   解压缩官方下载的uIP0.9压缩包,添加文件至项目,   
   需添加至项目的文件有:uip\uip.c, uip.c\uip.h, uip.c\uip_arch.h, 
     uip.c\uip_arp.c,uip.c\uip_arp.h     
     unix\main.c, unix\uip_arch.c, unix\uipopt.h,
     apps\httpd\所有文件

3. 因为data是系统关键字, 所以标识符data => dat
   以下文件需要改动:   fs.h, fsdata.h,httpd.c

4. 为RTL8019AS 编写驱动程序(具体如何操作寄存器老古的网站有详细的教程), 
          内容在压缩包中的RTL8019AS.c, RTL8019AS.h
     需要更改main.h中的如下地方:
     include "tapdev.h" => #include "rtl8019as.h"
     tapdev_init() -> rtl8019as_init()
     tapdev_send() -> rtl8019as_send()
     tapdev_read() -> rtl8019as_read()

5. fsdata.c 首行添加 #include "fsdata.h"
   关键字替换: 
   static const char -> const char code 
   const struct fsdata_file -> const struct fsdata_file code 
   
   fsdata.h 文件末尾添加:
                                #define FS_ROOT file_tcp_header_html
                                #define FS_NUMFILES 14
                                
                                const char code data_cgi_files[];
                                const char code data_cgi_stats[];
                                const char code data_cgi_tcp[];
                                const char code data_img_bg_png[];
                                const char code data_about_html[];
                                const char code data_control_html[];
                                const char code data_404_html[];
                                const char code data_files_footer_plain[];
                                const char code data_files_header_html[];
                                const char code data_index_html[];
                                const char code data_stats_footer_plain[];
                                const char code data_stats_header_html[];
                                const char code data_tcp_footer_plain[];
                                const char code data_tcp_header_html[];
                                const struct fsdata_file code file_cgi_files[];
                                const struct fsdata_file code file_cgi_stats[];
                                const struct fsdata_file code file_cgi_tcp[];
                                const struct fsdata_file code file_img_bg_png[];
                                const struct fsdata_file code file_about_html[];
                                const struct fsdata_file code file_control_html[];
                                const struct fsdata_file code file_404_html[];
                                const struct fsdata_file code file_files_footer_plain[];
                                const struct fsdata_file code file_files_header_html[];
                                const struct fsdata_file code file_index_html[];
                                const struct fsdata_file code file_stats_footer_plain[];
                                const struct fsdata_file code file_stats_header_html[];
                                const struct fsdata_file code file_tcp_footer_plain[];
                                const struct fsdata_file code file_tcp_header_html[];   


6. fs.c 第55行删除: #include "fsdata.c"

7. uipopt.h 
    181行: #define UIP_FIXEDETHADDR 0 -> 1
    299行: #define UIP_ACTIVE_OPEN 1 ->0
    497行: #define BYTE_ORDER     LITTLE_ENDIAN -> BIG_ENDIAN
    280行: #define UIP_UDP_APPCALL  udp_appcall -> httpd_appcall
     
    文件末尾添加:
    #ifndef NULL
    #define NULL (void *)0
    #endif /* NULL */


8. httpd.c
   删除以下内容:
                                   extern const struct fsdata_file file_index_html;
                                   extern const struct fsdata_file file_404_html;
   220行更改:
            fs_open(file_index_html.name, &fsfile);    =>   file_index_html->name 
   224行同上更改



9. 上电,开发板的webserver就启动了.具体的IP和掩码在uipopt.h 文件里面设置. 


https://bbs.21ic.com/upfiles/img/200712/20071219151754719.gif

相关帖子

发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

1

主题

8

帖子

0

粉丝