Added support for Travis CI

pull/7774/head
Christopher Haster 2017-07-16 14:34:05 -05:00
parent 4ae3dc05a6
commit daf4a7fea1
3 changed files with 42 additions and 14 deletions

28
.travis.yml Normal file
View File

@ -0,0 +1,28 @@
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 K82F
--source=. --build=BUILD/K82F/GCC_ARM -j0 &&
rm main.cpp
- sed -n '/@code/,${/@endcode/q;/@/d;s/^ \*//;p}' DataFlashBlockDevice.h > main.cpp &&
PYTHONPATH=mbed-os python mbed-os/tools/make.py -t GCC_ARM -m K82F
--source=. --build=BUILD/K82F/GCC_ARM -j0 &&
rm main.cpp
# Check that tests compile
- rm -r BUILD && PYTHONPATH=mbed-os python mbed-os/tools/test.py
-t GCC_ARM -m K82F --source=. --build=BUILD/TESTS/K82F/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

@ -29,10 +29,10 @@
* #include "DataFlashBlockDevice.h" * #include "DataFlashBlockDevice.h"
* *
* // Create DataFlash on SPI bus with PTE5 as chip select * // Create DataFlash on SPI bus with PTE5 as chip select
* DataFlashBlockDevice at45db(PTE2, PTE4, PTE1, PTE5); * DataFlashBlockDevice dataflash(PTE2, PTE4, PTE1, PTE5);
* *
* // Create DataFlash on SPI bus with PTE6 as write-protect * // Create DataFlash on SPI bus with PTE6 as write-protect
* DataFlashBlockDevice at45db(PTE2, PTE4, PTE1, PTE5, PTE6); * DataFlashBlockDevice dataflash2(PTE2, PTE4, PTE1, PTE5, PTE6);
* *
* int main() { * int main() {
* printf("dataflash test\n"); * printf("dataflash test\n");
@ -45,17 +45,17 @@
* printf("dataflash erase size: %llu\n", dataflash.get_erase_size()); * printf("dataflash erase size: %llu\n", dataflash.get_erase_size());
* *
* // Write "Hello World!" to the first block * // Write "Hello World!" to the first block
* uint8_t *buffer = (uint8_t*)malloc(spif.get_erase_size()); * char *buffer = (char*)malloc(dataflash.get_erase_size());
* sprintf(buffer, "Hello World!\n"); * sprintf(buffer, "Hello World!\n");
* spif.erase(0, spif.get_erase_size()); * dataflash.erase(0, dataflash.get_erase_size());
* spif.program(buffer, 0, spif.get_erase_size()); * dataflash.program(buffer, 0, dataflash.get_erase_size());
* *
* // Read back what was stored * // Read back what was stored
* spif.read(buffer, 0, spif.get_erase_size()); * dataflash.read(buffer, 0, dataflash.get_erase_size());
* printf("%s", buffer); * printf("%s", buffer);
* *
* // Deinitialize the device * // Deinitialize the device
* spif.deinit(); * dataflash.deinit();
* } * }
* @endcode * @endcode
*/ */

View File

@ -22,10 +22,10 @@ https://en.wikipedia.org/wiki/DataFlash
#include "DataFlashBlockDevice.h" #include "DataFlashBlockDevice.h"
// Create DataFlash on SPI bus with PTE5 as chip select // Create DataFlash on SPI bus with PTE5 as chip select
DataFlashBlockDevice at45db(PTE2, PTE4, PTE1, PTE5); DataFlashBlockDevice dataflash(PTE2, PTE4, PTE1, PTE5);
// Create DataFlash on SPI bus with PTE6 as write-protect // Create DataFlash on SPI bus with PTE6 as write-protect
DataFlashBlockDevice at45db(PTE2, PTE4, PTE1, PTE5, PTE6); DataFlashBlockDevice dataflash2(PTE2, PTE4, PTE1, PTE5, PTE6);
int main() { int main() {
printf("dataflash test\n"); printf("dataflash test\n");
@ -38,17 +38,17 @@ int main() {
printf("dataflash erase size: %llu\n", dataflash.get_erase_size()); printf("dataflash erase size: %llu\n", dataflash.get_erase_size());
// Write "Hello World!" to the first block // Write "Hello World!" to the first block
uint8_t *buffer = (uint8_t*)malloc(spif.get_erase_size()); char *buffer = (char*)malloc(dataflash.get_erase_size());
sprintf(buffer, "Hello World!\n"); sprintf(buffer, "Hello World!\n");
spif.erase(0, spif.get_erase_size()); dataflash.erase(0, dataflash.get_erase_size());
spif.program(buffer, 0, spif.get_erase_size()); dataflash.program(buffer, 0, dataflash.get_erase_size());
// Read back what was stored // Read back what was stored
spif.read(buffer, 0, spif.get_erase_size()); dataflash.read(buffer, 0, dataflash.get_erase_size());
printf("%s", buffer); printf("%s", buffer);
// Deinitialize the device // Deinitialize the device
spif.deinit(); dataflash.deinit();
} }
``` ```