cancel
Showing results for 
Search instead for 
Did you mean: 

Calling bootloader functions from user application

malfieri9
Associate II
Posted on March 05, 2009 at 06:25

Calling bootloader functions from user application

15 REPLIES 15
malfieri9
Associate II
Posted on May 17, 2011 at 12:56

Does anybody know how to do this?

I'm using IAR wotkbench (5.11)

Thanks for any help

jaroslaw2
Associate II
Posted on May 17, 2011 at 12:56

Hi,

I was thinking about it and this is rather difficult. What you have to do is to modify your linker script, add additional section to the linker script and then place attribute next each function from bootloader. You have to create one project with bootloader and main application. This let you call functions.

The only reading I have found is from Keil,

http://www.keil.com/support/man/docs/armlink/armlink_ccheecgi.htm

Maybe the IAR support could also help??

I didn't have a time to test it, please let me know if you have something in this topic? I will have to do it eventually.

malfieri9
Associate II
Posted on May 17, 2011 at 12:56

jaroslaw.oska thank you for your reply.

The first thing i would think to need is to link the bootloader files into and object module (so all the initializations and startup are correclty managed by linker), and then include this in my application project. In this way the bootloader object module would be an absolute object, in ELF format.

Is it right?

But: how can i input the ILINK linker with an absolut object module so that it can be linked with relocatable objects of the application? is this possible?

jaroslaw2
Associate II
Posted on May 17, 2011 at 12:56

No, I proposed different way. Not to place objects in a specific addresses but rather separate functions.

My idea is to create separate memory space

MEMORY

{

RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 64K

BOOT (rx) : ORIGIN = 0x8000000, LENGTH = 0x2000

FLASH (rx) : ORIGIN = 0x8002000, LENGTH = 512K-0x2000

FLASHB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0

EXTMEMB0 (rx) : ORIGIN = 0x00000000, LENGTH = 0

EXTMEMB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0

EXTMEMB2 (rx) : ORIGIN = 0x00000000, LENGTH = 0

EXTMEMB3 (rx) : ORIGIN = 0x00000000, LENGTH = 0

}

Then if function belongs to bootloader you have to write.

__attribute__((section(�BOOT�))) void BootFunction (vodi) {

}

Normal fucntion should be placed in FLASH reagion.

jaroslaw2
Associate II
Posted on May 17, 2011 at 12:56

In previous generations of arm's it used to be practised to place single functions in RAM to increase execution speed. Try to discover how they do it.

heavelove1
Associate II
Posted on May 17, 2011 at 12:56

Dear jaroslaw.oska,

==The system bootloader in stm32f is start from 0x1FFF F000

==0x1FFF F000~0x1FFF F003 is the init msp value of BootLoader,usually 0x2000 0200.

==0x1FFF F004~0x1FFF F007 is the program start address of BootLoader.

==This region is flash, and not in RAM.

==If wish to place a function into RAM, you can use ''ramfunc'' in IAR.

Regards!

heavelove1
Associate II
Posted on May 17, 2011 at 12:56

==FYI:

void (*pbootloaderEntry)(void) ;

pbootloaderEntry=(void (*)(void)) (*((u32 *) 0x1ffff004));

pbootloaderEntry();

Maybe init MSP from 0x1ffff000(0x20000200) is need before jump.

jaroslaw2
Associate II
Posted on May 17, 2011 at 12:56

Hi heavelove,

Ok jump into RAM region, and then what??? Do you know how to place body of a function into RAM region.

malfieri9
Associate II
Posted on May 17, 2011 at 12:56

Thanks to all!

I still misunderstand something, why are you talking about RAM?

The starting problem was to link two different projects, perhaps the new tool (isymexport) released with IAR Workbench 5.40 could help?

Regards