int32_t main(void)
{
uint8_t temp,i;
uint32_t u32Addr = 0x3fd0;
uint8_t u8Data = 0xaa;
uint16_t u16Data = 0xaa55;
//M0P_CLOCK->PERI_CLKEN_f.GPIO = 1;
M0P_CLOCK->PERI_CLKEN = 0x10100000;
setup();
M0P_GPIO->P0RIE_f.P03=1;
for(i=5;i>0;i--)
{
M0P_GPIO->P0OUT=0xff;
delay1ms(1000);
M0P_GPIO->P0OUT=0x00;
delay1ms(1000);
}
Flash_Init(FlashInt, 0);
Flash_SectorErase(u32Addr);
Flash_WriteByte(u32Addr, u8Data);
//temp=*((volatile uint8_t*)u32Addr);
if(*((volatile uint8_t*)u32Addr) == u8Data)
{
for(i=15;i>0;i--)
{
M0P_GPIO->P0OUT=0xff;
delay1ms(100);
M0P_GPIO->P0OUT=0x00;
delay1ms(1000);
}
}
else
{
for(i=3;i>0;i--)
{
M0P_GPIO->P0OUT=0xff;
delay1ms(500);
M0P_GPIO->P0OUT=0x00;
delay1ms(500);
}
}
while(1);
} |