Fork of my original MQTTGateway

Dependencies:   mbed-http

Committer:
vpcola
Date:
Sat Apr 08 14:43:14 2017 +0000
Revision:
0:a1734fe1ec4b
Initial commit

Who changed what in which revision?

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