Mark Butcher

utFAT ported to i.MX RT

Discussion created by Mark Butcher on Mar 10, 2020

Hi All

 

I have just ported utFAT to the i.MX RT USDHC - a binary is available here: https://www.utasker.com/iMX/RT1020.html for testing on the i.MX RT 1020 board.

 

Complete project code size is 43.5k including a DOS like interface on the VCOM UART at 115k Baud and advanced file analysis capabilities :

 

  Disk interface
===================
up           go to main menu
info         utFAT/card info
dir          [path] show directory content
dird         [path] show deleted directory content
dirh         [path] show hidden content
infof        [path] show file info
infod        [path] show deleted info
cd           [path] change dir. (.. for up)
comp         compare [file1] with [file2]
file         [path] new empty file
write        [path] test write to file
mkdir        new empty dir
rename       [from] [to] rename
trunc        truncate to [length] [path]
copy         [file1] to [file2]
hide         [path] file/dir to hide
unhide       [path] file/dir to un-hide
prot         [path] file/dir to write-protect
unprot       [path] file/dir to un-protect
print        [path] print file content
del          [path] delete file or dir.
sect         [hex no.] display sector
sectw        [hex no.] [offset] [val] [cnt]
help         Display menu specific help
quit         Leave command mode
>



SD-card V2 - High Capacity
Disk D mounted



D:\>info


Disk NO NAME (7761920 kBytes) SDHC FAT32
Bytes per sector: 512
Cluster size: 32768
Directory base: 0x00000002
FAT start: 0x0000005f
FAT size: 0x00000768
Number of FATs: 1
LBA: 0x000007c7
Total clusters: 0x0003b360
Info sect: 0x00000040
Free clusters: 0x0003b35c
Next free: 0x00000006
CSD: 0x40 0x0e 0x00 0x32 0x5b 0x59 0x00 0x00 0x3b 0x37 0x7f 0x80 0x0a 0x40 0x40 0x00
D:\>


#dir
Directory D:\


---- 01.01.2018  00:00 <DIR>            DIR_1
---- 09.03.2020  12:00 <DIR>            dir_2
0 files with 0 bytes
2 directories, 7760768 kBytes free


D:\>infof dir_2
Directory: dir_2 is LFN
Starting at entry 0x01 in sector 0x000007c7 (cluster 0x00000002)
First object from 1
Data = 0x41 0x64 0x00 0x69 0x00 0x72 0x00 0x5f 0x00 0x32 0x00 0x0f 0x00 0x60 0x00 0x00 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0x00 0x00 0xff 0xff 0xff 0xff
SFN File located at entry 0x02 in sector 0x000007c7 (cluster 0x00000002)
Data = 0x20 0x00 0x0f 0x03 0x17 0x15 0x0b 0x0e 0x2f 0x00 0x00 0x10 0x00 0x00 0x00 0x60 0x69 0x50 0x69 0x50 0x00 0x00 0x00 0x60 0x69 0x50 0x05 0x00 0x00 0x00 0x00 0x00
SFN name (directory) =  ......./.. Alias CS = 0x60 starting in sector 0x00000887 (cluster 0x00000005) FAT sector 0x0000005f offset 0x05


D:\>sect 5f
Reading sector 0x0000005f
0xfffffff8 0xffffffff 0x0fffffff 0x0fffffff 0x0fffffff 0x0fffffff 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000

 

 

utFAT user's document (compatible for Kinetis and i.MX RT): https://www.utasker.com/docs/uTasker/uTasker_utFAT.PDF

 

The utFAT interface allows secure SD card firmware updates with the uTasker Boot Loader too: https://www.utasker.com/docs/uTasker/uTaskerSerialLoader.pdf

 

The operation (i.MX RT, USDHC, FAT, SD-card) is simulated when built with VisualStudio and can be built for the target HW with IAR, MCUXpresso, Keil or GCC make file.

 

Regards

 

Mark
[uTasker project developer for Kinetis and i.MX RT]

Outcomes