SDK example from Xilinx do not compile

R

Rice

Guest
Hello, I have been trying to implement the SDK example
(http://www.xilinx.com/support/documentation/sw_manuals/xilinx11/edk_ctt.pdf)
into my Avnet Virtex 5 FXT Eval Kit... but the program gives an error...

/*************************************************************
* This program drives the LEDs using the custom circuit. *
*************************************************************/

#include "xparameters.h"
#include "mb_interface.h"
#include "stdio.h"
#include "xutil.h"
#include "stdlib.h"

int main() {

int offset = 0;
int *addr_ptr;
char keyboard;
int LED_value = 0;
int status;
int reg_value;
int all_off_value;
int run_value;
int linear_value;

while(1) {

/* Print initialization message, and prompt for user input. */
xil_printf ("*********************************************\r\n");
xil_printf ("* --> Hyperterm window must be selected <-- *\r\n");
xil_printf ("* *\r\n");
xil_printf ("* Enter value and Carriage Return *\r\n");
xil_printf ("* Enter 0 to read status *\r\n");
xil_printf ("* Enter 1 for LEDs off. *\r\n");
xil_printf ("* Enter 2 for LEDs on. *\r\n");
xil_printf ("* Enter 3 for Log scale. *\r\n");
xil_printf ("* Enter 4 for Linear scale. *\r\n");
xil_printf ("* Enter 5 for Constant value. *\r\n");
xil_printf ("* Enter 6 to exit program. *\r\n");
xil_printf ("*********************************************\r\r\n");

/* Read the keyboard, print the entry. */
keyboard = XUartLite_RecvByte(XPAR_RS232_UART_1_BASEADDR);
xil_printf ("%c \r\r\n", keyboard);

/* Perform requested action. */
switch ( keyboard ) {

case '0': { /* Print the status as read from the circuit */
addr_ptr = XPAR_PWM_LIGHTS_0_BASEADDR;
status = *addr_ptr;
reg_value = (status & 0x0000ff00) >> 8;
all_off_value = (status & 0x00000008) >> 3;
run_value = (status & 0x00000004) >> 2;
linear_value = (status & 0x00000003);
xil_printf ("Raw status read = %x \r\n", status);
xil_printf ("Register value = %d \r\n", reg_value);
xil_printf ("All_off value = %d \r\n", all_off_value);
xil_printf ("Run value = %d \r\n", run_value);
xil_printf ("Linear value = %d \r\r\n", linear_value); }
break;

case '1': { /* Turn off LEDs */
addr_ptr = XPAR_PWM_LIGHTS_0_BASEADDR;
*addr_ptr = 0x00000000; }
break;

case '2': { /* Turn on LEDs */
addr_ptr = XPAR_PWM_LIGHTS_0_BASEADDR + 4;
*addr_ptr = 0x00000000; }
break;

case '3': { /* Use log drive for LEDs */
addr_ptr = XPAR_PWM_LIGHTS_0_BASEADDR + 8;
*addr_ptr = 0x00000000; }
break;

case '4': { /* Use linear drive for LEDs */
addr_ptr = XPAR_PWM_LIGHTS_0_BASEADDR + 12;
*addr_ptr = 0x00000000; }
break;

case '5': { /* Drive LEDs with register value */
addr_ptr = XPAR_PWM_LIGHTS_0_BASEADDR + 16;
xil_printf ("* Enter LED intensity value (0 to 255) and CR:
*\r\n");
scanf ("%d", &LED_value);
if (LED_value > 255) LED_value = 255;
xil_printf ("%d \r\r\n", LED_value);
*addr_ptr = LED_value << 24; }
break;

case '6': /* Exit program */
xil_printf ("That was exciting, wasn't it? \r\r\n");
exit(0);
break;
default: {
addr_ptr = XPAR_PWM_LIGHTS_0_BASEADDR;
*addr_ptr = 0x00000000; }
break;
}
}
}

The error is:

Building file: ../led.c
Invoking: MicroBlaze gcc compiler
mb-gcc -Wall -O0 -g3 -c -fmessage-length=0
-I../../empty_application_bsp_0/microblaze_0/include -mxl-pattern-compare
-mcpu=v7.30.a -mno-xl-soft-mul -MMD -MP -MF"led.d" -MT"led.d" -o"led.o"
"../led.c"
../led.c: In function ‘main’:
../led.c:40: warning: implicit declaration of function
‘XUartLite_RecvByte’
../led.c:47: warning: assignment makes pointer from integer without a cast
../led.c:61: warning: assignment makes pointer from integer without a cast
../led.c:66: warning: assignment makes pointer from integer without a cast
../led.c:71: warning: assignment makes pointer from integer without a cast
../led.c:76: warning: assignment makes pointer from integer without a cast
../led.c:81: warning: assignment makes pointer from integer without a cast
../led.c:94: warning: assignment makes pointer from integer without a cast
../led.c:13: warning: unused variable ‘offset’
Finished building: ../led.c

Building target: LEDs.elf
Invoking: MicroBlaze gcc linker
mb-gcc
-L"C:\Xilinx\12.1\ISE_DS\EDK\gnu\microblaze\nt\microblaze-xilinx-elf\include"
-Wl,-T -Wl,../src/lscript.ld
-L../../empty_application_bsp_0/microblaze_0/lib -mxl-pattern-compare
-mcpu=v7.30.a -mno-xl-soft-mul -o"LEDs.elf" ./led.o -lstdio.h
/cygdrive/c/Xilinx/12.1/ISE_DS/EDK/gnu/microblaze/nt/bin/../lib/gcc/microblaze-xilinx-elf/4.1.2/../../../../microblaze-xilinx-elf/bin/ld:
cannot find -lstdio.h
collect2: ld returned 1 exit status
make: *** [LEDs.elf] Error 1


Any help would be appreciated.

Thank you very much in advance.

---------------------------------------
Posted through http://www.FPGARelated.com
 
My makefile is the following:

################################################################################
# Automatically-generated file. Do not edit!
################################################################################

-include ../makefile.init

RM := rm -rf

# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include objects.mk

ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C_DEPS)),)
-include $(C_DEPS)
endif
ifneq ($(strip $(S_UPPER_DEPS)),)
-include $(S_UPPER_DEPS)
endif
endif

-include ../makefile.defs

# Add inputs and outputs from these tool invocations to the build variables

ELFSIZE += \
LEDs.elf.size \

ELFCHECK += \
LEDs.elf.elfcheck \


# All Target
all: LEDs.elf secondary-outputs

# Tool invocations
LEDs.elf: $(OBJS) $(USER_OBJS)
@echo 'Building target: $@'
@echo 'Invoking: MicroBlaze gcc linker'
mb-gcc
-L"C:\Xilinx\12.1\ISE_DS\EDK\gnu\microblaze\nt\microblaze-xilinx-elf\include"
-Wl,-T -Wl,../src/lscript.ld
-L../../empty_application_bsp_0/microblaze_0/lib -mxl-pattern-compare
-mcpu=v7.30.a -mno-xl-soft-mul -o"LEDs.elf" $(OBJS) $(USER_OBJS) $(LIBS)
@echo 'Finished building target: $@'
@echo ' '

LEDs.elf.size: LEDs.elf
@echo 'Invoking: MicroBlaze Print Size'
mb-size LEDs.elf |tee "LEDs.elf.size"
@echo 'Finished building: $@'
@echo ' '

LEDs.elf.elfcheck: LEDs.elf
@echo 'Invoking: Xilinx ELF Check'
elfcheck LEDs.elf -hw ../../ledd/system.xml -pe microblaze_0 |tee
"LEDs.elf.elfcheck"
@echo 'Finished building: $@'
@echo ' '

# Other Targets
clean:
-$(RM) $(OBJS)$(C_DEPS)$(EXECUTABLES)$(ELFSIZE)$(ELFCHECK)$(S_UPPER_DEPS)
LEDs.elf
-@echo ' '

secondary-outputs: $(ELFSIZE) $(ELFCHECK)

..PHONY: all clean dependents
..SECONDARY:

-include ../makefile.targets



There is not anything like -lstdio.h

Is there any way of searching a word inside the whole project in order to
locate the error?

---------------------------------------
Posted through http://www.FPGARelated.com
 
On Aug 17, 12:33 pm, "Rice"
<albertopv@n_o_s_p_a_m.n_o_s_p_a_m.hotmail.com> wrote:
Hello, I have been trying to implement the SDK example
(http://www.xilinx.com/support/documentation/sw_manuals/xilinx11/edk_c...)
into my Avnet Virtex 5 FXT Eval Kit... but the program gives an error...

/*************************************************************
* This program drives the LEDs using the custom circuit.     *
*************************************************************/

#include "xparameters.h"
#include "mb_interface.h"
#include "stdio.h"
#include "xutil.h"
#include "stdlib.h"

int main() {

  int offset = 0;
  int *addr_ptr;
  char keyboard;
  int LED_value = 0;
  int status;
  int reg_value;
  int all_off_value;
  int run_value;
  int linear_value;

  while(1) {

/*  Print initialization message, and prompt for user input. */
  xil_printf ("*********************************************\r\n");
  xil_printf ("* --> Hyperterm window must be selected <-- *\r\n");
  xil_printf ("*                                           *\r\n");
  xil_printf ("* Enter value and Carriage Return           *\r\n");    
  xil_printf ("* Enter 0 to read status                    *\r\n");
  xil_printf ("* Enter 1 for LEDs off.                     *\r\n");
  xil_printf ("* Enter 2 for LEDs on.                      *\r\n");
  xil_printf ("* Enter 3 for Log scale.                    *\r\n");
  xil_printf ("* Enter 4 for Linear scale.                 *\r\n");
  xil_printf ("* Enter 5 for Constant value.               *\r\n");
  xil_printf ("* Enter 6 to exit program.                  *\r\n");
  xil_printf ("*********************************************\r\r\n");

/* Read the keyboard, print the entry.  */  
  keyboard = XUartLite_RecvByte(XPAR_RS232_UART_1_BASEADDR);  
  xil_printf ("%c \r\r\n", keyboard);

 /* Perform requested action. */
  switch ( keyboard ) {

        case '0': {    /* Print the status as read from the circuit */
          addr_ptr = XPAR_PWM_LIGHTS_0_BASEADDR;
          status = *addr_ptr;
          reg_value = (status & 0x0000ff00) >> 8;
          all_off_value = (status & 0x00000008) >> 3;
          run_value = (status & 0x00000004) >> 2;
          linear_value = (status & 0x00000003);      
          xil_printf ("Raw status read = %x \r\n", status);
          xil_printf ("Register value  = %d \r\n", reg_value);        
          xil_printf ("All_off value   = %d \r\n", all_off_value);    
          xil_printf ("Run value       = %d \r\n", run_value);        
          xil_printf ("Linear value    = %d \r\r\n", linear_value); }            
          break;

        case '1': {    /* Turn off LEDs */
          addr_ptr = XPAR_PWM_LIGHTS_0_BASEADDR;
          *addr_ptr = 0x00000000; }
          break;

        case '2': {   /* Turn on LEDs */
          addr_ptr = XPAR_PWM_LIGHTS_0_BASEADDR + 4;
          *addr_ptr = 0x00000000; }
          break;

        case '3': {   /* Use log drive for LEDs */
          addr_ptr = XPAR_PWM_LIGHTS_0_BASEADDR + 8;
          *addr_ptr = 0x00000000; }
          break;

        case '4': {   /* Use linear drive for LEDs */
          addr_ptr = XPAR_PWM_LIGHTS_0_BASEADDR + 12;
          *addr_ptr = 0x00000000; }
          break;

        case '5': {   /* Drive LEDs with register value */
          addr_ptr = XPAR_PWM_LIGHTS_0_BASEADDR + 16;
          xil_printf ("* Enter LED intensity value (0 to 255) and CR:    
*\r\n");
          scanf ("%d", &LED_value);
          if (LED_value > 255) LED_value = 255;
          xil_printf ("%d \r\r\n", LED_value);
          *addr_ptr = LED_value << 24; }
          break;

        case '6':   /* Exit program */
          xil_printf ("That was exciting, wasn't it? \r\r\n");
          exit(0);
          break;
        default: {
          addr_ptr = XPAR_PWM_LIGHTS_0_BASEADDR;
          *addr_ptr = 0x00000000; }      
          break;
    }  
  }

}

The error is:

Building file: ../led.c
Invoking: MicroBlaze gcc compiler
mb-gcc -Wall -O0 -g3 -c -fmessage-length=0
-I../../empty_application_bsp_0/microblaze_0/include -mxl-pattern-compare
-mcpu=v7.30.a -mno-xl-soft-mul -MMD -MP -MF"led.d" -MT"led.d" -o"led.o"
"../led.c"
./led.c: In function ‘main’:
./led.c:40: warning: implicit declaration of function
‘XUartLite_RecvByte’
./led.c:47: warning: assignment makes pointer from integer without a cast
./led.c:61: warning: assignment makes pointer from integer without a cast
./led.c:66: warning: assignment makes pointer from integer without a cast
./led.c:71: warning: assignment makes pointer from integer without a cast
./led.c:76: warning: assignment makes pointer from integer without a cast
./led.c:81: warning: assignment makes pointer from integer without a cast
./led.c:94: warning: assignment makes pointer from integer without a cast
./led.c:13: warning: unused variable ‘offset’
Finished building: ../led.c

Building target: LEDs.elf
Invoking: MicroBlaze gcc linker
mb-gcc
-L"C:\Xilinx\12.1\ISE_DS\EDK\gnu\microblaze\nt\microblaze-xilinx-elf\include"
-Wl,-T -Wl,../src/lscript.ld
-L../../empty_application_bsp_0/microblaze_0/lib -mxl-pattern-compare
-mcpu=v7.30.a -mno-xl-soft-mul -o"LEDs.elf"  ./led.o   -lstdio.h
/cygdrive/c/Xilinx/12.1/ISE_DS/EDK/gnu/microblaze/nt/bin/../lib/gcc/microblaze-xilinx-elf/4.1.2/../../../../microblaze-xilinx-elf/bin/ld:
cannot find -lstdio.h
collect2: ld returned 1 exit status
make: *** [LEDs.elf] Error 1

Any help would be appreciated.

Thank you very much in advance.    

---------------------------------------        
Posted throughhttp://www.FPGARelated.com
"cannot find -lstdio.h"

Looks like a syntax error in your make file. Maybe there should
be a space like -l stdio.h?
 
On Aug 17, 6:12 pm, "Rice"
<albertopv@n_o_s_p_a_m.n_o_s_p_a_m.hotmail.com> wrote:
My makefile is the following:

################################################################################
# Automatically-generated file. Do not edit!
################################################################################

-include ../makefile.init

RM := rm -rf

# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include objects.mk

ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C_DEPS)),)
-include $(C_DEPS)
endif
ifneq ($(strip $(S_UPPER_DEPS)),)
-include $(S_UPPER_DEPS)
endif
endif

-include ../makefile.defs

# Add inputs and outputs from these tool invocations to the build variables

ELFSIZE += \
LEDs.elf.size \

ELFCHECK += \
LEDs.elf.elfcheck \

# All Target
all: LEDs.elf secondary-outputs

# Tool invocations
LEDs.elf: $(OBJS) $(USER_OBJS)
        @echo 'Building target: $@'
        @echo 'Invoking: MicroBlaze gcc linker'
        mb-gcc
-L"C:\Xilinx\12.1\ISE_DS\EDK\gnu\microblaze\nt\microblaze-xilinx-elf\include"
-Wl,-T -Wl,../src/lscript.ld
-L../../empty_application_bsp_0/microblaze_0/lib -mxl-pattern-compare
-mcpu=v7.30.a -mno-xl-soft-mul -o"LEDs.elf" $(OBJS) $(USER_OBJS) $(LIBS)
        @echo 'Finished building target: $@'
        @echo ' '

LEDs.elf.size: LEDs.elf
        @echo 'Invoking: MicroBlaze Print Size'
        mb-size LEDs.elf  |tee "LEDs.elf.size"
        @echo 'Finished building: $@'
        @echo ' '

LEDs.elf.elfcheck: LEDs.elf
        @echo 'Invoking: Xilinx ELF Check'
        elfcheck LEDs.elf -hw ../../ledd/system.xml -pe microblaze_0  |tee
"LEDs.elf.elfcheck"
        @echo 'Finished building: $@'
        @echo ' '

# Other Targets
clean:
        -$(RM) $(OBJS)$(C_DEPS)$(EXECUTABLES)$(ELFSIZE)$(ELFCHECK)$(S_UPPER_DEPS)
LEDs.elf
        -@echo ' '

secondary-outputs: $(ELFSIZE) $(ELFCHECK)

.PHONY: all clean dependents
.SECONDARY:

-include ../makefile.targets

There is not anything like -lstdio.h

Is there any way of searching a word inside the whole project in order to
locate the error?          

---------------------------------------        
Posted throughhttp://www.FPGARelated.com
If the problem isn't in the make file, then it's possible the
error message is just messed up and the real issue is that it
can't find stdio.h

Near the top of the code in your original post you have:

#include "stdio.h"

This implies the header file should be located in the project
directory.
Normally system libraries are included as:

#include <stdio.h>

which indicates the header file is in the system libraries directory.

Are there any other projects you could look at to see if this might
be the normal way to include stdio.h?

Regards,
Gabor
 
"Rice" <albertopv@n_o_s_p_a_m.n_o_s_p_a_m.hotmail.com> writes:

There is not anything like -lstdio.h
Maybe it's in the included makefile.init then? Or somewhere in the
project settings?

Is there any way of searching a word inside the whole project in order to
locate the error?
Surely that's normal computer usage?
 
On Tue, 17 Aug 2010 17:12:08 -0500, "Rice"
<albertopv@n_o_s_p_a_m.n_o_s_p_a_m.hotmail.com> wrote:

My makefile is the following:


# Tool invocations
LEDs.elf: $(OBJS) $(USER_OBJS)
@echo 'Building target: $@'
@echo 'Invoking: MicroBlaze gcc linker'
mb-gcc
-L"C:\Xilinx\12.1\ISE_DS\EDK\gnu\microblaze\nt\microblaze-xilinx-elf\include"
-Wl,-T -Wl,../src/lscript.ld

There is not anything like -lstdio.h
Look for an error in that "script.ld" which sounds like a linker script.
Any mention of "stdio" there is suspicious

Possibly rename/remove it and use the "generate linker script" tool to make a
new one.


- Brian
 
One workmate of mine has given me a small clue of how the problem can be
solved.

The failing line is at the makefile. The following:

mb-gcc
-L"C:\Xilinx\12.1\ISE_DS\EDK\gnu\microblaze\nt\microblaze-xilinx-elf\include"
-Wl,-T -Wl,../src/lscqagipt.ld
-L../../empty_application_bsp_0/microblaze_0/lib -mxl-pattern-compare
-mcpu=v7.30.a -mno-xl-soft-mul -o"LEDs.elf" $(OBJS) $(USER_OBJS) $(LIBS)


Here the error is:

/cygdrive/c/Xilinx/12.1/ISE_DS/EDK/gnu/microblaze/nt/bin/../lib/gcc/microblaze-xilinx-elf/4.1.2/../../../../microblaze-xilinx-elf/bin/ld:
cannot find -lstdio.h

which mainly tells that it can not find libstdio.a in the library folder.

I have introduced in windows' environment variables the following path:

C:\Xilinx\12.1\ISE_DS\EDK\gnu\microblaze\nt\microblaze-xilinx-elf\include

but the error remains the same. In that folder there is no libstdio.a as
well as in the rest of the EDK folders...

really i do not know what to do at this point

---------------------------------------
Posted through http://www.FPGARelated.com
 

Welcome to EDABoard.com

Sponsor

Back
Top