GD32的Flash的名字是FMC,写入单位是字,也就是四个字节。
void FLASH_ProgramBytes(u32 Address, u8 *Buffer, u16 ByteCount) //Flash写入多个8位字节
{
u16 i = 0; //循环次数
FMC_Unlock();
while(i<ByteCount) //循环字节次数
{
FMC_ProgramWord(Address, *(u32*)Buffer);
i = i+4; //字节数+4
Address = Address + 4; //地址+4
Buffer = Buffer + 4; //要写入的数据字节+4
}
FMC_Lock();
}
|