set_vector() on SPARC

Sebastian Huber sebastian.huber at embedded-brains.de
Thu Oct 15 17:57:59 UTC 2020


Hello,

the set_vector() function yields this warning on SPARC:

[ 107/4376] Compiling bsps/sparc/leon3/start/setvec.c
../../../bsps/sparc/leon3/start/setvec.c: In function 'set_vector':
../../../bsps/sparc/leon3/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/leon3/include/bsp.h:32,
                  from ../../../bsps/sparc/leon3/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,
       |   ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~

I think this function is broken by design. It is always called with the 
third parameter set to 1 in the RTEMS code base:

bsps/sparc/erc32/start/bspsmp.c:  set_vector( 
bsp_inter_processor_interrupt, IPI_VECTOR, 1 );
bsps/sparc/erc32/start/setvec.c:/*  set_vector
bsps/sparc/erc32/start/setvec.c:rtems_isr_entry 
set_vector(                   /* returns old vector */
bsps/sparc/erc32/start/spurious.c: *  Install the spurious handler for 
most traps. Note that set_vector()
bsps/sparc/erc32/start/spurious.c:    set_vector( (rtems_isr_entry) 
bsp_spurious_handler,
bsps/sparc/erc32/console/erc32_console.c: 
set_vector(erc32_console_isr_a, CONSOLE_UART_A_TRAP, 1);
bsps/sparc/erc32/console/erc32_console.c: 
set_vector(erc32_console_isr_b, CONSOLE_UART_B_TRAP, 1);
bsps/sparc/erc32/console/erc32_console.c: 
set_vector(erc32_console_isr_error, CONSOLE_UART_ERROR_TRAP, 1);
bsps/sparc/erc32/clock/ckinit.c:  set_vector( _new, CLOCK_VECTOR, 1 )
bsps/sparc/erc32/include/bsp.h:rtems_isr_entry 
set_vector(                     /* returns old vector */
bsps/sparc/erc32/include/tm27.h:  set_vector( (handler), TEST_VECTOR, 1 );
bsps/sparc/erc32/include/tm27.h:  set_vector( (handler), TEST_VECTOR, 1 ); \
bsps/sparc/erc32/include/tm27.h:  set_vector( (handler), TEST_VECTOR2, 1 );
bsps/sparc/leon3/mpci/mpisr.c:  set_vector((rtems_isr_entry) Shm_isr, 
LEON_TRAP_TYPE(LEON3_mp_irq), 1);
bsps/sparc/leon3/start/bspsmp.c: 
set_vector(bsp_inter_processor_interrupt, LEON_TRAP_TYPE(LEON3_mp_irq), 1);
bsps/sparc/leon3/start/setvec.c:rtems_isr_entry 
set_vector(                   /* returns old vector */
bsps/sparc/leon3/start/spurious.c: *  Install the spurious handler for 
most traps. Note that set_vector()
bsps/sparc/leon3/start/spurious.c:    set_vector(
bsps/sparc/leon3/include/bsp.h:rtems_isr_entry 
set_vector(                     /* returns old vector */
bsps/sparc/leon3/include/tm27.h:  set_vector( (handler), TEST_VECTOR, 1 );
bsps/sparc/leon3/include/tm27.h:  set_vector( (handler), TEST_VECTOR, 1 ); \
bsps/sparc/leon3/include/tm27.h:  set_vector( (handler), TEST_VECTOR2, 1 );
bsps/sparc/leon2/start/setvec.c:/*  set_vector
bsps/sparc/leon2/start/setvec.c:rtems_isr_entry 
set_vector(                   /* returns old vector */
bsps/sparc/leon2/start/spurious.c: *  Install the spurious handler for 
most traps. Note that set_vector()
bsps/sparc/leon2/start/spurious.c:    set_vector(
bsps/sparc/leon2/console/console.c:  set_vector( console_isr_a, 
CONSOLE_UART_1_TRAP, 1 );
bsps/sparc/leon2/console/console.c:  set_vector( console_isr_b, 
CONSOLE_UART_2_TRAP, 1 );
bsps/sparc/leon2/clock/ckinit.c:  set_vector( _new, CLOCK_VECTOR, 1 )
bsps/sparc/leon2/include/bsp.h:rtems_isr_entry 
set_vector(                     /* returns old vector */
bsps/sparc/leon2/include/tm27.h:  set_vector( (handler), TEST_VECTOR, 1 );
bsps/sparc/leon2/include/tm27.h:  set_vector( (handler), TEST_VECTOR, 1 ); \
bsps/sparc/leon2/include/tm27.h:  set_vector( (handler), TEST_VECTOR2, 1 );
bsps/sparc/shared/gnatcommon.c: set_vector (__gnat_exception_handler, 
SPARC_SYNCHRONOUS_TRAP (trap), 1);

I suggest to remove this function and replace it with 
rtems_interrupt_catch() and add the interrupt enable to 
rtems_interrupt_catch().



More information about the devel mailing list