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.

Compiler/ARM-CGT: Required pragmas for _c_int00

Part Number: ARM-CGT
Other Parts Discussed in Thread: HALCOGEN

Tool/software: TI C/C++ Compiler

The default _c_int00 is weak and we make use of that feature as we have our own startup sequence.

We implemented our own _c_int00 (therefore not weak) and this works fine. Today doing some code review I realized that the weak _c_int00 generated by HALCoGen is created like this

#pragma CODE_STATE(_c_int00, 32)
#pragma INTERRUPT(_c_int00, RESET)
#pragma WEAK(_c_int00)
void _c_int00(void) {
 /* some code */
}

In our implementation we just do

void _c_int00(void) {
/* our Code */
}
  • We are compiling with --code_state=32 so I guess omitting #pragma CODE_STATE(_c_int00, 32) is not a (real) Problem.
  • Of course we omit weak, as we want to overwrite it
  • We did not use #pragma INTERRUPT(_c_int00, RESET). We did not have any undesired behavior sofar, but is omitting #pragma INTERRUPT(_c_int00, RESET) even allowed/recommended? Does the compiler know somehow that _c_int00 needs RESET Interrupt and thats why it works at all?

It would be nice, to get some insight in that.

Thanks and best regards

  • user6135372 said:
    We are compiling with --code_state=32 so I guess omitting #pragma CODE_STATE(_c_int00, 32) is not a (real) Problem.

    That's correct.  But there is a case to be made for using the pragma anyway.  What if, by some mistake, the code is compiled with --code_state=16?  And it is good for a function to be self-documenting about its presumptions.

    user6135372 said:
    is omitting #pragma INTERRUPT(_c_int00, RESET) even allowed/recommended?

    A function that is compiled with this pragma has no return instruction at all.  I doubt this means much to your reset function.  But, if it does, now you know how to avoid that return instruction.

    Thanks and regards,

    -George