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.

msp430f2618 : How can i reduce startup time ?



hello i have code size about 45K , and i m using CLIB.

I noticed that the main() starts running 14 ms after power up (very long time).

if i run a smaller code (1k) , the main() starts running less than 2ms after power up.

I must reduce the startup time in my project , how can i do that?

should i change the CLIB linker file?

thanks..

  • Gili Zafrani said:

    I noticed that the main() starts running 14 ms after power up (very long time).

    if i run a smaller code (1k) , the main() starts running less than 2ms after power up.

    The startup time to get to main() has nothing to do with how big the overall code package is.

    It has everything to do with how many words of initialized data you have, as well as how you are configuring the clock between the different applications.

  • Brian Boorman said:
    It has everything to do with how many words of initialized data you have

    So you shall consider using __no_init for data which does not need to be initialized by cstartup code - like buffers and so on

  • Brian Boorman said:

    ...

    The startup time to get to main() has nothing to do with how big the overall code package is.

    It has everything to do with how many words of initialized data you have, as well as how you are configuring the clock between the different applications.

    How does one configuring the clock between the different applications?

  • old_cow_yellow said:
    How does one configuring the clock between the different applications?

    What I meant is that (since we know nothing about what the OP's two different applications are/do) the code, at the (IAR specific terminology ahead) __low_level_init() function, which happens before __c_init() could be configuring the clock for different speed (maybe 1 MHz in the one that is slow, 16Mhz in the one that is fast), and that would affect startup time.

    So, the startup time is dependent on how you configure the clock and how much initialized data there is to process in __c_init()

  • where should I change the __low_level_init() funcrion  ? in what file ?

     

     

     

  • do you mean , that i should set __no_init  before global and static variables  to reduce time ?

  •  

    It has everything to do with how many words of initialized data you have,


    what do you mean "words" ?  the global \static variables, ?

  • Gili Zafrani said:
    where should I change the __low_level_init() funcrion  ? in what file ?

    If you use IAR toolchain, the function is called __low_level_init() (read the IAR user's guide). You can include this function in any source file you want in the project, though most make a new source and add it to the project or put in in main.c.

    If you use CCS toolchain, I think the function is called __system_init or something like that. Search the forum for examples.

    No matter which toolchain, the purpose of this function is to give you a place to do some system initialization prior to the C-runtime environment being setup. Things like turning off watchdog, setting up clocks, etc. The watchdog is important if you have a lot of initialized data so that it doesn't reset the processor before you get to main().

    Gili Zafrani said:
    do you mean , that i should set __no_init  before global and static variables  to reduce time ?

    That would help. As a general you need to make sure every variable is initialized before being used. You can do this at startup by defining a default variable when it is declared, or can do it later (before it is read). If you specify __no_init, then just remember that you are responsible for making sure that you don't read an uninitialized variable later on in your code.

    Gili Zafrani said:
    what do you mean "words" ?  the global \static variables, ?

    Yes. Word = 2 Bytes. The MSP430 is a 16-bit processor, so the standard unit of measure is a word.

  • Gili Zafrani said:
    what do you mean "words" ?  the global \static variables, ?


    One word is two bytes. It is the native data size of the MSP CPU. It can read or write a word with one instruction.

    The more initialized (or implicitly initialized) data/variables you have, the more clock cycles does the MSP need to copy over the init values (or set these variables to zero).

    Declare all constant data as CONST, so it stays in FLASH and doesn't have to be initialized (saves ram too) and put all global or static arrays/buffers that don't need initialization into the no_init section.

**Attention** This is a public forum