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
Regular Contributor
sxl630828191
Posts: 53
Registered: ‎02-13-2012
0

Why My file cannot include stdio.h

Hey ,everyone

 

        I am puzzled with a problem.

 

        In the C project, I can include stdio.h. But files in the bsp cannot. For example , at the beginning of the file xemacliteif.c,

 

        there are two sentence : #include <stdio.h>
                                                     #include <string.h>

 

        But the SDK enviroment shows that Unresolved inclusion: <string.h>  And so does <stdio.h>  .

 

        Anybody can help me?

Expert Contributor
rcingham
Posts: 2,010
Registered: ‎09-09-2010
0

Re: Why My file cannot include stdio.h

Regarding stdio.h, this is the header for functions that access the 'standard input', 'standard output', and 'standard error' streams. Although these are mapped to physical resources by default for a standard computer (such as your PC), they are not for an FPGA. Therefore the header file, and the underlying functions, do not exist, and so cannot be referenced.

------------------------------------------
"If it don't work in simulation, it won't work on the board."
Regular Contributor
sxl630828191
Posts: 53
Registered: ‎02-13-2012
0

Re: Why My file cannot include stdio.h

Hey,

 

       Thanks for your reply.

 

       I am just planning to use xil_printf() to show whether the project did the function or not .

 

       For exmple, I added xil_printf("xemacliteif_init\r\n"); in the xemacliteif_init() function. And when debugging with the SDK ,

 

It really exacute this function , but never print anything at the uart terminal. And there are two sentences at the beginning of

 

the file containning the function xemacliteif_init()  :#include <stdio.h> #include <string.h>..

 

       How can i debug the project in this way?

Expert Contributor
rcingham
Posts: 2,010
Registered: ‎09-09-2010
0

Re: Why My file cannot include stdio.h

Try
#include "stdio.h"
instead and report back...

------------------------------------------
"If it don't work in simulation, it won't work on the board."
Regular Contributor
sxl630828191
Posts: 53
Registered: ‎02-13-2012
0

Re: Why My file cannot include stdio.h

Hey,

 

      I have changed <> to " " . But it doesn't work at all.

     

      The  file cannot include it .I clicked the stdio.h line on the outline window, it shows that.  Why can not it find the file?

stdio.jpg

Expert Contributor
rcingham
Posts: 2,010
Registered: ‎09-09-2010
0

Re: Why My file cannot include stdio.h

My limited expertise on this subject is now exhausted.

------------------------------------------
"If it don't work in simulation, it won't work on the board."
Trusted Contributor
jmdavid1789
Posts: 26
Registered: ‎02-27-2008
0

Re: Why My file cannot include stdio.h

<stdio.h> and <string.h> belong to the standard library (AKA libc.a).

Your BSP stores the library (see: C:\your_workspace\your_bsp\microblaze_0\lib\libc.a)
but your application refers to it by linking to the library (see: Your_application->C/C++ building settings->Microblaze gcc linker->Software Platform->Software Platform library path->../../your_bsp/microblaze_0/lib.

 

So either your BSP does not have the library or your application does not refer to it or it refers to it but the path is wrong.

Regular Contributor
sxl630828191
Posts: 53
Registered: ‎02-13-2012
0

Re: Why My file cannot include stdio.h

 

Thanks for your reply at all.

Regular Contributor
sxl630828191
Posts: 53
Registered: ‎02-13-2012
0

Re: Why My file cannot include stdio.h

Hey,

 

        I have to say you misunderstood my words.

 

        I have checked what you say on my project, they are all correct.

 

        In the C project, I can include the "stdio.h" normally. while in the bsp/microblaze/libsrc/...   , stdio.h cannot be included

 

into it . Just as the picture I attached above : the SDK can not find it. I just want to add some xil_printf() sentence for debug

 

        I am puzzled.

Regular Contributor
mmonforte
Posts: 57
Registered: ‎11-25-2009
0

Re: Why My file cannot include stdio.h

Hello,

 

I had the same identical problem (using SDK 14.1):

for me the solution was upgrading to 14.2.

 

Hope it helps,

Michele