cancel
Showing results for 
Search instead for 
Did you mean: 

Not able to jump from internal memory boot code to QSPI external memory application code.

Nagarajan
Associate III

I am working on NUCLEO-H563ZI evaluation board interfacing with QSPI external memory. I have done below steps,

I am able to do read and write.

I have created the external loader file.

I am able to run application code in external memory with debugger support.

Now i am trying to run application code from external memory with bootloader code but i am always ending up with code crash. Could anybody give a clue how to debug this issue?

 

Note: I have flashed the application code in external memory using cube programmer with external loader.

         I have enabled the memory mapped mode in boot up code and able to see the app code in Ext memory.

          I have written jump code like below and changed linker script also,

 

/* Disable Systick interrupt */

SysTick->CTRL = 0;

 

/* Jump to application */

jumpToApplication = (pFunction)(*(__IO uint32_t*)(APPLICATION_ADDRESS + 4));

__set_MSP(*(__IO uint32_t*)APPLICATION_ADDRESS);

jumpToApplication();

 

 

21 REPLIES 21

It seems like a known issue with custom external loader and recent versions of CubeProgrammer (both standalone and CubeIDE embedded versions).

Solved: Re: External loader fails to download - STMicroelectronics Community this is the same issue i am facing here.

I replaced 0x480.stldr file with the flash loader given in the above link but it didnt work for me. Could you please give the solution for this issue.

I am using STM32CubeIDE_1.14.0.

You start mix two problems. 1. mapped read only mode fail 2. upload loader fail

I recomm for testing create little app for external load but load it into internal. Then in boot copy to external switch to mapped mode and try run.

Yeah but  first problem
1. mapped read only mode fail

for this like you suggested, i created a small app code for led blink and a small boot code to jump app code. Its works for me but sometime i get hard fault error. This consistency problem i can solve it later as it is less priority now.

 

2. upload loader fail

This is high priority task now, i am not getting clear solution. Could you please give the clear steps to resolve this issue, i am exactly facing same issue like mentioned in this post Solved: Re: External loader fails to download - STMicroelectronics Community

Seems like a different issue on a different chip from a build two years ago..

Debug the problem YOU have.

Start in your code that boots and step into your application. Understand at what point it stops working and what it was doing. You wrote this code so should be able to follow it.

Pay attention to the context the system has with respect to addresses and vector tables and the settings in the MCU. The clocks that are running and the memory that is configured and visible.

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

Nothing you've posted here with respect to logs/outputs support it being that issue. Further more the H563 is using 0x484.stldr

Now you have issues upload data to your platform?

On the execution side, make sure you have Error_Handler() and HardFault_Handler() that output useful and actionable data. Add diagnostic output so you can follow what's happening in your own code, and how far it gets, and at what point it stops functioning as expected.

Perhaps dump registers and memory content so you can see whats happening internally.

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

From example code i have changed the boot code like below, its working without any issues now. I have done many times power cycle the board, its jumping to app code correctly.

 
/* Disable all interrupts */
__disable_irq();
 
/* Disable Systick timer */
SysTick->CTRL = 0;
 
/* Clear Interrupt Enable Registers & Interrupt Pending Registers */
for (uint8_t i = 0; i < 16; i++)
{
NVIC->ICER[i]=0xFFFFFFFF;
NVIC->ICPR[i]=0xFFFFFFFF;
}
 
/* Jump to application */
jumpToApplication = (pFunction)(*(__IO uint32_t*)(APPLICATION_ADDRESS + 4));
__set_PSP(*(uint32_t*)APPLICATION_ADDRESS);
__set_MSP(*(__IO uint32_t*)APPLICATION_ADDRESS);
__set_CONTROL(0);
__ISB(); // Flush the pipeline because of SP change
__DSB(); // Ensure the VTOR and SP operations are complete
 
/* Re-enable all interrupts */
__enable_irq();
jumpToApplication();

 

After disabling interrupts in Loader file, i am able to download the code to internal flash and external flash simultaneously.

Nagarajan
Associate III

Is it possible to download code to internal as well as external memory at the same time using cube programmer?

If yes, which address should i give as start address?

With cube IDE i am able to download but cube programmer i am seeing the hang like below.

Nagarajan_0-1715257875531.png

 

You'd need to split the data into TWO .BIN covering the individual regions which are otherwise a long way apart, resulting in a file that's 2GB in size, and clearly not going to fit within a device with a fraction of that capacity.

A .HEX or .ELF can be sparse

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

Is there any tool to download .hex file into STM32H5 microcontroller?