cancel
Showing results for 
Search instead for 
Did you mean: 

Application start address can be != start of flash ?

ranran
Senior II

Hello,

I need to use the example which boots (jumps) into application in external memory, but with a very slight modification:

So that the start address of application can be somewhere inside the flash, not particulary at the start of flash, as it is not in example:

(1) User application location address is defined in the memory.h file as:

   -QSPI:  #define APPLICATION_ADDRESS      ((uint32_t)0x90000000)

   -NOR :  #define APPLICATION_ADDRESS      ((uint32_t)0x60000000)

   -SDRAM:  #define APPLICATION_ADDRESS      ((uint32_t)0xD0000000)

   -SRAM:  #[define APPLICATION_ADDRESS      ((uint32_t)0x68000000)]​ 

Is that possible ?

I mean, can I use different address, for example for NOR 0x6100000 instead of 0x60000000 ?

My final goal is actually to have 2 different application in external flash (flash NOR) so that the bootloader will choose which of them to jump to.

Thank you,

ran

1 ACCEPTED SOLUTION

Accepted Solutions

You can use many different addresses, most situations the vector table needs to be at an address divisible by 0x200 (512)

The code you build, and it's vector table, needs to be built for the address you place it.

You will need to tell the FMC that the memory window is that big, and you'll need to decode the address bits on the external bus properly.

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

View solution in original post

2 REPLIES 2

You can use many different addresses, most situations the vector table needs to be at an address divisible by 0x200 (512)

The code you build, and it's vector table, needs to be built for the address you place it.

You will need to tell the FMC that the memory window is that big, and you'll need to decode the address bits on the external bus properly.

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

Hello Clive,

In ExtMem_boot example the jump to the other application is done as following:

 /* Initialize user application's Stack Pointer & Jump to user application */
 
 JumpToApplication = (pFunction) (*(__IO uint32_t*) (APPLICATION_ADDRESS + 4));
 
 __set_MSP(*(__IO uint32_t*) APPLICATION_ADDRESS);
 
 JumpToApplication();
 
 
 
 /* We should never get here as execution is now on user application */
 
 while(1)
 
 {
 
 }
 

What I don't find here is the setting of VTOR , but I did find the VTOR setting in the application start.

From past experience with cortex M7, I am familiar with the following jump to address routine which sets VTOR as you can see:

void JumpToApplication(uint32_t start_address)
{
    void (*entry)(void);
    uint32_t pc, sp;
    S32_SCB->VTOR=(uint32_t)(start_address);      /*Relocate interrupt table ptr*/
    sp = *((volatile uint32_t*)start_address);
    asm(" ldr sp, [r0,#0]");
    pc = *((volatile uint32_t *)(start_address + 4));
    entry = (void (*)(void))pc;
    entry();
}

Doesn't it need to be set before the jump in the above code ?

Thank you!

Ran