I am trying to make a secondary bootloader and I have issues copying data from RAM to flash.
I prepared the sector (command 50), erased the page I want to write into. No errors up to this point. Then when I call (command 51) write RAM to Flash, I get return value = 2. “Ram address not a word (or something like that).” Buffer address is at location 0x02000082 (read from debugger). Page I want to write into is 0x00008000 and data buffer is 256 bytes long.
What could be the cause of this error?
i read in user manual that I need to disable ISR. Is that just a case of having all NVIC ISR=0 or there is something else that needs to be disabled?
已解决! 转到解答。
You can never rely on hope for alignment!
instead use the compiler directive when declaring the variable
__attribute__ ((aligned (4)))
Place the directive before your declaration.
See here for more information
I see. Is that the start address requirement or end address? I dont have idea how to force static allocation of buffer at certain location.. I suppose by shuffling variable position in the code? Will that address be guaranteed when optimizer kicks in? Or is there a way to guard part of memory that I need for my buffer?
I am writting the code in C.
You can never rely on hope for alignment!
instead use the compiler directive when declaring the variable
__attribute__ ((aligned (4)))
Place the directive before your declaration.
See here for more information