Lars Kruse wrote:
Attached you find the assembler code, that I used to accomplish this.
Now you can use "normal" inline assembly like this:
inline void flash_t::Erase(address_t page)
{
asm volatile( "\r\n"
" push %B0 \r\n"
" push %A0 \r\n"
" popx.a %A0 \r\n"
" mov %3, %2 \r\n" // FCTL1 = FWKEY | ERASE;
" clrx 0(%A0) \r\n"
:"=r"(page)
:"0"(page), "m"(FCTL1), "i"((uint16_t)FWKEY | ERASE)
);
}
Sergey.
