This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Is 2KB flash + mspgcc + printf hopeless?

Hi All,

 

Does anyone know of a combination of compile options that will allow a printf("%d", x); to work with a 2231 (2KB flash) using mspgcc?  I know pritnf is a bit of a pig but I know that at least on some other compilers there are smaller printf variants available via certain flags.  But I can't find anything similar for mspgcc.

 

Thanks,

  • I think printf and all that's needed for it will fit into 2k flash, but then there's not much space left for any application :)
    Other compilers allow to deactivate much of its functionality, so printf is not much more than puts. But IMHO it's of no more use than puts too.

    You can still create your own printf variant (different name, of course) which just implements %s and %c support, or only integer but not FP values etc. Yet there are no predefined ones.

    See it as an exercise how to get along without printf :)

  • Thanks, I was hoping there was a lite prtinf built in to mspgcc, since there is a few different versions on the avr-gcc port.  Interestingly enough it is smart enough to at least not blow up the code when doing a printf("Constant String"); but as soon as any arguments are added 2k+ boom.

     

    I'm personally going to see it more as an exercise in patience waiting for the 8KB flash parts to ship.  :^)

  • Paul Haddad said:
      ...waiting for the 8KB flash parts to ship.  :^)

    I am waiting for PCs with256-bit xTB SRAM and yTHz CPU. There is never enough memory or CPU cycles. (What is the letter that represent 1000*T?)

     

  • >> What is the letter that represent 1000*T?)

    P for Peta.  http://en.wikipedia.org/wiki/SI_prefix#List_of_SI_prefixes

    I don't think there has been as much library development for MSP430 as there has for AVR.  You can always see if the avrlibc version of printf will compile for msp430; they're both gcc based with 16-bit ints, right?  They ought to be pretty close.

     

**Attention** This is a public forum