mirror of https://github.com/ARMmbed/mbed-os.git
parent
71431437fd
commit
8bca678ed8
|
@ -1,6 +1,6 @@
|
|||
# Getting started with the Mbed OS block device test
|
||||
|
||||
Mbed OS block device test is used to test existing and new block devices.
|
||||
You can use the Mbed OS block device test to test existing and new block devices.
|
||||
|
||||
You can find more information about the Mbed OS block device and other related pieces of the Mbed OS storage stack [in the storage overview](https://os.mbed.com/docs/latest/reference/storage.html).
|
||||
|
||||
|
@ -15,16 +15,13 @@ You can find more information about the Mbed OS block device and other related p
|
|||
|
||||
## Hardware requirements
|
||||
|
||||
This test uses a block device as storage. This can be either an external
|
||||
block device (one of SPI flash, DataFlash or an SD card) or simulated on a
|
||||
heap block device on boards with enough RAM.
|
||||
This test uses a block device as storage. This can be either an external block device (one of SPI flash, DataFlash or an SD card) or simulated on a heap block device on boards with enough RAM.
|
||||
|
||||
## Usage
|
||||
|
||||
#### Compile the test
|
||||
|
||||
Invoke `mbed test`, and specify the name of your platform and your favorite
|
||||
toolchain (`GCC_ARM`, `ARM`, `IAR`). For example, for the ARM Compiler 5:
|
||||
Invoke `mbed test`, and specify the name of your platform and your favorite toolchain (`GCC_ARM`, `ARM`, `IAR`). For example, for the ARM Compiler 5:
|
||||
|
||||
```
|
||||
mbed test -m K64F -t ARM -n mbed-os-features-storage-tests-blockdevice-general_block_device --compile
|
||||
|
@ -40,18 +37,17 @@ mbed test -m K64F -t ARM -n mbed-os-features-storage-tests-blockdevice-general_b
|
|||
|
||||
#### Troubleshooting
|
||||
|
||||
If you have problems, you can review the [documentation](https://os.mbed.com/docs/latest/tutorials/debugging.html)
|
||||
for suggestions on what could be wrong and how to fix it.
|
||||
Please review the [documentation](https://os.mbed.com/docs/latest/tutorials/debugging.html) for suggestions about how to fix possible issues you may face.
|
||||
|
||||
## Changing the block device
|
||||
|
||||
In Mbed OS, a C++ class that inherits from the [BlockDevice](https://os.mbed.com/docs/latest/reference/storage.html#block-devices)
|
||||
interface represents each block device.
|
||||
This test uses the default block device received by the function get_default_instance(), it is defined in [SystemStorage.cpp](https://github.com/ARMmbed/mbed-os/blob/master/features/storage/system_storage/SystemStorage.cpp#L35-L77) as MBED_WEAK, in case we would like to test a new block device we will have to override it.
|
||||
In Mbed OS, a C++ class that inherits from the [BlockDevice](https://os.mbed.com/docs/latest/reference/storage.html#block-devices) interface represents each block device.
|
||||
|
||||
first add the new block device cpp and header files to [blockdevice folder](https://github.com/ARMmbed/mbed-os/tree/master/features/storage/blockdevice), then implement get_default_instance() inside the test main.cpp.
|
||||
This test uses the default block device that the function `get_default_instance()` receives. [SystemStorage.cpp](https://github.com/ARMmbed/mbed-os/blob/master/features/storage/system_storage/SystemStorage.cpp#L35-L77) defines this as `MBED_WEAK`. If you would like to test a new block device, you have to override it.
|
||||
|
||||
for example, in order to test the HeapBlockDevice add:
|
||||
First add the new block device .cpp and header files to the [blockdevice folder](https://github.com/ARMmbed/mbed-os/tree/master/features/storage/blockdevice). Then, implement `get_default_instance()` inside the test `main.cpp`.
|
||||
|
||||
For example, to test the HeapBlockDevice, add:
|
||||
|
||||
``` diff
|
||||
+#define TEST_BLOCK_SIZE 128
|
||||
|
@ -69,7 +65,7 @@ Now you can recompile and run.
|
|||
|
||||
## Tested configurations
|
||||
|
||||
- K64F + SD
|
||||
- K64F + Heap
|
||||
- K82F + SPIF
|
||||
- K82F + Heap
|
||||
- K64F + SD.
|
||||
- K64F + Heap.
|
||||
- K82F + SPIF.
|
||||
- K82F + Heap.
|
||||
|
|
Loading…
Reference in New Issue