Added support for Travis CI

pull/7774/head
Christopher Haster 2017-07-16 13:21:14 -05:00
parent cc15f37141
commit c46b2a762d
3 changed files with 54 additions and 18 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}' SPIFBlockDevice.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

@ -26,7 +26,7 @@ int main() {
printf("spif erase size: %llu\n", spif.get_erase_size()); printf("spif erase size: %llu\n", spif.get_erase_size());
// Write "Hello World!" to the first block // Write "Hello World!" to the first block
uint8_t *buffer = malloc(spif.get_erase_size()); char *buffer = (char*)malloc(spif.get_erase_size());
sprintf(buffer, "Hello World!\n"); sprintf(buffer, "Hello World!\n");
spif.erase(0, spif.get_erase_size()); spif.erase(0, spif.get_erase_size());
spif.program(buffer, 0, spif.get_erase_size()); spif.program(buffer, 0, spif.get_erase_size());

View File

@ -24,29 +24,37 @@
* such as the MX25R or SST26F016B * such as the MX25R or SST26F016B
* *
* @code * @code
* // Here's an example using the MX25R SPI flash device on the K82F
* #include "mbed.h" * #include "mbed.h"
* #include "SPIFBlockDevice.h" * #include "SPIFBlockDevice.h"
* *
* // Create mx25r on SPI bus with PTE5 as chip select * // Create flash device on SPI bus with PTE5 as chip select
* SPIFBlockDevice mx25r(PTE2, PTE4, PTE1, PTE5); * SPIFBlockDevice spif(PTE2, PTE4, PTE1, PTE5);
* *
* int main() { * int main() {
* printf("mx25r test\n"); * printf("spif test\n");
* mx52r.init(); *
* printf("mx25r size: %llu\n", mx25r.size()); * // Initialize the SPI flash device and print the memory layout
* printf("mx25r read size: %llu\n", mx25r.get_read_size()); * spif.init();
* printf("mx25r program size: %llu\n", mx25r.get_program_size()); * printf("spif size: %llu\n", spif.size());
* printf("mx25r erase size: %llu\n", mx25r.get_erase_size()); * printf("spif read size: %llu\n", spif.get_read_size());
* * printf("spif program size: %llu\n", spif.get_program_size());
* uint8_t *buffer = malloc(mx25r.get_erase_size()); * printf("spif erase size: %llu\n", spif.get_erase_size());
*
* // Write "Hello World!" to the first block
* char *buffer = (char*)malloc(spif.get_erase_size());
* sprintf(buffer, "Hello World!\n"); * sprintf(buffer, "Hello World!\n");
* mx25r.erase(0, mx25r.get_erase_size()); * spif.erase(0, spif.get_erase_size());
* mx25r.program(buffer, 0, mx25r.get_erase_size()); * spif.program(buffer, 0, spif.get_erase_size());
* mx25r.read(buffer, 0, mx25r.get_erase_size()); *
* // Read back what was stored
* spif.read(buffer, 0, spif.get_erase_size());
* printf("%s", buffer); * printf("%s", buffer);
* *
* mx25r.deinit(); * // Deinitialize the device
* spif.deinit();
* } * }
* @endcode
*/ */
class SPIFBlockDevice : public BlockDevice { class SPIFBlockDevice : public BlockDevice {
public: public: