Lpc54102 iap ram to flash

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Lpc54102 iap ram to flash

Jump to solution
1,218 Views
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?

Labels (1)
0 Kudos
Reply
1 Solution
1,019 Views
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) 

View solution in original post

4 Replies
1,019 Views
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 Kudos
Reply
1,019 Views
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 Kudos
Reply
1,020 Views
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,019 Views
svensavic
Contributor III

That is handy to have cheatsheet. Thanks for that.

0 Kudos
Reply