The program list template defined by stm32f10x_it.c (stm32f103x_it.c puts the interrupted empty function)

1. In stm32f103x_it.c, the interrupted empty function is placed

2. How STM32 enters the interrupt program: First, the program is placed in the code segment where 0x80000000-0x8001ffff FLASH is located; SRAM starts from address 0x20000000 and has 20K storage variables and so on.
    

    When BOOT0=0 (BOOT0 should not be left floating!), the interrupt vector is placed at the address starting at 0x80000000. At this time, when the ARM starts, the program is actually executed from the "function address" stored in 0x80000004. The function address should be emphasized. .

3. The interrupt service function in stm32f10x_it.c calls the functions of other files through compilation but a warning will appear:

It is best to add the relevant header files to it. To use global variables in other files, be sure to add an external variable declaration extern,

Such as: declare unsigned char a=0 in AAA.c;

If you want to call this variable in BBB.c, you must also declare extern unsigned char a;

4. The names of the interrupt service routines are all fixed:

    You can't make it up by yourself, because the corresponding service program must be placed under a fixed interrupt entry address when compiling, and the compiler can't recognize the random name, and the service program name corresponding to each different type of film is different. , for example, medium-capacity films only support EXTI4_IRQHandler, EXTI5_IRQHandler seems to be gone. I haven't found which file these entry function names correspond to the address, but you can see it from the chip's startup file. For example, for medium-capacity chips, you can see all available services in startup_stm32f10x_md.s The program entry name, it is enough to write it according to the inside (of course, the specific content of the service program is still written by you, and it is placed in stm32f10x_it.c).

5. The program list template defined by stm32f10x_it.c is as follows:

#include "stm32f10x_it.h"

void NMIException(void)

{}


void HardFaultException(void)
{
 
  while (1)
  {}
}

void MemManageException(void)
{
 
  while (1)
  {}
}

void BusFaultException(void)
{
 
  while (1)
  {}
}
void UsageFaultException(void)
{
 
  while (1)
  {}
}

void DebugMonitor(void)
{}

void SVCHandler(void)
{}


void PendSVC(void)
{}


void SysTickHandler(void)
{}


void WWDG_IRQHandler(void)
{}

void PVD_IRQHandler(void)

{}


void TAMPER_IRQHandler(void)
{}


void RTC_IRQHandler(void)
{}

void FLASH_IRQHandler(void)
{}

void RCC_IRQHandler(void)
{}

void EXTI0_IRQHandler(void)
{}

void EXTI1_IRQHandler(void)
{}


void EXTI2_IRQHandler(void)
{}


void EXTI3_IRQHandler(void)
{}


void EXTI4_IRQHandler(void)
{}


void DMA1_Channel1_IRQHandler(void)
{}




void DMA1_Channel2_IRQHandler(void)
{}




void DMA1_Channel3_IRQHandler(void)
{}




void DMA1_Channel4_IRQHandler(void)
{}




void DMA1_Channel5_IRQHandler(void)
{}




void DMA1_Channel6_IRQHandler(void)
{}




void DMA1_Channel7_IRQHandler(void)
{}




void ADC1_2_IRQHandler(void)
{}




void USB_HP_CAN_TX_IRQHandler(void)
{}




void USB_LP_CAN_RX0_IRQHandler(void)
{}




void CAN_RX1_IRQHandler(void)
{}




void CAN_SCE_IRQHandler(void)
{}




void EXTI9_5_IRQHandler(void)
{}




void TIM1_BRK_IRQHandler(void)
{}




void TIM1_UP_IRQHandler(void)
{}




void TIM1_TRG_COM_IRQHandler(void)
{}




void TIM1_CC_IRQHandler(void)
{}




void TIM2_IRQHandler(void)
{}




void TIM3_IRQHandler(void)
{}




void TIM4_IRQHandler(void)
{}




void I2C1_EV_IRQHandler(void)
{}




void I2C1_ER_IRQHandler(void)
{}




void I2C2_EV_IRQHandler(void)
{}




void I2C2_ER_IRQHandler(void)
{}




void SPI1_IRQHandler(void)
{}




void SPI2_IRQHandler(void)
{}




void USART1_IRQHandler(void)
{}




void USART2_IRQHandler(void)
{}




void USART3_IRQHandler(void)
{}




void EXTI15_10_IRQHandler(void)
{}




void RTCAlarm_IRQHandler(void)
{}




void USBWakeUp_IRQHandler(void)
{}




void TIM8_BRK_IRQHandler(void)
{}




void TIM8_UP_IRQHandler(void)
{}




void TIM8_TRG_COM_IRQHandler(void)
{}




void TIM8_CC_IRQHandler(void)
{}




void ADC3_IRQHandler(void)
{}




void FSMC_IRQHandler(void)
{}




void SDIO_IRQHandler(void)
{}




void TIM5_IRQHandler(void)
{}




void SPI3_IRQHandler(void)
{}




void UART4_IRQHandler(void)
{}




void UART5_IRQHandler(void)
{}




void TIM6_IRQHandler(void)
{}




void TIM7_IRQHandler(void)
{}




void DMA2_Channel1_IRQHandler(void)
{}




void DMA2_Channel2_IRQHandler(void)
{}




void DMA2_Channel3_IRQHandler(void)
{}




void DMA2_Channel4_5_IRQHandler(void)
{}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325524233&siteId=291194637