IMXRT1171 switching context ISR

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

IMXRT1171 switching context ISR

654 次查看
Nexus76
Contributor II

Hi, I use RTOS Threadx and into the folder Threadx\threadx-6.4.1_rel\ports\cortex_m7\gnu the file readme_threadx.txt report about manged interrupts

A ThreadX managed interrupt is defined below. By following these conventions, the 
application ISR is then allowed access to various ThreadX services from the ISR.
Here is the standard template for managed ISRs in ThreadX:
 
 
        .global  __tx_IntHandler
        .thumb_func
__tx_IntHandler:
; VOID InterruptHandler (VOID)
; {
        PUSH    {r0, lr}
 
;    /* Do interrupt handler work here */
;    /* BL <your interrupt routine in C> */
 
        POP     {r0, lr}
        BX      lr
; }
 
 
Note: the Cortex-M requires exception handlers to be thumb labels, this implies bit 0 set.
To accomplish this, the declaration of the label has to be preceded by the assembler directive
.thumb_func to instruct the linker to create thumb labels. The label __tx_IntHandler needs to 
be inserted in the correct location in the interrupt vector table. This table is typically 
located in either your runtime startup file or in the tx_initialize_low_level.S file.
 
but in every example MCUXpresso project or like "driver\fsl_lpuart.c" file the ISR function it's written in C will take the form (where "your_C_isr" is an entry in the vector table):

 

void your_C_isr(void)
{

/* ISR processing goes here, including any needed function calls. */

SDK_ISR_EXIT_BARRIER;
}

so I'd like to understand witch is the correct way to write ISR function Threadx or MCUXpresso ?
 
bye
 
 
0 项奖励
回复
1 回复

592 次查看
Omar_Anguiano
NXP TechSupport
NXP TechSupport

Both approach are correct, the criteria to chose which to use should be based on the specific needs however for microcontroller ISRs we need to consider that the routine should be as short and simple as possible. 

Best regards,
Omar

0 项奖励
回复