Added support for Travis CI

pull/10711/head
Christopher Haster 2017-07-16 13:24:42 -05:00
parent 69da721261
commit 2be4fafeb0
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}' I2CEEBlockDevice.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

@ -24,29 +24,37 @@
* Microchip's 24LC or ATMEL's AT24C ranges
*
* @code
* // Here's an example using a 24LC256 on a GR PEACH
* #include "mbed.h"
* #include "I2CEEBlockDevice.h"
*
* // Create 24LC device with 32Kbytes of memory
* I2CEEBlockDevice flash(D14, D15, 0xa0, 32*1024);
* // Create EEPROM device on I2C bus with 32kbytes of memory
* I2CEEBlockDevice i2cee(D14, D15, 0xa0, 32*1024);
*
* int main() {
* printf("flash test\n");
* mx52r.init();
* printf("flash size: %llu\n", flash.size());
* printf("flash read size: %llu\n", flash.get_read_size());
* printf("flash program size: %llu\n", flash.get_program_size());
* printf("flash erase size: %llu\n", flash.get_erase_size());
* printf("i2cee test\n");
*
* uint8_t *buffer = malloc(flash.get_erase_size());
* // Initialize the device and print the memory layout
* i2cee.init();
* printf("i2cee size: %llu\n", i2cee.size());
* printf("i2cee read size: %llu\n", i2cee.get_read_size());
* printf("i2cee program size: %llu\n", i2cee.get_program_size());
* printf("i2cee erase size: %llu\n", i2cee.get_erase_size());
*
* // Write "Hello World!" to the first block
* char *buffer = (char*)malloc(i2cee.get_erase_size());
* sprintf(buffer, "Hello World!\n");
* flash.erase(0, flash.get_erase_size());
* flash.program(buffer, 0, flash.get_erase_size());
* flash.read(buffer, 0, flash.get_erase_size());
* i2cee.erase(0, i2cee.get_erase_size());
* i2cee.program(buffer, 0, i2cee.get_erase_size());
*
* // Read back what was stored
* i2cee.read(buffer, 0, i2cee.get_erase_size());
* printf("%s", buffer);
*
* flash.deinit();
* // Deinitialize the device
* i2cee.deinit();
* }
* @endcode
*/
class I2CEEBlockDevice : public BlockDevice {
public:

View File

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