cancel
Showing results for 
Search instead for 
Did you mean: 

ROP and bootloader

jfelix
Associate II
Posted on June 27, 2012 at 18:20

Hi,

Does anybody knows how to jump properly to Bootloader entry point at adress 0x602D?

I 've tried :

#define BOOTLOADER_ADDR 0x602Dul

typedef  void (*TFunction)(void);

void JumpToBootLoader(void)

{

const TFunction MainUserApplication = (TFunction)BOOTLOADER_ADDR ;

TFunction GoAddress;

GoAddress();

}

but it does not seems to go the entry point.

Many thanks,

jfelix

9 REPLIES 9
elil
Associate III
Posted on July 11, 2012 at 08:59

Felix,

GoAddress does not point to BOOTLOADER_ADDR,moreover, it is not initialized.

Try MainUserApplication() instead of GoAddress(); 

Good luck!

jfelix
Associate II
Posted on July 12, 2012 at 11:52

Thank you Yevpator,

Well now the micro seems to jump but I did not succeed to enter the bootloader. No answer from bootloader but I'm still trying...

I'll give you an update when I will finaly manage to use the bootloader.

Felix

elil
Associate III
Posted on July 12, 2012 at 12:46

Hi Felix,

As I understand, you try to activate the build-in STM8 bootloader. Recently I managed to do that. Be aware that different MCU in this family have different entry addresses of the Boot-loader. So check what is the correct address for MCU you use.

I also understand that you want to bypass the ROP checking, don't you ? I mean that you try to jump to the point where usually Bootloader should come after the ROP byte is tested.

But check also if Bootloader is enabled in Option bytes. The default is disable : 0000. To enable that you need to write 55AA in the appropriate Option bytes. If you didn't enable these option bytes, the Bootloader would run only if the device is virgin, and this is not your case, since you're writing a program...

Good luck !

elil
Associate III
Posted on August 27, 2012 at 17:33

Hi Felix.

Did you manage to solve the problem ? If so, would you please share here your results ?

I'm asking, since I have the same problem now...

Thanks.

Thank you Yevpator,

Well now the micro seems to jump but I did not succeed to enter the bootloader. No answer from bootloader but I'm still trying...

I'll give you an update when I will finaly manage to use the bootloader.

Felix

jfelix
Associate II
Posted on August 28, 2012 at 13:40

Hi all,

I have to postpone this work since I have others issues to deal with. As soon as I come back to bootloader I will share my results.

Many thanks

elil
Associate III
Posted on August 30, 2012 at 11:45

Felix,

I managed to do that.

Before you jump to the Bootloader entry you should release all the peripheral essential for Bootloader. Since no list with the peripherals being used by Bootloader is provided, when I want to start Bootloader, I put a label(flag) in the Data EEPROM and then expect for POR. After POR, I check if this flag is signalling. If it is, then I jump. That is to say, if you jump to the Bootloader immediately after POR, you don't have to take care about releasing peripherals.

Please pay attention that you have 1 sec for starting communication with bootloader, afterwards Bootloader jumps back to the application program.

Hope you find this information helpful.

Good luck !

jfelix
Associate II
Posted on October 16, 2012 at 14:44

Hi Yevpator,

Now it works perfectly. 

Your last comment was very helpfull to me, many thanks!

felix

 

From: Yevpator

Posted: Thursday, August 30, 2012 11:45 AM

Subject: ROP and bootloader

Felix,

I managed to do that.

Before you jump to the Bootloader entry you should release all the peripheral essential for Bootloader. Since no list with the peripherals being used by Bootloader is provided, when I want to start Bootloader, I put a label(flag) in the Data EEPROM and then expect for POR. After POR, I check if this flag is signalling. If it is, then I jump. That is to say, if you jump to the Bootloader immediately after POR, you don't have to take care about releasing peripherals.

Please pay attention that you have 1 sec for starting communication with bootloader, afterwards Bootloader jumps back to the application program.

Hope you find this information helpful.

Good luck !

elil
Associate III
Posted on October 16, 2012 at 21:56

It's my pleasure.

np1
Associate II
Posted on May 10, 2013 at 11:17

Hi,

Can you share your code? I try to do but can not enter bootloader when ROP eneble

Thanks very much