cancel
Showing results for 
Search instead for 
Did you mean: 

Jump to internal bootloader

trevor23
Associate III
Posted on May 07, 2010 at 19:20

Jump to internal bootloader

#bootloader-gpio
27 REPLIES 27
Posted on August 21, 2013 at 23:34

Even addresses are assumed to indicate 32-bit ARM code, rather than Thumb. The M3/M4 can't execute 32-bit ARM code and faults.

Be sure that you're calling code, not vector points to code.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
winman
Associate II
Posted on January 09, 2014 at 21:44

how do you initialize temp and Jump_to_Bootloader?  

on launch_dfu request i'm writing a 'code word' to the last flash section, then at the top of main I check for the code word before launching the program.  Nothing has been configured except whatever is called in system_startup (I think only HSE).  I just can't figure out how to do the jump in c.. thanks!

Posted on January 09, 2014 at 22:46

Post#4 from Trevor would seem to have all the definitions you'd be looking for.

The address is for the F1's Boot Loader

The startup code typically calls System_Init() prior to main(), so what ever you set up there for the HSE/PLL will be in effect, not running from HSI

It's loading vectors for SP and PC from the vector table at the beginning of the image, C does the call as a POINTER to a FUNCTION. Observe how you pass compare routines to qsort(), see K&R or other C Language texts.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Beachmiles
Associate III
Posted on November 26, 2014 at 23:48

First off, thank you Clive for all your help. I am still coming up to speed on microcontroller coding.

I have a computer with a stm32f05 chip that controls the PWM of the LED screen backlight among other things. I created a special serial command that tells the chip to jump to the bootloader. I have the jump working good and can flash the new firmware fine but the trouble is that the LED backlight turns off once you hit the SysMemBootJump(); code.

I tried disabling PWM and setting the pins PA11 and PB3 high with this code before I do the jump.

        GPIO_ResetBits(GPIOA,GPIO_Pin_11);

        GPIO_Struct.GPIO_Pin = GPIO_Pin_11;

        GPIO_Struct.GPIO_Mode = GPIO_Mode_OUT;

        GPIO_Struct.GPIO_PuPd = GPIO_PuPd_UP;

        GPIO_Struct.GPIO_OType = GPIO_OType_PP;

        GPIO_Init(GPIOA, &GPIO_Struct);

        GPIO_WriteBit(GPIOA, GPIO_Pin_11, Bit_SET);

        GPIO_SetBits(GPIOA,GPIO_Pin_11);    //turns on

        GPIO_WriteBit(GPIOA,GPIO_Pin_11,Bit_SET);

Any way to keep a PIN level high after jumping to the bootloader? Or is it that the GPIO clock gets disabled once you enter the bootloader? Is my only solution to create a custom bootloader?

This is the jump function I am using

void (*SysMemBootJump)(void) = (void (*)(void)) (*((uint32_t *) 0x1fffec04));

Thanks,

Miles

Posted on November 27, 2014 at 01:26

More probably just writing some hard-coded values into the GPIO configuration registers.

Generally I think you're going to want to build your own loader, depending on your requirements and space constrains, the flashing code could be downloaded by the updating application into RAM.

I might also be feasible to jump into a different area of the ROM, in a fashion that preserves the GPIO pins, but this would require you to disassemble the ROM, and would be complicated if the version of code in the ROM changes.

You might want to look for IAP (In Application Programming) for this and other STM32 platforms.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
stenasc
Senior
Posted on October 30, 2015 at 12:19

Hi Miles,

Did you ever get this working? I am using a stm32f051 device and I would like to be able to remotely update it. How did you handle the vector relocation on this device and the bootloading?

Many regards

Bb Carter

Posted on October 04, 2017 at 18:05

https://community.st.com/0D50X00009Xkh3DSAR

 
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
gaurav sharma
Associate
Posted on March 21, 2018 at 06:58

I have made this code working without uart driver but with uart this code is not working for STM32L073RZ

void Bootloader_JumpToSysMem(void)

{

uint32_t JumpAddress = *(__IO uint32_t*)(SYSMEM_ADDRESS + 4);

pFunction Jump = (pFunction)JumpAddress;

HAL_NVIC_DisableIRQ(USARTX_IRQn);

HAL_UART_DeInit(&UartHandle);

HAL_RCC_DeInit();

HAL_DeInit();

SysTick->CTRL = 0;

SysTick->LOAD = 0;

SysTick->VAL = 0;

__HAL_SYSCFG_REMAPMEMORY_SYSTEMFLASH();

__set_MSP(*(__IO uint32_t*)SYSMEM_ADDRESS);

Jump();

// HAL_GPIO_TogglePin(LED2_GPIO_PORT, LED2_PIN);

while(1);

}