cancel
Showing results for 
Search instead for 
Did you mean: 

Jumping to ST ROM Bootloader from user flash on STM32L073

Dhanyakumar Hosamane
Associate II
Posted on July 22, 2017 at 13:03

Hi

STM32L073RZ supports dual bank mechanism. Dual-bank boot capability allowing to boot either from Bank 1 or Bank 2 at startup based on BOOT pins. However, I need to jump to system boot loader from user flash using simple address based mechanism to allow the user to upgrade new code on to flash memory.

Configuration

BOOT0 pin tied to 0

Using BANK 1 flash memory

Issue

On jumping to system memory from BANK 1 Flash, control (PC) returns to BANK1 flash start address as code BANK1 code is not valid. But I wanted to control to stay in system bootloader to upgrade flash memory

Is there any way to jump to system boot loader from BANK1 user flash?

#stm32l073 #stm32lo #dual-bank #system-bootloader #bootloader-rom
11 REPLIES 11
Posted on July 22, 2017 at 14:17

>>

Is there any way to jump to system boot loader from BANK1 user flash?

I'd assume it is possible, you might have to review the code in the ROM and determine what it is looking for, and how the memory shadowing is configured.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on July 23, 2017 at 05:17

Hi Clive

I appreciate you for the quick response.

ROM bootloader code is written by ST, will I get access ROM boot loader code? if so can you please guide me the procedure to get ROM bootloader code.

As per my understanding so far (after going through AN2606), bootloader looks for code validity on the flash bank (both 1 & 2) and jumps back to flash code if the flash code is valid. because of this dual bank mechanism control immediately switches bank to bank 1 as it has valid code.

I am looking a way to that make system bootloder to continue its execution even if it finds the valid code on the flash bank when BOOT0 pins is tied to low.

Here is the snapshot of dual bank boot mechanism from AN2606 for STM32L073XX

0690X00000603yNQAQ.jpg
Posted on July 23, 2017 at 15:42

>>

ROM bootloader code is written by ST, will I get access ROM boot loader code?

But it is on every part, you could disassembly/analyze, determine an entry point for functionality.

If updating your own code, consider coding a loader to achieve that.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on July 24, 2017 at 16:23

Thanks again Clive

I think it's not a good idea to read back ROM bootloader code to determine entry point as it is subjected to change over time and part revisions. I needed bootloader source code so that I can customize and use it to minimize my effort.

But I am just wondering what is the use embedded ROM bootloader when there is no software mechanism to switch to boot from user application? 

Posted on July 24, 2017 at 16:36

It's designed to allow simple programming of parts with no code on them in a production, or bricked-in-field situations.

Pretty sure I can trivially enter the loader from software, problem is having it do something different than coded in the ROM.

If you need to uses the dual banking, a short loader copied in both locations could easily fork and manage which image is used.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on October 20, 2017 at 12:34

Bootloader can be entered:

- Pulling BOOT0 pin  high  and give reset

- Jump to Bootloader from code when some conditions are fullfilled.

Jump to bootloader is best done this way.

- Reserve some RAM that your startup code does not initialize

- Check for some magic value there early in your startup before clock/interrup setup

- If that value is given, reset that value, remap system memory and jump to bootloader

- otherwise start normal program.

- When normal program should start bootloader, set the magic value and reset the device

Posted on November 23, 2017 at 13:20

Hey Clive

Is there any way to enter the bootloader mode without controlling the BOOT0 pin. In my application, there is only one microcontroller (STM32), and thus there is no way I can remotely control the BOOT0 pin to perform a firmware upgrade. 

Is it possible for STM32 to enter bootloader mode at every reset, and check the system configuration to start running the code from Bank 1 or Bank 2?

Posted on November 23, 2017 at 13:44

You can jump to code in ROM as you can with any code within the processor address space. I believe I've illustrated this several times.

You can also implement your own IAP boot loader to upgrade your application firmware.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on November 23, 2017 at 14:10

What is the role of BOOT0 pin here? What will happen if a system reset happens due to power fluctuations?