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.

Using INT_TIMER0A without a P/N defined (INT_RESOLVE declared implicitly)

I need to use IntEnable(INT_TIMER6A); inside a generic library which should work for either TM4C123 or 129.

Well, INT_TIMER6A expands to INT_CONCAT(INT_TIMER6A_, INT_DEVICE_CLASS) and, if there is no p/n defined in the library (as is the case), further goes to:

#define INT_DEVICE_CLASS        "UNKNOWN"

Causing the error

function INT_RESOLVE declared implicitly

Is there a (simple) solution for that?

For further reference, this thread asked something on the same theme, but there is just a generic explanation there, yet not the solution.

e2e.ti.com/.../424662

Regards

Bruno

  • Bruno Saraiva said:
    I need to use IntEnable(INT_TIMER6A); inside a generic library which should work for either TM4C123 or 129.

    Well, INT_TIMER6A expands to INT_CONCAT(INT_TIMER6A_, INT_DEVICE_CLASS) and, if there is no p/n defined in the library (as is the case), further goes to

    The CLASS_IS_TM4C129 macro allows a run-time test of if the code is running on a TM4C129 class processor. Therefore, I was going to suggest writing the library function to test which class the code is running on, and then select the TM4C123 or TM4C129 class specific interrupt vector numbers.

    However, in writing the following code then realised that the TM4C123 class doesn't contain TIMER6A.

    For reference here is a code fragment which was compiled in a library for which no part number macro was defined during the compilation:

    #include <stdint.h>
    #include <stdbool.h>
    
    #include <inc/hw_ints.h>
    #include <inc/hw_types.h>
    #include <inc/hw_sysctl.h>
    #include <driverlib/interrupt.h>
    
    void enable_timer_interrupt (void)
    {
        if (CLASS_IS_TM4C129)
        {
            IntEnable(INT_TIMER6A_TM4C129);
        }
        else
        {
            /* The TM4C123 class doesn't have TIMER6A so can't enable the interrupt
            IntEnable(INT_TIMER6A_TM4C123);
            */
        }
    }

  • Rather than use a if statement for every interrupt vector in the library a more maintainable solution might be to use a macro such as RUN_TIME_RESOLVE_INT:

    #include <stdint.h>
    #include <stdbool.h>
    
    #include <inc/hw_ints.h>
    #include <inc/hw_types.h>
    #include <inc/hw_sysctl.h>
    #include <driverlib/interrupt.h>
    
    /*
     * At runtime resolve the TMC4C123 or TM4C129 class specific interrupt vector.
     * This will result in a compile error if intname doesn't exist on both TMC4C123 or TM4C129 class processors.
     */
    #define RUN_TIME_RESOLVE_INT(intname) (CLASS_IS_TM4C129 ? intname##_TM4C129 : intname##_TM4C123)
    
    void enable_timer_interrupt (void)
    {
        IntEnable(RUN_TIME_RESOLVE_INT (INT_TIMER5A));
    }
    

  • Thanks Chester.
    For now I'll keep this solution (although it did post another more "elegant" right after your first reply.
    In case other readers search for this, might it be repeated that it is indeed a fact that 32-bit timers on TM4C123 devices go only up to 5A/5B.
    Bruno
  • Bruno Saraiva said:
    ... it is indeed a fact that 32-bit timers on TM4C123 devices go only up to 5A/5B.

    "Go only" - (unless friend Bruno is "joking") many newer, (in my book vastly superior ARM MCUs [from others]) - would give their "eye-teeth" to reach beyond 2 such 32-bit timers.

    This vendor has done an excellent job in terms of Timer Capability - and number - in this humble reporter's book...     (and this reporter will (now) shut-up, "go only" away...)

  • In that case, let us NOT forget that, past the "only" 6X 32-bit timers (0 to 5), there are another 6X 64-bit timers on the 123 family...
  • Indeed,there are enough timers on this micro to metaphorically choke the proverbial horse.

    Robert
  • Robert Adsett72 said:
    enough timers on this micro to metaphorically choke the proverbial horse.

    Yet - (remaining w/in today's "current event/keyword/vendor avoided theme") -  might that "choking" (even metaphorically) have prevented even ONE Horse (likely deemed proverbial) from the successive capture of the famed, "Triple Crown!"      

    It should be noted that each horse carries an MCU based RF device - which sends highly accurate "track positional data" - to the GIANT, Churchill Downs scoreboard.    (this so the track's "infield masses" can view the race!      Without that scoreboard - infield ticket-holders - "see at best" only a "tiny sliver" of the terrific race & track...)