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.

Interrupt handlers outside of main.c



Is it possible to define an interrupt handler outside of your main file?

For instance I set up a uart0IntHandler in startup_ccs.c

Is there a way I can define that function in a different file, i.e. myuart.c that is included in my main file?

When I simply moved the function from main.c to myuart.c the linker could no longer find it. If I want to have this functionality should I just create the uart0IntHandler in main.c and have it hand off to a myuart0IntHandler?

  • Hello Jamie,

    Moving the interrupt handler into another file is not a problem as long as the other file is also included in the project compile. If you can send in your CCS (I assume you are using CCS IDE) we can check why linker is not working.

    Regards

    Amit

  • turns out it was a simple mistake.

    After you convinced me it was possible I took another look at it.

    Having multiple declarations is a very foreign concept to me. I had the handler declared in startup_ccs.c and defined in myuart.c but not declared in myuart.h

    Once I added the declaration to myuart.h it seems to be working.

    Thanks