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.
Part Number: MSP432P401R
Tool/software: Code Composer Studio
Hi,
similarly to the TI compiler, gcc will optimize unused functions and variables out. Therefore, the attribute used should be added to the array of interrupt handlers (in the file startup_msp432p401r_gcc.c), which will prevent gcc from removing the interrupt handlers.
Please add this to the default templates, as this might cause very weird problems for users.
Cheers,
Dan
Dan,
Which version of the tools are you using? The reason is that I created a simple project using all the defaults in my CCSv7 and I can see the .intvecs was fully allocated when the optimizer is fully on. Also, I compared the startup file of my project with one of the GCC examples of the Simplelink MSP432 SDK (msp432p401_adc14_21) and their differences are only on the entry point - the project template calls GCC's _mainCRTStartup() and the project initializes .bss manually and calls main() directly.
I ported the example project to my template-based project and it worked fine as well. Please check attached the project I used.
Regards,
Rafael
Hey Dan,
Just to make sure that I understand you correctly, you're using GCC compiler without CCS and seeing that the .intvecs section is empty but the handlers are linked (I assume in .text). The following line will result with the requested change:
void (* const interruptVectors[])(void) __attribute__ ((section (".intvecs"))) __attribute__((used))= { ... }
I cannot recreate the issue in CCS with ARM GCC 4.9.3, the __attribute__((used)) makes no difference. The map file shows that the .intvecs section is 0xe4 long.
Maybe the CCS GCC linker does it a bit differently. Could you please tell me what linker options you using so I recreate it with the standalone GCC support package?
Thanks,
Bob Heilmaier
Hi Bob,
yes, I am using standalone GCC. I just figured out what the issue was, I put the Interrupt Vectors in a cpp files and put it in an extern "C" {}. Then the .intvecs section is empty in the map file (the handlers are still present). When I put everything in the C file, the intvecs section is there (does not matter whether used is specified or not).
Don't know why this happens, maybe it is a bug the optimizer of gcc.
Cheers,
Dan