cancel
Showing results for 
Search instead for 
Did you mean: 

problem jump application after reset

samir2
Associate II
Posted on December 06, 2016 at 11:31

I have problem with jump to application by bootloader  after reset.

The device used is the STM32F098.

The code of the bootloader making the jump is:

&sharpdefine APPLICATIONADDRESS    (uint32_t)0x08008000

/* Test if user code is programmed starting from address 'ApplicationAddress' */

if (((*(__IO uint32_t*)APPLICATIONADDRESS) & 0x2FFE0000 ) == 0x20000000)

    {                    

        /* Jump to user application */

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

        Jump_To_Application = (pFunction) JumpAddress;

        /* Initialize user application's Stack Pointer */

        __set_MSP(*(__IO uint32_t*) APPLICATIONADDRESS);

        Jump_To_Application();

    }

the first time after download application, jump to program works perfectly.

But when reset occure, the application deleted and program start at  bootloader !

#problem-jump-application-after-reset
7 REPLIES 7
ST Renegade
Senior
Posted on December 06, 2016 at 14:23

Hey there,

you need to be more verbose otherwise it's hard to help you efficiently.

At the end you mentioned that after reset the application gets deleted. How did you verify this? How can an app be deleted? Does this your bootloader allows? Under which conditions?

I assume you are using your own bootloader which starts from 0x0800 0000 and your app starts at 0x0800 8000, is that right?

Have you checked with ST-Link utility, that the application code is in the 0x0800 8000 range after reset or the memory is empty?

I'm not familiar with F0 devices much, but I assume this will be the same, don't forget to relocate your vector table for your application.

How do you jump into your bootloader and your main app? Do you always jump into your bootloader and from there to your app or not?

Have a nice day,

Renegade

samir2
Associate II
Posted on December 06, 2016 at 14:49

Hi,

Sorry for my short response.

As you said, my bootloader start at 0x0800000 and my application at 0x08008000.

My simple application consist of blinky a led. when bootloader jump to application, I can see

that it work perfectly. I also check memory register and compare it with .hex file ( everything is ok).

So, the problem is when i power down my board and restart it, i can see through

st link utility, memory register empty.

here before reset

0690X00000603TCQAY.jpg

here after reset (or restart my board)

0690X00000603TKQAY.jpg

I relocate my vector table like this :

linker file :   .RAMVectorTable(NOLOAD): {*(.RAMVectorTable)} >VTRAM

main application:

int main(void)

{

    uint32_t ui32_VectorIndex = 0;

    for(ui32_VectorIndex = 0; ui32_VectorIndex < 48; ui32_VectorIndex++)

    {

        VectorTable[ui32_VectorIndex] = *(__IO uint32_t*)((uint32_t)APPLICATION_ADDRESS + (ui32_VectorIndex << 2));

    }

    /* Enable the SYSCFG peripheral clock*/

    RCC_APB2PeriphResetCmd(RCC_APB2Periph_SYSCFG, ENABLE);

    /* Remap SRAM at 0x00000000 */

    SYSCFG_MemoryRemapConfig(SYSCFG_MemoryRemap_SRAM);

Any ideas please

samir2
Associate II
Posted on December 06, 2016 at 16:14

at 0x0800000, there is my bootloader program and also after reset.

Just app is missing.

My bootloader download binary file, flash area memory at 0x08008000 and jump to app...like application note

Posted on December 06, 2016 at 16:22

Well it is going to fail the stack pointer check with 0xFFFFFFFF in the base vector. ie it's not pointing to 0x2000xxxx so the sanity check doesn't allow it to call the application.

You need to review what code you have in the loader or the application that can erase the flash. Instrument that, and understand why/how it is called/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 December 06, 2016 at 15:49

What about your memory at 0x0800 0000? Is it also empty? Or only your main app is missing?

Which operations is your bootloader performing? Can you describe the process a bit more?

Thanks,

Renegade

PS: Have you looked at this application note:

http://www.st.com/content/ccc/resource/technical/document/application_note/48/12/4c/de/62/b1/43/82/DM00050074.pdf/files/DM00050074.pdf/jcr:content/translations/en.DM00050074.pdf

  ? Maybe this can help a lot. :)
ST Renegade
Senior
Posted on December 06, 2016 at 18:38

As Clive said,

there has to be something in your bootloader code, what erases the code in the flash. I hardly think the flash is erased by itself...

Try to debug your code right after reset and go through your bootloader step by step to see, what the bootloader does with your main application. In my opinion you have some function erasing the flash sector/page by sector/page if some condition is not met... This removes your app after reset. Just my opinion.

Good luck with your application!

Have a nice day,

Renegade

Posted on December 06, 2016 at 19:05

/* Enable the SYSCFG peripheral clock*/

    RCC_APB2PeriphResetCmd(RCC_APB2Periph_SYSCFG, ENABLE);

This needs to enable the clock, not reset

RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);

The ST example code is broken, has been for a few years...

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