doubao_chat/apps/common/example/peripheral/flash/flash_opt/main.c

29 lines
664 B
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include "app_config.h"
#include "system/includes.h"
#include "fs/fs.h"
#include "asm/sfc_norflash_api.h"
#ifdef USE_FLASH_OPT_TEST_DEMO
static int c_main(void)
{
printf("norflash_otp test \n");
int norflash_eraser_otp(void);
int norflash_write_otp(u8 * buf, int len);
int norflash_read_otp(u8 * buf, int len);
u8 buf[32];
for (int i = 0; i < 32; i++) {
buf[i] = i;
}
norflash_eraser_otp();//擦除
norflash_write_otp(buf, 32);//写,读写最大字节:768
memset(buf, 0, 32);
norflash_read_otp(buf, 32);//读,读写最大字节:768
put_buf(buf, 32);
return 0;
}
late_initcall(c_main);
#endif