📄 main.txt
字号:
00005a b138 CBZ r0,|L6.108|
00005c 2000 MOVS r0,#0 ;347
00005e a901 ADD r1,sp,#4 ;347
000060 9a21 LDR r2,[sp,#0x84] ;347
000062 5488 STRB r0,[r1,r2] ;347
000064 a01f ADR r0,|L6.228|
000066 f7fffffe BL __2printf
00006a e002 B |L6.114|
|L6.108|
00006c a025 ADR r0,|L6.260|
00006e f7fffffe BL __2printf
|L6.114|
000072 a829 ADD r0,sp,#0xa4 ;356
000074 f7fffffe BL f_close
000078 2100 MOVS r1,#0 ;359
00007a 4608 MOV r0,r1 ;359
00007c f7fffffe BL f_mount
000080 bf00 NOP
000082 e7d4 B |L6.46|
;;;361
ENDP
|L6.132|
000084 b9d2d4d8 DCB 185,210,212,216,206,196,188,254,207,181,205,179,202,167,176
000088 cec4bcfe
00008c cfb5cdb3
000090 caa7b0
000093 dc282564 DCB 220,"(%d)\r\n",0
000097 290d0a00
00009b 00 DCB 0
|L6.156|
00009c 2f00 DCB "/",0
00009e 00 DCB 0
00009f 00 DCB 0
|L6.160|
0000a0 b4f2bfaa DCB 180,242,191,170,184,249,196,191,194,188,202,167,176,220,"("
0000a4 b8f9c4bf
0000a8 c2bccaa7
0000ac b0dc28
0000af 2564290d DCB "%d)\r\n",0
0000b3 0a00
0000b5 00 DCB 0
0000b6 00 DCB 0
0000b7 00 DCB 0
|L6.184|
0000b8 61726d66 DCB "armfly.txt",0
0000bc 6c792e74
0000c0 787400
0000c3 00 DCB 0
|L6.196|
0000c4 446f6e27 DCB "Don't Find File : armfly.txt\r\n",0
0000c8 74204669
0000cc 6e642046
0000d0 696c6520
0000d4 3a206172
0000d8 6d666c79
0000dc 2e747874
0000e0 0d0a00
0000e3 00 DCB 0
|L6.228|
0000e4 0d0a6172 DCB "\r\narmfly.txt ",206,196,188,254,196,218,200,221," : \r"
0000e8 6d666c79
0000ec 2e747874
0000f0 20cec4bc
0000f4 fec4dac8
0000f8 dd203a20
0000fc 0d
0000fd 0a25730d DCB "\n%s\r\n",0
000101 0a00
000103 00 DCB 0
|L6.260|
000104 0d0a6172 DCB "\r\narmfly.txt ",206,196,188,254,196,218,200,221," : \r"
000108 6d666c79
00010c 2e747874
000110 20cec4bc
000114 fec4dac8
000118 dd203a20
00011c 0d
00011d 0a00 DCB "\n",0
00011f 00 DCB 0
AREA ||i.ViewRootDir||, CODE, READONLY, ALIGN=2
REQUIRE _printf_percent
REQUIRE _printf_d
REQUIRE _printf_int_dec
REQUIRE _printf_s
REQUIRE _printf_str
ViewRootDir PROC
;;;182 */
;;;183 static void ViewRootDir(void)
000000 b530 PUSH {r4,r5,lr}
;;;184 {
000002 f5ad7d1f SUB sp,sp,#0x27c
;;;185 /* 本函数使用的局部变量占用较多,请修改启动文件,保证堆栈空间够用 */
;;;186 FRESULT result;
;;;187 FATFS fs;
;;;188 DIR DirInf;
;;;189 FILINFO FileInf;
;;;190
;;;191 uint8_t tmpStr[20];
;;;192 uint32_t cnt = 0;
000006 2500 MOVS r5,#0
;;;193
;;;194 /* 挂载文件系统 */
;;;195 result = f_mount(0, &fs); /* Mount a logical drive */
000008 a913 ADD r1,sp,#0x4c
00000a 2000 MOVS r0,#0
00000c f7fffffe BL f_mount
000010 4604 MOV r4,r0
;;;196 if (result != FR_OK)
000012 b11c CBZ r4,|L7.28|
;;;197 {
;;;198 printf("挂载文件系统失败 (%d)\r\n", result);
000014 4621 MOV r1,r4
000016 a02a ADR r0,|L7.192|
000018 f7fffffe BL __2printf
|L7.28|
;;;199 }
;;;200
;;;201 /* 打开根文件夹 */
;;;202 result = f_opendir(&DirInf, "/"); /* 如果不带参数,则从当前目录开始 */
00001c a12e ADR r1,|L7.216|
00001e a80c ADD r0,sp,#0x30
000020 f7fffffe BL f_opendir
000024 4604 MOV r4,r0
;;;203 if (result != FR_OK)
000026 b134 CBZ r4,|L7.54|
;;;204 {
;;;205 printf("打开根目录失败 (%d)\r\n", result);
000028 4621 MOV r1,r4
00002a a02c ADR r0,|L7.220|
00002c f7fffffe BL __2printf
|L7.48|
;;;206 return;
;;;207 }
;;;208
;;;209 /* 读取当前文件夹下的文件和目录 */
;;;210 printf("Name\t\tTyepe\t\tSize\r\n");
;;;211 for (cnt = 0; ;cnt++)
;;;212 {
;;;213 result = f_readdir(&DirInf,&FileInf); /* 读取目录项,索引会自动下移 */
;;;214 if (result != FR_OK || FileInf.fname[0] == 0)
;;;215 {
;;;216 break;
;;;217 }
;;;218
;;;219 if (FileInf.fname[0] == '.')
;;;220 {
;;;221 continue;
;;;222 }
;;;223
;;;224 printf("%s", FileInf.fname);
;;;225 if (strlen(FileInf.fname) < 8) /* 对齐 */
;;;226 {
;;;227 printf("\t\t");
;;;228 }
;;;229 else
;;;230 {
;;;231 printf("\t");
;;;232 }
;;;233 if (FileInf.fattrib == AM_DIR)
;;;234 {
;;;235 printf("目录\t\t");
;;;236 }
;;;237 else
;;;238 {
;;;239 printf("文件\t\t");
;;;240 }
;;;241 printf("%d\r\n", FileInf.fsize);
;;;242 sprintf((char *)tmpStr, "%d", FileInf.fsize);
;;;243 }
;;;244
;;;245 /* 卸载文件系统 */
;;;246 f_mount(0, NULL);
;;;247 }
000030 f50d7d1f ADD sp,sp,#0x27c
000034 bd30 POP {r4,r5,pc}
|L7.54|
000036 a02f ADR r0,|L7.244|
000038 f7fffffe BL __2printf
00003c 2500 MOVS r5,#0 ;211
00003e bf00 NOP ;211
|L7.64|
000040 a906 ADD r1,sp,#0x18 ;213
000042 a80c ADD r0,sp,#0x30 ;213
000044 f7fffffe BL f_readdir
000048 4604 MOV r4,r0 ;213
00004a b914 CBNZ r4,|L7.82|
00004c f89d0021 LDRB r0,[sp,#0x21] ;214
000050 b900 CBNZ r0,|L7.84|
|L7.82|
000052 e02d B |L7.176|
|L7.84|
000054 f89d0021 LDRB r0,[sp,#0x21] ;219
000058 282e CMP r0,#0x2e ;219
00005a d100 BNE |L7.94|
00005c e026 B |L7.172|
|L7.94|
00005e f10d0121 ADD r1,sp,#0x21 ;224
000062 a029 ADR r0,|L7.264|
000064 f7fffffe BL __2printf
000068 f10d0021 ADD r0,sp,#0x21 ;225
00006c f7fffffe BL strlen
000070 2808 CMP r0,#8 ;225
000072 d203 BCS |L7.124|
000074 a025 ADR r0,|L7.268|
000076 f7fffffe BL __2printf
00007a e002 B |L7.130|
|L7.124|
00007c a024 ADR r0,|L7.272|
00007e f7fffffe BL __2printf
|L7.130|
000082 f89d0020 LDRB r0,[sp,#0x20] ;233
000086 2810 CMP r0,#0x10 ;233
000088 d103 BNE |L7.146|
00008a a022 ADR r0,|L7.276|
00008c f7fffffe BL __2printf
000090 e002 B |L7.152|
|L7.146|
000092 a022 ADR r0,|L7.284|
000094 f7fffffe BL __2printf
|L7.152|
000098 a022 ADR r0,|L7.292|
00009a 9906 LDR r1,[sp,#0x18] ;241
00009c f7fffffe BL __2printf
0000a0 a122 ADR r1,|L7.300|
0000a2 a801 ADD r0,sp,#4 ;242
0000a4 9a06 LDR r2,[sp,#0x18] ;242
0000a6 f7fffffe BL __2sprintf
0000aa bf00 NOP ;221
|L7.172|
0000ac 1c6d ADDS r5,r5,#1 ;211
0000ae e7c7 B |L7.64|
|L7.176|
0000b0 bf00 NOP ;216
0000b2 2100 MOVS r1,#0 ;246
0000b4 4608 MOV r0,r1 ;246
0000b6 f7fffffe BL f_mount
0000ba bf00 NOP
0000bc e7b8 B |L7.48|
;;;248
ENDP
0000be 0000 DCW 0x0000
|L7.192|
0000c0 b9d2d4d8 DCB 185,210,212,216,206,196,188,254,207,181,205,179,202,167,176
0000c4 cec4bcfe
0000c8 cfb5cdb3
0000cc caa7b0
0000cf dc202825 DCB 220," (%d)\r\n",0
0000d3 64290d0a
0000d7 00
|L7.216|
0000d8 2f00 DCB "/",0
0000da 00 DCB 0
0000db 00 DCB 0
|L7.220|
0000dc b4f2bfaa DCB 180,242,191,170,184,249,196,191,194,188,202,167,176,220," "
0000e0 b8f9c4bf
0000e4 c2bccaa7
0000e8 b0dc20
0000eb 28256429 DCB "(%d)\r\n",0
0000ef 0d0a00
0000f2 00 DCB 0
0000f3 00 DCB 0
|L7.244|
0000f4 4e616d65 DCB "Name\t\tTyepe\t\tSize\r\n",0
0000f8 09095479
0000fc 65706509
000100 0953697a
000104 650d0a00
|L7.264|
000108 257300 DCB "%s",0
00010b 00 DCB 0
|L7.268|
00010c 090900 DCB "\t\t",0
00010f 00 DCB 0
|L7.272|
000110 0900 DCB "\t",0
000112 00 DCB 0
000113 00 DCB 0
|L7.276|
000114 c4bfc2bc DCB 196,191,194,188,"\t\t",0
000118 090900
00011b 00 DCB 0
|L7.284|
00011c cec4bcfe DCB 206,196,188,254,"\t\t",0
000120 090900
000123 00 DCB 0
|L7.292|
000124 25640d0a DCB "%d\r\n",0
000128 00
000129 00 DCB 0
00012a 00 DCB 0
00012b 00 DCB 0
|L7.300|
00012c 256400 DCB "%d",0
00012f 00 DCB 0
AREA ||i.WriteFileTest||, CODE, READONLY, ALIGN=2
REQUIRE _printf_percent
REQUIRE _printf_d
REQUIRE _printf_int_dec
WriteFileTest PROC
;;;442 */
;;;443 static void WriteFileTest(void)
000000 e92d4ff0 PUSH {r4-r11,lr}
;;;444 {
000004 f2ad4d74 SUB sp,sp,#0x474
;;;445 /* 本函数使用的局部变量占用较多,请修改启动文件,保证堆栈空间够用 */
;;;446 FRESULT result;
;;;447 FATFS fs;
;;;448 FIL file;
;;;449 DIR DirInf;
;;;450 uint32_t bw;
;;;451 uint32_t i;
;;;452 uint32_t runtime1,runtime2,timelen;
;;;453 uint8_t err = 0;
000008 f04f0900 MOV r9,#0
;;;454
;;;455 for (i = 0; i < sizeof(g_TestBuf); i++)
00000c 2600 MOVS r6,#0
00000e e008 B |L8.34|
|L8.16|
;;;456 {
;;;457 g_TestBuf[i] = (i % 10) + '0';
000010 200a MOVS r0,#0xa
000012 fbb6f1f0 UDIV r1,r6,r0
000016 fb006011 MLS r0,r0,r1,r6
00001a 3030 ADDS r0,r0,#0x30
00001c 493c LDR r1,|L8.272|
00001e 5588 STRB r0,[r1,r6]
000020 1c76 ADDS r6,r6,#1 ;455
|L8.34|
000022 2e32 CMP r6,#0x32 ;455
000024 d3f4 BCC |L8.16|
;;;458 }
;;;459
;;;460 /* 挂载文件系统 */
;;;461 result = f_mount(0, &fs); /* Mount a logical drive */
000026 a991 ADD r1,sp,#0x244
000028 2000 MOVS r0,#0
00002a f7fffffe BL f_mount
00002e 4604 MOV r4,r0
;;;462 if (result != FR_OK)
000030 b11c CBZ r4,|L8.58|
;;;463 {
;;;464 printf("挂载文件系统失败 (%d)\r\n", result);
000032 4621 MOV r1,r4
000034 a037 ADR r0,|L8.276|
000036 f7fffffe BL __2printf
|L8.58|
;;;465 }
;;;466
;;;467 /* 打开根文件夹 */
;;;468 result = f_opendir(&DirInf, "/"); /* 如果不带参数,则从当前目录开始 */
00003a a13c ADR r1,|L8.300|
00003c a801 ADD r0,sp,#4
00003e f7fffffe BL f_opendir
000042 4604 MOV r4,r0
;;;469 if (result != FR_OK)
000044 b13c CBZ r4,|L8.86|
;;;470 {
;;;471 printf("打开根目录失败 (%d)\r\n", result);
000046 4621 MOV r1,r4
000048 a039 ADR r0,|L8.304|
00004a f7fffffe BL __2printf
|L8.78|
;;;472 return;
;;;473 }
;;;474
;;;475 /* 打开文件 */
;;;476 result = f_open(&file, "Speed1.txt", FA_CREATE_ALWAYS | FA_WRITE);
;;;477
;;;478 /* 写一串数据 */
;;;479 // TEST_FILE_LEN (2*1024*1024) /* 用于测试的文件长度 */
;;;480 //#define BUF_SIZE 512 /* 每次读写SD卡的最大数据长度 */
;;;481 //uint8_t g_TestBuf[BUF_SIZE];
;;;482 //
;;;483 printf("开始写文件 %dKB ...\r\n", TEST_FILE_LEN / 1024);
;;;484 runtime1 = bsp_GetRunTime(); /* 读取系统运行时间 */
;;;485 for (i = 0; i < TEST_FILE_LEN / BUF_SIZE; i++) ////4096
;;;486 {
;;;487 result = f_write(&file, g_TestBuf, sizeof(g_TestBuf), &bw);
;;;488 if (result == FR_OK)
;;;489 {
;;;490 if ((i % 100) == 0)
;;;491 {
;;;492 bsp_LedToggle(1); /* 闪烁LED---change0---1 ????? */
;;;493 }
;;;494 }
;;;495 else
;;;496 {
;;;497 err = 1;
;;;498 printf("Speed1.txt 文件写失败\r\n");
;;;499 break;
;;;500 }
;;;501 }
;;;502 runtime2 = bsp_GetRunTime(); /* 读取系统运行时间 */
;;;503
;;;504 if (err == 0)
;;;505 {
;;;506 timelen = (runtime2 - runtime1);
;;;507 printf(" 写耗长 : %dms 平均写速度 : %dB/S (%dKB/S)\r\n", timelen,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -