Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
This application contains the example codes to:
1) Connect PFM-M487/PFM-NUC472 boards to Pelion
2) Enable Firmware update
For storage, PFM-M487/PFM-NUC472 support both SPI interface SD and built-in SD bus SD.
For connectivity, PFM-M487/PFM-NUC472 support Ethernet (on-board) by default.
This example supports Ethernet and built-in SD by default.

targets/TARGET_NUVOTON/SystemStorage.cpp@14:5ce1bab0e558, 2018-11-23 (annotated)
- Committer:
- ccli8
- Date:
- Fri Nov 23 15:19:06 2018 +0800
- Revision:
- 14:5ce1bab0e558
Organize target-dependent directory structure
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| ccli8 |
14:5ce1bab0e558 | 1 | /* Storage interface defaults |
| ccli8 |
14:5ce1bab0e558 | 2 | * Copyright (c) 2018-2020 Nuvoton |
| ccli8 |
14:5ce1bab0e558 | 3 | * |
| ccli8 |
14:5ce1bab0e558 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| ccli8 |
14:5ce1bab0e558 | 5 | * you may not use this file except in compliance with the License. |
| ccli8 |
14:5ce1bab0e558 | 6 | * You may obtain a copy of the License at |
| ccli8 |
14:5ce1bab0e558 | 7 | * |
| ccli8 |
14:5ce1bab0e558 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| ccli8 |
14:5ce1bab0e558 | 9 | * |
| ccli8 |
14:5ce1bab0e558 | 10 | * Unless required by applicable law or agreed to in writing, software |
| ccli8 |
14:5ce1bab0e558 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| ccli8 |
14:5ce1bab0e558 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| ccli8 |
14:5ce1bab0e558 | 13 | * See the License for the specific language governing permissions and |
| ccli8 |
14:5ce1bab0e558 | 14 | * limitations under the License. |
| ccli8 |
14:5ce1bab0e558 | 15 | */ |
| ccli8 |
14:5ce1bab0e558 | 16 | #include "mbed.h" |
| ccli8 |
14:5ce1bab0e558 | 17 | #include "FileSystem.h" |
| ccli8 |
14:5ce1bab0e558 | 18 | #include "FATFileSystem.h" |
| ccli8 |
14:5ce1bab0e558 | 19 | #include "LittleFileSystem.h" |
| ccli8 |
14:5ce1bab0e558 | 20 | |
| ccli8 |
14:5ce1bab0e558 | 21 | #if COMPONENT_SPIF |
| ccli8 |
14:5ce1bab0e558 | 22 | #include "SPIFBlockDevice.h" |
| ccli8 |
14:5ce1bab0e558 | 23 | #endif |
| ccli8 |
14:5ce1bab0e558 | 24 | |
| ccli8 |
14:5ce1bab0e558 | 25 | #if COMPONENT_SD |
| ccli8 |
14:5ce1bab0e558 | 26 | #include "SDBlockDevice.h" |
| ccli8 |
14:5ce1bab0e558 | 27 | #include "MBRBlockDevice.h" |
| ccli8 |
14:5ce1bab0e558 | 28 | #endif |
| ccli8 |
14:5ce1bab0e558 | 29 | |
| ccli8 |
14:5ce1bab0e558 | 30 | #if COMPONENT_NUSD |
| ccli8 |
14:5ce1bab0e558 | 31 | #include "NuSDBlockDevice.h" |
| ccli8 |
14:5ce1bab0e558 | 32 | #include "MBRBlockDevice.h" |
| ccli8 |
14:5ce1bab0e558 | 33 | #endif |
| ccli8 |
14:5ce1bab0e558 | 34 | |
| ccli8 |
14:5ce1bab0e558 | 35 | BlockDevice *BlockDevice::get_default_instance() |
| ccli8 |
14:5ce1bab0e558 | 36 | { |
| ccli8 |
14:5ce1bab0e558 | 37 | #if COMPONENT_SPIF |
| ccli8 |
14:5ce1bab0e558 | 38 | |
| ccli8 |
14:5ce1bab0e558 | 39 | static SPIFBlockDevice default_bd( |
| ccli8 |
14:5ce1bab0e558 | 40 | MBED_CONF_SPIF_DRIVER_SPI_MOSI, |
| ccli8 |
14:5ce1bab0e558 | 41 | MBED_CONF_SPIF_DRIVER_SPI_MISO, |
| ccli8 |
14:5ce1bab0e558 | 42 | MBED_CONF_SPIF_DRIVER_SPI_CLK, |
| ccli8 |
14:5ce1bab0e558 | 43 | MBED_CONF_SPIF_DRIVER_SPI_CS, |
| ccli8 |
14:5ce1bab0e558 | 44 | MBED_CONF_SPIF_DRIVER_SPI_FREQ |
| ccli8 |
14:5ce1bab0e558 | 45 | ); |
| ccli8 |
14:5ce1bab0e558 | 46 | |
| ccli8 |
14:5ce1bab0e558 | 47 | return &default_bd; |
| ccli8 |
14:5ce1bab0e558 | 48 | |
| ccli8 |
14:5ce1bab0e558 | 49 | #elif COMPONENT_SD |
| ccli8 |
14:5ce1bab0e558 | 50 | |
| ccli8 |
14:5ce1bab0e558 | 51 | static SDBlockDevice default_bd( |
| ccli8 |
14:5ce1bab0e558 | 52 | MBED_CONF_SD_SPI_MOSI, |
| ccli8 |
14:5ce1bab0e558 | 53 | MBED_CONF_SD_SPI_MISO, |
| ccli8 |
14:5ce1bab0e558 | 54 | MBED_CONF_SD_SPI_CLK, |
| ccli8 |
14:5ce1bab0e558 | 55 | MBED_CONF_SD_SPI_CS |
| ccli8 |
14:5ce1bab0e558 | 56 | ); |
| ccli8 |
14:5ce1bab0e558 | 57 | |
| ccli8 |
14:5ce1bab0e558 | 58 | return &default_bd; |
| ccli8 |
14:5ce1bab0e558 | 59 | |
| ccli8 |
14:5ce1bab0e558 | 60 | #elif COMPONENT_NUSD |
| ccli8 |
14:5ce1bab0e558 | 61 | |
| ccli8 |
14:5ce1bab0e558 | 62 | static NuSDBlockDevice default_bd; |
| ccli8 |
14:5ce1bab0e558 | 63 | |
| ccli8 |
14:5ce1bab0e558 | 64 | return &default_bd; |
| ccli8 |
14:5ce1bab0e558 | 65 | |
| ccli8 |
14:5ce1bab0e558 | 66 | #else |
| ccli8 |
14:5ce1bab0e558 | 67 | |
| ccli8 |
14:5ce1bab0e558 | 68 | return NULL; |
| ccli8 |
14:5ce1bab0e558 | 69 | |
| ccli8 |
14:5ce1bab0e558 | 70 | #endif |
| ccli8 |
14:5ce1bab0e558 | 71 | } |