cancel
Showing results for 
Search instead for 
Did you mean: 

How do i boot from one of two locations on the STM32L072RBT6? I

HElHa
Associate

have a default location X. If want to update the code, i download it to location Y and expect the STM32 to start at location Y after reboot. However, the routine keeps rebooting from X. what am i missing?

15 REPLIES 15

The CM0 always boots from the vector table it finds starting at the base address of zero.

The BOOTx pins determine what memory that is. Typically it is the base of flash (0x08000000) which then gets mapped/shadowed at 0x00000000

It is not going to magically find your code at Y, you would have to create code at X that directs it to other locations, Y or Z

>>what am i missing?

A clear reading of the processor technical reference manual? Basic functionality of micro-controllers?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

You can change the base for the vector table of the CM0+ once it has started, the reset clears the SCB->VTOR register.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

@JMani.14​ 

I just mean you're randomly messaging me, about a guy who hasn't responded to the answer I left, and I'm missing a whole set of conversations/thoughts that goes with that.

"Not Working as Expected" isn't helpful, have you stepped the code with the debugger? Does it go into your Reset_Handlers for App1 or App2? Do interrupts stop working? What are your observations about what code is actually running and what is it doing?

You have a __disable_irq() but unless there is complementary code on the other side they will never be enabled again.

The MSP setting code is perhaps dangerous on GNU/GCC systems.

There is no sanity checking of the jump addresses, if the Flash there is blank the system will crash.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

@JMani.14​ 

Check build addresses, and output from the linker, ie .MAP files, etc

Make sure that code in SystemInit() is not changing SCB->VTOR to the wrong address.

Execution will go exactly where you tell it to go, if it goes to the wrong places you need to review why it pulls and uses those addresses. Start with the linker, and linker scripts or scatter files.

The addresses in the Vector Table are absolute, you need to ensure the images are built for the addresses they are going to be placed, or relocate them to the new address.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
JMani.14
Associate II

Hi, Clive

I moved to here.

JMani.14
Associate II

I am using IAR, could you please let me know how to loading several hex files on STM?

The .HEX file contain addressing data. You can use the STM32 Cube Programmer to load and program the individual files one at a time.

You may merge multiple . HEX files, the body of the data is everything excluding the last line.

ie

BODY1

END RECORD

BODY2

END RECORD

BODY3

END RECORD

Can be recombined as

BODY1

BODY2

BODY3

END RECORD

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
JMani.14
Associate II

What do you mean by excluding the last line?

The one at the end that is different from all the others.

I​n a .HEX file with 1000 lines, line 1000. So the ones of interest being 1 thru 999.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..