Skip to content

Commit 521e7ae

Browse files
committed
Added support for Travis CI
1 parent 2a1c923 commit 521e7ae

File tree

2 files changed

+66
-42
lines changed

2 files changed

+66
-42
lines changed

.travis.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
script:
2+
# Check that examples compile
3+
- sed -n '/``` cpp/,${/```$/q;/```/d;p}' README.md > main.cpp &&
4+
PYTHONPATH=mbed-os python mbed-os/tools/make.py -t GCC_ARM -m K64F
5+
--source=. --build=BUILD/K64F/GCC_ARM -j0 &&
6+
rm main.cpp
7+
8+
# Check that tests compile
9+
- rm -rf BUILD && PYTHONPATH=mbed-os python mbed-os/tools/test.py
10+
-t GCC_ARM -m K64F --source=. --build=BUILD/TESTS/K64F/GCC_ARM -j0
11+
-n tests*
12+
13+
python:
14+
- "2.7"
15+
16+
install:
17+
# Get arm-none-eabi-gcc
18+
- sudo add-apt-repository -y ppa:terry.guo/gcc-arm-embedded
19+
- sudo apt-get update -qq
20+
- sudo apt-get install -qq gcc-arm-none-eabi --force-yes
21+
# Get dependencies
22+
- git clone https://github.com/armmbed/mbed-os.git
23+
# Install python dependencies
24+
- sudo pip install -r mbed-os/requirements.txt

README.md

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -368,53 +368,53 @@ The above figure shows how to connect the NUCLEO_F429ZI with the v1.0.0 CI test
368368
369369
The following sample code illustrates how to use the sd-driver Block Device API:
370370
371+
``` cpp
372+
#include "mbed.h"
373+
#include "SDBlockDevice.h"
374+
375+
// Instantiate the SDBlockDevice by specifying the SPI pins connected to the SDCard
376+
// socket. The PINS are:
377+
// MOSI (Master Out Slave In)
378+
// MISO (Master In Slave Out)
379+
// SCLK (Serial Clock)
380+
// CS (Chip Select)
381+
SDBlockDevice sd(MBED_CONF_SD_SPI_MOSI, MBED_CONF_SD_SPI_MISO, MBED_CONF_SD_SPI_CLK, MBED_CONF_SD_SPI_CS);
382+
uint8_t block[512] = "Hello World!\n";
383+
384+
int main()
385+
{
386+
// call the SDBlockDevice instance initialisation method.
387+
if ( 0 != sd.init()) {
388+
printf("Init failed \n");
389+
return -1;
390+
}
391+
printf("sd size: %llu\n", sd.size());
392+
printf("sd read size: %llu\n", sd.get_read_size());
393+
printf("sd program size: %llu\n", sd.get_program_size());
394+
printf("sd erase size: %llu\n", sd.get_erase_size());
395+
396+
// set the frequency
397+
if ( 0 != sd.frequency(5000000)) {
398+
printf("Error setting frequency \n");
399+
}
371400
372-
#include "mbed.h"
373-
#include "SDBlockDevice.h"
374-
375-
// Instantiate the SDBlockDevice by specifying the SPI pins connected to the SDCard
376-
// socket. The PINS are:
377-
// MOSI (Master Out Slave In)
378-
// MISO (Master In Slave Out)
379-
// SCLK (Serial Clock)
380-
// CS (Chip Select)
381-
SDBlockDevice sd(MBED_CONF_SD_SPI_MOSI, MBED_CONF_SD_SPI_MISO, MBED_CONF_SD_SPI_CLK, MBED_CONF_SD_SPI_CS);
382-
uint8_t block[512] = "Hello World!\n";
383-
384-
int main()
385-
{
386-
// call the SDBlockDevice instance initialisation method.
387-
if ( 0 != sd.init()) {
388-
printf("Init failed \n");
389-
return -1;
390-
}
391-
printf("sd size: %llu\n", sd.size());
392-
printf("sd read size: %llu\n", sd.get_read_size());
393-
printf("sd program size: %llu\n", sd.get_program_size());
394-
printf("sd erase size: %llu\n", sd.get_erase_size());
395-
396-
// set the frequency
397-
if ( 0 != sd.frequency(5000000)) {
398-
printf("Error setting frequency \n");
399-
}
400-
401-
if ( 0 != sd.erase(0, sd.get_erase_size())) {
402-
printf("Error Erasing block \n");
403-
}
401+
if ( 0 != sd.erase(0, sd.get_erase_size())) {
402+
printf("Error Erasing block \n");
403+
}
404404
405-
// Write some the data block to the device
406-
if ( 0 == sd.program(block, 0, 512)) {
407-
// read the data block from the device
408-
if ( 0 == sd.read(block, 0, 512)) {
409-
// print the contents of the block
410-
printf("%s", block);
411-
}
405+
// Write some the data block to the device
406+
if ( 0 == sd.program(block, 0, 512)) {
407+
// read the data block from the device
408+
if ( 0 == sd.read(block, 0, 512)) {
409+
// print the contents of the block
410+
printf("%s", block);
412411
}
413-
414-
// call the SDBlockDevice instance de-initialisation method.
415-
sd.deinit();
416412
}
417413
414+
// call the SDBlockDevice instance de-initialisation method.
415+
sd.deinit();
416+
}
417+
```
418418

419419
# SDCard POSIX File API mbed Greentea Test Cases
420420

0 commit comments

Comments
 (0)