Lpc54102 iap ram to flash

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Lpc54102 iap ram to flash

ソリューションへジャンプ
1,216件の閲覧回数
svensavic
Contributor III

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?

ラベル(1)
0 件の賞賛
返信
1 解決策
1,017件の閲覧回数
converse
Senior Contributor V

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 

Using the GNU Compiler Collection (GCC) 

元の投稿で解決策を見る

4 返答(返信)
1,017件の閲覧回数
converse
Senior Contributor V

Your ram needs to be 4-byte (word) aligned. So, the address needs to end with a 0,4,8, or C. Your address is only 2-byte aligned.

0 件の賞賛
返信
1,017件の閲覧回数
svensavic
Contributor III

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. 

0 件の賞賛
返信
1,018件の閲覧回数
converse
Senior Contributor V

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 

Using the GNU Compiler Collection (GCC) 

1,017件の閲覧回数
svensavic
Contributor III

That is handy to have cheatsheet. Thanks for that.

0 件の賞賛
返信