SDCC requires that all interrupts be prototyped in "main", at minimum by #including the prototype in a header file. Sure, this does work but it means I have to
(1) specify like so in my uart.h file:
void uartIsr(void) __interrupt (4) __using (0);
(2) repeat the above in my uart.c file where I additionally define the actual code:
That leaves two places in two different files where I must faithfully duplicate both the interrupt number and register set, which isn't all that sterile squeaky clean IMHO.
Has anyone found a way to prototype the function only once, and then define the code without having to repeat the interrupt number and register set spec?
Last edit: Stepan Novotny 2020-05-27
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
First of all I suggest to make sure you include uart.h in uart.c so the prototype is checked against the implementation and you get warned if it's not.
Second, this isn't any different from any other extern function with a prototype declaration in a header file.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
SDCC requires that all interrupts be prototyped in "main", at minimum by #including the prototype in a header file. Sure, this does work but it means I have to
(1) specify like so in my uart.h file:
(2) repeat the above in my uart.c file where I additionally define the actual code:
That leaves two places in two different files where I must faithfully duplicate both the interrupt number and register set, which isn't all that sterile squeaky clean IMHO.
Has anyone found a way to prototype the function only once, and then define the code without having to repeat the interrupt number and register set spec?
Last edit: Stepan Novotny 2020-05-27
I guess you could have the interrupt handler in "main", andhave it contain only a single function call, e.g.:
First of all I suggest to make sure you include uart.h in uart.c so the prototype is checked against the implementation and you get warned if it's not.
Second, this isn't any different from any other extern function with a prototype declaration in a header file.