We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi all,
I'm working on a stm32h7 project, and I found a very strange compile problem.
After I set Optimization as -O3 compile and download into my board, the program is hang, and I digged into .map file, find out the compiler links 2 diffirent functions to same location:
[Anonymous Symbol] 0x0802e210 Section 0 adc.o(.text.MX_ADC1_Init) [Anonymous Symbol] 0x0802e210 Section 0 rm_user.o(.text.MOVE_NVIC_VECTOR)
function MX_ADC1_Init is from STM32Cube_FW_H7_V1.12.1, and function MOVE_NVIC_VECTOR is below:
#define FLASH_APP_ADDR (0x08020000) #define ITCM_NVIC_ADDR (0x0) // move nvic into ITCM void MOVE_NVIC_VECTOR(void); void MOVE_NVIC_VECTOR(void) { unsigned int i; int *src, *dst; src = (int *)FLASH_APP_ADDR; dst = (int *)ITCM_NVIC_ADDR; for (i = 0; i < (ITCM_NVIC_SIZE / sizeof(int)); ++i) { *dst++ = *src++; } // 将nvic寄存器指向itcm SCB->VTOR = ITCM_NVIC_ADDR; }
Does anybody know what happend?
And after I individually set main.c compile as -O0 this problem dissapeared and program runs ok.