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/TM4C123GH6PM: WEAK function declarations defaulting to an other function

Part Number: TM4C123GH6PM


Tool/software: TI C/C++ Compiler

I have an question about the WEAK pragma of the TI/ARM compiler(i use version 16.9.x).

The code snippet below is from an project where i used GCC as the compiler for an Cortex M3 MCU(non TI mcu).
It is from the startup file of that project, and declares for each interrupt vector an weak function prototype
and defaults to the Default_Handler using the pragma.
#define WEAK __attribute__ ((weak))
void WEAK  TIMER0_IRQHandler(void);


__attribute__ ((used,section(".isr_vector"))) void (* const g_pfnVectors[])(void) = {
 TIMER0_IRQHandler, /*!< 1: Timer0 */
}

#pragma weak TIMER0_IRQHandler = Default_Handler



In the TI ARM compiler manual i couldn't find any thing about how to let an
weak function prototype default to an other function.

Is there a way to do this in the TI compiler?

Thanks
  • Jesse de Waard said:
    Is there a way to do this in the TI compiler?

    Unfortunately, no.  The TI compiler supports #pragma WEAK.  It is the same thing as the weak function attribute.  The GCC #pragma weak supplies an additional feature called a weak alias, which you use here ...

    Jesse de Waard said:
    #pragma weak TIMER0_IRQHandler = Default_Handler

    The TI compiler does not support that feature.

    Thanks and regards,

    -George