3 Replies Latest reply on Jan 21, 2013 6:49 PM by grant

    sscanf produces unhosted IO warnings

    grant

      Hi,

       

      I am using codesourcery ARM EABI toolchain to build code for a energy micro cortex M3 (EFM32GG290F1024)

       

      I can build and run code fine however calling sscanf seems to give me 4 warnings:

      "libcs3unhosted.a(unhosted-_close.o): warning: IO function '_close' used"
      and similar warnings for '_lseek', '_read' and '_write'

       

      I am looking to try to understand and remove these warnings

       

      Any help would be much appreciated

       

      Thanks,

       

      Grant

        • 1. Re: sscanf produces unhosted IO warnings
          Anil

          Hi Grant,

           

          Our apologies for the delay in the response. I wanted to let you know that our engineering team is looking at your question and we should have a response for your shortly.


          Since you did not mention the edition you are using, I wanted to remind you that if you are using the Professional or the Standard edition of Sourcery CodeBench and if under a current support contract, you may also file your issue on the Sourcery Support portal.

           

          Regards

           

          Anil

          • 2. Re: sscanf produces unhosted IO warnings
            ricardo_anguiano

            Hello Grant,

             

            Take a look at the Getting Started document, in the chapter titled CS3: The CodeSourcery Common

            Startup Code Sequence, in the section titled Hosting and Semihosting.  Here's the relevant paragraph:

             

            The hosted CS3 linker scripts provide the semihosting support, and as such programs linked with

            them may only be run with the debugger. For production code, or programs where memory usage

            is tightly constrained, use the unhosted CS3 linker scripts instead. These scripts provide stub versions

            of the system calls, which return an appropriate error value in errno. If such a stub system call is

            required in the executable, the linker also produces a warning. Such a warning may indicate that you

            have left debugging code active, or that your program contains unused code.

             

            Try removing calls to the functions mentioned in the warnings.  If you aren't making any calls directly, you

            may be including libraries that make those calls.

             

            Let us know if you continue to encounter this problem.

             

            Thanks,

            Ricardo

            1 of 1 people found this helpful
            • 3. Re: sscanf produces unhosted IO warnings
              grant

              Hi Ricardo,

               

              Thanks for the response, that helps me to understand the issue.

              However I am surprised sscanf produces it, even in an example as simple as below:

               

              This code gives me the warnings:

              #include <stdio.h>

              int main(void)

              {

                  sscanf(".", ".");

              }

               

              this code does not give me the warnings:

              #include <stdio.h>

              int main(void)

              {

                  char string[2];

                  sprintf(string, ".");

              }

               

               

              My code seems to work fine so none of these stub functions must be called/required runtime

              I do not intend on removing sscanf calls from my code. Is there maybe a flag to remove these warnings now I understand them?

               

              Thanks,

               

               

              Grant