2009-09-11 87 views
0

我試圖運行tftp服務器的示例代碼。在合成我的硬件或編譯代碼時我沒有抱怨。但是,當我添加lwip_init()語句時,它似乎停止工作(它不輸出任何打印語句)。這是非常令人沮喪的,我不知道是什麼導致了它。有任何想法嗎?由於嘗試運行任何lwip函數時出現代碼中斷

#include <stdio.h> 
#include "xenv_standalone.h" 
#include "xparameters.h" 
#include "platform.h" 
#include "netif/xadapter.h" 
#include "lwip/init.h" 

#define EMAC_BASEADDR XPAR_LLTEMAC_0_BASEADDR 

int main() 
{ 
    print("-- Starting main() -- \r\n"); 

    struct netif *netif, server_netif; 
    struct ip_addr ipaddr, netmask, gw; 

    /* the mac address of the board. this should be unique per board */ 
    unsigned char mac_ethernet_address[] = { 0x00, 0x0a, 0x35, 0x00, 0x01, 0x02 }; 

    netif = &server_netif; 

    microblaze_init_icache_range(0, XPAR_MICROBLAZE_0_CACHE_BYTE_SIZE); 
    microblaze_init_dcache_range(0, XPAR_MICROBLAZE_0_DCACHE_BYTE_SIZE); 

    /* enable caches */ 
    XCACHE_ENABLE_ICACHE(); 
    XCACHE_ENABLE_DCACHE(); 

    platform_setup_interrupts(); 

    /* initliaze IP addresses to be used */ 
    IP4_ADDR(&ipaddr, 192, 168, 1, 10); 
    IP4_ADDR(&netmask, 255, 255, 255, 0); 
    IP4_ADDR(&gw,  192, 168, 1, 1); 

    print_app_header(); 
    print_ip_settings(&ipaddr, &netmask, &gw); 

    lwip_init(); 

    ... 
} 

編輯迴應玉萍:

也許你可以解釋一下,因爲你可能是正確的。當我編譯它沒有lwip_init(),我得到:

text data bss dec hex 
7214 356 1104 8674 21e2 

與lwip_init()我得到:

text data bss dec hex 
9726 356 559080 569162 8af4a 

這是一個很大更大。太糟糕了,它不能給出警告

回答

1

假設(假設你正在做一個乾淨的重建),當你開始調用LWIP函數時,它會鏈接許多新的東西,所以你的圖像已經改變了。你的圖像溢出了它的任何約束(程序大小,數據大小,堆棧大小...)嗎?

+0

我確實有這個問題,我相信我通過增加使用的塊RAM的大小來解決這個問題(至少我沒有看到任何錯誤/警告) – giroy 2009-09-11 15:35:58

相關問題