Nuvoton / Mbed OS NuMaker-mbed-cloud-example-Ethernet

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.

https://os.mbed.com/media/cache/platforms/NuMaker-PFM-M487.png.170x170_q85.png https://os.mbed.com/media/cache/platforms/NuMaker-PFM-NUC472Small.png.170x170_q85.png

targets/TARGET_NUVOTON/SystemStorage.cpp

Committer:
ccli8
Date:
2018-11-23
Revision:
14:5ce1bab0e558

File content as of revision 14:5ce1bab0e558:

/* Storage interface defaults
 * Copyright (c) 2018-2020 Nuvoton
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
#include "mbed.h"
#include "FileSystem.h"
#include "FATFileSystem.h"
#include "LittleFileSystem.h"

#if COMPONENT_SPIF
#include "SPIFBlockDevice.h"
#endif

#if COMPONENT_SD
#include "SDBlockDevice.h"
#include "MBRBlockDevice.h"
#endif

#if COMPONENT_NUSD
#include "NuSDBlockDevice.h"
#include "MBRBlockDevice.h"
#endif

BlockDevice *BlockDevice::get_default_instance()
{
#if COMPONENT_SPIF

    static SPIFBlockDevice default_bd(
        MBED_CONF_SPIF_DRIVER_SPI_MOSI,
        MBED_CONF_SPIF_DRIVER_SPI_MISO,
        MBED_CONF_SPIF_DRIVER_SPI_CLK,
        MBED_CONF_SPIF_DRIVER_SPI_CS,
        MBED_CONF_SPIF_DRIVER_SPI_FREQ
    );

    return &default_bd;

#elif COMPONENT_SD

    static SDBlockDevice default_bd(
        MBED_CONF_SD_SPI_MOSI,
        MBED_CONF_SD_SPI_MISO,
        MBED_CONF_SD_SPI_CLK,
        MBED_CONF_SD_SPI_CS
    );

    return &default_bd;

#elif COMPONENT_NUSD

    static NuSDBlockDevice default_bd;

    return &default_bd;

#else

    return NULL;

#endif
}