Mbed Cloud example program for workshop in W27 2018.

Dependencies:   MMA7660 LM75B

Committer:
MACRUM
Date:
Sat Jun 30 01:40:30 2018 +0000
Revision:
0:119624335925
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MACRUM 0:119624335925 1 # mbed OS SDCard Driver (sd-driver) for FAT32 Filesystem Support
MACRUM 0:119624335925 2
MACRUM 0:119624335925 3
MACRUM 0:119624335925 4 Simon Hughes
MACRUM 0:119624335925 5
MACRUM 0:119624335925 6 20170329
MACRUM 0:119624335925 7
MACRUM 0:119624335925 8 Version 0.1.2
MACRUM 0:119624335925 9
MACRUM 0:119624335925 10
MACRUM 0:119624335925 11 # Executive Summary
MACRUM 0:119624335925 12
MACRUM 0:119624335925 13 The purpose of this document is to describe how to use the mbed OS SDCard
MACRUM 0:119624335925 14 driver (sd-driver) so applications can read/write
MACRUM 0:119624335925 15 data to flash storage cards using the standard POSIX File API
MACRUM 0:119624335925 16 programming interface. The sd-driver uses the SDCard SPI-mode of operation
MACRUM 0:119624335925 17 which is a subset of possible SDCard functionality.
MACRUM 0:119624335925 18
MACRUM 0:119624335925 19 This repository contains the mbed-os SDCard driver for generic SPI
MACRUM 0:119624335925 20 SDCard support and other resources, as outlined below:
MACRUM 0:119624335925 21
MACRUM 0:119624335925 22 - `SDBlockDevice.h` and `SDBlockDevice.cpp`. This is the SDCard driver module presenting
MACRUM 0:119624335925 23 a Block Device API (derived from BlockDevice) to the underlying SDCard.
MACRUM 0:119624335925 24 - POSIX File API test cases for testing the FAT32 filesystem on SDCard.
MACRUM 0:119624335925 25 - basic.cpp, a basic set of functional test cases.
MACRUM 0:119624335925 26 - fopen.cpp, more functional tests reading/writing greater volumes of data to SDCard, for example.
MACRUM 0:119624335925 27 - `mbed_lib.json` mbed-os application configuration file with SPI pin configurations for the CI shield and overrides for specific targets.
MACRUM 0:119624335925 28 This file allows the SPI pins to be specified for the target without having to edit the implementation files.
MACRUM 0:119624335925 29 - This README which includes [Summary of POSIX File API Documentation](#summary-posix-api-documentation)
MACRUM 0:119624335925 30 including detailed instruction on how to use the FAT filesystem and SDBlockDevice driver.
MACRUM 0:119624335925 31
MACRUM 0:119624335925 32 The SDCard driver is maintained in this repository as a component separate from the main mbed OS repository.
MACRUM 0:119624335925 33 Hence the 2 repositories (mbed-os and sd-driver) have to be used together
MACRUM 0:119624335925 34 to deliver the FAT32 Filesystem/SDCard support. This document explains how to do this.
MACRUM 0:119624335925 35
MACRUM 0:119624335925 36
MACRUM 0:119624335925 37 # Introduction
MACRUM 0:119624335925 38
MACRUM 0:119624335925 39 ### Overview
MACRUM 0:119624335925 40
MACRUM 0:119624335925 41 The scope of this document is to describe how applications use the FAT filesystem and sd-driver
MACRUM 0:119624335925 42 components to persistently store data on SDCards. The document is intended to help developers adopt the
MACRUM 0:119624335925 43 mbed OS POSIX File API support, and in particular to help explain:
MACRUM 0:119624335925 44
MACRUM 0:119624335925 45 - How the software components work together to deliver the storage functionality.
MACRUM 0:119624335925 46 - How to work with the sd-driver and mbed OS to build the examples. The example code can easily
MACRUM 0:119624335925 47 be copied into your new application code.
MACRUM 0:119624335925 48 - How to work with the CI Test Shield, which adds an SDCard slot to those targets that do not have already have one.
MACRUM 0:119624335925 49 - How to run the POSIX File API mbed Greentea test cases, which provide further example code of how to use
MACRUM 0:119624335925 50 the POSIX File API.
MACRUM 0:119624335925 51
MACRUM 0:119624335925 52 Section 1 provides an Executive Summary, describing the purpose of the sd-driver, the supporting
MACRUM 0:119624335925 53 software, examples, test cases and documentation.
MACRUM 0:119624335925 54
MACRUM 0:119624335925 55 Section 2 provides an an overview of the material covered including descriptions of the major sections.
MACRUM 0:119624335925 56
MACRUM 0:119624335925 57 Section 3 provides an overview of the mbed OS filesystem software components,
MACRUM 0:119624335925 58 including the inter-relationships between the application, POSIX file API, the standard c-library,
MACRUM 0:119624335925 59 the mbed OS filesystem and the SDCard driver (sd-driver).
MACRUM 0:119624335925 60
MACRUM 0:119624335925 61 Section 4 describes how to build and run an example application for reading
MACRUM 0:119624335925 62 and writing data to an SDCard using the POSIX File API. The example begins by describing
MACRUM 0:119624335925 63 the procedure for building and testing on the K64F target. The final sub-sections
MACRUM 0:119624335925 64 describe how to use the test shield to add an SDCard slot to any mbed target,
MACRUM 0:119624335925 65 and hence enable the persistent storage of data on any supported target.
MACRUM 0:119624335925 66
MACRUM 0:119624335925 67 Section 5 describes an example application which uses the raw
MACRUM 0:119624335925 68 BlockDevice API to read and write data to the SDCard.
MACRUM 0:119624335925 69
MACRUM 0:119624335925 70 Section 6 describes how to build and run the SDCard POSIX File API mbed Greentea test cases.
MACRUM 0:119624335925 71 There are a number of functional test cases demonstrating how to use the
MACRUM 0:119624335925 72 mbed OS POSIX File API.
MACRUM 0:119624335925 73
MACRUM 0:119624335925 74 Section 7 describes the POSIX File API and provides links to useful API documentation web pages.
MACRUM 0:119624335925 75
MACRUM 0:119624335925 76
MACRUM 0:119624335925 77 ### Known mbed-os and sd-driver Compatible Versions
MACRUM 0:119624335925 78
MACRUM 0:119624335925 79 The following versions of the mbed-os and sd-driver repositories are known to work together:
MACRUM 0:119624335925 80
MACRUM 0:119624335925 81 - {mbed-os, sd-driver} = {mbed-os-5.4.0-rc2, sd-driver-0.0.1-mbed-os-5.4.0-rc2}.
MACRUM 0:119624335925 82 `K64F`, `NUCLEO_F429ZI` and `UBLOX_EVK_ODIN_W2` fopen and basic filesystem tests working.
MACRUM 0:119624335925 83 - {mbed-os, sd-driver} = {mbed-os-5.4.0, sd-driver-0.0.2-mbed-os-5.4.0}.
MACRUM 0:119624335925 84 `K64F`, `NUCLEO_F429ZI` and `UBLOX_EVK_ODIN_W2` fopen and basic filesystem tests working.
MACRUM 0:119624335925 85 - {mbed-os, sd-driver} = {mbed-os-5.4.1, sd-driver-0.0.3-mbed-os-5.4.1}.
MACRUM 0:119624335925 86 - {mbed-os, sd-driver} = {mbed-os-5.5.1, sd-driver-0.1.0-mbed-os-5.5.1}.
MACRUM 0:119624335925 87 - {mbed-os, sd-driver} = {mbed-os-5.5.4, sd-driver-0.1.1-mbed-os-5.5.4}.
MACRUM 0:119624335925 88 - {mbed-os, sd-driver} = {mbed-os-5.6.1, sd-driver-0.1.2-mbed-os-5.6.1}.
MACRUM 0:119624335925 89
MACRUM 0:119624335925 90 To find the latest compatible versions, use the following command to see the messages attached to the tags
MACRUM 0:119624335925 91 in the sd-driver repository:
MACRUM 0:119624335925 92
MACRUM 0:119624335925 93 ex_app7/$ cd sd-driver
MACRUM 0:119624335925 94 ex_app7/sd-driver$ git tag -n
MACRUM 0:119624335925 95 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.
MACRUM 0:119624335925 96 sd-driver-0.0.2-mbed-os-5.4.0 Updated README.md to include worked exmaples and restructuring of information.
MACRUM 0:119624335925 97 sd-driver-0.0.3-mbed-os-5.4.1 Version compatible with mbed-os-5.4.1.
MACRUM 0:119624335925 98 sd-driver-0.1.1-mbed-os-5.5.4 Version compatible with mbed-os-5.5.4
MACRUM 0:119624335925 99 sd-driver-0.1.2-mbed-os-5.6.1 Version compatible with mbed-os-5.6.1
MACRUM 0:119624335925 100
MACRUM 0:119624335925 101
MACRUM 0:119624335925 102 ### Known Issues With This Document
MACRUM 0:119624335925 103
MACRUM 0:119624335925 104 There are no known issues with this document.
MACRUM 0:119624335925 105
MACRUM 0:119624335925 106
MACRUM 0:119624335925 107 # Overview of mbed OS Filesystem Software Component Stack
MACRUM 0:119624335925 108
MACRUM 0:119624335925 109
MACRUM 0:119624335925 110 ------------------------
MACRUM 0:119624335925 111 | |
MACRUM 0:119624335925 112 | Application | // This application uses the POSIX File API
MACRUM 0:119624335925 113 | | // to read/write data to persistent storage backends.
MACRUM 0:119624335925 114 ------------------------
MACRUM 0:119624335925 115
MACRUM 0:119624335925 116 ------------------------ // POSIX File API (ISO).
MACRUM 0:119624335925 117
MACRUM 0:119624335925 118 ------------------------
MACRUM 0:119624335925 119 | |
MACRUM 0:119624335925 120 | libc | // The standard c library implementation
MACRUM 0:119624335925 121 | | // e.g. newlib.
MACRUM 0:119624335925 122 ------------------------
MACRUM 0:119624335925 123
MACRUM 0:119624335925 124 ------------------------ // sys_xxx equivalent API.
MACRUM 0:119624335925 125
MACRUM 0:119624335925 126 ------------------------
MACRUM 0:119624335925 127 | |
MACRUM 0:119624335925 128 | mbed_retarget.cpp | // Target specific mapping layer.
MACRUM 0:119624335925 129 | |
MACRUM 0:119624335925 130 ------------------------
MACRUM 0:119624335925 131
MACRUM 0:119624335925 132 ------------------------ // Filesystem Upper Edge API.
MACRUM 0:119624335925 133
MACRUM 0:119624335925 134 ------------------------
MACRUM 0:119624335925 135 | |
MACRUM 0:119624335925 136 | File System | // File system wrappers and implementation.
MACRUM 0:119624335925 137 | |
MACRUM 0:119624335925 138 ------------------------
MACRUM 0:119624335925 139
MACRUM 0:119624335925 140 ------------------------ // FS Lower Edge API (Block Store Interface).
MACRUM 0:119624335925 141
MACRUM 0:119624335925 142 ------------------------
MACRUM 0:119624335925 143 | Block API |
MACRUM 0:119624335925 144 | Device Driver | // The SDCard driver, for example.
MACRUM 0:119624335925 145 | e.g. sd-driver |
MACRUM 0:119624335925 146 ------------------------
MACRUM 0:119624335925 147
MACRUM 0:119624335925 148 ------------------------ // SPI.h interface.
MACRUM 0:119624335925 149
MACRUM 0:119624335925 150 ------------------------
MACRUM 0:119624335925 151 | |
MACRUM 0:119624335925 152 | SPI | // SPI subsystem (C++ classes and C-HAL implementation).
MACRUM 0:119624335925 153 | |
MACRUM 0:119624335925 154 ------------------------
MACRUM 0:119624335925 155
MACRUM 0:119624335925 156 Figure 1. mbedOS generic architecture of filesystem software stack.
MACRUM 0:119624335925 157
MACRUM 0:119624335925 158 The figure above shows the mbed OS software component stack used for data
MACRUM 0:119624335925 159 storage on SDCard:
MACRUM 0:119624335925 160
MACRUM 0:119624335925 161 - At the top level is the application component which uses the standard POSIX File API
MACRUM 0:119624335925 162 to read and write application data to persistent storage.
MACRUM 0:119624335925 163 - The newlib standard library (libc) stdio.h interface (POSIX File API)
MACRUM 0:119624335925 164 implementation is used as it's optimised for resource limited embedded systems.
MACRUM 0:119624335925 165 - mbed_retarget.cpp implements the libc back-end file OS handlers and maps them
MACRUM 0:119624335925 166 to the FileSystem.
MACRUM 0:119624335925 167 - The File System code (hosted in mbed-os) is composed of 2 parts:
MACRUM 0:119624335925 168 - The mbed OS file system wrapper classes (e.g. FileSystem, File, FileBase classes)
MACRUM 0:119624335925 169 which are used to present a consistent API to the retarget module for different
MACRUM 0:119624335925 170 (third-party) file system implementations.
MACRUM 0:119624335925 171 - The FAT filesystem implementation code.
MACRUM 0:119624335925 172 The [FATFS: Generic FAT File System Module](http://elm-chan.org/fsw/ff/00index_e.html)
MACRUM 0:119624335925 173 (ChanFS) has been integrated within mbed-os.
MACRUM 0:119624335925 174 - The Block API Device Driver. The SDCard driver is an example of a persistent storage driver.
MACRUM 0:119624335925 175 It's maintained as a separate component from the mbed OS repository (in this repository).
MACRUM 0:119624335925 176 - The SPI module provides the mbed OS generic SPI API. This functionality is maintained in
MACRUM 0:119624335925 177 mbed OS.
MACRUM 0:119624335925 178
MACRUM 0:119624335925 179
MACRUM 0:119624335925 180 # SDCard POSIX File API Example App for Reading/Writing Data
MACRUM 0:119624335925 181
MACRUM 0:119624335925 182 Refer to [SD driver Example](https://github.com/ARMmbed/mbed-os-example-sd-driver)
MACRUM 0:119624335925 183
MACRUM 0:119624335925 184
MACRUM 0:119624335925 185 ### <a name="testing-with-an-sdcard-on-target-xyx"></a> Testing with an SDCard on Target XYZ
MACRUM 0:119624335925 186
MACRUM 0:119624335925 187 The standard way to test is with the mbed CI Test Shield plugged into the
MACRUM 0:119624335925 188 target board. This pin mapping for this configuration is parameterised in
MACRUM 0:119624335925 189 the `mbed_lib.json` file.
MACRUM 0:119624335925 190
MACRUM 0:119624335925 191 The following is an example of the `mbed_lib.json` file available in the repository:
MACRUM 0:119624335925 192
MACRUM 0:119624335925 193 {
MACRUM 0:119624335925 194 "config": {
MACRUM 0:119624335925 195 "SPI_CS": "D10",
MACRUM 0:119624335925 196 "SPI_MOSI": "D11",
MACRUM 0:119624335925 197 "SPI_MISO": "D12",
MACRUM 0:119624335925 198 "SPI_CLK": "D13",
MACRUM 0:119624335925 199 "DEVICE_SPI": 1,
MACRUM 0:119624335925 200 "FSFAT_SDCARD_INSTALLED": 1
MACRUM 0:119624335925 201 },
MACRUM 0:119624335925 202 "target_overrides": {
MACRUM 0:119624335925 203 "DISCO_F051R8": {
MACRUM 0:119624335925 204 "SPI_MOSI": "SPI_MOSI",
MACRUM 0:119624335925 205 "SPI_MISO": "SPI_MISO",
MACRUM 0:119624335925 206 "SPI_CLK": "SPI_SCK",
MACRUM 0:119624335925 207 "SPI_CS": "SPI_CS"
MACRUM 0:119624335925 208 },
MACRUM 0:119624335925 209 "KL46Z": {
MACRUM 0:119624335925 210 "SPI_MOSI": "PTD6",
MACRUM 0:119624335925 211 "SPI_MISO": "PTD7",
MACRUM 0:119624335925 212 "SPI_CLK": "PTD5",
MACRUM 0:119624335925 213 "SPI_CS": "PTD4"
MACRUM 0:119624335925 214 },
MACRUM 0:119624335925 215 "K64F": {
MACRUM 0:119624335925 216 "SPI_MOSI": "PTE3",
MACRUM 0:119624335925 217 "SPI_MISO": "PTE1",
MACRUM 0:119624335925 218 "SPI_CLK": "PTE2",
MACRUM 0:119624335925 219 "SPI_CS": "PTE4"
MACRUM 0:119624335925 220 }
MACRUM 0:119624335925 221 }
MACRUM 0:119624335925 222
MACRUM 0:119624335925 223 Note the following things about the `mbed_lib.json` file:
MACRUM 0:119624335925 224
MACRUM 0:119624335925 225 - The `mbed_lib.json` file is used to define target specific symbols for the SPI pins connecting the SDCard slot to the target MCU:
MACRUM 0:119624335925 226 - "SPI\_CS". This is the Chip Select line.
MACRUM 0:119624335925 227 - "SPI\_MOSI". This is the Master Out Slave In data line.
MACRUM 0:119624335925 228 - "SPI\_MISO". This is the Master In Slave Out data line.
MACRUM 0:119624335925 229 - "SPI\_CLK". This is the serial Clock line.
MACRUM 0:119624335925 230 - The default configuration defined in the "config" section is for the standard Arduino header pin mappings for the SPI bus.
MACRUM 0:119624335925 231 The "config" section defines a dictionary mapping functional names to target board Arduino header pins:
MACRUM 0:119624335925 232 - "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.
MACRUM 0:119624335925 233 D10 is defined in the target specific PinNames.h file.
MACRUM 0:119624335925 234 - "SPI\_MOSI": "D11". This causes the MBED\_CONF\_APP\_SPI\_MOSI symbol to be defined in mbed\_config.h.
MACRUM 0:119624335925 235 - "SPI\_MISO": "D12". This causes the MBED\_CONF\_APP\_SPI\_MISO symbol to be defined in mbed\_config.h.
MACRUM 0:119624335925 236 - "SPI\_CLK": "D13". This causes the MBED\_CONF\_APP\_SPI\_CLK symbol to be defined in mbed\_config.h.
MACRUM 0:119624335925 237 - The `"target_overrides"` section is used to override the "SPI\_xxx" symbols for specific target boards, which may have an SDCard slot, for example.
MACRUM 0:119624335925 238 This is the case for the K64F, where the "SPI\_xxx" are mapped to the pin names for the on-board SDCard.
MACRUM 0:119624335925 239
MACRUM 0:119624335925 240 ```
MACRUM 0:119624335925 241 "K64F": {
MACRUM 0:119624335925 242 "SPI_MOSI": "PTE3",
MACRUM 0:119624335925 243 "SPI_MISO": "PTE1",
MACRUM 0:119624335925 244 "SPI_CLK": "PTE2",
MACRUM 0:119624335925 245 "SPI_CS": "PTE4"
MACRUM 0:119624335925 246 }
MACRUM 0:119624335925 247 ```
MACRUM 0:119624335925 248 - Thus, in the absence of any target specific definitions in the `"target_overrides"` section, all boards will default to
MACRUM 0:119624335925 249 using the Arduino header configuration. For those platforms with a `"target_overrides"` section then this configuration
MACRUM 0:119624335925 250 will be used in preference.
MACRUM 0:119624335925 251 - Hence in the case that you want to test a platform with an SDCard inserted into a
MACRUM 0:119624335925 252 fitted CI test shield (rather than the on-board SDCard slot)
MACRUM 0:119624335925 253 and there is a `"target_overrides"` section present in the `mbed_lib.json` file, you must then delete the `"target_overrides"`
MACRUM 0:119624335925 254 section before building. This will result in the default configuration being used (suitable for the CI
MACRUM 0:119624335925 255 Test Shield).
MACRUM 0:119624335925 256 - Note when inserting the v1.0.0 CI Test Shield into the Arduino header of the target platform, the shield pins D0 and
MACRUM 0:119624335925 257 D1 should be bent to be parallel to the shield PCB so they are not inserted into the Arduino header. This is because
MACRUM 0:119624335925 258 some boards use the same UART on DAPLINK and D0/D1, which means the serial debug channel breaks and hence the mbed greentea
MACRUM 0:119624335925 259 test suite will not work correctly. This is mainly on older ST boards and should not be a problem on
MACRUM 0:119624335925 260 `K64F`, `NUCLEO_F429ZI` and `UBLOX_EVK_ODIN_W2`. Note also that the v2.0.0 CI Test Shield doesn't suffer from this
MACRUM 0:119624335925 261 problem and the pins don't need to be bent.
MACRUM 0:119624335925 262 - When inserting the SDCard into the card slot on the CI test shield, make sure the card is fully inserted.
MACRUM 0:119624335925 263 On insertion, there should be a small clicking sound when the card registers, and the back edge of the card
MACRUM 0:119624335925 264 should protrude no more than ~1mm over the edge of the CI test shield PCB. If the SDCard fails to register,
MACRUM 0:119624335925 265 try gently pushing the metal flexible strip in the shape of a spade at the top edge of the SDCard metal slot
MACRUM 0:119624335925 266 casing with a pair of tweezers, bending it a little to lower it into the slot casing. This helps with the
MACRUM 0:119624335925 267 insertion mechanism.
MACRUM 0:119624335925 268
MACRUM 0:119624335925 269 ### Wiring instructions for target NUCLEO_F429ZI with CI Test Shield
MACRUM 0:119624335925 270 ![alt text](docs/pics/NUCLEO_F429ZI_wiring_with_ci_test_shield.png "unseen title text")
MACRUM 0:119624335925 271
MACRUM 0:119624335925 272 **Figure 3. The figure shows how to connect the NUCLEO_F429ZI platform with the CI shield.**
MACRUM 0:119624335925 273
MACRUM 0:119624335925 274 The above figure shows how to connect the NUCLEO_F429ZI with the v1.0.0 CI test shield. Note:
MACRUM 0:119624335925 275
MACRUM 0:119624335925 276 - To get the SD Card to work with this platform the CI test shield cannot be connected directly to this board, instead follow the instructions above.
MACRUM 0:119624335925 277 - Any SD-card adapter will work as long as you connect all the relevant pins (MOSI, MISO, SCLK, CS, 3.3V and GND) as illustrated in figure 3.
MACRUM 0:119624335925 278 - The SDCard is fully inserted into the slot and overhangs the PCB by ~1mm.
MACRUM 0:119624335925 279
MACRUM 0:119624335925 280 # SDBlockDevice Example Application
MACRUM 0:119624335925 281
MACRUM 0:119624335925 282 The following sample code illustrates how to use the sd-driver Block Device API:
MACRUM 0:119624335925 283
MACRUM 0:119624335925 284 ``` cpp
MACRUM 0:119624335925 285 #include "mbed.h"
MACRUM 0:119624335925 286 #include "SDBlockDevice.h"
MACRUM 0:119624335925 287
MACRUM 0:119624335925 288 // Instantiate the SDBlockDevice by specifying the SPI pins connected to the SDCard
MACRUM 0:119624335925 289 // socket. The PINS are:
MACRUM 0:119624335925 290 // MOSI (Master Out Slave In)
MACRUM 0:119624335925 291 // MISO (Master In Slave Out)
MACRUM 0:119624335925 292 // SCLK (Serial Clock)
MACRUM 0:119624335925 293 // CS (Chip Select)
MACRUM 0:119624335925 294 SDBlockDevice sd(MBED_CONF_SD_SPI_MOSI, MBED_CONF_SD_SPI_MISO, MBED_CONF_SD_SPI_CLK, MBED_CONF_SD_SPI_CS);
MACRUM 0:119624335925 295 uint8_t block[512] = "Hello World!\n";
MACRUM 0:119624335925 296
MACRUM 0:119624335925 297 int main()
MACRUM 0:119624335925 298 {
MACRUM 0:119624335925 299 // call the SDBlockDevice instance initialisation method.
MACRUM 0:119624335925 300 if ( 0 != sd.init()) {
MACRUM 0:119624335925 301 printf("Init failed \n");
MACRUM 0:119624335925 302 return -1;
MACRUM 0:119624335925 303 }
MACRUM 0:119624335925 304 printf("sd size: %llu\n", sd.size());
MACRUM 0:119624335925 305 printf("sd read size: %llu\n", sd.get_read_size());
MACRUM 0:119624335925 306 printf("sd program size: %llu\n", sd.get_program_size());
MACRUM 0:119624335925 307 printf("sd erase size: %llu\n", sd.get_erase_size());
MACRUM 0:119624335925 308
MACRUM 0:119624335925 309 // set the frequency
MACRUM 0:119624335925 310 if ( 0 != sd.frequency(5000000)) {
MACRUM 0:119624335925 311 printf("Error setting frequency \n");
MACRUM 0:119624335925 312 }
MACRUM 0:119624335925 313
MACRUM 0:119624335925 314 if ( 0 != sd.erase(0, sd.get_erase_size())) {
MACRUM 0:119624335925 315 printf("Error Erasing block \n");
MACRUM 0:119624335925 316 }
MACRUM 0:119624335925 317
MACRUM 0:119624335925 318 // Write some the data block to the device
MACRUM 0:119624335925 319 if ( 0 == sd.program(block, 0, 512)) {
MACRUM 0:119624335925 320 // read the data block from the device
MACRUM 0:119624335925 321 if ( 0 == sd.read(block, 0, 512)) {
MACRUM 0:119624335925 322 // print the contents of the block
MACRUM 0:119624335925 323 printf("%s", block);
MACRUM 0:119624335925 324 }
MACRUM 0:119624335925 325 }
MACRUM 0:119624335925 326
MACRUM 0:119624335925 327 // call the SDBlockDevice instance de-initialisation method.
MACRUM 0:119624335925 328 sd.deinit();
MACRUM 0:119624335925 329 }
MACRUM 0:119624335925 330 ```
MACRUM 0:119624335925 331
MACRUM 0:119624335925 332 # SDCard POSIX File API mbed Greentea Test Cases
MACRUM 0:119624335925 333
MACRUM 0:119624335925 334 This section describes how to build and run the POSIX file API test cases.
MACRUM 0:119624335925 335 The following steps are covered:
MACRUM 0:119624335925 336
MACRUM 0:119624335925 337 - [Create the FAT/SDCard Application Project](#create-fat-sdcard-application-project).
MACRUM 0:119624335925 338 This section describes how to git clone the mbed OS and sd-driver repositories containing the
MACRUM 0:119624335925 339 code and test cases of interest.
MACRUM 0:119624335925 340 - [Build the mbed OS Test Cases](#build-the-mbedos-test-cases). This section
MACRUM 0:119624335925 341 describes how to build the mbed OS test cases.
MACRUM 0:119624335925 342 - [Insert a microSD Card Into the K64F for Greentea Testing](#greentea-insert-sdcard-into-k64f).This section
MACRUM 0:119624335925 343 describes how to format (if required) a microSD card prior to running the tests.
MACRUM 0:119624335925 344 - [Run the POSIX File Test Case](#run-the-posix-file-test-cases).This section
MACRUM 0:119624335925 345 describes how to run the POSIX file test cases.
MACRUM 0:119624335925 346
MACRUM 0:119624335925 347
MACRUM 0:119624335925 348 ### <a name="create-fat-sdcard-application-project"></a> Create the FAT/SDCard Application Project
MACRUM 0:119624335925 349
MACRUM 0:119624335925 350 This section describes how to create an application project combining the mbed-os and
MACRUM 0:119624335925 351 sd-driver repositories into a single project.
MACRUM 0:119624335925 352 In summary the following steps will be covered in this section:
MACRUM 0:119624335925 353
MACRUM 0:119624335925 354 - A top level application project directory is created. The directory name is ex_app1.
MACRUM 0:119624335925 355 - In the ex_app1 directory, the mbed-os repository is cloned.
MACRUM 0:119624335925 356 - In the ex_app1 directory at the same level as the mbed-os directory, the sd-driver repository is cloned.
MACRUM 0:119624335925 357 - The `mbed_lib.json` file is copied from the `sd-driver/config/mbed_lib.json` to the ex_app1 directory.
MACRUM 0:119624335925 358
MACRUM 0:119624335925 359 First create the top level application directory ex_app1 and move into it:
MACRUM 0:119624335925 360
MACRUM 0:119624335925 361 shell:/d/demo_area$ mkdir ex_app1
MACRUM 0:119624335925 362 shell:/d/demo_area$ pushd ex_app1
MACRUM 0:119624335925 363
MACRUM 0:119624335925 364 Next, get a clone of public mbed OS repository in the following way:
MACRUM 0:119624335925 365
MACRUM 0:119624335925 366 shell:/d/demo_area/ex_app1$ git clone git@github.com:/armmbed/mbed-os
MACRUM 0:119624335925 367 <trace removed>
MACRUM 0:119624335925 368 shell:/d/demo_area/ex_app1$
MACRUM 0:119624335925 369
MACRUM 0:119624335925 370 Next, get a clone of the sd-driver repository:
MACRUM 0:119624335925 371
MACRUM 0:119624335925 372 shell:/d/demo_area/ex_app1$ git clone git@github.com:/armmbed/sd-driver
MACRUM 0:119624335925 373 <trace removed>
MACRUM 0:119624335925 374 shell:/d/demo_area/ex_app1$
MACRUM 0:119624335925 375
MACRUM 0:119624335925 376 Note: The `mbed_lib.json` file specifies the SPI bus pin configuration for different targets,
MACRUM 0:119624335925 377 and is discussed in the [Testing with an SDCard on Target XYZ](#testing-with-an-sdcard-on-target-xyx) section.
MACRUM 0:119624335925 378
MACRUM 0:119624335925 379 ### <a name="build-the-mbedos-test-cases"></a> Build the mbed OS Test Cases
MACRUM 0:119624335925 380
MACRUM 0:119624335925 381 Build the test cases for the K64F target using the following command:
MACRUM 0:119624335925 382
MACRUM 0:119624335925 383 shell:/d/demo_area/ex_app1$ mbed -v test --compile -t GCC_ARM -m K64F
MACRUM 0:119624335925 384 <trace removed>
MACRUM 0:119624335925 385 shell:/d/demo_area/ex_app1$
MACRUM 0:119624335925 386
MACRUM 0:119624335925 387 The build trace is quite extensive but on a successful build you should see the following output at the end of the log:
MACRUM 0:119624335925 388
MACRUM 0:119624335925 389 Build successes:
MACRUM 0:119624335925 390 * K64F::GCC_ARM::MBED-BUILD
MACRUM 0:119624335925 391 * K64F::GCC_ARM::MBED-OS-FEATURES-FEATURE_LWIP-TESTS-MBEDMICRO-NET-CONNECTIVITY
MACRUM 0:119624335925 392 <trace removed>
MACRUM 0:119624335925 393 * K64F::GCC_ARM::MBED-OS-FEATURES-TESTS-FILESYSTEM-FAT_FILE_SYSTEM
MACRUM 0:119624335925 394 * K64F::GCC_ARM::MBED-OS-FEATURES-TESTS-FILESYSTEM-HEAP_BLOCK_DEVICE
MACRUM 0:119624335925 395 * K64F::GCC_ARM::MBED-OS-FEATURES-TESTS-FILESYSTEM-UTIL_BLOCK_DEVICE
MACRUM 0:119624335925 396 <trace removed>
MACRUM 0:119624335925 397 * K64F::GCC_ARM::SD-DRIVER-TESTS-BLOCK_DEVICE-BASIC
MACRUM 0:119624335925 398 * K64F::GCC_ARM::SD-DRIVER-TESTS-FILESYSTEM-BASIC
MACRUM 0:119624335925 399 * K64F::GCC_ARM::SD-DRIVER-TESTS-FILESYSTEM-DIRS
MACRUM 0:119624335925 400 * K64F::GCC_ARM::SD-DRIVER-TESTS-FILESYSTEM-FILES
MACRUM 0:119624335925 401 * K64F::GCC_ARM::SD-DRIVER-TESTS-FILESYSTEM-FOPEN
MACRUM 0:119624335925 402 * K64F::GCC_ARM::SD-DRIVER-TESTS-FILESYSTEM-PARALLEL
MACRUM 0:119624335925 403 * K64F::GCC_ARM::SD-DRIVER-TESTS-FILESYSTEM-SEEK
MACRUM 0:119624335925 404
MACRUM 0:119624335925 405 Build skips:
MACRUM 0:119624335925 406 * K64F::GCC_ARM::MBED-OS-FEATURES-FEATURE_LWIP-TESTS-MBEDMICRO-NET-TCP_PACKET_PRESSURE
MACRUM 0:119624335925 407 <trace removed>
MACRUM 0:119624335925 408
MACRUM 0:119624335925 409
MACRUM 0:119624335925 410 Notice the following tests in the sd-driver tree are listed above:
MACRUM 0:119624335925 411
MACRUM 0:119624335925 412 - `SD-DRIVER-TESTS-BLOCK_DEVICE-BASIC`
MACRUM 0:119624335925 413 - `SD-DRIVER-TESTS-FILESYSTEM-BASIC`
MACRUM 0:119624335925 414 - `SD-DRIVER-TESTS-FILESYSTEM-DIRS`
MACRUM 0:119624335925 415 - `SD-DRIVER-TESTS-FILESYSTEM-FILES`
MACRUM 0:119624335925 416 - `SD-DRIVER-TESTS-FILESYSTEM-FOPEN`
MACRUM 0:119624335925 417 - `SD-DRIVER-TESTS-FILESYSTEM-PARALLEL`
MACRUM 0:119624335925 418 - `SD-DRIVER-TESTS-FILESYSTEM-SEEK`
MACRUM 0:119624335925 419
MACRUM 0:119624335925 420 The FAT32/SDCard test cases are at following locations in the source code tree:
MACRUM 0:119624335925 421
MACRUM 0:119624335925 422 /d/demo_area/ex_app1/sd-driver/TESTS/filesystem/basic/basic.cpp
MACRUM 0:119624335925 423 /d/demo_area/ex_app1/sd-driver/TESTS/filesystem/fopen/fopen.cpp
MACRUM 0:119624335925 424 /d/demo_area/ex_app1/sd-driver/TESTS/block_device/basic/basic.cpp
MACRUM 0:119624335925 425 /d/demo_area/ex_app1/sd-driver/TESTS/filesystem/dirs/main.cpp
MACRUM 0:119624335925 426 /d/demo_area/ex_app1/sd-driver/TESTS/filesystem/files/main.cpp
MACRUM 0:119624335925 427 /d/demo_area/ex_app1/sd-driver/TESTS/filesystem/parallel/main.cpp
MACRUM 0:119624335925 428 /d/demo_area/ex_app1/sd-driver/TESTS/filesystem/seek/main.cpp
MACRUM 0:119624335925 429
MACRUM 0:119624335925 430 #### <a name="settting-repos-to-compatible-versions"></a> Setting mbed-os/sd-driver Repositories To Compatible Versions
MACRUM 0:119624335925 431
MACRUM 0:119624335925 432 The sd-driver master HEAD and the mbed-os master HEAD should be compatible
MACRUM 0:119624335925 433 with one another and therefore no specific tagged versions need to be checked out.
MACRUM 0:119624335925 434 However, in the case that you experience problems building, checkout out the compatible
MACRUM 0:119624335925 435 tagged version of each repository, as shown below:
MACRUM 0:119624335925 436
MACRUM 0:119624335925 437 shell:/d/demo_area/ex_app1$ pushd mbed-os
MACRUM 0:119624335925 438 shell:/d/demo_area/ex_app1$ git checkout tags/mbed-os-5.4.0
MACRUM 0:119624335925 439 shell:/d/demo_area/ex_app1$ popd
MACRUM 0:119624335925 440 shell:/d/demo_area/ex_app1$ pushd sd-driver
MACRUM 0:119624335925 441 shell:/d/demo_area/ex_app1$ git checkout tags/sd-driver-0.0.2-mbed-os-5.4.0
MACRUM 0:119624335925 442 shell:/d/demo_area/ex_app1$ popd
MACRUM 0:119624335925 443
MACRUM 0:119624335925 444 In the above:
MACRUM 0:119624335925 445
MACRUM 0:119624335925 446 - `mbed-os-5.4.0` should be replaced with the latest mbed-os release tag.
MACRUM 0:119624335925 447 - 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`
MACRUM 0:119624335925 448 where `a.b.c` is the latest version code for the `mbed-os-x.y.z` tag.
MACRUM 0:119624335925 449
MACRUM 0:119624335925 450 ### <a name="greentea-insert-sdcard-into-k64f"></a> Insert SDCard into K64F for Greentea Testing
MACRUM 0:119624335925 451
MACRUM 0:119624335925 452 See the previous section for [Insert SDCard into K64F](#insert-sdcard-into-k64f) for details.
MACRUM 0:119624335925 453
MACRUM 0:119624335925 454
MACRUM 0:119624335925 455 ### <a name="run-the-posix-file-test-cases"></a> Run the POSIX File Test Case
MACRUM 0:119624335925 456
MACRUM 0:119624335925 457 To setup for running the test cases, connect the K64F development board to your
MACRUM 0:119624335925 458 PC using a suitable USB cable.
MACRUM 0:119624335925 459
MACRUM 0:119624335925 460 All tests can be run using the following command:
MACRUM 0:119624335925 461
MACRUM 0:119624335925 462 shell:/d/demo_area/ex_app1$ mbedgt -VS
MACRUM 0:119624335925 463 <trace removed>
MACRUM 0:119624335925 464
MACRUM 0:119624335925 465 However, it's possible to run a particular test case using the following form of the mbedgt command:
MACRUM 0:119624335925 466
MACRUM 0:119624335925 467 shell:/d/demo_area/ex_app1$ mbedgt -VS --test-by-names=<test-name>
MACRUM 0:119624335925 468
MACRUM 0:119624335925 469 The names of the tests can be listed using:
MACRUM 0:119624335925 470
MACRUM 0:119624335925 471 shell:/d/demo_area/ex_app1$ mbedgt -VS --list
MACRUM 0:119624335925 472
MACRUM 0:119624335925 473 For example, to run the basic test use:
MACRUM 0:119624335925 474
MACRUM 0:119624335925 475 shell:/d/demo_area/ex_app1$ mbedgt -VS --test-by-names=sd-driver-tests-filesystem-basic
MACRUM 0:119624335925 476
MACRUM 0:119624335925 477 To run the fopen test use:
MACRUM 0:119624335925 478
MACRUM 0:119624335925 479 shell:/d/demo_area/ex_app1$ mbedgt -VS --test-by-names=sd-driver-tests-filesystem-fopen
MACRUM 0:119624335925 480
MACRUM 0:119624335925 481 On a successful run, results similar to the following will be shown:
MACRUM 0:119624335925 482
MACRUM 0:119624335925 483 mbedgt: test suite report:
MACRUM 0:119624335925 484 +--------------+---------------+-------------------------------------------+--------+--------------------+-------------+
MACRUM 0:119624335925 485 | target | platform_name | test suite | result | elapsed_time (sec) | copy_method |
MACRUM 0:119624335925 486 +--------------+---------------+-------------------------------------------+--------+--------------------+-------------+
MACRUM 0:119624335925 487 | K64F-GCC_ARM | K64F | sd-driver-features-tests-filesystem-fopen | OK | 151.46 | shell |
MACRUM 0:119624335925 488 +--------------+---------------+-------------------------------------------+--------+--------------------+-------------+
MACRUM 0:119624335925 489 mbedgt: test suite results: 1 OK
MACRUM 0:119624335925 490 mbedgt: test case report:
MACRUM 0:119624335925 491 +--------------+---------------+------------------------------------+----------------------------------------------------------------------------------------+--------+--------+--------+--------------------+
MACRUM 0:119624335925 492 | target | platform_name | test suite | test case | passed | failed | result | elapsed_time (sec) |
MACRUM 0:119624335925 493 +--------------+---------------+------------------------------------+----------------------------------------------------------------------------------------+--------+--------+--------+--------------------+
MACRUM 0:119624335925 494 | K64F-GCC_ARM | K64F | sd-driver-tests-filesystem-fopen | FSFAT_FOPEN_TEST_01: fopen()/fwrite()/fclose() directories/file in multi-dir filepath. | 1 | 0 | OK | 7.57 |
MACRUM 0:119624335925 495 | K64F-GCC_ARM | K64F | sd-driver-tests-filesystem-fopen | FSFAT_FOPEN_TEST_02: fopen(r) pre-existing file try to write it. | 1 | 0 | OK | 0.2 |
MACRUM 0:119624335925 496 | K64F-GCC_ARM | K64F | sd-driver-tests-filesystem-fopen | FSFAT_FOPEN_TEST_03: fopen(w+) pre-existing file try to write it. | 1 | 0 | OK | 0.41 |
MACRUM 0:119624335925 497 | K64F-GCC_ARM | K64F | sd-driver-tests-filesystem-fopen | FSFAT_FOPEN_TEST_04: fopen() with a filename exceeding the maximum length. | 1 | 0 | OK | 0.11 |
MACRUM 0:119624335925 498 | K64F-GCC_ARM | K64F | sd-driver-tests-filesystem-fopen | FSFAT_FOPEN_TEST_06: fopen() with bad filenames (minimal). | 1 | 0 | OK | 0.1 |
MACRUM 0:119624335925 499 | K64F-GCC_ARM | K64F | sd-driver-tests-filesystem-fopen | FSFAT_FOPEN_TEST_07: fopen()/errno handling. | 1 | 0 | OK | 0.07 |
MACRUM 0:119624335925 500 | K64F-GCC_ARM | K64F | sd-driver-tests-filesystem-fopen | FSFAT_FOPEN_TEST_08: ferror()/clearerr()/errno handling. | 1 | 0 | OK | 0.1 |
MACRUM 0:119624335925 501 | K64F-GCC_ARM | K64F | sd-driver-tests-filesystem-fopen | FSFAT_FOPEN_TEST_09: ftell() handling. | 1 | 0 | OK | 0.17 |
MACRUM 0:119624335925 502 | K64F-GCC_ARM | K64F | sd-driver-tests-filesystem-fopen | FSFAT_FOPEN_TEST_10: remove() test. | 1 | 0 | OK | 1.28 |
MACRUM 0:119624335925 503 | K64F-GCC_ARM | K64F | sd-driver-tests-filesystem-fopen | FSFAT_FOPEN_TEST_11: rename(). | 1 | 0 | OK | 2.3 |
MACRUM 0:119624335925 504 | K64F-GCC_ARM | K64F | sd-driver-tests-filesystem-fopen | FSFAT_FOPEN_TEST_12: opendir(), readdir(), closedir() test. | 1 | 0 | OK | 3.57 |
MACRUM 0:119624335925 505 | K64F-GCC_ARM | K64F | sd-driver-tests-filesystem-fopen | FSFAT_FOPEN_TEST_13: mkdir() test. | 1 | 0 | OK | 1.21 |
MACRUM 0:119624335925 506 | K64F-GCC_ARM | K64F | sd-driver-tests-filesystem-fopen | FSFAT_FOPEN_TEST_14: stat() test. | 1 | 0 | OK | 1.47 |
MACRUM 0:119624335925 507 | K64F-GCC_ARM | K64F | sd-driver-tests-filesystem-fopen | FSFAT_FOPEN_TEST_15: format() test. | 1 | 0 | OK | 26.12 |
MACRUM 0:119624335925 508 | K64F-GCC_ARM | K64F | sd-driver-tests-filesystem-fopen | FSFAT_FOPEN_TEST_16: write/check n x 25kB data files. | 1 | 0 | OK | 87.11 |
MACRUM 0:119624335925 509 +--------------+---------------+------------------------------------+----------------------------------------------------------------------------------------+--------+--------+--------+--------------------+
MACRUM 0:119624335925 510 mbedgt: test case results: 15 OK
MACRUM 0:119624335925 511 mbedgt: completed in 152.35 sec
MACRUM 0:119624335925 512
MACRUM 0:119624335925 513
MACRUM 0:119624335925 514 # <a name="summary-posix-api-documentation"></a> Summary of POSIX File API Documentation
MACRUM 0:119624335925 515
MACRUM 0:119624335925 516 ### POSIX File API
MACRUM 0:119624335925 517
MACRUM 0:119624335925 518 mbed OS supports a subset of the POSIX File API, as outlined below:
MACRUM 0:119624335925 519
MACRUM 0:119624335925 520 - [clearerr()](https://linux.die.net/man/3/clearerr).
MACRUM 0:119624335925 521 - STATUS: Basic testing implemented. Working.
MACRUM 0:119624335925 522 - [fclose()](https://linux.die.net/man/3/fclose).
MACRUM 0:119624335925 523 - STATUS: Basic testing implemented. Working.
MACRUM 0:119624335925 524 - [ferror()](https://linux.die.net/man/3/clearerr).
MACRUM 0:119624335925 525 - STATUS: Basic testing implemented.
MACRUM 0:119624335925 526 - STATUS: GCC_ARM: Working.
MACRUM 0:119624335925 527 - STATUS: ARMCC: ARMCC has problem with ferror(filep) where filep is NULL. Appears to work for non-NULL pointer.
MACRUM 0:119624335925 528 - [fgetc()](https://linux.die.net/man/3/fgets).
MACRUM 0:119624335925 529 - STATUS: Basic testing implemented. Working.
MACRUM 0:119624335925 530 - [fgets()](https://linux.die.net/man/3/fgets).
MACRUM 0:119624335925 531 - STATUS: Basic testing implemented. Working.
MACRUM 0:119624335925 532 - [fputc()](https://linux.die.net/man/3/fputs).
MACRUM 0:119624335925 533 - STATUS: Unknown.
MACRUM 0:119624335925 534 - [fputs()](https://linux.die.net/man/3/fputs).
MACRUM 0:119624335925 535 - STATUS: Basic testing implemented. Working.
MACRUM 0:119624335925 536 - [fprintf()](https://linux.die.net/man/3/fprintf).
MACRUM 0:119624335925 537 - STATUS: Basic testing implemented. Working.
MACRUM 0:119624335925 538 - [fopen()](https://linux.die.net/man/3/fopen).
MACRUM 0:119624335925 539 - STATUS: Basic testing implemented. Working.
MACRUM 0:119624335925 540 - [freopen()](https://linux.die.net/man/3/fopen).
MACRUM 0:119624335925 541 - STATUS: This is not tested.
MACRUM 0:119624335925 542 - [fread()](https://linux.die.net/man/3/fread).
MACRUM 0:119624335925 543 - STATUS: Basic testing implemented. Working.
MACRUM 0:119624335925 544 - STATUS: n x 25kB stress test working.
MACRUM 0:119624335925 545 - [ftell()](https://linux.die.net/man/3/ftell).
MACRUM 0:119624335925 546 - STATUS: Basic testing implemented. Working.
MACRUM 0:119624335925 547 - [fwrite()](https://linux.die.net/man/3/fwrite).
MACRUM 0:119624335925 548 - STATUS: Basic testing implemented. Working.
MACRUM 0:119624335925 549 - STATUS: n x 25kB stress test working.
MACRUM 0:119624335925 550 - [fseek()](https://linux.die.net/man/3/fseek)
MACRUM 0:119624335925 551 - STATUS: Basic testing implemented. Working.
MACRUM 0:119624335925 552 - [getc()](https://linux.die.net/man/3/fgets).
MACRUM 0:119624335925 553 - STATUS: Basic testing implemented. Working.
MACRUM 0:119624335925 554 - [gets()](https://linux.die.net/man/3/fgets).
MACRUM 0:119624335925 555 - STATUS: Unknown.
MACRUM 0:119624335925 556 - [putc()](https://linux.die.net/man/3/fputs).
MACRUM 0:119624335925 557 - STATUS: Unknown.
MACRUM 0:119624335925 558 - [puts()](https://linux.die.net/man/3/fputs).
MACRUM 0:119624335925 559 - STATUS: Unknown.
MACRUM 0:119624335925 560 - [remove()](https://linux.die.net/man/3/remove)
MACRUM 0:119624335925 561 - STATUS: Basic testing implemented. Working.
MACRUM 0:119624335925 562 - [rewind()](https://linux.die.net/man/3/rewind).
MACRUM 0:119624335925 563 - STATUS: Basic testing implemented. Working.
MACRUM 0:119624335925 564 - [stat()](https://linux.die.net/man/2/stat)
MACRUM 0:119624335925 565 - STATUS: Implemented. Working.
MACRUM 0:119624335925 566 - STATUS: Not supported by ARMCC/IAR libc.
MACRUM 0:119624335925 567 - [tmpfile()](https://linux.die.net/man/3/tmpfile).
MACRUM 0:119624335925 568 - STATUS: Not implemented.
MACRUM 0:119624335925 569 - [tmpnam()](https://linux.die.net/man/3/tmpnam).
MACRUM 0:119624335925 570 - STATUS: Not implemented.
MACRUM 0:119624335925 571
MACRUM 0:119624335925 572 Supported directory related operations are as follows:
MACRUM 0:119624335925 573
MACRUM 0:119624335925 574 - [closedir()](https://linux.die.net/man/3/closedir).
MACRUM 0:119624335925 575 - STATUS: Implemented. Working.
MACRUM 0:119624335925 576 - [mkdir()](https://linux.die.net/man/3/mkdir).
MACRUM 0:119624335925 577 - STATUS: Basic testing implemented. Working.
MACRUM 0:119624335925 578 - [opendir()](https://linux.die.net/man/3/opendir).
MACRUM 0:119624335925 579 - STATUS: Implemented. Working.
MACRUM 0:119624335925 580 - [readdir()](https://linux.die.net/man/3/readdir).
MACRUM 0:119624335925 581 - STATUS: Implemented. Working.
MACRUM 0:119624335925 582 - [remove()](https://linux.die.net/man/3/remove).
MACRUM 0:119624335925 583 - STATUS: Basic testing implemented. Working.
MACRUM 0:119624335925 584 - [rename()](https://linux.die.net/man/3/rename).
MACRUM 0:119624335925 585 - STATUS: Implemented. Not tested.
MACRUM 0:119624335925 586 - [rewinddir()](https://linux.die.net/man/3/rewinddir).
MACRUM 0:119624335925 587 - STATUS: Implemented. Found not to work. Test case not present in repo.
MACRUM 0:119624335925 588 - [seekdir()](https://linux.die.net/man/3/seekdir).
MACRUM 0:119624335925 589 - STATUS: Implemented. Found not to work. Test case not present in repo.
MACRUM 0:119624335925 590 - [telldir()](https://linux.die.net/man/3/telldir).
MACRUM 0:119624335925 591 - STATUS: Implemented. Found not to work. Test case not present in repo.
MACRUM 0:119624335925 592
MACRUM 0:119624335925 593 ### errno
MACRUM 0:119624335925 594
MACRUM 0:119624335925 595 Basic errno reporting is supported, tested and known to be working.
MACRUM 0:119624335925 596
MACRUM 0:119624335925 597
MACRUM 0:119624335925 598 # Related Projects Resources
MACRUM 0:119624335925 599
MACRUM 0:119624335925 600 The following are related mbed storage projects and useful resources:
MACRUM 0:119624335925 601
MACRUM 0:119624335925 602 - The [mbed-os](https://github.com/ARMmbed/mbed-os) main repository.
MACRUM 0:119624335925 603 - The [mbed-os-example-fat-filesystem](https://github.com/ARMmbed/mbed-os-example-fat-filesystem) repository.
MACRUM 0:119624335925 604 This is an example project for the mbed OS FAT filesystem.
MACRUM 0:119624335925 605 - The [spiflash-driver](https://github.com/armmbed/spiflash-driver) repository.
MACRUM 0:119624335925 606 - The [i2ceeprom-driver](https://github.com/ARMmbed/i2ceeprom-driver.git) repository.
MACRUM 0:119624335925 607 - The [ci-test-shield](https://github.com/ARMmbed/ci-test-shield) repository. This is the project describing
MACRUM 0:119624335925 608 the mbed-os Continuous Integration test shield, together with standard tests.
MACRUM 0:119624335925 609 - The [mbed-HDK](https://github.com/ARMmbed/mbed-HDK) repository containing Hardware Development Kit resources
MACRUM 0:119624335925 610 including the schematics for the CI test shield.
MACRUM 0:119624335925 611 - [POSIX File Interface ISO/IEC 9899:TC2 Documentation](http://www.eng.utah.edu/~cs5785/slides-f10/n1124.pdf).
MACRUM 0:119624335925 612 - [FATFS: Generic FAT File System Module used in mbed OS](http://elm-chan.org/fsw/ff/00index_e.html)