cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 Boot Loader Function Calls

design5
Associate II
Posted on October 26, 2008 at 23:48

STM32 Boot Loader Function Calls

3 REPLIES 3
design5
Associate II
Posted on May 17, 2011 at 12:48

Hi fellow programmers:

Does anybody know if the Boot Loader Functions are available to be called from an application?

There would be functions in the boot loader for handling the communications, then other functions for writing to flash, the functions to wait for flash timing, then functions for reading flash, etc.

If function calls were available, then they may be useful for making some flash operate as EE memory for data storage. It seems like a waste of effort to write one's own code if the System Memory can be accessed.

Does anybody know if the source code is available for the boot loader? If not, does anybody know how to read-out the system memory so it can be disassembled?

Thanks,

Garry.

lanchon
Associate II
Posted on May 17, 2011 at 12:48

hi d6,

the BL (''system memory'') is aliased to address 0 at reset if the BL is selected. the code could be compiled to run at address 0 or at its sys mem address (or a mixture of both). in the former case, invoking it from your code wouldn't work. excluding the mixture scenario, an easy way to distinguish between these two options is by taking a look at the value of the reset vector in the beginning of sys mem.

ST is not disclosing the code though we've asked, which is a pity. it could be used as a start to write your own BL or to better understand flash programming. it'd also reassure those of us who doubt its security. (unfortunately ST's secrecy on this matter has precisely the opposite effect on me.)

ST doesn't want you to use the BL from your code, as evidenced by the complete lack of info on how to do it. that's understandable; they want to be free to change the BL as they see fit. for instance, they might one day add more peripherals as sources of user code. reverse engineering the BL for security analysis or just for the heck of it would be a good move. but using the result of the analysis to invoke the BL from your production code would be a mistake IMHO.

> It seems like a waste of effort to write one's own code if the System Memory can be accessed.

that's why I say having the source code would be a good starting point for our work.

> If function calls were available, then they may be useful for making some flash operate as EE memory for data storage.

there's no read-while-write on the STM32 flash, so either the core would stall or you'd have to be running your code from RAM. few apps could tolerate not being responsive to interrupts during write operations. I believe there's sample code by ST to emulate EEPROM with flash.

> does anybody know how to read-out the system memory so it can be disassembled?

apparently you can simply dump it with your debugger or read it with your code. that's what I heard anyway.

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

If you can read chinese, see this link:

http://bbs.21ic.com/club/bbs/list.asp?boardid=49&t=3048847&tp=%u5982%u4F55%u8DF3%u8F6C%u5230stm32f%u7684bootloader%u521D%u63A2%uFF1A

these code is readout use IAR and ST-LINK II.