Home > other >  Stm32 bootloader jump after application failure
Stm32 bootloader jump after application failure

Time:09-24

Recently met a puzzled for a long time, use STM32F103VE microcontroller, according to the conventional way to test, all functions are normal, and then for future application upgrade convenient, brush bootloader program first, and then through the front-end ports download application program, found the following problem (introduce) step by step below:

1: upgrade download tool tip the download is complete, then the board should work under the mode of application, but actually did not see any function, try again still
2: use the debug debugging, with JLINK download bootloader program first, and then change the application project in the way of wiping out all sector will also download applications in and start the debug, so you can download via JLINK go in both process and can online debugging
3: application to succeed from bootloader to jump to the application of the main entrance, single step down debugging, program can work normally, but using a run at full speed (no breakpoint way), the program ran fly
4: at this time click the stop button, the program stops at the end of the interrupt service function of the boot file b. , seemed to occur after all didn't find the interrupt service function
DMA2_Channel1_IRQHandler
DMA2_Channel2_IRQHandler
DMA2_Channel3_IRQHandler
DMA2_Channel4_5_IRQHandler
b.

ENDP

The ALIGN
5: blocking other interrupt initialization, can only make a timer interrupt, within the interrupt breakpoints, can always come in execution and successful exit, but I can't cancel the breakpoint operation still

6: here are the main place of application initialization code
NVIC_SetVectorTable (NVIC_VectTab_FLASH, 0);
NVIC_PriorityGroupConfig (NVIC_PriorityGroup_1);
ReadFlashCfg ();
DrLed ();
DrTimer_Init ();

System_stm32f10x. C file Settings
# define VECT_TAB_OFFSET 0 x0/*! This value must be a multiple of 0 x200. */

In the target option IROM1 Settings
Start 0 x8008000 size 0 x1c000

Mish. H file Settings that offset 0 x8000
# define NVIC_VectTab_RAM ((uint32_t) 0 x20000000)
# define NVIC_VectTab_FLASH ((uint32_t) 0 x08008000)
# define IS_NVIC_VECTTAB (VECTTAB) (((VECTTAB)==NVIC_VectTab_RAM) | | \
((VECTTAB)==NVIC_VectTab_FLASH))

Bootloader program is the company's mature products, other programs can be normal operation, but the program has a problem, the preliminary theory is a problem with the interruption after the relocation, after the interruption point to illegal address (but not understand single-step debugging can run), understand the situation which the great spirit, know what is the problem, thank you very much!

CodePudding user response:

Since the bootloader is ripe, then put it into an array of __root constants "@" to a fixed Flash address, on the independence of a source file, a project there are both bootloader and application, is very convenient, although not necessarily can solve your problem,,
Such as IAR so to get the
 __root const static unsigned char BOOTLOADER [] @ x08000000=0 
{
.
};


In addition, since added 0 x8000 NVIC_VectTab_FLASH offset, so VECT_TAB_OFFSET conveniently also to offset 0 x8000

CodePudding user response:

reference 1st floor sugar13 response:
since bootloader is ripe, then put it into an array of __root constants "@" to a fixed Flash address, on the independence of a source file, and such a project there are both bootloader and application, is very convenient, although not necessarily can solve your problem,,
Such as IAR so to get the
 __root const static unsigned char BOOTLOADER [] @ x08000000=0 
{
.
};


In addition, since added 0 x8000 NVIC_VectTab_FLASH offset, so VECT_TAB_OFFSET also, by the way how to 0 x8000 offset

IAR with so strong function, don't know if there is any keil this functionality, I use keil is divided into two, one boot, an app,

CodePudding user response:

By rights, as long as the offset address is correct, the interrupt vector map migration is correct, no problem commonly, close all interrupt before the jump,

CodePudding user response:

Change two place
1, in the "OPTION" of the "target" make the following changes in
2, in the "system_stm32f1xx. C", change the interrupt to the scale of the offset
//# define VECT_TAB_OFFSET 0 x0//the original values
# define VECT_TAB_OFFSET 0 x4000//change after numerical

//the offset in the following instruction is executed in
# ifdef VECT_TAB_SRAM
SCB - & gt; VTOR=SRAM_BASE | VECT_TAB_OFFSET;/* the Vector Table Relocation in Internal SRAM. */
# the else
SCB - & gt; VTOR=FLASH_BASE | VECT_TAB_OFFSET;/* the Vector Table Relocation in Internal FLASH. */
# endif

In the "OPTION" in the "target" make the following changes in the starting address of the "IROM1" with offset,

CodePudding user response:

Sorry, the late reply, thank you provide Suggestions and methods, at the beginning I the root cause is the bootloader and application using two project, but the library version number, bootloader is company has been in the use of mature products, application upgrade, the STM32 firmware library upgraded to the latest, caused the problem, if the firmware library into the same version of two engineering projects, there will be no problem,

CodePudding user response:

reference 1/f, separated sugar response:
since bootloader is ripe, then put it into an array of __root constants "@" to a fixed address of Flash on the independence of a source file, and such a project there are both bootloader and application, is very convenient, although not necessarily can solve your problem,,
Such as IAR so to get the
 __root const static unsigned char BOOTLOADER [] @ x08000000=0 
{
.
};


In addition, since added 0 x8000 NVIC_VectTab_FLASH offset, so VECT_TAB_OFFSET also, by the way how to 0 x8000 offset


This method is worth to recommend

CodePudding user response:

O
reference 7 floor spring O response:
Quote: refer to 1st floor scatter response: sugar

Since the bootloader is ripe, then put it into an array of __root constants "@" to a fixed Flash address, on the independence of a source file, a project there are both bootloader and application, is very convenient, although not necessarily can solve your problem,,
Such as IAR so to get the
 __root const static unsigned char BOOTLOADER [] @ x08000000=0 
{
.
};


In addition, since added 0 x8000 NVIC_VectTab_FLASH offset, so VECT_TAB_OFFSET also, by the way how to 0 x8000 offset


This method is worth to recommend


Really good, not old driver can't think of method

CodePudding user response:

Method makes upstairs after generating code bin file is very big change, bin file size
  • Related