serial_isr.S adaptation for several interrupts

tronicals wrote on Monday, July 17, 2017:

Hi all,

It seems I have trouble with my InteruptWrappers interacting with FreeRTOS.
I used the serial_isr.S file coming with the demo and extended it for more UARTinterrupts.
It compiles fine, it works fine, but after 2 days running and receivig constantly serial data some interrupt are ignored.

I wonder if I made some errors in the serial_isr.S file, because I am not familiar with asm
Should :
.set nomips16
.set noreorder

be repeated for each interrupt?

Thanks iin advance

#include <p32xxxx.h>
#include <sys/asm.h>
#include "ISR_Support.h"

/*U1*/
	.set	nomips16
	.set 	noreorder

	.extern vU1InterruptHandler
	.extern xISRStackTop
	.global	vU1InterruptWrapper

	.set	noreorder
	.set 	noat
	.ent	vU1InterruptWrapper

vU1InterruptWrapper:

	portSAVE_CONTEXT
	jal vU1InterruptHandler
	nop
	portRESTORE_CONTEXT

	.end	vU1InterruptWrapper

/*U2*/
	.set	nomips16
	.set 	noreorder

	.extern vU2InterruptHandler
	.extern xISRStackTop
	.global	vU2InterruptWrapper

	.set	noreorder
	.set 	noat
	.ent	vU2InterruptWrapper

vU2InterruptWrapper:

	portSAVE_CONTEXT
	jal vU2InterruptHandler
	nop
	portRESTORE_CONTEXT

	.end	vU2InterruptWrapper

/*U3*/
	.set	nomips16
	.set 	noreorder

	.extern vU3InterruptHandler
	.extern xISRStackTop
	.global	vU3InterruptWrapper

	.set	noreorder
	.set 	noat
	.ent	vU3InterruptWrapper

vU3InterruptWrapper:

	portSAVE_CONTEXT
	jal vU3InterruptHandler
	nop
	portRESTORE_CONTEXT

	.end	vU3InterruptWrapper

/*U4 - N.A*/
/*U5*/
	.set	nomips16
	.set 	noreorder

	.extern vU5InterruptHandler
	.extern xISRStackTop
	.global	vU5InterruptWrapper

	.set	noreorder
	.set 	noat
	.ent	vU5InterruptWrapper

vU5InterruptWrapper:

	portSAVE_CONTEXT
	jal vU5InterruptHandler
	nop
	portRESTORE_CONTEXT

	.end	vU5InterruptWrapper

/*U6*/
	.set	nomips16
	.set 	noreorder

	.extern vU6InterruptHandler
	.extern xISRStackTop
	.global	vU6InterruptWrapper

	.set	noreorder
	.set 	noat
	.ent	vU6InterruptWrapper

vU6InterruptWrapper:

	portSAVE_CONTEXT
	jal vU6InterruptHandler
	nop
	portRESTORE_CONTEXT

	.end	vU6InterruptWrapper

rtel wrote on Sunday, July 23, 2017:

Sorry for the delay in your post showing - it went into moderation -
which it is not supposed to do.

In future, please give some clues as to which FreeRTOS port you are
using. In this case I can work it out because you show some source code.

When you say the interrupt is ignored, can you be more specific. Is it
that the interrupt is asserted in the hardware, but the wrapper never
executes, or that the wrapper executes and calls the handler, but
something in the handler is not working.

If it is the hardware is not asserting the interrupt then you will need
to inspect the UART registers to see why that is, maybe it has got
itself into an error state.

If the handler is being called but not behaving as you expect then
please post the handler code.

Also, in general, do you have configASSERT() defined to ensure execution
stops if an assert fails? Do you have stack overflow detection switched
on? Are you 100% sure the priorities of the interrupts are at or below
configMAX_SYSCALL_INTERRUPT_PRIORITY?