2009-03-04 09:25 PM
Calling bootloader functions from user application
2011-05-17 03:56 AM
Does anybody know how to do this?
I'm using IAR wotkbench (5.11) Thanks for any help2011-05-17 03:56 AM
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.2011-05-17 03:56 AM
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?2011-05-17 03:56 AM
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.2011-05-17 03:56 AM
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.
2011-05-17 03:56 AM
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!2011-05-17 03:56 AM
==FYI:
void (*pbootloaderEntry)(void) ; pbootloaderEntry=(void (*)(void)) (*((u32 *) 0x1ffff004)); pbootloaderEntry(); Maybe init MSP from 0x1ffff000(0x20000200) is need before jump.2011-05-17 03:56 AM
Hi heavelove,
Ok jump into RAM region, and then what??? Do you know how to place body of a function into RAM region.2011-05-17 03:56 AM
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