Why remove set_vector()?
Description: Building up on the previous article, I will try to explore why set_vector() should be removed.
Tags: rtems, interrupts, gsoc
Reason 1: Warnings
Lets jump right into a warning thrown by the compiler while compiling the Board Support Package(BSP) for SPARC/ERC32:
`
../../../bsps/sparc/erc32/start/setvec.c: In function 'set_vector':
../../../bsps/sparc/erc32/start/setvec.c:51:43: warning: passing argument 2 of '_CPU_ISR_install_raw_handler' from incompatible pointer type [-Wincompatible-pointer-types]
51 | _CPU_ISR_install_raw_handler( vector, handler, (void *)&previous_isr );
| ^~~~~~~
| |
| rtems_isr_entry {aka void (*)(unsigned int)}
In file included from ../../../cpukit/include/rtems/config.h:30,
from ../../../cpukit/include/rtems.h:56,
from ../../../bsps/include/bsp/default-initial-extension.h:26,
from ../../../bsps/sparc/erc32/include/bsp.h:32,
from ../../../bsps/sparc/erc32/start/setvec.c:36:
../../../cpukit/score/cpu/sparc/include/rtems/score/cpu.h:958:24: note: expected 'CPU_ISR_raw_handler' {aka 'void ()(void)'} but argument is of type 'rtems_isr_entry' {aka 'void ()(unsigned int)'}
958 | CPU_ISR_raw_handler new_handler,
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
`
To understand this warning I will have to look into the root cause, i.e. the set_vector() function. Here is the function prototype:
`c
rtems_isr_entry set_vector( / returns old vector /
rtems_isr_entry handler, / isr routine /
rtems_vector_number vector, / vector number /
int type / RTEMS or RAW intr /
);
`
For uniformity, I will be referencing set_vector() usage from SPARC/ERC32 BSP but to be honest the same is true in most BSPs.
This is a link to one of the files where the said function is defined in bsps/sparc/erc32/start/setvec.c
Warning: Incompatible pointer type
The warning suggests there is a type mismatch inside the fun