[mw_shl_code=c,true]#include "stm32f10x.h"
#include "string.h"
uint16_t LEDTimeCnt = 0;
void stConfig(void);
void delayMs( u32 nMs);
int main(void)
{
FATFS *fs;
FRESULT res;
FIL fsrc,fdst;
BYTE textFileBuffer[] = "_^ \r\n";
UINT bw;
u8 m =3;
stConfig();
disk_initialize(MMC);
mem_init();
fs = (FATFS*)mymalloc(sizeof(FATFS));
m = f_mount(fs,"0:",0);
GUI_DispDec(m,1);
res = f_open(&fdst,"0:/Demo.TXT",FA_CREATE_NEW | FA_WRITE);
if ( res == FR_OK )
{
res = f_write(&fdst, textFileBuffer, sizeof(textFileBuffer), &bw);
GUI_DispString( "\r\n OK \n" );
f_close(&fdst);
}
else if ( res == FR_EXIST )
{
GUI_DispString( "\r\n Extern \n" );
}
GUI_DispString( "\r\n sdfd\n" );
GUI_DispDec(res,2);
while(1)
{
}
}
void stConfig(void)
{
u32 sd_size;
SysTick_Init();
/**CRC??enWin??????????????????????????±??¤??×???
???ùSTenWin????????????ST??????????±?????????·¨????*/
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_CRC,ENABLE);
//emwin
GUI_Init();
GUI_SetBkColor(GUI_BLUE);
GUI_Clear();
}
[/mw_shl_code]
加入mem_init();或者fs = (FATFS*)mymalloc(sizeof(FATFS));后,程序完全错了!不像跑飞!可能是堆栈溢出还是什么?
程序中植入了emwin裸机,从初始化来看,先是进行显示屏清屏(蓝底),然后再执行
mem_init();
fs = (FATFS*)mymalloc(sizeof(FATFS));
但是下载后显示屏是白色的,也就是说没进行清屏(没对显示屏进行操作)。
去掉
mem_init();
fs = (FATFS*)mymalloc(sizeof(FATFS));
显示屏正常清屏,但是发f_mount()返回值 m = 0,而f_open()返回值 res = 12;即FR_NOT_ENABLED, /* (12) The volume has no work area */
对文件系统这块刚刚接触完全不懂!哪位大神指导下,感激不尽。
FR_NOT_ENABLED, /* (12) The volume has no work area */mem_init();
fs = (FATFS*)mymalloc(sizeof(FATFS));这两个函数都是从论坛开发板历程上的。
|