This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Printf() size, questions?

How many bytes will printf() take up in a non debug-monitor
environment?

Also, is it easy to set up printf() to map to a second UART?
I will need control of the UART ISR so that I can handle receives
appropriately. How will this confict with printf()?

Parents
  • Again, I'm using the uVision2 eval simulator. When I try to see code size
    it doesn't appear to include the size of printf(). In fact it just tells
    me the starting location of my functions but not the sizes. Is there
    a way to list the code and data sizes of objects? Also, even at the
    end of the .m51 file, the total code size does not seem to include the
    size of the printf() function. Is this because of the simulator?

Reply
  • Again, I'm using the uVision2 eval simulator. When I try to see code size
    it doesn't appear to include the size of printf(). In fact it just tells
    me the starting location of my functions but not the sizes. Is there
    a way to list the code and data sizes of objects? Also, even at the
    end of the .m51 file, the total code size does not seem to include the
    size of the printf() function. Is this because of the simulator?

Children
  • I just compiled and linked the HELLO example project. The following excerpt from the MAP file (*.m51) lists the starting location and sizes of the modules inthe program.

    LINK MAP OF MODULE:  Hello (HELLO)
    
    
                TYPE    BASE      LENGTH    RELOCATION   SEGMENT NAME
                -----------------------------------------------------
    
                * * * * * * *   D A T A   M E M O R Y   * * * * * * *
                REG     0000H     0008H     ABSOLUTE     "REG BANK 0"
                DATA    0008H     0014H     UNIT         _DATA_GROUP_
                        001CH     0004H                  *** GAP ***
                BIT     0020H.0   0001H.1   UNIT         _BIT_GROUP_
                        0021H.1   0000H.7                *** GAP ***
                IDATA   0022H     0001H     UNIT         ?STACK
    
                * * * * * * *   C O D E   M E M O R Y   * * * * * * *
                CODE    0000H     0003H     ABSOLUTE     
                CODE    0003H     035CH     UNIT         ?PR?PRINTF?PRINTF
                CODE    035FH     008EH     UNIT         ?C?LIB_CODE
                CODE    03EDH     0027H     UNIT         ?PR?PUTCHAR?PUTCHAR
                CODE    0414H     001BH     UNIT         ?PR?MAIN?HELLO
                CODE    042FH     000DH     UNIT         ?CO?HELLO
                CODE    043CH     000CH     UNIT         ?C_C51STARTUP
    

    Note that the size of the printf module is 35Ch bytes.

    Keil Support

  • Again, I'm using the uVision2 eval simulator. When I try to see code size
    it doesn't appear to include the size of printf(). In fact it just tells
    me the starting location of my functions but not the sizes. Is there
    a way to list the code and data sizes of objects? Also, even at the
    end of the .m51 file, the total code size does not seem to include the
    size of the printf() function. Is this because of the simulator?


    Just look in the .m51 file for a simple foo.c file compiled and linked, don't use your big project for this. Build the file without using printf, check the total size. Then add one call to printf, check the size again. The simulator has nothing to do with the linker output file (.m51).

    - Mark

  • CODE    0003H     035CH     UNIT         ?PR?PRINTF?PRINTF
    Doh! I forgot about the itemized list entries. This is the answer he needs. Of course he should turn on all the fancy output using linker control directives.

    - Mark