本文共 2996 字,大约阅读时间需要 9 分钟。
CONFIG_CMD_FAT=y
fs/fat/fat.cfs/fs_internal.cfs/fs.ccmd/fat.c
fatinfo - print information about filesystemfatload - load binary file from a dos filesystemfatls - list files in a directory (default /)fatsize - determine a file's size=> fatinfo mmc 0:1 Interface: MMC Device 0: Vendor: Man 0000fe Snr 00023d01 Rev: 0.0 Prod: SD16G Type: Removable Hard Disk Capacity: 30474.0 MB = 29.7 GB (62410752 x 512)Filesystem: FAT16 "NO NAME => fatload mmc 0:1 0x50008000 uImage1828792 bytes read in 277 ms (6.3 MiB/s)=> fatls mmc 0:1 1828792 uImage1 file(s), 0 dir(s)=> fatsize mmc 0:1 uImage// 没有任何打印
可以从命令解析的角度了解 fat fs
do_fat_fsinfo cmd/fat.c blk_get_device_part_str disk/part.c fat_set_blk_dev fs/fat/fat.c file_fat_detectfs fs/fat/fat.c printf("\n Device %d: ", cur_dev->devnum); dev_print(cur_dev); disk/part.c read_bootsectandvi(&bs, &volinfo, &fatsize) fs/fat/fat.c memcpy(vol_label, volinfo.volume_label, 11) vol_label[11] = '\0'; volinfo.fs_type[5] = '\0'; printf("Filesystem: %s \"%s\"\n", volinfo.fs_type, vol_label);
do_fat_ls cmd/fat.c do_ls fs/fs.c fs_set_blk_dev fs/fs.c blk_get_device_part_str disk/part.c info->probe/fat_set_blk_dev fs/fat/fat.c fs_ls fs/fs.c struct fstype_info *info = fs_get_info(fs_type); fs/fs.c info->ls(dirname);/fs_ls_generic fs/fs.c fs_opendir fs/fs.c struct fstype_info *info = fs_get_info(fs_type); fs/fs.c info->opendir(filename, &dirs);/fat_opendir fs/fat/fat.c dirs->desc = fs_dev_desc; fs/fs.c dirs->part = fs_dev_part; fs/fs.c while(dent = fs_readdir(dirs)) fs/fs.c switch(dent->type){ case FS_DT_DIR: printf(" %s/\n", dent->name);break; case FS_DT_LNK: printf("%s\n", dent->name);break; default: printf(" %8lld %s\n", dent->size, dent->name);break; } fs_closedir fs/fs.c printf("\n%d file(s), %d dir(s)\n\n", nfiles, ndirs);
do_fat_fsload cmd/fat.c do_load fs/fs.c _fs_read fs/fs.c fs_read_lmb_check fs/fs.c info->read/file_fat_read_at fs/fat/fat.c malloc_cache_aligned include/memalign.h fat_itr_root// 填充itr fs/fat/fat.c fat_itr_resolve fs/fat/fat.c get_contents // 搬运数据 fs/fat/fat.c get_cluster fs/fat/fat.c disk_read(startsect, idx, buffer); fs/fat/fat.c blk_dread drivers/block/blk-uclass.c if (size)disk_read(startsect, 1, tmpbuf); memcpy(buffer, tmpbuf, size); printf("%llu bytes read in %lu ms", len_read, time);
=> fatload mmc 0:1 51000000 2led_c.bin1049 bytes read in 20 ms (50.8 KiB/s)=> go 51000000## Starting application at 0x51000000 ...// 此时会看到 led灯闪烁// 一定要主要加载地址和链接地址和运行地址的关系
转载地址:http://gbigi.baihongyu.com/