embeded/Cortex-M3 Ti2012. 11. 6. 14:56
근 일주일을 골머리 아프게 만든 녀석...
데이터를 저장하는데 귀찮아서 몇단계 래핑해버리고 쓰다보니
그리고 정말정말 운이좋게 4의 배수로 저장이 되서 티가 안났었는데
이번에 프로그램을 수정/확장하다가 우연히 발견.. -_-

아무튼, LM3S에서(cortex-m3) FlashProgram()을 통해서 내장 플래시에 데이터를 써넣을때
4바이트 align이 되지 않으면 미치거나 죽는다 -_- (무한루프 돌고 있을지도?)
어쩌면 쓰긴 쓰는데 개비지 값이 이상한데로 튀어서 SRAM 영역 건드리는게 아닐까 싶을 정도.. FlashProgram
Programs flash.
long FlashProgram(unsigned long *pulData, unsigned long ulAddress, unsigned long ulCount)
pulData is a pointer to the data to be programmed.
ulAddress is the starting address in flash to be programmed. Must be a multiple of four.
ulCount is the number of bytes to be programmed. Must be a multiple of four.
This function programs a sequence of words into the on-chip flash. Each word in a page of
flash can only be programmed one time between an erase of that page; programming a word
multiple times results in an unpredictable value in that word of flash.
Because the flash is programmed one word at a time, the starting address and byte count
must both be multiples of four. It is up to the caller to verify the programmed contents, if such
verification is required.
This function does not return until the data has been programmed.
Returns 0 on success, or -1 if a programming error is encountered.  

Posted by 구차니