Sign In

Don't have a Xilinx account yet?

  • Choose to receive important news and product information
  • Gain access to special content
  • Personalize your web experience on Xilinx.com

Create Account

Username

Password

Forgot your password?
XClose Panel
Xilinx Home
Reply
Visitor
mad29
Posts: 10
Registered: ‎07-08-2010
0

Re: EDK Concepts, Tools, and Techniques 12.1??

I have created the linker script and have included the timer and interrupt controller. I am going to turn this over to a webcase. I don't know enough about SDK to pretend that I know what I am doing in software. I need an example that works or else this is just a waist of time. Thanks all for your help I shall report back with my findings.  

Visitor
mad29
Posts: 10
Registered: ‎07-08-2010
0

Re: EDK Concepts, Tools, and Techniques 12.1??

Webcase won't help with version 12.1 so I have decided to look back to you guys for help. I created a BSP that has a timer and interrupt controller. I am using the socket platform version so I enabled xilkernel. I enabled lwip and added the following to the linker script: -llwip4 -lxilkernel. My source code,  mss file, and errors are posted below. 

 

Source:

 

// Located in: microblaze_0/include/xparameters.h

#include "xparameters.h"

#include "xmk.h"

#include "stdio.h"

#include "lwip/sockets.h"

#include "lwipopts.h"

#include "lwip/inet.h"

#include "netif/xadapter.h"

#include "lwip/sys.h"

 

void* processConnection(void* arg){

 char revbuf[RECV_BUFFER_SIZE];

 int bytereceived;

 int sd=*((int*) arg);

 char sendbuf[1024]="send data from FPGA";

 lwip_write(sd,sendbuf,1024);

 bytereceived=lwip_read(sd,revbuf,RECV_BUFFER_SIZE);

 xil_printf("received data length is %d\r\n",bytereceived);

 xil_printf("received data is %s\r\n",revbuf);

}

 

void* serverAppThread(void){

 struct netif* pnetif;

 struct netif servernetif;

 struct ip_addr ipaddr, netmask, gw;

 struct sockaddr_in address, remote;

 int sock;

 int new_sd;

 int size;

      unsigned char mac_ethernet_address[] = { 0x00, 0x0a, 0x35, 0x00, 0x01, 0x02 };

    IP4_ADDR(&ipaddr, 192, 168, 1, 224);

    IP4_ADDR(&netmask, 255, 255, 255, 0);

    IP4_ADDR(&gw, 192, 168, 1, 1);

     pnetif=&servernetif;

    if (!xemac_add(pnetif, &ipaddr, &netmask, &gw, mac_ethernet_address, ETHERNET_MAC_ADDRESS))

     {

        xil_printf("Error adding N/W interface\n\r");

        return;

        }

    netif_set_default(pnetif);

     netif_set_up(pnetif);

      sys_thread_new((void(*)(void*))xemacif_input_thread, pnetif, 1);

 

    sock = lwip_socket(AF_INET, SOCK_STREAM, 0);

    address.sin_family      = AF_INET;

    address.sin_port        = htons(8080);

    address.sin_addr.s_addr = INADDR_ANY;

    lwip_bind(sock, (struct sockaddr*)&address, sizeof(address));

    xil_printf("Server initialization complete.\r\n");

 

    lwip_listen(sock,4);

    size=sizeof(remote);

    new_sd = lwip_accept(sock, (struct sockaddr *)&remote, &size);

    xil_printf("accepted from socket %d\r\n",new_sd);

    sys_thread_new((void *)&processConnection, &new_sd, 1);

}

void* serverThread(void){

     lwip_init();

    sleep(300);

    sys_thread_new((void *)&serverAppThread, 0, 1);

}

int main (void) {

   xillkernel_main();    //The serverThread() gets executed;

   return 0;

}

MSS FILE:

 

 

 

 PARAMETER VERSION = 2.2.0

 

 

BEGIN OS

 PARAMETER OS_NAME = xilkernel

 PARAMETER OS_VER = 5.00.a

 PARAMETER PROC_INSTANCE = microblaze_0

 PARAMETER STDIN = RS232_DCE

 PARAMETER STDOUT = RS232_DCE

 PARAMETER SYSTMR_SPEC = true

 PARAMETER SYSTMR_DEV = xps_timer_0

 PARAMETER SYSINTC_SPEC = xps_intc_0

END

 

 

BEGIN PROCESSOR

 PARAMETER DRIVER_NAME = cpu

 PARAMETER DRIVER_VER = 1.12.b

 PARAMETER HW_INSTANCE = microblaze_0

END

 

 

BEGIN DRIVER

 PARAMETER DRIVER_NAME = gpio

 PARAMETER DRIVER_VER = 3.00.a

 PARAMETER HW_INSTANCE = BTNs_4Bit

END

 

BEGIN DRIVER

 PARAMETER DRIVER_NAME = mpmc

 PARAMETER DRIVER_VER = 4.00.a

 PARAMETER HW_INSTANCE = DDR2_SDRAM

END

 

BEGIN DRIVER

 PARAMETER DRIVER_NAME = gpio

 PARAMETER DRIVER_VER = 3.00.a

 PARAMETER HW_INSTANCE = DIPs_4Bit

END

 

BEGIN DRIVER

 PARAMETER DRIVER_NAME = emaclite

 PARAMETER DRIVER_VER = 3.00.a

 PARAMETER HW_INSTANCE = Ethernet_MAC

END

 

BEGIN DRIVER

 PARAMETER DRIVER_NAME = gpio

 PARAMETER DRIVER_VER = 3.00.a

 PARAMETER HW_INSTANCE = LEDs_8Bit

END

 

BEGIN DRIVER

 PARAMETER DRIVER_NAME = uartlite

 PARAMETER DRIVER_VER = 2.00.a

 PARAMETER HW_INSTANCE = RS232_DCE

END

 

BEGIN DRIVER

 PARAMETER DRIVER_NAME = uartlite

 PARAMETER DRIVER_VER = 2.00.a

 PARAMETER HW_INSTANCE = RS232_DTE

END

 

BEGIN DRIVER

 PARAMETER DRIVER_NAME = spi

 PARAMETER DRIVER_VER = 3.00.a

 PARAMETER HW_INSTANCE = SPI_FLASH

END

 

BEGIN DRIVER

 PARAMETER DRIVER_NAME = bram

 PARAMETER DRIVER_VER = 2.00.a

 PARAMETER HW_INSTANCE = dlmb_cntlr

END

 

BEGIN DRIVER

 PARAMETER DRIVER_NAME = bram

 PARAMETER DRIVER_VER = 2.00.a

 PARAMETER HW_INSTANCE = ilmb_cntlr

END

 

BEGIN DRIVER

 PARAMETER DRIVER_NAME = uartlite

 PARAMETER DRIVER_VER = 2.00.a

 PARAMETER HW_INSTANCE = mdm_0

END

 

BEGIN DRIVER

 PARAMETER DRIVER_NAME = intc

 PARAMETER DRIVER_VER = 2.00.a

 PARAMETER HW_INSTANCE = xps_intc_0

END

 

BEGIN DRIVER

 PARAMETER DRIVER_NAME = tmrctr

 PARAMETER DRIVER_VER = 2.00.a

 PARAMETER HW_INSTANCE = xps_timer_0

END

 

 

BEGIN LIBRARY

 PARAMETER LIBRARY_NAME = lwip130

 PARAMETER LIBRARY_VER = 2.00.a

 PARAMETER PROC_INSTANCE = microblaze_0

END

 

BEGIN LIBRARY

 PARAMETER LIBRARY_NAME = xilmfs

 PARAMETER LIBRARY_VER = 1.00.a

 PARAMETER PROC_INSTANCE = microblaze_0

END

 

 

ERRORS:

 

Description Resource Path Location Type
‘AF_INET’ undeclared (first use in this function) main.c /sock_apps line 44 C/C++ Problem
‘ETHERNET_MAC_ADDRESS’ undeclared (first use in this function) main.c /sock_apps line 35 C/C++ Problem
‘INADDR_ANY’ undeclared (first use in this function) main.c /sock_apps line 47 C/C++ Problem
‘RECV_BUFFER_SIZE’ undeclared (first use in this function) main.c /sock_apps line 12 C/C++ Problem
‘SOCK_STREAM’ undeclared (first use in this function) main.c /sock_apps line 44 C/C++ Problem
‘sys_thread_new’ undeclared (first use in this function) main.c /sock_apps line 42 C/C++ Problem
‘sys_thread_new’ undeclared (first use in this function) main.c /sock_apps line 60 C/C++ Problem
macro "sys_thread_new" requires 5 arguments, but only 3 given main.c /sock_apps line 42 C/C++ Problem
macro "sys_thread_new" requires 5 arguments, but only 3 given main.c /sock_apps line 55 C/C++ Problem
macro "sys_thread_new" requires 5 arguments, but only 3 given main.c /sock_apps line 60 C/C++ Problem
make: *** [main.o] Error 1 sock_apps line 0 C/C++ Problem
storage size of ‘address’ isn’t known main.c /sock_apps line 26 C/C++ Problem
storage size of ‘remote’ isn’t known main.c /sock_apps line 26 C/C++ Problem
‘return’ with no value, in function returning non-void main.c /sock_apps line 38 C/C++ Problem
control reaches end of non-void function main.c /sock_apps line 20 C/C++ Problem
control reaches end of non-void function main.c /sock_apps line 56 C/C++ Problem
control reaches end of non-void function main.c /sock_apps line 61 C/C++ Problem
implicit declaration of function ‘lwip_accept’ main.c /sock_apps line 53 C/C++ Problem
implicit declaration of function ‘lwip_bind’ main.c /sock_apps line 48 C/C++ Problem
implicit declaration of function ‘lwip_init’ main.c /sock_apps line 58 C/C++ Problem
implicit declaration of function ‘lwip_listen’ main.c /sock_apps line 51 C/C++ Problem
implicit declaration of function ‘lwip_read’ main.c /sock_apps line 17 C/C++ Problem
implicit declaration of function ‘lwip_socket’ main.c /sock_apps line 44 C/C++ Problem
implicit declaration of function ‘lwip_write’ main.c /sock_apps line 16 C/C++ Problem
implicit declaration of function ‘xillkernel_main’ main.c /sock_apps line 63 C/C++ Problem
unused variable ‘address’ main.c /sock_apps line 26 C/C++ Problem
unused variable ‘remote’ main.c /sock_apps line 26 C/C++ Problem
unused variable ‘revbuf’ main.c /sock_apps line 12 C/C++ Problem

Description Resource Path Location Type‘AF_INET’ undeclared (first use in this function) main.c /sock_apps line 44 C/C++ Problem‘ETHERNET_MAC_ADDRESS’ undeclared (first use in this function) main.c /sock_apps line 35 C/C++ Problem‘INADDR_ANY’ undeclared (first use in this function) main.c /sock_apps line 47 C/C++ Problem‘RECV_BUFFER_SIZE’ undeclared (first use in this function) main.c /sock_apps line 12 C/C++ Problem‘SOCK_STREAM’ undeclared (first use in this function) main.c /sock_apps line 44 C/C++ Problem‘sys_thread_new’ undeclared (first use in this function) main.c /sock_apps line 42 C/C++ Problem‘sys_thread_new’ undeclared (first use in this function) main.c /sock_apps line 60 C/C++ Problemmacro "sys_thread_new" requires 5 arguments, but only 3 given main.c /sock_apps line 42 C/C++ Problemmacro "sys_thread_new" requires 5 arguments, but only 3 given main.c /sock_apps line 55 C/C++ Problemmacro "sys_thread_new" requires 5 arguments, but only 3 given main.c /sock_apps line 60 C/C++ Problemmake: *** [main.o] Error 1 sock_apps line 0 C/C++ Problemstorage size of ‘address’ isn’t known main.c /sock_apps line 26 C/C++ Problemstorage size of ‘remote’ isn’t known main.c /sock_apps line 26 C/C++ Problem‘return’ with no value, in function returning non-void main.c /sock_apps line 38 C/C++ Problemcontrol reaches end of non-void function main.c /sock_apps line 20 C/C++ Problemcontrol reaches end of non-void function main.c /sock_apps line 56 C/C++ Problemcontrol reaches end of non-void function main.c /sock_apps line 61 C/C++ Problemimplicit declaration of function ‘lwip_accept’ main.c /sock_apps line 53 C/C++ Problemimplicit declaration of function ‘lwip_bind’ main.c /sock_apps line 48 C/C++ Problemimplicit declaration of function ‘lwip_init’ main.c /sock_apps line 58 C/C++ Problemimplicit declaration of function ‘lwip_listen’ main.c /sock_apps line 51 C/C++ Problemimplicit declaration of function ‘lwip_read’ main.c /sock_apps line 17 C/C++ Problemimplicit declaration of function ‘lwip_socket’ main.c /sock_apps line 44 C/C++ Problemimplicit declaration of function ‘lwip_write’ main.c /sock_apps line 16 C/C++ Problemimplicit declaration of function ‘xillkernel_main’ main.c /sock_apps line 63 C/C++ Problemunused variable ‘address’ main.c /sock_apps line 26 C/C++ Problemunused variable ‘remote’ main.c /sock_apps line 26 C/C++ Problemunused variable ‘revbuf’ main.c /sock_apps line 12 C/C++ Problem

 

Xilinx Employee
vsiva
Posts: 495
Registered: ‎01-18-2008

Re: EDK Concepts, Tools, and Techniques 12.1??

Here's a different way in which you can try to get things working:

 

1. Download http://github.com/vsiva/sp605-lwip/archives/master

2. Open SDK, point to a new workspace.

3. Click on import existing projects into workspace, select the archive that you downloaded in step 1.

4. Now you'll have a working lwIP echo server for SP605 board.

5. Create a new h/w platform for your board.

6. Create a new BSP for your board. Make sure the lwIP settings in your system.mss match the one that you downloaded in the steps above.

7. Right click on the echo server app, select change referenced BSP and point to your newly created BSP.

 

That should get things working. The primary issue you are facing is that in 12.1, the driver API has changed. As a result, if you want your existing software to compile, you have to either not upgrade any drivers (from 11.4), or you have to modify your sources to match the new driver API.

Visitor
mad29
Posts: 10
Registered: ‎07-08-2010
0

Re: EDK Concepts, Tools, and Techniques 12.1??

[ Edited ]

I went the 12.1 route posted above. This worked amazingly. Thanks! :smileyhappy:

Visitor
mad29
Posts: 10
Registered: ‎07-08-2010
0

Re: EDK Concepts, Tools, and Techniques 12.1??

Okay, It was working fine, but I found a problem. Maybe it is because I don't know that much about SDK. When I compile everything works fine for the first couple of times that I run it. If I try to place my own breakpoints (Not the breakpoints that are provided by debug) or type to fast in telnet the console says error cant find driver or something to that effect. I reload the board and software, but now when I debug again the debug break points that pauses the software at startup no longer exist and the console does not display the server info. Any suggestions?

Visitor
mad29
Posts: 10
Registered: ‎07-08-2010
0

Re: EDK Concepts, Tools, and Techniques 12.1??

Here is the error I get before everything stops working. 

 

incorrect configuration: xps_ethernetlite drivers not present?

 


mad29 wrote:

Okay, It was working fine, but I found a problem. Maybe it is because I don't know that much about SDK. When I compile everything works fine for the first couple of times that I run it. If I try to place my own breakpoints (Not the breakpoints that are provided by debug) or type to fast in telnet the console says error cant find driver or something to that effect. I reload the board and software, but now when I debug again the debug break points that pauses the software at startup no longer exist and the console does not display the server info. Any suggestions?