cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Contributor
Contributor
8,170 Views
Registered: ‎03-13-2008

Need some explanation in XAPP1026

Hello,

I am trying to build a webserver in ML403 Evaluation board (Xilinx Vertix 4 F12).

and I'm trying to start using xilinx example which is XAPP1026  (webserver part).

 

 

---->   in http_rsponse.c file.

what is the functionalty of the following code block:

 

#if 1

for(n=0; n< n_swithches ; n++; p++)

*p = '0' + (s & 0x1);

s>>= ;

}

 

#else

strco...

...

#end if

 

- This is the first time that i see this statment in c code which is (#if #else #endif) , what is the functionalty of this statment.

if it is like normal if, then i think it 's trivial to put a condition with (1) and write else statment?

 

- what is the functionalty of 

*p = '0' + (s & 0x1);

s>>= ;

 

 

 

--------------> i have a problem in building a new project and copy XAPP1026 code, as it is.

then generate the bit stream file and elf file.

then i program my kit with generated bit file.

when i dow/run my elf file, nothing occure , and web browser give can't find server.

when i dow/run XAPP1026 elf file in my bit file, web brewser find the website and show it, but it can't use any kit resouces such as toggle leds, or get switch states.

 

There is different that i see in XMD window which is varing in addresses of section form my elf, and xapp elf.

such as section fini, got, got1, got2 as shown in attached picture.

 

Hoping to hear from you soon, Thank you in advanced.

Best Regards.
Hamzah A. Abdel-Aziz
0 Kudos
8 Replies
Highlighted
Contributor
Contributor
8,169 Views
Registered: ‎03-13-2008

 
Best Regards.
Hamzah A. Abdel-Aziz
ece.JPG
0 Kudos
Highlighted
Xilinx Employee
Xilinx Employee
8,143 Views
Registered: ‎01-18-2008

>> This is the first time that i see this statment in c code which is (#if #else #endif) , what is the functionalty of this statment.

>> if it is like normal if, then i think it 's trivial to put a condition with (1) and write else statment?

 

It looks like I didn't fully clean up the code before releasing it. Sorry about that. Also, this code is only there in the RAW mode example, and since you are a beginner, I'd advise you to look at the socket mode example.

 

The #if #else #endif are just C preprocessor macros. 

http://gcc.gnu.org/onlinedocs/cpp/If.html#If

 

It is a trivial #if 1 condition, so you can just ignore the else part.

 

>> - what is the functionalty of 

>> *p = '0' + (s & 0x1);

>> s>>= ;

 

Bad naming of variables, but you should be able to see that s is just a integer that needs to be converted into a binary string.

 

There is a section at the end of the appnote that discusses common mistakes. That might be of help to you. I'm not sure how you compiled your ELF, but you should check if you have a linker script specified.

0 Kudos
Highlighted
Contributor
Contributor
8,115 Views
Registered: ‎03-13-2008

>> since you are a beginner, I'd advise you to look at the socket mode example.

 

I think the differenance between Socket and RAW mode is in the processing methodology of sending and receiving data, which is not problem with me.

but i am using RAW mode because i want to get the best data rate in transfering data, Is it true?

 

concerning with linker script, I just click in generate linker script, and then click OK -because all fields aren't writable except chosing memory in the poped-up  window - but no change in behavior.

The only different between my project and XAPP1026 that i use  xps_bram_if_cntlr_1 as 32K instead of 8k, but have the same base address.

and PPC clock is 200MHz instead of 300MHz. and i think it is not critical different.

and if i have problem in linker script. why your ELF file can't access board IO, that when press in toggle led the button will be inactive and no change occure?

The problem may be in addresses of IO, but i sure that it 's same from system assbley view.

 

Many Thanks

Best Regards.
Hamzah A. Abdel-Aziz
0 Kudos
Highlighted
Explorer
Explorer
7,871 Views
Registered: ‎12-06-2007

Based on the coding below , I can not receive anything from the hyperterminal. How can I rectify the problem , so that I can receive data from the hyperterminal and display it back to the hyperterminal? I tried to debug , but there is no value assign to t . If the coding is wrong, should I use array.

 

 

#include "xparameters.h"
#include "xuartlite.h"


#define UART_BASEADDR XPAR_UARTLITE_0_BASEADDR
#define ESCAPE 0x1b


static void myprintf (char *s)
{
  char t;
 
  while (*s)
  {
   XUartLite_SendByte (UART_BASEADDR ,*s ); // Able to send to Hyperterminal
   s++;
  }
 
  
 do
 {
   /*Problem is here. It should receive data from hyperterminal and display it back.
   But it does not work.How should I rectify it? */
     t = XUartLite_RecvByte(UART_BASEADDR); //Receive
     XUartLite_SendByte (UART_BASEADDR , t ); //Send
    
 } while (t != ESCAPE);
 
}


int main()
{
 myprintf("Good morning");
 
 
 return 0;
}

 

This is the UCF , which automatically generated by using XPS 9.2 

 

Net sys_clk_pin LOC=AE14;
Net sys_clk_pin IOSTANDARD = LVCMOS33;
Net sys_rst_pin LOC=D6;
Net sys_rst_pin PULLUP;
 

## System level constraints
Net sys_clk_pin TNM_NET = sys_clk_pin;
TIMESPEC TS_sys_clk_pin = PERIOD sys_clk_pin 10000 ps;
Net sys_rst_pin TIG;

 

## IO Devices constraints

#### Module RS232_Uart constraints

Net fpga_0_RS232_Uart_RX_pin LOC=W2;
Net fpga_0_RS232_Uart_RX_pin IOSTANDARD = LVCMOS33;
Net fpga_0_RS232_Uart_TX_pin LOC=W1;
Net fpga_0_RS232_Uart_TX_pin IOSTANDARD = LVCMOS33;

0 Kudos
Highlighted
Observer
Observer
5,892 Views
Registered: ‎09-13-2012

HI. I READ YOUR POST AND I AM USING VERTIX 4 FOR MY FINAL YEAR PROJECT BUT THE PROBLEM IS THAT I COULDN'T FIND WHAT PROGRAMMING TOOL IS USED. IF YOU KINDLY TELL ME WHAT PROGRAMMING TOOL SHOUL I USE???

 

0 Kudos
Highlighted
Contributor
Contributor
5,882 Views
Registered: ‎03-13-2008

Hello,

Oh this is an old project. 

Anyway, what type of project are you working in? I mean, you may not need to use a programming language if you intend to build a pure hardware project. In this case, you just need Xilinx ISE software and you can use HDL language such as VHDL, or Verilog to build your system.

However, if you planning to build an embedded system in the vertix 4, so you may use ISE or EDK. All of them are part of Xiiinx ISE suite. in EDK, you can use C++ to program your embedded software in PowerPC or softcore processor inside the FPGA.

 

Good luck.

Best Regards.
Hamzah A. Abdel-Aziz
0 Kudos
Highlighted
Observer
Observer
5,872 Views
Registered: ‎09-13-2012

hi

basically i want to use c++ and my project is on signal processing

0 Kudos
Highlighted
Contributor
Contributor
5,863 Views
Registered: ‎03-13-2008

Do u want to build an embedded system?

Or

just you want to describe your hardware with c++ instead of VHDL? In this case you will need a high level synthesis tool that synthesize your c++ to VHDLHowever your project  will still be merely hardware not embedded system.

Best Regards.
Hamzah A. Abdel-Aziz
0 Kudos