cancel
Showing results for 
Search instead for 
Did you mean: 

jump to bootloader failed in stm32f765

sajeevan
Associate II

Hi all,

I am trying to develop a bootloader software for STM32F765.

I requires two features in it.

1) jumping from Bootloader to Application

2) jumping from Application to Bootloader

I could make jump from Bootloader to Application very easily.

But I am suffering with jumping from Application to Bootloader for 4-5 days now.

The final code I tried is given below:

void Bootloader_JumpToBootloader_Program(void)
{
void (*app_reset_handler)(void);

__disable_irq();

SysTick->CTRL = 0 ;
SysTick->LOAD = 0;
SysTick->VAL = 0;
HAL_RCC_DeInit();
HAL_DeInit();

/* 2) disable all enabled interrupts */
NVIC->ICER[ 0 ] = 0xFFFFFFFF ;
NVIC->ICER[ 1 ] = 0xFFFFFFFF ;
NVIC->ICER[ 2 ] = 0xFFFFFFFF ;
NVIC->ICER[ 3 ] = 0xFFFFFFFF ;
NVIC->ICER[ 4 ] = 0xFFFFFFFF ;
NVIC->ICER[ 5 ] = 0xFFFFFFFF ;
NVIC->ICER[ 6 ] = 0xFFFFFFFF ;
NVIC->ICER[ 7 ] = 0xFFFFFFFF ;

NVIC->ICPR[ 0 ] = 0xFFFFFFFF ;
NVIC->ICPR[ 1 ] = 0xFFFFFFFF ;
NVIC->ICPR[ 2 ] = 0xFFFFFFFF ;
NVIC->ICPR[ 3 ] = 0xFFFFFFFF ;
NVIC->ICPR[ 4 ] = 0xFFFFFFFF ;
NVIC->ICPR[ 5 ] = 0xFFFFFFFF ;
NVIC->ICPR[ 6 ] = 0xFFFFFFFF ;
NVIC->ICPR[ 7 ] = 0xFFFFFFFF ;

// Set embedded bootloader vector table base offset
WRITE_REG(SCB->VTOR, SCB_VTOR_TBLOFF_Msk & 0x00000000);
__enable_irq();

// Instruction synchronization barrier
__ISB();

uint32_t msp_val = *(uint32_t *)SYSTEM_START_ADDRESS;////SYSTEM_START_ADDRESS

__set_MSP(msp_val);
__DSB(); // Data synchronization barrier
__ISB(); // Instruction synchronization barrier

uint32_t reset_handler_address = *(uint32_t *)(SYSTEM_START_ADDRESS + 4);////SYSTEM_START_ADDRESS

/* assign the reset handler address to reset handler */
app_reset_handler = (void *)reset_handler_address;
app_reset_handler = (void (*) (void))reset_handler_address;
/* Jump to reset handler of the User Application */
app_reset_handler();
}

Please share your valuable suggestions to solve the issue.

 

Sajeevan.K

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
MM..1
Chief III

Jumping into , dont work on MCUs with empty flash checks. I dont test 765, but other require before jump erase flash part 0. How you try this ? First step is test with hw way .

MM1_0-1777618366383.png

after this work, do jump from app.

View solution in original post

8 REPLIES 8
MM..1
Chief III

Jumping into , dont work on MCUs with empty flash checks. I dont test 765, but other require before jump erase flash part 0. How you try this ? First step is test with hw way .

MM1_0-1777618366383.png

after this work, do jump from app.

Shirley.Ye
ST Employee

do you mean you want to jump from the application to the bootloader software you are writing? the bootloader here means the software you are writing or the bootloader inside the STM32F765 system memory and flashed in the manufacture?

The OP says: "embedded bootloader". That's system memory.

 

Saket_Om
ST Employee

Hello @sajeevan 

Please refer to the article below for inspiration. 

How to jump to system bootloader from application ... - STMicroelectronics Community

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
Saket_Om

Hi Shirley,

Sorry for the delay in response.

First let me answer your following question:

 "the bootloader here means the software you are writing or the bootloader inside the STM32F765 system memory?"

A: The Bootloader that I have written.

Here our system shall have the feature of "Check for Software Update", while the application is running in the system. If there is an update trigger, jump from Application Code to Bootloader Code should be done.

 

  

 

 

 

Hi MM,

I have gone through the following link:

https://community.st.com/t5/stm32-mcus/empty-check-mechanism-on-stm32/ta-p/49369

This says Empty check mechanism need to be done only for the following series:

F0, C0, G0, L0, L4, U0, WL & WB. 

The series I am using is F7. I think Empty Check Mechanism is not applicable for STM32F765. 

Empty check is only in system bootloaders. Your own bootloader is normal application here... RESET jump to it one line of code. Call NVIC Reset or start watchdog = reset.

Hi MM and all,

Thank you for responding to my queries. I could solve the issue by jumping to the custom bootloader start address 0x08000000 after disabling I Cache and D Cache.