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.

MSP430 CSTART in Code composer



Engineer at UTC Fire and Safetly was wondering how he can find the equivalent of cstart for the MSP430 in code-composer?

He is trying to assert an IO pin very early on in the boot process (actually right after reset, and before the stack and data are initialized and main is called).

On previous compilers, he mentioned he would edit cstart.asm (aka crt0.asm), and write some simple assembler to assert a pin.

Could you point me to the file he could edit to achieve the same goal with CCS?

Shawn

  • In IAR: int __LOW_LEVEL_INIT(void)
    In CCS compiler: int _system_pre_init(void)
     
    If the function returns 0, the data segments will not be initialized.

    But does he want a asm version for doing this?

  • Some of the newer MSP430s have a Boot ROM. After BOR, the Boot Code in that ROM will be executed first. There is nothing you can prevent this from happening.
  • The __low_level_init/_system_pre_init functions are called after the stack has been initialized.

    I don't know the names of the start-up module in IAR/CCS, but in gcc with newlib, that would be libgloss/msp430/crt0.S. Please note that this file allows code fragments to be inserted by putting them into specially named sections:

    static void __attribute__((naked, section(".crt_0001"), used))
    my_extra_startup_code()
    {
        // ...
    }

    (Unfortunately, it is not possible to insert code before the crt_0000 section, so to get something executed before the stack initialization, you would need to modify the original assember file also for gcc.)

  • I think he is only looking to set pins before the heavy lifting of initializing variables, the initialize of the stack is only a 2 word instruction.

    __program_start:
     00C000    4031 0400          mov.w   #0x400,SP   // stack setup
    ?cstart_call_low_level_init:
     00C004    12B0 C0FA          call    #__low_level_init
     00C008    930C               tst.w   R12
     00C00A    2406               jeq     ?cstart_call_main  // skip var initiation if returned 0
    

**Attention** This is a public forum