cancel
Showing results for 
Search instead for 
Did you mean: 

Does System-bootloader eventually timeout? (and jump to user program)

Javier1
Principal

If Systembootloader Doesnt detect anything comming from any peripheral, does it timeout and jump to 0x8000000?

Because by reading AN3154 , it looks like it does, but when im trying with my stm32f405RE it doesnJavier1_0-1737476993543.png

Javier1_1-1737477104507.png

 

this is my code:

 

 

int main(void)
{

  /* USER CODE BEGIN 1 */
#define BOOTLOADER_ADDRESS 0x1FFF77DE
typedef  void (*pFunction)(void);
pFunction JumpToApplication;
uint32_t JumpAddress;


  /* 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 */

  /* USER CODE END SysInit */

  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  /* USER CODE BEGIN 2 */
  HAL_Delay(1000);
  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
	  HAL_Delay(250/2);
	  HAL_GPIO_TogglePin(LEDRED_GPIO_Port, LEDRED_Pin);

	  if(HAL_GetTick()>10000){
		  /* Jump to system memory bootloader */
		  JumpAddress = *(__IO uint32_t*) (BOOTLOADER_ADDRESS + 4);
		  JumpToApplication = (pFunction) JumpAddress;
		  JumpToApplication();
	  }
    /* USER CODE END WHILE */

    /* USER CODE BEGIN 3 */
  }
  /* USER CODE END 3 */
}

 

 

What im expecting:

  1. blink blink blink....
  2. jump to systembootloader
  3. systembootloader timesout and creates System reset

 

  1. blink blink blink...... again

But im only reaching point 3, and stays there.

we dont need to firmware by ourselves, lets talk
4 REPLIES 4
Javier1
Principal

Maybe im not even jumping to SystemBootloader, ill check tomorrow

we dont need to firmware by ourselves, lets talk
MM..1
Chief III

Primary move your jump before hal init. Secondary address you use isnt ok. Here is ID if loader not start.

AN2606 try 1fff0000

The memory location is what AN2606 says

Javier1_0-1737547395892.png

 

so

0x1FFF77DE

should be alright.

You were right for some reason 0x1FFF0000 is the actual address

By disabling interruptions and sysclock i am able to get into Sysbootloader, but it doesnt timeout, i am able to do firmware updates, but if no CAN comms are going on it doesnt jump to 0x8000000 like is supposed to do, in other words, once it gerts into systembootloader it never goes out.

 

 

  /* USER CODE BEGIN WHILE */
  while (1)
  {
	  HAL_Delay(250/2);
	  HAL_GPIO_TogglePin(LEDRED_GPIO_Port, LEDRED_Pin);

	  if(HAL_GetTick()>10000){
		  /* Jump to system memory bootloader */
		  /* Disable all interrupts */
		  	__disable_irq();

		  	/* Disable Systick timer */
		  	SysTick->CTRL = 0;

		  	/* Set the clock to the default state */
		  	HAL_RCC_DeInit();

		  	/* Clear Interrupt Enable Register & Interrupt Pending Register */
		  	for (uint32_t i=0;i<16U;i++)
		  	{
		  		NVIC->ICER[i]=0xFFFFFFFF;
		  		NVIC->ICPR[i]=0xFFFFFFFF;
		  	}
		  	__enable_irq();

		  JumpAddress = *(__IO uint32_t*) (BOOTLOADER_ADDRESS + 4);
		  JumpToSystembootloader = (pFunction) JumpAddress;
		  JumpToSystembootloader();
	  }
    /* USER CODE END WHILE */

    /* USER CODE BEGIN 3 */
  }

 

 

 

we dont need to firmware by ourselves, lets talk
Javier1
Principal

It doesnt jump from Systembootloader to 0x80000000 even if im using cubeProgrammer and selecting "Run after programming" option, i am able to execute my blinky code only after a Power reset or button Reset.

Javier1_0-1737552272702.png


If "run after programming" is selected im not able to "Disconnect" without Cubeprogrammer crashing

Javier1_0-1737552422942.pngJavier1_1-1737552438085.png

 

 

 

 

we dont need to firmware by ourselves, lets talk