一步一步教你移植uIP

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

一步一步教你移植uIP0.9到8051+RTL8019AS

追风发表于2010-11-11 22:21|只看该作者|倒序浏览|打印

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, 设置项目属性.

2 L( E/ A* h( C# e0 @6 m

memory_model 设置为large 模式,这样默认的存储方式是xdata6 |0 v5 H. { m0 Q5 V+ s: O

因为uIP0.9编译后占用20K rom, 所以必须选一个32K(>20K)的rom的单片机,+ u* m8 p& T/ Z( o: f 比如Device可设置为SST89x58或者SST89x516xx,

解压缩官方下载的uIP0.9压缩包,添加文件至项目, ) |4 M1 V0 C5 a' w; b

! F3 ?- @, v' N% j5 u

需添加至项目的文件有:uip\uip.c, uip.c\uip.h, uip.c\uip_arch.h,

) y! x2 Q: E. A- a% p! l5 `

uip.c\uip_arp.c,uip.c\uip_arp.h

, I; I- G7 d: t0 ]& A8 d

unix\main.c, unix\uip_arch.c, unix\uipopt.h,

4 `: P* G, w$ m; S/ D, j* y

apps\httpd\所有文件# j! B+ \7 |1 q1 c$ \5 ?

3. 因为data是系统关键字, 所以标识符data => dat

6 ~' C6 J& |4 ]4 M; Y2 i) }

以下文件需要改动: fs.h, fsdata.h,httpd.c

4. 为RTL8019AS 编写驱动程序(具体如何操作寄存器老古的网站有详细的教程),

2 r- F

3 k5 S, d- U. V e# M

内容在压缩包中的RTL8019AS.c, RTL8019AS.h

需要更改main.h中的如下地方:

include "tapdev.h" => #include "rtl8019as.h"

7 `- j$ i: d Y8 {: A/ ~

tapdev_init() -> rtl8019as_init()

0 Q4 p9 l$ a2 H8 X w

tapdev_send() -> rtl8019as_send()

5 F( X8 f1 {* b% N

tapdev_read() -> rtl8019as_read()

5. fsdata.c 首行添加#include "fsdata.h"

关键字替换: 6 h# K, [! S7 \* w5 h

/ K$ L! C& u# o. F

static const char -> const char code

const struct fsdata_file -> const struct fsdata_file code

7 w4 \: h* c$ Q6 I( C4 Y* {

fsdata.h 文件末尾添加:

) M8 x6 I' d- X2 ^" T; W

#define FS_ROOT file_tcp_header_html' [4 m1 V' B$ w' g6 x

; b+ o5 G: @2 s) w+ l

#define FS_NUMFILES 14) v4 l D5 l9 L* h6 R. f

( A2 V* {9 {/ m5 l5 U3 @

& \- a% x2 Y$ V; U

const char code data_cgi_files[];

const char code data_cgi_stats[];

7 D/ M. D7 d' a0 H' c

const char code data_cgi_tcp[];

const char code data_img_bg_png[];# D# ^: f. P1 _5 [( x+ w* L

0 N/ M, V. o/ e" O/ O- h

const char code data_about_html[];' ^8 x& b6 w2 V+ t7 D( D% W7 O5 d ; q* z x0 e9 |$ F! ~

const char code data_control_html[];

const char code data_404_html[];( s/ w; A2 G. s+ V' s( k

0 j2 F8 a3 T; Z: I

const char code data_files_footer_plain[];2 f& i/ S& S4 p5 G# c const char code data_files_header_html[];

const char code data_index_html[];

. }$ `' ~7 `( H# u: `

const char code data_stats_footer_plain[];

const char code data_stats_header_html[];

相关文档
最新文档