cancel
Showing results for 
Search instead for 
Did you mean: 

Jump to application. STM32F051 vs STM32L151 (M0 to M3)

JFELI.13
Associate III
 
15 REPLIES 15

Why would they be different from the 'F051 case?

JW

If they are machine code, probably that the CM0 has a significantly reduced instruction set and flexibility.

I don't think you can load SP directly, you have to move to r[0..7] one first, and the move over

ie

LDR R0, [R0, #0]

MOV SP,R0

vs

LDR SP,[R0, #0]

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

The array of things you change has to be 0x20000000

This mirrors or shadows at 0x00000000

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

Because it is ;)

It works on STM32F051, it doedn't on STM32L151

JFELI.13
Associate III

Y Tesla DeLorean

Thanks a lot for answering to me, it seems it's quite difficult to have solutions for this kind of problem.

  • Bootloader run individually (if there is no PROGRAM1 ou PROGRAM2 datas in flash)
  • PROGRAM1 or PROGRAM2 run too.
  • I putted PROGRAM vectors area at PROGRAM_ADRESS_VECTORS (so 0x... area copied at , for example, 0x400), program code area is at +0x200. This is done by a c# soft who mix bootloader file with program file.
#define BOOTLOADER_ADRESS 0x5B000  
#define VECT_OFFSET 0x00
#define PROGRAM1_ADDR_VECTORS     0x400    // ... <0x326FF  
#define PROGRAM2_ADDR_VECTORS     0x2E000  // ... <0x5B000 

What I did

void JumpToAddress(unsigned long addr)
{
    typedef void (*FunctionPointer)(void);
    FunctionPointer functionPtr = (FunctionPointer)addr;
    functionPtr();
}
 
void TestJump()
{
    unsigned long x4;
 
    union
    {
        unsigned long addr;
        FunctionPointer funcPtr;
    } jump;
 
    jump.addr = PROGRAM1_ADDR_VECTORS;
    SCB_VTOR = PROGRAM1_ADDR_VECTORS;
    WHILE1LEDXX // this line will do LED flashing. I can see PC register is in bootloader area, not in program area
    JumpToAddress(jump.addr);  //if no line "WHILE1LEDXX" I will see PC register is in program area but nothing happen. 
 
    delay_ms(3000);
}

I suppose VTOR must have PC vectors value but it seem it doesn't here

If you have solution ....

JFELI.13
Associate III

Update: it's OK now !!

I can use a bootloader, writed with StmCubeIde and launch a program writed with MikroC