mirror of https://github.com/ARMmbed/mbed-os.git
Added support for Travis CI
parent
2a1c923ec7
commit
521e7aeea7
|
@ -0,0 +1,24 @@
|
||||||
|
script:
|
||||||
|
# Check that examples compile
|
||||||
|
- sed -n '/``` cpp/,${/```$/q;/```/d;p}' README.md > main.cpp &&
|
||||||
|
PYTHONPATH=mbed-os python mbed-os/tools/make.py -t GCC_ARM -m K64F
|
||||||
|
--source=. --build=BUILD/K64F/GCC_ARM -j0 &&
|
||||||
|
rm main.cpp
|
||||||
|
|
||||||
|
# Check that tests compile
|
||||||
|
- rm -rf BUILD && PYTHONPATH=mbed-os python mbed-os/tools/test.py
|
||||||
|
-t GCC_ARM -m K64F --source=. --build=BUILD/TESTS/K64F/GCC_ARM -j0
|
||||||
|
-n tests*
|
||||||
|
|
||||||
|
python:
|
||||||
|
- "2.7"
|
||||||
|
|
||||||
|
install:
|
||||||
|
# Get arm-none-eabi-gcc
|
||||||
|
- sudo add-apt-repository -y ppa:terry.guo/gcc-arm-embedded
|
||||||
|
- sudo apt-get update -qq
|
||||||
|
- sudo apt-get install -qq gcc-arm-none-eabi --force-yes
|
||||||
|
# Get dependencies
|
||||||
|
- git clone https://github.com/armmbed/mbed-os.git
|
||||||
|
# Install python dependencies
|
||||||
|
- sudo pip install -r mbed-os/requirements.txt
|
84
README.md
84
README.md
|
@ -368,53 +368,53 @@ The above figure shows how to connect the NUCLEO_F429ZI with the v1.0.0 CI test
|
||||||
|
|
||||||
The following sample code illustrates how to use the sd-driver Block Device API:
|
The following sample code illustrates how to use the sd-driver Block Device API:
|
||||||
|
|
||||||
|
``` cpp
|
||||||
|
#include "mbed.h"
|
||||||
|
#include "SDBlockDevice.h"
|
||||||
|
|
||||||
#include "mbed.h"
|
// Instantiate the SDBlockDevice by specifying the SPI pins connected to the SDCard
|
||||||
#include "SDBlockDevice.h"
|
// socket. The PINS are:
|
||||||
|
// MOSI (Master Out Slave In)
|
||||||
|
// MISO (Master In Slave Out)
|
||||||
|
// SCLK (Serial Clock)
|
||||||
|
// CS (Chip Select)
|
||||||
|
SDBlockDevice sd(MBED_CONF_SD_SPI_MOSI, MBED_CONF_SD_SPI_MISO, MBED_CONF_SD_SPI_CLK, MBED_CONF_SD_SPI_CS);
|
||||||
|
uint8_t block[512] = "Hello World!\n";
|
||||||
|
|
||||||
// Instantiate the SDBlockDevice by specifying the SPI pins connected to the SDCard
|
int main()
|
||||||
// socket. The PINS are:
|
{
|
||||||
// MOSI (Master Out Slave In)
|
// call the SDBlockDevice instance initialisation method.
|
||||||
// MISO (Master In Slave Out)
|
if ( 0 != sd.init()) {
|
||||||
// SCLK (Serial Clock)
|
printf("Init failed \n");
|
||||||
// CS (Chip Select)
|
return -1;
|
||||||
SDBlockDevice sd(MBED_CONF_SD_SPI_MOSI, MBED_CONF_SD_SPI_MISO, MBED_CONF_SD_SPI_CLK, MBED_CONF_SD_SPI_CS);
|
}
|
||||||
uint8_t block[512] = "Hello World!\n";
|
printf("sd size: %llu\n", sd.size());
|
||||||
|
printf("sd read size: %llu\n", sd.get_read_size());
|
||||||
|
printf("sd program size: %llu\n", sd.get_program_size());
|
||||||
|
printf("sd erase size: %llu\n", sd.get_erase_size());
|
||||||
|
|
||||||
int main()
|
// set the frequency
|
||||||
{
|
if ( 0 != sd.frequency(5000000)) {
|
||||||
// call the SDBlockDevice instance initialisation method.
|
printf("Error setting frequency \n");
|
||||||
if ( 0 != sd.init()) {
|
|
||||||
printf("Init failed \n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
printf("sd size: %llu\n", sd.size());
|
|
||||||
printf("sd read size: %llu\n", sd.get_read_size());
|
|
||||||
printf("sd program size: %llu\n", sd.get_program_size());
|
|
||||||
printf("sd erase size: %llu\n", sd.get_erase_size());
|
|
||||||
|
|
||||||
// set the frequency
|
|
||||||
if ( 0 != sd.frequency(5000000)) {
|
|
||||||
printf("Error setting frequency \n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( 0 != sd.erase(0, sd.get_erase_size())) {
|
|
||||||
printf("Error Erasing block \n");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write some the data block to the device
|
|
||||||
if ( 0 == sd.program(block, 0, 512)) {
|
|
||||||
// read the data block from the device
|
|
||||||
if ( 0 == sd.read(block, 0, 512)) {
|
|
||||||
// print the contents of the block
|
|
||||||
printf("%s", block);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// call the SDBlockDevice instance de-initialisation method.
|
|
||||||
sd.deinit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( 0 != sd.erase(0, sd.get_erase_size())) {
|
||||||
|
printf("Error Erasing block \n");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write some the data block to the device
|
||||||
|
if ( 0 == sd.program(block, 0, 512)) {
|
||||||
|
// read the data block from the device
|
||||||
|
if ( 0 == sd.read(block, 0, 512)) {
|
||||||
|
// print the contents of the block
|
||||||
|
printf("%s", block);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// call the SDBlockDevice instance de-initialisation method.
|
||||||
|
sd.deinit();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
# SDCard POSIX File API mbed Greentea Test Cases
|
# SDCard POSIX File API mbed Greentea Test Cases
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue