Skip to main content
SMano.1
Associate II
July 3, 2021
Question

STM32L4R9 fails execution by going to an invalid address for program execution.

  • July 3, 2021
  • 4 replies
  • 1647 views

I am using an STM32L4R9ZIT. I have written a simple code to toggle a GPIO high and low, with a delay of 2 seconds in between. However, the controller never actually executes this functionality. When I run in debug mode, everything seems to be going alright if I manually run it line by line.

But the moment I let the controller resume execution and then pause it, I see that it is now execution code at a location of 0x1fff3a3c. However, my original program was located near 0x80000000.

The issue I think is that the program counter always gets corrupted at ends up near 0x1ff3a3c. However, this never happens when running through the program instruction by instruction.

Any help with this would be greatly appreciated.

This topic has been closed for replies.

4 replies

Tesla DeLorean
Guru
July 3, 2021

BOOT0 pin needs to be pulled LOW

Or vector table at 0x08000000 invalid ​

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
SMano.1
SMano.1Author
Associate II
July 4, 2021

Thanks for your help Tesla!

I had tried setting the options bits for nSWBOOT and nBOOT0 so that it would ignore the BOOT0 pin. But that didn't work.

BOOT0 was a floating pin on my board, so I soldered a wire to it and connected that to ground. But that didn't work either.

So I looked into the vector table. SCB->VTOR was set to 0.

I tried setting SCB->VTOR = 0x08000000. And now it works!!

Tesla DeLorean
Guru
July 4, 2021

Seems odd the ROM would be mapped by the SYSCFG unit

The SCB->VTOR is usually set to the link/build address basis in SystemInit()

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
waclawek.jan
Super User
July 14, 2021

Hi @SMano.1​ ,

the above linked thread now contains a solution, which probably helps you with this issue too.

JW