relocation of main source and IRQ vector stm32f103
hello!
I'm working on stm32f103 and I found one problem which has a weird solution.
In my project, I have a bootloader and main source. I use the 0x800000 address to start the bootloader and 0x8008200 to begin my main project (the bootloader jumps to this address). after changing the main project:
address I defined also:
#define USER_VECT_TAB_ADDRESS in "system_stm32f1xx.c"
it opened me section where I wrote this
#define USER_VECT_TAB_ADDRESS
#if defined(USER_VECT_TAB_ADDRESS)
/*!< Uncomment the following line if you need to relocate your vector Table
in Sram else user remap will be done in Flash. */
/* #define VECT_TAB_SRAM */
#if defined(VECT_TAB_SRAM)
#define VECT_TAB_BASE_ADDRESS SRAM_BASE /*!< Vector Table base address field.
This value must be a multiple of 0x200. */
#define VECT_TAB_OFFSET 0x00000000U /*!< Vector Table base offset field.
This value must be a multiple of 0x200. */
#else
#define VECT_TAB_BASE_ADDRESS FLASH_BASE /*!< Vector Table base address field.
This value must be a multiple of 0x200. */
#define VECT_TAB_OFFSET 0x00008200 /*!< Vector Table base offset field.
This value must be a multiple of 0x200. */
#endif /* VECT_TAB_SRAM */
#endif /* USER_VECT_TAB_ADDRESS */after this everything works great if I will add __eneable_irq(); in the main source
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
/* USER CODE BEGIN SysInit */
static dev_trace_init_t trace_init;
trace_init.mosi.port = GPIO_PB;
trace_init.sck.port = GPIO_PA;
trace_init.nss.port = GPIO_PA;
trace_init.mosi.pin = BB(0, b00100000);
trace_init.sck.pin = BB(b00010000, 0);
trace_init.nss.pin = BB(b00001000, 0);
dev_trace_init(&trace_init);
debug_printf("\n\r\n\r\n\r----------------------------------------------start Version 0.10----------------------------------------------\n\r\n\r");
//IWDG_Init();
/* USER CODE END SysInit */
__enable_irq();
/* Initialize all configured peripherals */
/* USER CODE BEGIN 2 */so why is it needed and why it doesn't work without enabling? is there some bug in shifting the IRQ vector? if I won't write this, project will be broken at the first IRQ