Understanding Interrupt Subroutines

The ISR address function are declared as "weak" type in startup file.

 In *.s file format  it is like

.word NMI_Handler

and Interrupt address is defined in the line

.weak NMI_Handler                                             //declared as weak type
.thumb_set NMI_Handler,Default_Handler       // NMI_Handler ISR is declared as weak and assigned Default_Handler which is a infinite loop

  In *.c  file format it is like

void WEAK  NMI_Handler(void);

and Interrupt address is defined in the line

#pragma weak NMI_Handler = Default_Handler

whereas
#pragma is for compiler directives that are machine-specific or operating-system-specific, i.e. it tells the compiler to do something, set some option, take some action, override some default, etc. that may or may not apply to all machines and operating systems.


Comments

Popular posts from this blog

HackRF with srsLTE and openlte

Blinking a LED in STM32F103C8T6 (Blue Pill) Board

Read Continuously from Serial Port in QT