iar下对stm8s的flash进行块操作,哪位成功了吗,用了__ramfunc关键字把操作放到ram里边操作了,还是不行,贴上块擦除的代码
__ramfunc void erase_block(uint8_t *BlockAddress)
{
/* Enable erase block mode */
FLASH_CR2_ERASE = 1;
FLASH_NCR2_NERASE = 0;
*BlockAddress = (uint8_t)0;
*(BlockAddress + 1) = (uint8_t)0;
*(BlockAddress + 2) = (uint8_t)0;
*(BlockAddress + 3) = (uint8_t)0;
} |