Added support for Travis CI

pull/7774/head
Christopher Haster 2017-07-16 15:02:09 -05:00
parent 2a1c923ec7
commit 521e7aeea7
2 changed files with 66 additions and 42 deletions

24
.travis.yml Normal file
View File

@ -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

View File

@ -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:
``` cpp
#include "mbed.h"
#include "SDBlockDevice.h"
#include "mbed.h"
#include "SDBlockDevice.h"
// Instantiate the SDBlockDevice by specifying the SPI pins connected to the SDCard
// 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
// 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";
int main()
{
// call the SDBlockDevice instance initialisation method.
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());
int main()
{
// call the SDBlockDevice instance initialisation method.
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();
// 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();
}
```
# SDCard POSIX File API mbed Greentea Test Cases