Fork of my MQTTGateway

Dependencies:   mbed-http

Committer:
vpcola
Date:
Sat Apr 08 14:45:51 2017 +0000
Revision:
0:f1d3878b8dd9
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
vpcola 0:f1d3878b8dd9 1 # mbed OS SDCard Driver (sd-driver) for FAT32 Filesystem Support
vpcola 0:f1d3878b8dd9 2
vpcola 0:f1d3878b8dd9 3
vpcola 0:f1d3878b8dd9 4 Simon Hughes
vpcola 0:f1d3878b8dd9 5
vpcola 0:f1d3878b8dd9 6 20170329
vpcola 0:f1d3878b8dd9 7
vpcola 0:f1d3878b8dd9 8 Version 1.00
vpcola 0:f1d3878b8dd9 9
vpcola 0:f1d3878b8dd9 10
vpcola 0:f1d3878b8dd9 11 # Executive Summary
vpcola 0:f1d3878b8dd9 12
vpcola 0:f1d3878b8dd9 13 The purpose of this document is to describe how to use the mbed OS SDCard
vpcola 0:f1d3878b8dd9 14 driver (sd-driver) so applications can read/write
vpcola 0:f1d3878b8dd9 15 data to flash storage cards using the standard POSIX File API
vpcola 0:f1d3878b8dd9 16 programming interface. The sd-driver uses the SDCard SPI-mode of operation
vpcola 0:f1d3878b8dd9 17 which is a subset of possible SDCard functionality.
vpcola 0:f1d3878b8dd9 18
vpcola 0:f1d3878b8dd9 19 This repository contains the mbed-os SDCard driver for generic SPI
vpcola 0:f1d3878b8dd9 20 SDCard support and other resources, as outlined below:
vpcola 0:f1d3878b8dd9 21
vpcola 0:f1d3878b8dd9 22 - `SDBlockDevice.h` and `SDBlockDevice.cpp`. This is the SDCard driver module presenting
vpcola 0:f1d3878b8dd9 23 a Block Device API (derived from BlockDevice) to the underlying SDCard.
vpcola 0:f1d3878b8dd9 24 - POSIX File API test cases for testing the FAT32 filesystem on SDCard.
vpcola 0:f1d3878b8dd9 25 - basic.cpp, a basic set of functional test cases.
vpcola 0:f1d3878b8dd9 26 - fopen.cpp, more functional tests reading/writing greater volumes of data to SDCard, for example.
vpcola 0:f1d3878b8dd9 27 - `mbed_app.json` mbed-os application configuration file with SPI pin configurations for the CI shield and overrides for specific targets.
vpcola 0:f1d3878b8dd9 28 This file allows the SPI pins to be specified for the target without having to edit the implementation files.
vpcola 0:f1d3878b8dd9 29 - This README which includes [Summary of POSIX File API Documentation](#summary-posix-api-documentation)
vpcola 0:f1d3878b8dd9 30 including detailed instruction on how to use the FAT filesystem and SDBlockDevice driver.
vpcola 0:f1d3878b8dd9 31
vpcola 0:f1d3878b8dd9 32 The SDCard driver is maintained in this repository as a component separate from the main mbed OS repository.
vpcola 0:f1d3878b8dd9 33 Hence the 2 repositories (mbed-os and sd-driver) have to be used together
vpcola 0:f1d3878b8dd9 34 to deliver the FAT32 Filesystem/SDCard support. This document explains how to do this.
vpcola 0:f1d3878b8dd9 35
vpcola 0:f1d3878b8dd9 36
vpcola 0:f1d3878b8dd9 37 # Introduction
vpcola 0:f1d3878b8dd9 38
vpcola 0:f1d3878b8dd9 39 ### Overview
vpcola 0:f1d3878b8dd9 40
vpcola 0:f1d3878b8dd9 41 The scope of this document is to describe how applications use the FAT filesystem and sd-driver
vpcola 0:f1d3878b8dd9 42 components to persistently store data on SDCards. The document is intended to help developers adopt the
vpcola 0:f1d3878b8dd9 43 mbed OS POSIX File API support, and in particular to help explain:
vpcola 0:f1d3878b8dd9 44
vpcola 0:f1d3878b8dd9 45 - How the software components work together to deliver the storage functionality.
vpcola 0:f1d3878b8dd9 46 - How to work with the sd-driver and mbed OS to build the examples. The example code can easily
vpcola 0:f1d3878b8dd9 47 be copied into your new application code.
vpcola 0:f1d3878b8dd9 48 - How to work with the CI Test Shield, which adds an SDCard slot to those targets that do not have already have one.
vpcola 0:f1d3878b8dd9 49 - How to run the POSIX File API mbed Greentea test cases, which provide further example code of how to use
vpcola 0:f1d3878b8dd9 50 the POSIX File API.
vpcola 0:f1d3878b8dd9 51
vpcola 0:f1d3878b8dd9 52 Section 1 provides an Executive Summary, describing the purpose of the sd-driver, the supporting
vpcola 0:f1d3878b8dd9 53 software, examples, test cases and documentation.
vpcola 0:f1d3878b8dd9 54
vpcola 0:f1d3878b8dd9 55 Section 2 provides an an overview of the material covered including descriptions of the major sections.
vpcola 0:f1d3878b8dd9 56
vpcola 0:f1d3878b8dd9 57 Section 3 provides an overview of the mbed OS filesystem software components,
vpcola 0:f1d3878b8dd9 58 including the inter-relationships between the application, POSIX file API, the standard c-library,
vpcola 0:f1d3878b8dd9 59 the mbed OS filesystem and the SDCard driver (sd-driver).
vpcola 0:f1d3878b8dd9 60
vpcola 0:f1d3878b8dd9 61 Section 4 describes how to build and run an example application for reading
vpcola 0:f1d3878b8dd9 62 and writing data to an SDCard using the POSIX File API. The example begins by describing
vpcola 0:f1d3878b8dd9 63 the procedure for building and testing on the K64F target. The final sub-sections
vpcola 0:f1d3878b8dd9 64 describe how to use the test shield to add an SDCard slot to any mbed target,
vpcola 0:f1d3878b8dd9 65 and hence enable the persistent storage of data on any supported target.
vpcola 0:f1d3878b8dd9 66
vpcola 0:f1d3878b8dd9 67 Section 5 describes an example application which uses the raw
vpcola 0:f1d3878b8dd9 68 BlockDevice API to read and write data to the SDCard.
vpcola 0:f1d3878b8dd9 69
vpcola 0:f1d3878b8dd9 70 Section 6 describes how to build and run the SDCard POSIX File API mbed Greentea test cases.
vpcola 0:f1d3878b8dd9 71 There are a number of functional test cases demonstrating how to use the
vpcola 0:f1d3878b8dd9 72 mbed OS POSIX File API.
vpcola 0:f1d3878b8dd9 73
vpcola 0:f1d3878b8dd9 74 Section 7 describes the POSIX File API and provides links to useful API documentation web pages.
vpcola 0:f1d3878b8dd9 75
vpcola 0:f1d3878b8dd9 76
vpcola 0:f1d3878b8dd9 77 ### Known mbed-os and sd-driver Compatible Versions
vpcola 0:f1d3878b8dd9 78
vpcola 0:f1d3878b8dd9 79 The following versions of the mbed-os and sd-driver repositories are known to work together:
vpcola 0:f1d3878b8dd9 80
vpcola 0:f1d3878b8dd9 81 - {mbed-os, sd-driver} = {mbed-os-5.4.0-rc2, sd-driver-0.0.1-mbed-os-5.4.0-rc2}.
vpcola 0:f1d3878b8dd9 82 `K64F`, `NUCLEO_F429ZI` and `UBLOX_EVK_ODIN_W2` fopen and basic filesystem tests working.
vpcola 0:f1d3878b8dd9 83 - {mbed-os, sd-driver} = {mbed-os-5.4.0, sd-driver-0.0.2-mbed-os-5.4.0}.
vpcola 0:f1d3878b8dd9 84 `K64F`, `NUCLEO_F429ZI` and `UBLOX_EVK_ODIN_W2` fopen and basic filesystem tests working.
vpcola 0:f1d3878b8dd9 85 - {mbed-os, sd-driver} = {mbed-os-5.4.1, sd-driver-0.0.3-mbed-os-5.4.1}.
vpcola 0:f1d3878b8dd9 86
vpcola 0:f1d3878b8dd9 87 To find the latest compatible versions, use the following command to see the messages attached to the tags
vpcola 0:f1d3878b8dd9 88 in the sd-driver repository:
vpcola 0:f1d3878b8dd9 89
vpcola 0:f1d3878b8dd9 90 ex_app7/$ cd sd-driver
vpcola 0:f1d3878b8dd9 91 ex_app7/sd-driver$ git tag -n
vpcola 0:f1d3878b8dd9 92 sd-driver-0.0.1-mbed-os-5.3.4 Version compatible with mbed-os-5.3.4, and private_mbedos_filesystems-0.0.1-mbed-os-5.3.4.
vpcola 0:f1d3878b8dd9 93 sd-driver-0.0.2-mbed-os-5.4.0 Updated README.md to include worked exmaples and restructuring of information.
vpcola 0:f1d3878b8dd9 94 sd-driver-0.0.3-mbed-os-5.4.1 Version compatible with mbed-os-5.4.1.
vpcola 0:f1d3878b8dd9 95
vpcola 0:f1d3878b8dd9 96
vpcola 0:f1d3878b8dd9 97 ### Known Issues With This Document
vpcola 0:f1d3878b8dd9 98
vpcola 0:f1d3878b8dd9 99 There are no known issues with this document.
vpcola 0:f1d3878b8dd9 100
vpcola 0:f1d3878b8dd9 101
vpcola 0:f1d3878b8dd9 102 # Overview of mbed OS Filesystem Software Component Stack
vpcola 0:f1d3878b8dd9 103
vpcola 0:f1d3878b8dd9 104
vpcola 0:f1d3878b8dd9 105 ------------------------
vpcola 0:f1d3878b8dd9 106 | |
vpcola 0:f1d3878b8dd9 107 | Application | // This application uses the POSIX File API
vpcola 0:f1d3878b8dd9 108 | | // to read/write data to persistent storage backends.
vpcola 0:f1d3878b8dd9 109 ------------------------
vpcola 0:f1d3878b8dd9 110
vpcola 0:f1d3878b8dd9 111 ------------------------ // POSIX File API (ISO).
vpcola 0:f1d3878b8dd9 112
vpcola 0:f1d3878b8dd9 113 ------------------------
vpcola 0:f1d3878b8dd9 114 | |
vpcola 0:f1d3878b8dd9 115 | libc | // The standard c library implementation
vpcola 0:f1d3878b8dd9 116 | | // e.g. newlib.
vpcola 0:f1d3878b8dd9 117 ------------------------
vpcola 0:f1d3878b8dd9 118
vpcola 0:f1d3878b8dd9 119 ------------------------ // sys_xxx equivalent API.
vpcola 0:f1d3878b8dd9 120
vpcola 0:f1d3878b8dd9 121 ------------------------
vpcola 0:f1d3878b8dd9 122 | |
vpcola 0:f1d3878b8dd9 123 | mbed_retarget.cpp | // Target specific mapping layer.
vpcola 0:f1d3878b8dd9 124 | |
vpcola 0:f1d3878b8dd9 125 ------------------------
vpcola 0:f1d3878b8dd9 126
vpcola 0:f1d3878b8dd9 127 ------------------------ // Filesystem Upper Edge API.
vpcola 0:f1d3878b8dd9 128
vpcola 0:f1d3878b8dd9 129 ------------------------
vpcola 0:f1d3878b8dd9 130 | |
vpcola 0:f1d3878b8dd9 131 | File System | // File system wrappers and implementation.
vpcola 0:f1d3878b8dd9 132 | |
vpcola 0:f1d3878b8dd9 133 ------------------------
vpcola 0:f1d3878b8dd9 134
vpcola 0:f1d3878b8dd9 135 ------------------------ // FS Lower Edge API (Block Store Interface).
vpcola 0:f1d3878b8dd9 136
vpcola 0:f1d3878b8dd9 137 ------------------------
vpcola 0:f1d3878b8dd9 138 | Block API |
vpcola 0:f1d3878b8dd9 139 | Device Driver | // The SDCard driver, for example.
vpcola 0:f1d3878b8dd9 140 | e.g. sd-driver |
vpcola 0:f1d3878b8dd9 141 ------------------------
vpcola 0:f1d3878b8dd9 142
vpcola 0:f1d3878b8dd9 143 ------------------------ // SPI.h interface.
vpcola 0:f1d3878b8dd9 144
vpcola 0:f1d3878b8dd9 145 ------------------------
vpcola 0:f1d3878b8dd9 146 | |
vpcola 0:f1d3878b8dd9 147 | SPI | // SPI subsystem (C++ classes and C-HAL implementation).
vpcola 0:f1d3878b8dd9 148 | |
vpcola 0:f1d3878b8dd9 149 ------------------------
vpcola 0:f1d3878b8dd9 150
vpcola 0:f1d3878b8dd9 151 Figure 1. mbedOS generic architecture of filesystem software stack.
vpcola 0:f1d3878b8dd9 152
vpcola 0:f1d3878b8dd9 153 The figure above shows the mbed OS software component stack used for data
vpcola 0:f1d3878b8dd9 154 storage on SDCard:
vpcola 0:f1d3878b8dd9 155
vpcola 0:f1d3878b8dd9 156 - At the top level is the application component which uses the standard POSIX File API
vpcola 0:f1d3878b8dd9 157 to read and write application data to persistent storage.
vpcola 0:f1d3878b8dd9 158 - The newlib standard library (libc) stdio.h interface (POSIX File API)
vpcola 0:f1d3878b8dd9 159 implementation is used as it's optimised for resource limited embedded systems.
vpcola 0:f1d3878b8dd9 160 - mbed_retarget.cpp implements the libc back-end file OS handlers and maps them
vpcola 0:f1d3878b8dd9 161 to the FileSystem.
vpcola 0:f1d3878b8dd9 162 - The File System code (hosted in mbed-os) is composed of 2 parts:
vpcola 0:f1d3878b8dd9 163 - The mbed OS file system wrapper classes (e.g. FileSystem, File, FileBase classes)
vpcola 0:f1d3878b8dd9 164 which are used to present a consistent API to the retarget module for different
vpcola 0:f1d3878b8dd9 165 (third-party) file system implementations.
vpcola 0:f1d3878b8dd9 166 - The FAT filesystem implementation code.
vpcola 0:f1d3878b8dd9 167 The [FATFS: Generic FAT File System Module](http://elm-chan.org/fsw/ff/00index_e.html)
vpcola 0:f1d3878b8dd9 168 (ChanFS) has been integrated within mbed-os.
vpcola 0:f1d3878b8dd9 169 - The Block API Device Driver. The SDCard driver is an example of a persistent storage driver.
vpcola 0:f1d3878b8dd9 170 It's maintained as a separate component from the mbed OS repository (in this repository).
vpcola 0:f1d3878b8dd9 171 - The SPI module provides the mbed OS generic SPI API. This functionality is maintained in
vpcola 0:f1d3878b8dd9 172 mbed OS.
vpcola 0:f1d3878b8dd9 173
vpcola 0:f1d3878b8dd9 174
vpcola 0:f1d3878b8dd9 175 # SDCard POSIX File API Example App for Reading/Writing Data
vpcola 0:f1d3878b8dd9 176
vpcola 0:f1d3878b8dd9 177 ### Overview
vpcola 0:f1d3878b8dd9 178
vpcola 0:f1d3878b8dd9 179 This section describes how to build and run an example application that
vpcola 0:f1d3878b8dd9 180 uses the POSIX File API to read and write data to SDCard. The discussion begins by
vpcola 0:f1d3878b8dd9 181 descibing how to run the example on the FRDM K64F target, but this is later
vpcola 0:f1d3878b8dd9 182 generalised to all target platforms that have the standard
vpcola 0:f1d3878b8dd9 183 Arduino form factor headers. Tthe Continuous Integration (CI) Test Shield
vpcola 0:f1d3878b8dd9 184 can be inserted into the headers to add a SDCard slot to the target.
vpcola 0:f1d3878b8dd9 185
vpcola 0:f1d3878b8dd9 186 The example code is a modified version of the
vpcola 0:f1d3878b8dd9 187 [mbed-os-example-fat-filesystem](https://github.com/ARMmbed/mbed-os-example-fat-filesystem) example
vpcola 0:f1d3878b8dd9 188 modified for use with the sd-driver.
vpcola 0:f1d3878b8dd9 189
vpcola 0:f1d3878b8dd9 190 The following sub-sections describe the steps for building and running the example:
vpcola 0:f1d3878b8dd9 191
vpcola 0:f1d3878b8dd9 192 - The [Pre-Requisites](#pre-requisites) section describes the development environment used for this example.
vpcola 0:f1d3878b8dd9 193 Other similar development environments can be used.
vpcola 0:f1d3878b8dd9 194 - The [Create the Example Project](#create-the-example-project) section describes how the application project is created
vpcola 0:f1d3878b8dd9 195 by including the mbed-os and sd-driver code.
vpcola 0:f1d3878b8dd9 196 - The [Build the Example Project](#build-the-example-project) section describes how to build the example application.
vpcola 0:f1d3878b8dd9 197 - The [Insert SDCard into K64F](#insert-sdcard-into-k64f) section describes how to select a card and insert it into the
vpcola 0:f1d3878b8dd9 198 SDCard slot on the K64F.
vpcola 0:f1d3878b8dd9 199 - The [Run the Example Binary on the K64F](#run-the-example-binary-on-the-k64f) section describes how to run the
vpcola 0:f1d3878b8dd9 200 example binary on the target and verify the example has run correctly.
vpcola 0:f1d3878b8dd9 201 - The [Testing with an SDCard on Target XYZ](#testing-with-an-sdcard-on-target-xyx) section describes the use
vpcola 0:f1d3878b8dd9 202 of Continuous Integration Test Shield, which hosts an SDCard slot. By inserting the CI test shield into the
vpcola 0:f1d3878b8dd9 203 Arduino headers of an mbed target platform, the SDCard/FAT Filesystem components can be used to store data
vpcola 0:f1d3878b8dd9 204 persistently on any standard mbed target development board.
vpcola 0:f1d3878b8dd9 205
vpcola 0:f1d3878b8dd9 206
vpcola 0:f1d3878b8dd9 207 ### <a name="pre-requisites"></a> Pre-Requisites
vpcola 0:f1d3878b8dd9 208
vpcola 0:f1d3878b8dd9 209 To work through this example, you should have a working development environment on your machine. For example,
vpcola 0:f1d3878b8dd9 210 the following tools should be installed:
vpcola 0:f1d3878b8dd9 211
vpcola 0:f1d3878b8dd9 212 - A compiler e.g. arm-none-eabi-gcc.
vpcola 0:f1d3878b8dd9 213 - Python 2.7.9 or later.
vpcola 0:f1d3878b8dd9 214 - [mbed Greentea](https://github.com/armmbed/greentea), the mbed OS test tool.
vpcola 0:f1d3878b8dd9 215 - Git Bash or a similar git command line tool to interact with the ARM mbed GitHub repositories.
vpcola 0:f1d3878b8dd9 216 - [mbed-cli](https://github.com/armmbed/mbed-cli), the tool used to make mbed OS application and test builds.
vpcola 0:f1d3878b8dd9 217
vpcola 0:f1d3878b8dd9 218 For more information on how to setup a development environment, please review the documentation on the
vpcola 0:f1d3878b8dd9 219 [mbed documentation site](https://docs.mbed.com).
vpcola 0:f1d3878b8dd9 220
vpcola 0:f1d3878b8dd9 221
vpcola 0:f1d3878b8dd9 222 ### <a name="create-the-example-project"></a> Create the Example Project
vpcola 0:f1d3878b8dd9 223
vpcola 0:f1d3878b8dd9 224 First create the top level application directory sd_ex1 and move into it:
vpcola 0:f1d3878b8dd9 225
vpcola 0:f1d3878b8dd9 226 simhug01@E107851:/d/demo_area$ mkdir sd_ex1
vpcola 0:f1d3878b8dd9 227 simhug01@E107851:/d/demo_area$ cd sd_ex1
vpcola 0:f1d3878b8dd9 228 simhug01@E107851:/d/demo_area/sd_ex1$
vpcola 0:f1d3878b8dd9 229
vpcola 0:f1d3878b8dd9 230 Next, perform the "mbed new" operation to download the mbed-os repository into this directory:
vpcola 0:f1d3878b8dd9 231
vpcola 0:f1d3878b8dd9 232 simhug01@E107851:/d/demo_area/sd_ex1$ mbed new .
vpcola 0:f1d3878b8dd9 233 [mbed] Creating new program "ex_sdcard" (git)
vpcola 0:f1d3878b8dd9 234 [mbed] Adding library "mbed-os" from "https://github.com/ARMmbed/mbed-os" at branch latest
vpcola 0:f1d3878b8dd9 235 [mbed] Updating reference "mbed-os" -> "https://github.com/ARMmbed/mbed-os/#5faf4b26c5954d15c7c1cccac6498e0c690ad101"
vpcola 0:f1d3878b8dd9 236 warning: LF will be replaced by CRLF in mbed-os.lib.
vpcola 0:f1d3878b8dd9 237 The file will have its original line endings in your working directory.
vpcola 0:f1d3878b8dd9 238 (mx1_venv1) simhug01@E107851:/d/demo_area/sd_ex1$ ls -1
vpcola 0:f1d3878b8dd9 239 mbed-os
vpcola 0:f1d3878b8dd9 240 mbed-os.lib
vpcola 0:f1d3878b8dd9 241 mbed_settings.py
vpcola 0:f1d3878b8dd9 242 (mx1_venv1) simhug01@E107851:/d/demo_area/sd_ex1$
vpcola 0:f1d3878b8dd9 243
vpcola 0:f1d3878b8dd9 244 Next, get add the sd-driver component to the application project:
vpcola 0:f1d3878b8dd9 245
vpcola 0:f1d3878b8dd9 246 simhug01@E107851:/d/demo_area/sd_ex1$ mbed add sd-driver
vpcola 0:f1d3878b8dd9 247 <trace removed>
vpcola 0:f1d3878b8dd9 248 simhug01@E107851:/d/demo_area/sd_ex1$
vpcola 0:f1d3878b8dd9 249
vpcola 0:f1d3878b8dd9 250 Next, copy the example1.cpp file and `mbed_app.json` files from inside the sd-driver directory to the top level sd_ex1 directory:
vpcola 0:f1d3878b8dd9 251
vpcola 0:f1d3878b8dd9 252 simhug01@E107851:/d/demo_area/sd_ex1$ cp sd-driver/features/TESTS/examples/example1.cpp .
vpcola 0:f1d3878b8dd9 253 simhug01@E107851:/d/demo_area/sd_ex1$ cp sd-driver/config/mbed_app.json .
vpcola 0:f1d3878b8dd9 254 simhug01@E107851:/d/demo_area/sd_ex1$
vpcola 0:f1d3878b8dd9 255
vpcola 0:f1d3878b8dd9 256 The `mbed_app.json` file specifies the SPI bus pin configuration for different targets.
vpcola 0:f1d3878b8dd9 257 The file includes a specific configuration of the K64F which is used
vpcola 0:f1d3878b8dd9 258 because the mbed compile command specifies the K64F build target. The `mbed_app.json` file
vpcola 0:f1d3878b8dd9 259 is described in more detail in the [Testing with an SDCard on Target XYZ](#testing-with-an-sdcard-on-target-xyx) section.
vpcola 0:f1d3878b8dd9 260
vpcola 0:f1d3878b8dd9 261 ### <a name="build-the-example-project"></a> Build the Example Project
vpcola 0:f1d3878b8dd9 262
vpcola 0:f1d3878b8dd9 263 Next, build the example application:
vpcola 0:f1d3878b8dd9 264
vpcola 0:f1d3878b8dd9 265 simhug01@E107851:/d/demo_area/sd_ex1$ mbed compile -m K64F -t GCC_ARM
vpcola 0:f1d3878b8dd9 266
vpcola 0:f1d3878b8dd9 267
vpcola 0:f1d3878b8dd9 268 #### WARNING: "mbed new ." command and possible mbed-os sd-driver versioning incompatibilities
vpcola 0:f1d3878b8dd9 269
vpcola 0:f1d3878b8dd9 270 If you experience problems building the example then it may mean the version
vpcola 0:f1d3878b8dd9 271 of the mbed-os repository created with the "mbed new ." command is not compatible with
vpcola 0:f1d3878b8dd9 272 the sd-driver repository version created with "mbed add sd-driver" command. This is because:
vpcola 0:f1d3878b8dd9 273
vpcola 0:f1d3878b8dd9 274 - The "mbed new ." creates the mbed-os repository at the latest "Release" e.g. `mbed-os-5.4.0`.
vpcola 0:f1d3878b8dd9 275 - The "mbed add sd-driver" command creates the sd-driver repository at the latest version of
vpcola 0:f1d3878b8dd9 276 master i.e. the tip of master. Changes may be present that are not compatible with
vpcola 0:f1d3878b8dd9 277 the latest mbed-os release e.g. in preparation for the next release.
vpcola 0:f1d3878b8dd9 278
vpcola 0:f1d3878b8dd9 279 This situation can be resolved by checking out compatible versions of the repositories as
vpcola 0:f1d3878b8dd9 280 described in the section [Setting mbed-os/sd-driver Repositories To Compatible Versions](#settting-repos-to-compatible-versions)
vpcola 0:f1d3878b8dd9 281
vpcola 0:f1d3878b8dd9 282 ### <a name="insert-sdcard-into-k64f"></a> Insert SDCard into K64F
vpcola 0:f1d3878b8dd9 283
vpcola 0:f1d3878b8dd9 284 The examples and test cases have been run on a K64F with the following pre-formatted microSDHC cards:
vpcola 0:f1d3878b8dd9 285
vpcola 0:f1d3878b8dd9 286 - Kingston 2GB mircoSDHC card.
vpcola 0:f1d3878b8dd9 287 - Kingston 8GB mircoSDHC card.
vpcola 0:f1d3878b8dd9 288 - SanDisk 16GB mircoSDHC ultra card.
vpcola 0:f1d3878b8dd9 289
vpcola 0:f1d3878b8dd9 290 If the card requires formatting then the following procedure is known to work:
vpcola 0:f1d3878b8dd9 291
vpcola 0:f1d3878b8dd9 292 - Insert microSD card into SD adapter in USB stick (or similar) so the microSD card can be insert into windows PC.
vpcola 0:f1d3878b8dd9 293 - Within file explorer, right click/Format on the USB drive.
vpcola 0:f1d3878b8dd9 294 - Select FAT32, 4096 cluster size, Quick Format.
vpcola 0:f1d3878b8dd9 295 - Format the drive.
vpcola 0:f1d3878b8dd9 296
vpcola 0:f1d3878b8dd9 297 The microSD card should then be ready for use in the K64F. Insert the formatted card
vpcola 0:f1d3878b8dd9 298 into the SDCard slot on the K64F PCB.
vpcola 0:f1d3878b8dd9 299
vpcola 0:f1d3878b8dd9 300
vpcola 0:f1d3878b8dd9 301 ### <a name="run-the-example-binary-on-the-k64f"></a> Run the Example Binary on the K64F
vpcola 0:f1d3878b8dd9 302
vpcola 0:f1d3878b8dd9 303 Once the binary is built, copy the binary from `/d/demo_area/sd_ex1/BUILD/K64F/GCC_ARM/example1.bin` to the K64F.
vpcola 0:f1d3878b8dd9 304 After connecting a serial console and resetting the target, the following trace should be seen:
vpcola 0:f1d3878b8dd9 305
vpcola 0:f1d3878b8dd9 306 Welcome to the filesystem example.
vpcola 0:f1d3878b8dd9 307 Opening a new file, numbers.txt. done.
vpcola 0:f1d3878b8dd9 308 Writing decimal numbers to a file (20/20) done.
vpcola 0:f1d3878b8dd9 309 Closing file. done.
vpcola 0:f1d3878b8dd9 310 Re-opening file read-only. done.
vpcola 0:f1d3878b8dd9 311 Dumping file to screen.
vpcola 0:f1d3878b8dd9 312 0
vpcola 0:f1d3878b8dd9 313 1
vpcola 0:f1d3878b8dd9 314 2
vpcola 0:f1d3878b8dd9 315 3
vpcola 0:f1d3878b8dd9 316 4
vpcola 0:f1d3878b8dd9 317 5
vpcola 0:f1d3878b8dd9 318 6
vpcola 0:f1d3878b8dd9 319 7
vpcola 0:f1d3878b8dd9 320 8
vpcola 0:f1d3878b8dd9 321 9
vpcola 0:f1d3878b8dd9 322 10
vpcola 0:f1d3878b8dd9 323 11
vpcola 0:f1d3878b8dd9 324 12
vpcola 0:f1d3878b8dd9 325 13
vpcola 0:f1d3878b8dd9 326 14
vpcola 0:f1d3878b8dd9 327 15
vpcola 0:f1d3878b8dd9 328 16
vpcola 0:f1d3878b8dd9 329 17
vpcola 0:f1d3878b8dd9 330 18
vpcola 0:f1d3878b8dd9 331 19
vpcola 0:f1d3878b8dd9 332 EOF.
vpcola 0:f1d3878b8dd9 333 Closing file. done.
vpcola 0:f1d3878b8dd9 334 Opening root directory. done.
vpcola 0:f1d3878b8dd9 335 Printing all filenames:
vpcola 0:f1d3878b8dd9 336 numbers.txt
vpcola 0:f1d3878b8dd9 337 Closeing root directory. done.
vpcola 0:f1d3878b8dd9 338 Filesystem Demo complete.
vpcola 0:f1d3878b8dd9 339
vpcola 0:f1d3878b8dd9 340
vpcola 0:f1d3878b8dd9 341 ### <a name="testing-with-an-sdcard-on-target-xyx"></a> Testing with an SDCard on Target XYZ
vpcola 0:f1d3878b8dd9 342
vpcola 0:f1d3878b8dd9 343 The standard way to test is with the mbed CI Test Shield plugged into the
vpcola 0:f1d3878b8dd9 344 target board. This pin mapping for this configuration is parameterised in
vpcola 0:f1d3878b8dd9 345 the `mbed_app.json` file.
vpcola 0:f1d3878b8dd9 346
vpcola 0:f1d3878b8dd9 347 The following is an example of the `mbed_app.json` file available in the repository:
vpcola 0:f1d3878b8dd9 348
vpcola 0:f1d3878b8dd9 349 {
vpcola 0:f1d3878b8dd9 350 "config": {
vpcola 0:f1d3878b8dd9 351 "UART_RX": "D0",
vpcola 0:f1d3878b8dd9 352 "UART_TX": "D1",
vpcola 0:f1d3878b8dd9 353 "DIO_0": "D0",
vpcola 0:f1d3878b8dd9 354 "DIO_1": "D1",
vpcola 0:f1d3878b8dd9 355 "DIO_2": "D2",
vpcola 0:f1d3878b8dd9 356 "DIO_3": "D3",
vpcola 0:f1d3878b8dd9 357 "DIO_4": "D4",
vpcola 0:f1d3878b8dd9 358 "DIO_5": "D5",
vpcola 0:f1d3878b8dd9 359 "DIO_6": "D6",
vpcola 0:f1d3878b8dd9 360 "DIO_7": "D7",
vpcola 0:f1d3878b8dd9 361 "DIO_8": "D8",
vpcola 0:f1d3878b8dd9 362 "DIO_9": "D9",
vpcola 0:f1d3878b8dd9 363 "SPI_CS": "D10",
vpcola 0:f1d3878b8dd9 364 "SPI_MOSI": "D11",
vpcola 0:f1d3878b8dd9 365 "SPI_MISO": "D12",
vpcola 0:f1d3878b8dd9 366 "SPI_CLK": "D13",
vpcola 0:f1d3878b8dd9 367 "I2C_SDA": "D14",
vpcola 0:f1d3878b8dd9 368 "I2C_SCL": "D15",
vpcola 0:f1d3878b8dd9 369 "I2C_TEMP_ADDR":"0x90",
vpcola 0:f1d3878b8dd9 370 "I2C_EEPROM_ADDR":"0xA0",
vpcola 0:f1d3878b8dd9 371 "AIN_0": "A0",
vpcola 0:f1d3878b8dd9 372 "AIN_1": "A1",
vpcola 0:f1d3878b8dd9 373 "AIN_2": "A2",
vpcola 0:f1d3878b8dd9 374 "AIN_3": "A3",
vpcola 0:f1d3878b8dd9 375 "AIN_4": "A4",
vpcola 0:f1d3878b8dd9 376 "AIN_5": "A5",
vpcola 0:f1d3878b8dd9 377 "AOUT" : "A5",
vpcola 0:f1d3878b8dd9 378 "PWM_0": "D3",
vpcola 0:f1d3878b8dd9 379 "PWM_1": "D5",
vpcola 0:f1d3878b8dd9 380 "PWM_2": "D6",
vpcola 0:f1d3878b8dd9 381 "PWM_3": "D9",
vpcola 0:f1d3878b8dd9 382 "DEBUG_MSG": 0,
vpcola 0:f1d3878b8dd9 383 "DEVICE_SPI": 1,
vpcola 0:f1d3878b8dd9 384 "FSFAT_SDCARD_INSTALLED": 1
vpcola 0:f1d3878b8dd9 385 },
vpcola 0:f1d3878b8dd9 386 "target_overrides": {
vpcola 0:f1d3878b8dd9 387 "DISCO_F051R8": {
vpcola 0:f1d3878b8dd9 388 "SPI_MOSI": "SPI_MOSI",
vpcola 0:f1d3878b8dd9 389 "SPI_MISO": "SPI_MISO",
vpcola 0:f1d3878b8dd9 390 "SPI_CLK": "SPI_SCK",
vpcola 0:f1d3878b8dd9 391 "SPI_CS": "SPI_CS"
vpcola 0:f1d3878b8dd9 392 },
vpcola 0:f1d3878b8dd9 393 "K20D50M": {
vpcola 0:f1d3878b8dd9 394 "SPI_MOSI": "PTD2",
vpcola 0:f1d3878b8dd9 395 "SPI_MISO": "PTD3",
vpcola 0:f1d3878b8dd9 396 "SPI_CLK": "PTD1",
vpcola 0:f1d3878b8dd9 397 "SPI_CS": "PTC2"
vpcola 0:f1d3878b8dd9 398 },
vpcola 0:f1d3878b8dd9 399 "KL22F": {
vpcola 0:f1d3878b8dd9 400 "SPI_MOSI": "PTD6",
vpcola 0:f1d3878b8dd9 401 "SPI_MISO": "PTD7",
vpcola 0:f1d3878b8dd9 402 "SPI_CLK": "PTD5",
vpcola 0:f1d3878b8dd9 403 "SPI_CS": "PTD4"
vpcola 0:f1d3878b8dd9 404 },
vpcola 0:f1d3878b8dd9 405 "KL25Z": {
vpcola 0:f1d3878b8dd9 406 "SPI_MOSI": "PTD2",
vpcola 0:f1d3878b8dd9 407 "SPI_MISO": "PTD3",
vpcola 0:f1d3878b8dd9 408 "SPI_CLK": "PTD1",
vpcola 0:f1d3878b8dd9 409 "SPI_CS": "PTD0"
vpcola 0:f1d3878b8dd9 410 },
vpcola 0:f1d3878b8dd9 411 "KL43Z": {
vpcola 0:f1d3878b8dd9 412 "SPI_MOSI": "PTD6",
vpcola 0:f1d3878b8dd9 413 "SPI_MISO": "PTD7",
vpcola 0:f1d3878b8dd9 414 "SPI_CLK": "PTD5",
vpcola 0:f1d3878b8dd9 415 "SPI_CS": "PTD4"
vpcola 0:f1d3878b8dd9 416 },
vpcola 0:f1d3878b8dd9 417 "KL46Z": {
vpcola 0:f1d3878b8dd9 418 "SPI_MOSI": "PTD6",
vpcola 0:f1d3878b8dd9 419 "SPI_MISO": "PTD7",
vpcola 0:f1d3878b8dd9 420 "SPI_CLK": "PTD5",
vpcola 0:f1d3878b8dd9 421 "SPI_CS": "PTD4"
vpcola 0:f1d3878b8dd9 422 },
vpcola 0:f1d3878b8dd9 423 "K64F": {
vpcola 0:f1d3878b8dd9 424 "SPI_MOSI": "PTE3",
vpcola 0:f1d3878b8dd9 425 "SPI_MISO": "PTE1",
vpcola 0:f1d3878b8dd9 426 "SPI_CLK": "PTE2",
vpcola 0:f1d3878b8dd9 427 "SPI_CS": "PTE4"
vpcola 0:f1d3878b8dd9 428 },
vpcola 0:f1d3878b8dd9 429 "K66F": {
vpcola 0:f1d3878b8dd9 430 "SPI_MOSI": "PTE3",
vpcola 0:f1d3878b8dd9 431 "SPI_MISO": "PTE1",
vpcola 0:f1d3878b8dd9 432 "SPI_CLK": "PTE2",
vpcola 0:f1d3878b8dd9 433 "SPI_CS": "PTE4"
vpcola 0:f1d3878b8dd9 434 },
vpcola 0:f1d3878b8dd9 435 "LPC11U37H_401": {
vpcola 0:f1d3878b8dd9 436 "SPI_MOSI": "SDMOSI",
vpcola 0:f1d3878b8dd9 437 "SPI_MISO": "SDMISO",
vpcola 0:f1d3878b8dd9 438 "SPI_CLK": "SDSCLK",
vpcola 0:f1d3878b8dd9 439 "SPI_CS": "SDSSEL"
vpcola 0:f1d3878b8dd9 440 },
vpcola 0:f1d3878b8dd9 441 "LPC2368": {
vpcola 0:f1d3878b8dd9 442 "SPI_MOSI": "p11",
vpcola 0:f1d3878b8dd9 443 "SPI_MISO": "p12",
vpcola 0:f1d3878b8dd9 444 "SPI_CLK": "p13",
vpcola 0:f1d3878b8dd9 445 "SPI_CS": "p14"
vpcola 0:f1d3878b8dd9 446 },
vpcola 0:f1d3878b8dd9 447 "NUCLEO_L031K6": {
vpcola 0:f1d3878b8dd9 448 "SPI_MOSI": "SPI_MOSI",
vpcola 0:f1d3878b8dd9 449 "SPI_MISO": "SPI_MISO",
vpcola 0:f1d3878b8dd9 450 "SPI_CLK": "SPI_SCK",
vpcola 0:f1d3878b8dd9 451 "SPI_CS": "SPI_CS"
vpcola 0:f1d3878b8dd9 452 },
vpcola 0:f1d3878b8dd9 453 "nRF51822": {
vpcola 0:f1d3878b8dd9 454 "SPI_MOSI": "p12",
vpcola 0:f1d3878b8dd9 455 "SPI_MISO": "p13",
vpcola 0:f1d3878b8dd9 456 "SPI_CLK": "p15",
vpcola 0:f1d3878b8dd9 457 "SPI_CS": "p14"
vpcola 0:f1d3878b8dd9 458 },
vpcola 0:f1d3878b8dd9 459 "RZ_A1H": {
vpcola 0:f1d3878b8dd9 460 "SPI_MOSI": "P8_5",
vpcola 0:f1d3878b8dd9 461 "SPI_MISO": "P8_6",
vpcola 0:f1d3878b8dd9 462 "SPI_CLK": "P8_3",
vpcola 0:f1d3878b8dd9 463 "SPI_CS": "P8_4"
vpcola 0:f1d3878b8dd9 464 }
vpcola 0:f1d3878b8dd9 465 }
vpcola 0:f1d3878b8dd9 466 }
vpcola 0:f1d3878b8dd9 467
vpcola 0:f1d3878b8dd9 468 Note the following things about the `mbed_app.json` file:
vpcola 0:f1d3878b8dd9 469
vpcola 0:f1d3878b8dd9 470 - The `mbed_app.json` file is used to define target specific symbols for the SPI pins connecting the SDCard slot to the target MCU:
vpcola 0:f1d3878b8dd9 471 - "SPI\_CS". This is the Chip Select line.
vpcola 0:f1d3878b8dd9 472 - "SPI\_MOSI". This is the Master Out Slave In data line.
vpcola 0:f1d3878b8dd9 473 - "SPI\_MISO". This is the Master In Slave Out data line.
vpcola 0:f1d3878b8dd9 474 - "SPI\_CLK". This is the serial Clock line.
vpcola 0:f1d3878b8dd9 475 - The default configuration defined in the "config" section is for the standard Arduino header pin mappings for the SPI bus.
vpcola 0:f1d3878b8dd9 476 The "config" section defines a dictionary mapping functional names to target board Arduino header pins:
vpcola 0:f1d3878b8dd9 477 - "SPI\_CS": "D10". This causes the MBED\_CONF\_APP\_SPI\_CS symbol to be defined in mbed\_config.h as D10, which is used in the filesystem test implementation.
vpcola 0:f1d3878b8dd9 478 D10 is defined in the target specific PinNames.h file.
vpcola 0:f1d3878b8dd9 479 - "SPI\_MOSI": "D11". This causes the MBED\_CONF\_APP\_SPI\_MOSI symbol to be defined in mbed\_config.h.
vpcola 0:f1d3878b8dd9 480 - "SPI\_MISO": "D12". This causes the MBED\_CONF\_APP\_SPI\_MISO symbol to be defined in mbed\_config.h.
vpcola 0:f1d3878b8dd9 481 - "SPI\_CLK": "D13". This causes the MBED\_CONF\_APP\_SPI\_CLK symbol to be defined in mbed\_config.h.
vpcola 0:f1d3878b8dd9 482 - The `"target_overrides"` section is used to override the "SPI\_xxx" symbols for specific target boards, which may have an SDCard slot, for example.
vpcola 0:f1d3878b8dd9 483 This is the case for the K64F, where the "SPI\_xxx" are mapped to the pin names for the on-board SDCard.
vpcola 0:f1d3878b8dd9 484
vpcola 0:f1d3878b8dd9 485 ```
vpcola 0:f1d3878b8dd9 486 "K64F": {
vpcola 0:f1d3878b8dd9 487 "SPI_MOSI": "PTE3",
vpcola 0:f1d3878b8dd9 488 "SPI_MISO": "PTE1",
vpcola 0:f1d3878b8dd9 489 "SPI_CLK": "PTE2",
vpcola 0:f1d3878b8dd9 490 "SPI_CS": "PTE4"
vpcola 0:f1d3878b8dd9 491 }
vpcola 0:f1d3878b8dd9 492 ```
vpcola 0:f1d3878b8dd9 493 - Thus, in the absence of any target specific definitions in the `"target_overrides"` section, all boards will default to
vpcola 0:f1d3878b8dd9 494 using the Arduino header configuration. For those platforms with a `"target_overrides"` section then this configuration
vpcola 0:f1d3878b8dd9 495 will be used in preference.
vpcola 0:f1d3878b8dd9 496 - Hence in the case that you want to test a platform with an SDCard inserted into a
vpcola 0:f1d3878b8dd9 497 fitted CI test shield (rather than the on-board SDCard slot)
vpcola 0:f1d3878b8dd9 498 and there is a `"target_overrides"` section present in the `mbed_app.json` file, you must then delete the `"target_overrides"`
vpcola 0:f1d3878b8dd9 499 section before building. This will result in the default configuration being used (suitable for the CI
vpcola 0:f1d3878b8dd9 500 Test Shield).
vpcola 0:f1d3878b8dd9 501 - Note when inserting the v1.0.0 CI Test Shield into the Arduino header of the target platform, the shield pins D0 and
vpcola 0:f1d3878b8dd9 502 D1 should be bent to be parallel to the shield PCB so they are not inserted into the Arduino header. This is because
vpcola 0:f1d3878b8dd9 503 some boards use the same UART on DAPLINK and D0/D1, which means the serial debug channel breaks and hence the mbed greentea
vpcola 0:f1d3878b8dd9 504 test suite will not work correctly. This is mainly on older ST boards and should not be a problem on
vpcola 0:f1d3878b8dd9 505 `K64F`, `NUCLEO_F429ZI` and `UBLOX_EVK_ODIN_W2`. Note also that the v2.0.0 CI Test Shield doesn't suffer from this
vpcola 0:f1d3878b8dd9 506 problem and the pins don't need to be bent.
vpcola 0:f1d3878b8dd9 507 - When inserting the SDCard into the card slot on the CI test shield, make sure the card is fully inserted.
vpcola 0:f1d3878b8dd9 508 On insertion, there should be a small clicking sound when the card registers, and the back edge of the card
vpcola 0:f1d3878b8dd9 509 should protrude no more than ~1mm over the edge of the CI test shield PCB. If the SDCard fails to register,
vpcola 0:f1d3878b8dd9 510 try gently pushing the metal flexible strip in the shape of a spade at the top edge of the SDCard metal slot
vpcola 0:f1d3878b8dd9 511 casing with a pair of tweezers, bending it a little to lower it into the slot casing. This helps with the
vpcola 0:f1d3878b8dd9 512 insertion mechanism.
vpcola 0:f1d3878b8dd9 513
vpcola 0:f1d3878b8dd9 514
vpcola 0:f1d3878b8dd9 515 ### Target K64F with CI Test Shield fitted
vpcola 0:f1d3878b8dd9 516
vpcola 0:f1d3878b8dd9 517 ![alt text](docs/pics/sd_driver_k64_with_ci_test_shield.jpg "unseen title text")
vpcola 0:f1d3878b8dd9 518
vpcola 0:f1d3878b8dd9 519 **Figure 2. The figure shows the K64F platform with the CI shield fitted.**
vpcola 0:f1d3878b8dd9 520
vpcola 0:f1d3878b8dd9 521 The above figure shows the K64F with the v1.0.0 CI test shield fitted. Note:
vpcola 0:f1d3878b8dd9 522
vpcola 0:f1d3878b8dd9 523 - The pins D0/D1 (top right of CI test shield) are bent sideways so as not to insert into the header.
vpcola 0:f1d3878b8dd9 524 - The SDCard is fully inserted into the slot and overhangs the PCB by ~1mm.
vpcola 0:f1d3878b8dd9 525
vpcola 0:f1d3878b8dd9 526
vpcola 0:f1d3878b8dd9 527 # SDBlockDevice Example Application
vpcola 0:f1d3878b8dd9 528
vpcola 0:f1d3878b8dd9 529 The following sample code illustrates how to use the sd-driver Block Device API:
vpcola 0:f1d3878b8dd9 530
vpcola 0:f1d3878b8dd9 531
vpcola 0:f1d3878b8dd9 532 #include "mbed.h"
vpcola 0:f1d3878b8dd9 533 #include "SDBlockDevice.h"
vpcola 0:f1d3878b8dd9 534
vpcola 0:f1d3878b8dd9 535 // Instantiate the SDBlockDevice by specifying the SPI pins connected to the SDCard
vpcola 0:f1d3878b8dd9 536 // socket. The PINS are:
vpcola 0:f1d3878b8dd9 537 // MOSI (Master Out Slave In)
vpcola 0:f1d3878b8dd9 538 // MISO (Master In Slave Out)
vpcola 0:f1d3878b8dd9 539 // SCLK (Serial Clock)
vpcola 0:f1d3878b8dd9 540 // CS (Chip Select)
vpcola 0:f1d3878b8dd9 541 SDBlockDevice sd(p5, p6, p7, p12); // mosi, miso, sclk, cs
vpcola 0:f1d3878b8dd9 542 uint8_t block[512] = "Hello World!\n";
vpcola 0:f1d3878b8dd9 543
vpcola 0:f1d3878b8dd9 544 int main()
vpcola 0:f1d3878b8dd9 545 {
vpcola 0:f1d3878b8dd9 546 // call the SDBlockDevice instance initialisation method.
vpcola 0:f1d3878b8dd9 547 sd.init();
vpcola 0:f1d3878b8dd9 548
vpcola 0:f1d3878b8dd9 549 // Write some the data block to the device
vpcola 0:f1d3878b8dd9 550 sd.program(block, 0, 512);
vpcola 0:f1d3878b8dd9 551
vpcola 0:f1d3878b8dd9 552 // read the data block from the device
vpcola 0:f1d3878b8dd9 553 sd.read(block, 0, 512);
vpcola 0:f1d3878b8dd9 554
vpcola 0:f1d3878b8dd9 555 // print the contents of the block
vpcola 0:f1d3878b8dd9 556 printf("%s", block);
vpcola 0:f1d3878b8dd9 557
vpcola 0:f1d3878b8dd9 558 // call the SDBlockDevice instance de-initialisation method.
vpcola 0:f1d3878b8dd9 559 sd.deinit();
vpcola 0:f1d3878b8dd9 560 }
vpcola 0:f1d3878b8dd9 561
vpcola 0:f1d3878b8dd9 562
vpcola 0:f1d3878b8dd9 563 # SDCard POSIX File API mbed Greentea Test Cases
vpcola 0:f1d3878b8dd9 564
vpcola 0:f1d3878b8dd9 565 This section describes how to build and run the POSIX file API test cases.
vpcola 0:f1d3878b8dd9 566 The following steps are covered:
vpcola 0:f1d3878b8dd9 567
vpcola 0:f1d3878b8dd9 568 - [Create the FAT/SDCard Application Project](#create-fat-sdcard-application-project).
vpcola 0:f1d3878b8dd9 569 This section describes how to git clone the mbed OS and sd-driver repositories containing the
vpcola 0:f1d3878b8dd9 570 code and test cases of interest.
vpcola 0:f1d3878b8dd9 571 - [Build the mbed OS Test Cases](#build-the-mbedos-test-cases). This section
vpcola 0:f1d3878b8dd9 572 describes how to build the mbed OS test cases.
vpcola 0:f1d3878b8dd9 573 - [Insert a microSD Card Into the K64F for Greentea Testing](#greentea-insert-sdcard-into-k64f).This section
vpcola 0:f1d3878b8dd9 574 describes how to format (if required) a microSD card prior to running the tests.
vpcola 0:f1d3878b8dd9 575 - [Run the POSIX File Test Case](#run-the-posix-file-test-cases).This section
vpcola 0:f1d3878b8dd9 576 describes how to run the POSIX file test cases.
vpcola 0:f1d3878b8dd9 577
vpcola 0:f1d3878b8dd9 578
vpcola 0:f1d3878b8dd9 579 ### <a name="create-fat-sdcard-application-project"></a> Create the FAT/SDCard Application Project
vpcola 0:f1d3878b8dd9 580
vpcola 0:f1d3878b8dd9 581 This section describes how to create an application project combining the
vpcola 0:f1d3878b8dd9 582 mbed-os and sd-driver repositories into a single project.
vpcola 0:f1d3878b8dd9 583 In summary the following steps will be covered in this section:
vpcola 0:f1d3878b8dd9 584
vpcola 0:f1d3878b8dd9 585 - A top level application project directory is created. The directory name is ex_app1.
vpcola 0:f1d3878b8dd9 586 - In the ex_app1 directory, the mbed-os repository is cloned.
vpcola 0:f1d3878b8dd9 587 - In the ex_app1 directory at the same level as the mbed-os directory, the sd-driver repository is cloned.
vpcola 0:f1d3878b8dd9 588 - The `mbed_app.json` file is copied from the `sd-driver/config/mbed_app.json` to the ex_app1 directory.
vpcola 0:f1d3878b8dd9 589
vpcola 0:f1d3878b8dd9 590 First create the top level application directory ex_app1 and move into it:
vpcola 0:f1d3878b8dd9 591
vpcola 0:f1d3878b8dd9 592 simhug01@E107851:/d/demo_area$ mkdir ex_app1
vpcola 0:f1d3878b8dd9 593 simhug01@E107851:/d/demo_area$ pushd ex_app1
vpcola 0:f1d3878b8dd9 594
vpcola 0:f1d3878b8dd9 595 Next, get a clone of public mbed OS repository in the following way:
vpcola 0:f1d3878b8dd9 596
vpcola 0:f1d3878b8dd9 597 simhug01@E107851:/d/demo_area/ex_app1$ git clone git@github.com:/armmbed/mbed-os
vpcola 0:f1d3878b8dd9 598 <trace removed>
vpcola 0:f1d3878b8dd9 599 simhug01@E107851:/d/demo_area/ex_app1$
vpcola 0:f1d3878b8dd9 600
vpcola 0:f1d3878b8dd9 601 Next, get a clone of the sd-driver repository:
vpcola 0:f1d3878b8dd9 602
vpcola 0:f1d3878b8dd9 603 simhug01@E107851:/d/demo_area/ex_app1$ git clone git@github.com:/armmbed/sd-driver
vpcola 0:f1d3878b8dd9 604 <trace removed>
vpcola 0:f1d3878b8dd9 605 simhug01@E107851:/d/demo_area/ex_app1$
vpcola 0:f1d3878b8dd9 606
vpcola 0:f1d3878b8dd9 607 Finally, copy the `mbed_app.json` application configuration file from `sd-driver/config/mbed_app.json` to the ex_app1 directory:
vpcola 0:f1d3878b8dd9 608
vpcola 0:f1d3878b8dd9 609 simhug01@E107851:/d/demo_area/ex_app1$ cp sd-driver/config/mbed_app.json .
vpcola 0:f1d3878b8dd9 610 simhug01@E107851:/d/demo_area/ex_app1$
vpcola 0:f1d3878b8dd9 611
vpcola 0:f1d3878b8dd9 612 The `mbed_app.json` file specifies the SPI bus pin configuration for different targets,
vpcola 0:f1d3878b8dd9 613 and is discussed in the [Testing with an SDCard on Target XYZ](#testing-with-an-sdcard-on-target-xyx) section.
vpcola 0:f1d3878b8dd9 614
vpcola 0:f1d3878b8dd9 615
vpcola 0:f1d3878b8dd9 616 ### <a name="build-the-mbedos-test-cases"></a> Build the mbed OS Test Cases
vpcola 0:f1d3878b8dd9 617
vpcola 0:f1d3878b8dd9 618 Build the test cases for the K64F target using the following command:
vpcola 0:f1d3878b8dd9 619
vpcola 0:f1d3878b8dd9 620 simhug01@E107851:/d/demo_area/ex_app1$ mbed -v test --compile -t GCC_ARM -m K64F --app-config mbed_app.json
vpcola 0:f1d3878b8dd9 621 <trace removed>
vpcola 0:f1d3878b8dd9 622 simhug01@E107851:/d/demo_area/ex_app1$
vpcola 0:f1d3878b8dd9 623
vpcola 0:f1d3878b8dd9 624 The build trace is quite extensive but on a successful build you should see the following output at the end of the log:
vpcola 0:f1d3878b8dd9 625
vpcola 0:f1d3878b8dd9 626 Build successes:
vpcola 0:f1d3878b8dd9 627 * K64F::GCC_ARM::MBED-BUILD
vpcola 0:f1d3878b8dd9 628 * K64F::GCC_ARM::MBED-OS-FEATURES-FEATURE_LWIP-TESTS-MBEDMICRO-NET-CONNECTIVITY
vpcola 0:f1d3878b8dd9 629 <trace removed>
vpcola 0:f1d3878b8dd9 630 * K64F::GCC_ARM::MBED-OS-FEATURES-TESTS-FILESYSTEM-FAT_FILE_SYSTEM
vpcola 0:f1d3878b8dd9 631 * K64F::GCC_ARM::MBED-OS-FEATURES-TESTS-FILESYSTEM-HEAP_BLOCK_DEVICE
vpcola 0:f1d3878b8dd9 632 * K64F::GCC_ARM::MBED-OS-FEATURES-TESTS-FILESYSTEM-UTIL_BLOCK_DEVICE
vpcola 0:f1d3878b8dd9 633 <trace removed>
vpcola 0:f1d3878b8dd9 634 * K64F::GCC_ARM::SD-DRIVER-FEATURES-TESTS-FILESYSTEM-BASIC
vpcola 0:f1d3878b8dd9 635 * K64F::GCC_ARM::SD-DRIVER-FEATURES-TESTS-FILESYSTEM-FOPEN
vpcola 0:f1d3878b8dd9 636
vpcola 0:f1d3878b8dd9 637 Build skips:
vpcola 0:f1d3878b8dd9 638 * K64F::GCC_ARM::MBED-OS-FEATURES-FEATURE_LWIP-TESTS-MBEDMICRO-NET-TCP_PACKET_PRESSURE
vpcola 0:f1d3878b8dd9 639 <trace removed>
vpcola 0:f1d3878b8dd9 640
vpcola 0:f1d3878b8dd9 641
vpcola 0:f1d3878b8dd9 642 Notice the following tests in the sd-driver tree are listed above:
vpcola 0:f1d3878b8dd9 643
vpcola 0:f1d3878b8dd9 644 - `K64F::GCC_ARM::SD-DRIVER-FEATURES-TESTS-FILESYSTEM-BASIC`
vpcola 0:f1d3878b8dd9 645 - `K64F::GCC_ARM::SD-DRIVER-FEATURES-TESTS-FILESYSTEM-FOPEN`
vpcola 0:f1d3878b8dd9 646
vpcola 0:f1d3878b8dd9 647
vpcola 0:f1d3878b8dd9 648 The FAT32/SDCard test cases are at following locations in the source code tree:
vpcola 0:f1d3878b8dd9 649
vpcola 0:f1d3878b8dd9 650 /d/demo_area/ex_app1/sd-driver/features/TESTS/filesystem/basic/basic.cpp
vpcola 0:f1d3878b8dd9 651 /d/demo_area/ex_app1/sd-driver/features/TESTS/filesystem/fopen/fopen.cpp
vpcola 0:f1d3878b8dd9 652
vpcola 0:f1d3878b8dd9 653
vpcola 0:f1d3878b8dd9 654 #### <a name="settting-repos-to-compatible-versions"></a> Setting mbed-os/sd-driver Repositories To Compatible Versions
vpcola 0:f1d3878b8dd9 655
vpcola 0:f1d3878b8dd9 656 The sd-driver master HEAD and the mbed-os master HEAD should be compatible
vpcola 0:f1d3878b8dd9 657 with one another and therefore no specific tagged versions need to be checked out.
vpcola 0:f1d3878b8dd9 658 However, in the case that you experience problems building, checkout out the compatible
vpcola 0:f1d3878b8dd9 659 tagged version of each repository, as shown below:
vpcola 0:f1d3878b8dd9 660
vpcola 0:f1d3878b8dd9 661 simhug01@E107851:/d/demo_area/ex_app1$ pushd mbed-os
vpcola 0:f1d3878b8dd9 662 simhug01@E107851:/d/demo_area/ex_app1$ git checkout tags/mbed-os-5.4.0
vpcola 0:f1d3878b8dd9 663 simhug01@E107851:/d/demo_area/ex_app1$ popd
vpcola 0:f1d3878b8dd9 664 simhug01@E107851:/d/demo_area/ex_app1$ pushd sd-driver
vpcola 0:f1d3878b8dd9 665 simhug01@E107851:/d/demo_area/ex_app1$ git checkout tags/sd-driver-0.0.2-mbed-os-5.4.0
vpcola 0:f1d3878b8dd9 666 simhug01@E107851:/d/demo_area/ex_app1$ popd
vpcola 0:f1d3878b8dd9 667
vpcola 0:f1d3878b8dd9 668 In the above:
vpcola 0:f1d3878b8dd9 669
vpcola 0:f1d3878b8dd9 670 - `mbed-os-5.4.0` should be replaced with the latest mbed-os release tag.
vpcola 0:f1d3878b8dd9 671 - For an mbed-os release tag `mbed-os-x.y.z`, use the equivalent sd-driver tag `sd-driver-a.b.c-mbed-os-x.y.z`
vpcola 0:f1d3878b8dd9 672 where `a.b.c` is the latest version code for the `mbed-os-x.y.z` tag.
vpcola 0:f1d3878b8dd9 673
vpcola 0:f1d3878b8dd9 674 ### <a name="greentea-insert-sdcard-into-k64f"></a> Insert SDCard into K64F for Greentea Testing
vpcola 0:f1d3878b8dd9 675
vpcola 0:f1d3878b8dd9 676 See the previous section for [Insert SDCard into K64F](#insert-sdcard-into-k64f) for details.
vpcola 0:f1d3878b8dd9 677
vpcola 0:f1d3878b8dd9 678
vpcola 0:f1d3878b8dd9 679 ### <a name="run-the-posix-file-test-cases"></a> Run the POSIX File Test Case
vpcola 0:f1d3878b8dd9 680
vpcola 0:f1d3878b8dd9 681 To setup for running the test cases, connect the K64F development board to your
vpcola 0:f1d3878b8dd9 682 PC using a suitable USB cable.
vpcola 0:f1d3878b8dd9 683
vpcola 0:f1d3878b8dd9 684 All tests can be run using the following command:
vpcola 0:f1d3878b8dd9 685
vpcola 0:f1d3878b8dd9 686 simhug01@E107851:/d/demo_area/ex_app1$ mbedgt -VS
vpcola 0:f1d3878b8dd9 687 <trace removed>
vpcola 0:f1d3878b8dd9 688
vpcola 0:f1d3878b8dd9 689 However, it's possible to run a particular test case using the following form of the mbedgt command:
vpcola 0:f1d3878b8dd9 690
vpcola 0:f1d3878b8dd9 691 simhug01@E107851:/d/demo_area/ex_app1$ mbedgt -VS --test-by-names=<test-name>
vpcola 0:f1d3878b8dd9 692
vpcola 0:f1d3878b8dd9 693 The names of the tests can be listed using:
vpcola 0:f1d3878b8dd9 694
vpcola 0:f1d3878b8dd9 695 simhug01@E107851:/d/demo_area/ex_app1$ mbedgt -VS --list
vpcola 0:f1d3878b8dd9 696
vpcola 0:f1d3878b8dd9 697 For example, to run the basic test use:
vpcola 0:f1d3878b8dd9 698
vpcola 0:f1d3878b8dd9 699 simhug01@E107851:/d/demo_area/ex_app1$ mbedgt -VS --test-by-names=sd-driver-features-tests-filesystem-basic
vpcola 0:f1d3878b8dd9 700
vpcola 0:f1d3878b8dd9 701 To run the fopen test use:
vpcola 0:f1d3878b8dd9 702
vpcola 0:f1d3878b8dd9 703 simhug01@E107851:/d/demo_area/ex_app1$ mbedgt -VS --test-by-names=sd-driver-features-tests-filesystem-fopen
vpcola 0:f1d3878b8dd9 704
vpcola 0:f1d3878b8dd9 705 On a successful run, results similar to the following will be shown:
vpcola 0:f1d3878b8dd9 706
vpcola 0:f1d3878b8dd9 707 mbedgt: test suite report:
vpcola 0:f1d3878b8dd9 708 +--------------+---------------+-------------------------------------------+--------+--------------------+-------------+
vpcola 0:f1d3878b8dd9 709 | target | platform_name | test suite | result | elapsed_time (sec) | copy_method |
vpcola 0:f1d3878b8dd9 710 +--------------+---------------+-------------------------------------------+--------+--------------------+-------------+
vpcola 0:f1d3878b8dd9 711 | K64F-GCC_ARM | K64F | sd-driver-features-tests-filesystem-fopen | OK | 151.46 | shell |
vpcola 0:f1d3878b8dd9 712 +--------------+---------------+-------------------------------------------+--------+--------------------+-------------+
vpcola 0:f1d3878b8dd9 713 mbedgt: test suite results: 1 OK
vpcola 0:f1d3878b8dd9 714 mbedgt: test case report:
vpcola 0:f1d3878b8dd9 715 +--------------+---------------+-------------------------------------------+----------------------------------------------------------------------------------------+--------+--------+--------+--------------------+
vpcola 0:f1d3878b8dd9 716 | target | platform_name | test suite | test case | passed | failed | result | elapsed_time (sec) |
vpcola 0:f1d3878b8dd9 717 +--------------+---------------+-------------------------------------------+----------------------------------------------------------------------------------------+--------+--------+--------+--------------------+
vpcola 0:f1d3878b8dd9 718 | K64F-GCC_ARM | K64F | sd-driver-features-tests-filesystem-fopen | FSFAT_FOPEN_TEST_01: fopen()/fwrite()/fclose() directories/file in multi-dir filepath. | 1 | 0 | OK | 7.57 |
vpcola 0:f1d3878b8dd9 719 | K64F-GCC_ARM | K64F | sd-driver-features-tests-filesystem-fopen | FSFAT_FOPEN_TEST_02: fopen(r) pre-existing file try to write it. | 1 | 0 | OK | 0.2 |
vpcola 0:f1d3878b8dd9 720 | K64F-GCC_ARM | K64F | sd-driver-features-tests-filesystem-fopen | FSFAT_FOPEN_TEST_03: fopen(w+) pre-existing file try to write it. | 1 | 0 | OK | 0.41 |
vpcola 0:f1d3878b8dd9 721 | K64F-GCC_ARM | K64F | sd-driver-features-tests-filesystem-fopen | FSFAT_FOPEN_TEST_04: fopen() with a filename exceeding the maximum length. | 1 | 0 | OK | 0.11 |
vpcola 0:f1d3878b8dd9 722 | K64F-GCC_ARM | K64F | sd-driver-features-tests-filesystem-fopen | FSFAT_FOPEN_TEST_06: fopen() with bad filenames (minimal). | 1 | 0 | OK | 0.1 |
vpcola 0:f1d3878b8dd9 723 | K64F-GCC_ARM | K64F | sd-driver-features-tests-filesystem-fopen | FSFAT_FOPEN_TEST_07: fopen()/errno handling. | 1 | 0 | OK | 0.07 |
vpcola 0:f1d3878b8dd9 724 | K64F-GCC_ARM | K64F | sd-driver-features-tests-filesystem-fopen | FSFAT_FOPEN_TEST_08: ferror()/clearerr()/errno handling. | 1 | 0 | OK | 0.1 |
vpcola 0:f1d3878b8dd9 725 | K64F-GCC_ARM | K64F | sd-driver-features-tests-filesystem-fopen | FSFAT_FOPEN_TEST_09: ftell() handling. | 1 | 0 | OK | 0.17 |
vpcola 0:f1d3878b8dd9 726 | K64F-GCC_ARM | K64F | sd-driver-features-tests-filesystem-fopen | FSFAT_FOPEN_TEST_10: remove() test. | 1 | 0 | OK | 1.28 |
vpcola 0:f1d3878b8dd9 727 | K64F-GCC_ARM | K64F | sd-driver-features-tests-filesystem-fopen | FSFAT_FOPEN_TEST_11: rename(). | 1 | 0 | OK | 2.3 |
vpcola 0:f1d3878b8dd9 728 | K64F-GCC_ARM | K64F | sd-driver-features-tests-filesystem-fopen | FSFAT_FOPEN_TEST_12: opendir(), readdir(), closedir() test. | 1 | 0 | OK | 3.57 |
vpcola 0:f1d3878b8dd9 729 | K64F-GCC_ARM | K64F | sd-driver-features-tests-filesystem-fopen | FSFAT_FOPEN_TEST_13: mkdir() test. | 1 | 0 | OK | 1.21 |
vpcola 0:f1d3878b8dd9 730 | K64F-GCC_ARM | K64F | sd-driver-features-tests-filesystem-fopen | FSFAT_FOPEN_TEST_14: stat() test. | 1 | 0 | OK | 1.47 |
vpcola 0:f1d3878b8dd9 731 | K64F-GCC_ARM | K64F | sd-driver-features-tests-filesystem-fopen | FSFAT_FOPEN_TEST_15: format() test. | 1 | 0 | OK | 26.12 |
vpcola 0:f1d3878b8dd9 732 | K64F-GCC_ARM | K64F | sd-driver-features-tests-filesystem-fopen | FSFAT_FOPEN_TEST_16: write/check n x 25kB data files. | 1 | 0 | OK | 87.11 |
vpcola 0:f1d3878b8dd9 733 +--------------+---------------+-------------------------------------------+----------------------------------------------------------------------------------------+--------+--------+--------+--------------------+
vpcola 0:f1d3878b8dd9 734 mbedgt: test case results: 15 OK
vpcola 0:f1d3878b8dd9 735 mbedgt: completed in 152.35 sec
vpcola 0:f1d3878b8dd9 736
vpcola 0:f1d3878b8dd9 737
vpcola 0:f1d3878b8dd9 738 # <a name="summary-posix-api-documentation"></a> Summary of POSIX File API Documentation
vpcola 0:f1d3878b8dd9 739
vpcola 0:f1d3878b8dd9 740 ### POSIX File API
vpcola 0:f1d3878b8dd9 741
vpcola 0:f1d3878b8dd9 742 mbed OS supports a subset of the POSIX File API, as outlined below:
vpcola 0:f1d3878b8dd9 743
vpcola 0:f1d3878b8dd9 744 - [clearerr()](https://linux.die.net/man/3/clearerr).
vpcola 0:f1d3878b8dd9 745 - STATUS: Basic testing implemented. Working.
vpcola 0:f1d3878b8dd9 746 - [fclose()](https://linux.die.net/man/3/fclose).
vpcola 0:f1d3878b8dd9 747 - STATUS: Basic testing implemented. Working.
vpcola 0:f1d3878b8dd9 748 - [ferror()](https://linux.die.net/man/3/clearerr).
vpcola 0:f1d3878b8dd9 749 - STATUS: Basic testing implemented.
vpcola 0:f1d3878b8dd9 750 - STATUS: GCC_ARM: Working.
vpcola 0:f1d3878b8dd9 751 - STATUS: ARMCC: ARMCC has problem with ferror(filep) where filep is NULL. Appears to work for non-NULL pointer.
vpcola 0:f1d3878b8dd9 752 - [fgetc()](https://linux.die.net/man/3/fgets).
vpcola 0:f1d3878b8dd9 753 - STATUS: Basic testing implemented. Working.
vpcola 0:f1d3878b8dd9 754 - [fgets()](https://linux.die.net/man/3/fgets).
vpcola 0:f1d3878b8dd9 755 - STATUS: Basic testing implemented. Working.
vpcola 0:f1d3878b8dd9 756 - [fputc()](https://linux.die.net/man/3/fputs).
vpcola 0:f1d3878b8dd9 757 - STATUS: Unknown.
vpcola 0:f1d3878b8dd9 758 - [fputs()](https://linux.die.net/man/3/fputs).
vpcola 0:f1d3878b8dd9 759 - STATUS: Basic testing implemented. Working.
vpcola 0:f1d3878b8dd9 760 - [fprintf()](https://linux.die.net/man/3/fprintf).
vpcola 0:f1d3878b8dd9 761 - STATUS: Basic testing implemented. Working.
vpcola 0:f1d3878b8dd9 762 - [fopen()](https://linux.die.net/man/3/fopen).
vpcola 0:f1d3878b8dd9 763 - STATUS: Basic testing implemented. Working.
vpcola 0:f1d3878b8dd9 764 - [freopen()](https://linux.die.net/man/3/fopen).
vpcola 0:f1d3878b8dd9 765 - STATUS: This is not tested.
vpcola 0:f1d3878b8dd9 766 - [fread()](https://linux.die.net/man/3/fread).
vpcola 0:f1d3878b8dd9 767 - STATUS: Basic testing implemented. Working.
vpcola 0:f1d3878b8dd9 768 - STATUS: n x 25kB stress test working.
vpcola 0:f1d3878b8dd9 769 - [ftell()](https://linux.die.net/man/3/ftell).
vpcola 0:f1d3878b8dd9 770 - STATUS: Basic testing implemented. Working.
vpcola 0:f1d3878b8dd9 771 - [fwrite()](https://linux.die.net/man/3/fwrite).
vpcola 0:f1d3878b8dd9 772 - STATUS: Basic testing implemented. Working.
vpcola 0:f1d3878b8dd9 773 - STATUS: n x 25kB stress test working.
vpcola 0:f1d3878b8dd9 774 - [fseek()](https://linux.die.net/man/3/fseek)
vpcola 0:f1d3878b8dd9 775 - STATUS: Basic testing implemented. Working.
vpcola 0:f1d3878b8dd9 776 - [getc()](https://linux.die.net/man/3/fgets).
vpcola 0:f1d3878b8dd9 777 - STATUS: Basic testing implemented. Working.
vpcola 0:f1d3878b8dd9 778 - [gets()](https://linux.die.net/man/3/fgets).
vpcola 0:f1d3878b8dd9 779 - STATUS: Unknown.
vpcola 0:f1d3878b8dd9 780 - [putc()](https://linux.die.net/man/3/fputs).
vpcola 0:f1d3878b8dd9 781 - STATUS: Unknown.
vpcola 0:f1d3878b8dd9 782 - [puts()](https://linux.die.net/man/3/fputs).
vpcola 0:f1d3878b8dd9 783 - STATUS: Unknown.
vpcola 0:f1d3878b8dd9 784 - [remove()](https://linux.die.net/man/3/remove)
vpcola 0:f1d3878b8dd9 785 - STATUS: Basic testing implemented. Working.
vpcola 0:f1d3878b8dd9 786 - [rewind()](https://linux.die.net/man/3/rewind).
vpcola 0:f1d3878b8dd9 787 - STATUS: Basic testing implemented. Working.
vpcola 0:f1d3878b8dd9 788 - [stat()](https://linux.die.net/man/2/stat)
vpcola 0:f1d3878b8dd9 789 - STATUS: Implemented. Working.
vpcola 0:f1d3878b8dd9 790 - STATUS: Not supported by ARMCC/IAR libc.
vpcola 0:f1d3878b8dd9 791 - [tmpfile()](https://linux.die.net/man/3/tmpfile).
vpcola 0:f1d3878b8dd9 792 - STATUS: Not implemented.
vpcola 0:f1d3878b8dd9 793 - [tmpnam()](https://linux.die.net/man/3/tmpnam).
vpcola 0:f1d3878b8dd9 794 - STATUS: Not implemented.
vpcola 0:f1d3878b8dd9 795
vpcola 0:f1d3878b8dd9 796 Supported directory related operations are as follows:
vpcola 0:f1d3878b8dd9 797
vpcola 0:f1d3878b8dd9 798 - [closedir()](https://linux.die.net/man/3/closedir).
vpcola 0:f1d3878b8dd9 799 - STATUS: Implemented. Working.
vpcola 0:f1d3878b8dd9 800 - [mkdir()](https://linux.die.net/man/3/mkdir).
vpcola 0:f1d3878b8dd9 801 - STATUS: Basic testing implemented. Working.
vpcola 0:f1d3878b8dd9 802 - [opendir()](https://linux.die.net/man/3/opendir).
vpcola 0:f1d3878b8dd9 803 - STATUS: Implemented. Working.
vpcola 0:f1d3878b8dd9 804 - [readdir()](https://linux.die.net/man/3/readdir).
vpcola 0:f1d3878b8dd9 805 - STATUS: Implemented. Working.
vpcola 0:f1d3878b8dd9 806 - [remove()](https://linux.die.net/man/3/remove).
vpcola 0:f1d3878b8dd9 807 - STATUS: Basic testing implemented. Working.
vpcola 0:f1d3878b8dd9 808 - [rename()](https://linux.die.net/man/3/rename).
vpcola 0:f1d3878b8dd9 809 - STATUS: Implemented. Not tested.
vpcola 0:f1d3878b8dd9 810 - [rewinddir()](https://linux.die.net/man/3/rewinddir).
vpcola 0:f1d3878b8dd9 811 - STATUS: Implemented. Found not to work. Test case not present in repo.
vpcola 0:f1d3878b8dd9 812 - [seekdir()](https://linux.die.net/man/3/seekdir).
vpcola 0:f1d3878b8dd9 813 - STATUS: Implemented. Found not to work. Test case not present in repo.
vpcola 0:f1d3878b8dd9 814 - [telldir()](https://linux.die.net/man/3/telldir).
vpcola 0:f1d3878b8dd9 815 - STATUS: Implemented. Found not to work. Test case not present in repo.
vpcola 0:f1d3878b8dd9 816
vpcola 0:f1d3878b8dd9 817 ### errno
vpcola 0:f1d3878b8dd9 818
vpcola 0:f1d3878b8dd9 819 Basic errno reporting is supported, tested and known to be working.
vpcola 0:f1d3878b8dd9 820
vpcola 0:f1d3878b8dd9 821
vpcola 0:f1d3878b8dd9 822 # Related Projects Resources
vpcola 0:f1d3878b8dd9 823
vpcola 0:f1d3878b8dd9 824 The following are related mbed storage projects and useful resources:
vpcola 0:f1d3878b8dd9 825
vpcola 0:f1d3878b8dd9 826 - The [mbed-os](https://github.com/ARMmbed/mbed-os) main repository.
vpcola 0:f1d3878b8dd9 827 - The [mbed-os-example-fat-filesystem](https://github.com/ARMmbed/mbed-os-example-fat-filesystem) repository.
vpcola 0:f1d3878b8dd9 828 This is an example project for the mbed OS FAT filesystem.
vpcola 0:f1d3878b8dd9 829 - The [spiflash-driver](https://github.com/armmbed/spiflash-driver) repository.
vpcola 0:f1d3878b8dd9 830 - The [i2ceeprom-driver](https://github.com/ARMmbed/i2ceeprom-driver.git) repository.
vpcola 0:f1d3878b8dd9 831 - The [ci-test-shield](https://github.com/ARMmbed/ci-test-shield) repository. This is the project describing
vpcola 0:f1d3878b8dd9 832 the mbed-os Continuous Integration test shield, together with standard tests.
vpcola 0:f1d3878b8dd9 833 - The [mbed-HDK](https://github.com/ARMmbed/mbed-HDK) repository containing Hardware Development Kit resources
vpcola 0:f1d3878b8dd9 834 including the schematics for the CI test shield.
vpcola 0:f1d3878b8dd9 835 - [POSIX File Interface ISO/IEC 9899:TC2 Documentation](http://www.eng.utah.edu/~cs5785/slides-f10/n1124.pdf).
vpcola 0:f1d3878b8dd9 836 - [FATFS: Generic FAT File System Module used in mbed OS](http://elm-chan.org/fsw/ff/00index_e.html)
vpcola 0:f1d3878b8dd9 837
vpcola 0:f1d3878b8dd9 838