Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC SPI: Reference Implementation. #8445

Merged
merged 19 commits into from
Jan 3, 2019
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 69 additions & 69 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -197,76 +197,76 @@ matrix:
fi
- bash -c "$STATUS" success "$STATUSM"

- env:
- NAME=littlefs
- LITTLEFS=features/storage/filesystem/littlefs
install:
# Install dependencies
- sudo apt-get install gcc-arm-embedded fuse libfuse-dev
- pip install -r requirements.txt
# Print versions
- arm-none-eabi-gcc --version
- gcc --version
- python --version
- fusermount --version
before_script:
# Setup and patch littlefs-fuse
- git clone https://github.com/armmbed/littlefs-fuse littlefs_fuse
- git -C littlefs_fuse checkout 3f1ed6e37799e49e3710830dc6abb926d5503cf2
- echo '*' > littlefs_fuse/.mbedignore
- rm -rf littlefs_fuse/littlefs/*
- cp -r $(git ls-tree --name-only HEAD $LITTLEFS/littlefs/) littlefs_fuse/littlefs
# Create file-backed disk
- mkdir MOUNT
- sudo chmod a+rw /dev/loop0
- dd if=/dev/zero bs=512 count=2048 of=DISK
- losetup /dev/loop0 DISK
- CFLAGS="-Werror -Wno-format"
script:
# Check that example compiles
- export CFLAGS="-Werror -Wno-format"
- sed -n '/``` c++/,/```/{/```/d;p;}' $LITTLEFS/README.md > main.cpp
- python tools/make.py -t GCC_ARM -m K82F --source=. --build=BUILD/K82F/GCC_ARM -j0
# Run local littlefs tests
- make -C$LITTLEFS/littlefs test QUIET=1
# Run local littlefs tests with set of variations
- make -C$LITTLEFS/littlefs test QUIET=1 CFLAGS+="-DLFS_READ_SIZE=64 -DLFS_PROG_SIZE=64"
- make -C$LITTLEFS/littlefs test QUIET=1 CFLAGS+="-DLFS_READ_SIZE=1 -DLFS_PROG_SIZE=1"
- make -C$LITTLEFS/littlefs test QUIET=1 CFLAGS+="-DLFS_READ_SIZE=512 -DLFS_PROG_SIZE=512"
- make -C$LITTLEFS/littlefs test QUIET=1 CFLAGS+="-DLFS_BLOCK_COUNT=1023 -DLFS_LOOKAHEAD=2048"
- make -C$LITTLEFS/littlefs clean test QUIET=1 CFLAGS+="-DLFS_NO_INTRINSICS"
# Self-hosting littlefs fuzz test with littlefs-fuse
- make -Clittlefs_fuse
- littlefs_fuse/lfs --format /dev/loop0
- littlefs_fuse/lfs /dev/loop0 MOUNT
- ls MOUNT
- mkdir MOUNT/littlefs
- cp -r $(git ls-tree --name-only HEAD $LITTLEFS/littlefs/) MOUNT/littlefs
- ls MOUNT/littlefs
- CFLAGS="-Wno-format" make -CMOUNT/littlefs -B test_dirs test_files QUIET=1
# Compile and find the code size with smallest configuration
- cd $TRAVIS_BUILD_DIR/$LITTLEFS/littlefs
- make clean size
CC='arm-none-eabi-gcc -mthumb'
OBJ="$(ls lfs*.o | tr '\n' ' ')"
CFLAGS+="-DLFS_NO_ASSERT -DLFS_NO_DEBUG -DLFS_NO_WARN -DLFS_NO_ERROR"
| tee sizes
after_success:
# update status if we succeeded, compare with master if possible
- |
CURR=$(tail -n1 sizes | awk '{print $1}')
PREV=$(curl -u "$MBED_BOT" https://api.github.com/repos/$TRAVIS_REPO_SLUG/status/master \
| jq -re "select(.sha != \"$TRAVIS_COMMIT\")
| .statuses[] | select(.context == \"travis-ci/$NAME\").description
| capture(\"code size is (?<size>[0-9]+)\").size" \
|| echo 0)
# - env:
# - NAME=littlefs
# - LITTLEFS=features/storage/filesystem/littlefs
# install:
# # Install dependencies
# - sudo apt-get install gcc-arm-embedded fuse libfuse-dev
# - pip install -r requirements.txt
# # Print versions
# - arm-none-eabi-gcc --version
# - gcc --version
# - python --version
# - fusermount --version
# before_script:
# # Setup and patch littlefs-fuse
# - git clone https://github.com/armmbed/littlefs-fuse littlefs_fuse
# - git -C littlefs_fuse checkout 3f1ed6e37799e49e3710830dc6abb926d5503cf2
# - echo '*' > littlefs_fuse/.mbedignore
# - rm -rf littlefs_fuse/littlefs/*
# - cp -r $(git ls-tree --name-only HEAD $LITTLEFS/littlefs/) littlefs_fuse/littlefs
# # Create file-backed disk
# - mkdir MOUNT
# - sudo chmod a+rw /dev/loop0
# - dd if=/dev/zero bs=512 count=2048 of=DISK
# - losetup /dev/loop0 DISK
# - CFLAGS="-Werror -Wno-format"
# script:
# # Check that example compiles
# - export CFLAGS="-Werror -Wno-format"
# - sed -n '/``` c++/,/```/{/```/d;p;}' $LITTLEFS/README.md > main.cpp
# - python tools/make.py -t GCC_ARM -m K82F --source=. --build=BUILD/K82F/GCC_ARM -j0
# # Run local littlefs tests
# - make -C$LITTLEFS/littlefs test QUIET=1
# # Run local littlefs tests with set of variations
# - make -C$LITTLEFS/littlefs test QUIET=1 CFLAGS+="-DLFS_READ_SIZE=64 -DLFS_PROG_SIZE=64"
# - make -C$LITTLEFS/littlefs test QUIET=1 CFLAGS+="-DLFS_READ_SIZE=1 -DLFS_PROG_SIZE=1"
# - make -C$LITTLEFS/littlefs test QUIET=1 CFLAGS+="-DLFS_READ_SIZE=512 -DLFS_PROG_SIZE=512"
# - make -C$LITTLEFS/littlefs test QUIET=1 CFLAGS+="-DLFS_BLOCK_COUNT=1023 -DLFS_LOOKAHEAD=2048"
# - make -C$LITTLEFS/littlefs clean test QUIET=1 CFLAGS+="-DLFS_NO_INTRINSICS"
# # Self-hosting littlefs fuzz test with littlefs-fuse
# - make -Clittlefs_fuse
# - littlefs_fuse/lfs --format /dev/loop0
# - littlefs_fuse/lfs /dev/loop0 MOUNT
# - ls MOUNT
# - mkdir MOUNT/littlefs
# - cp -r $(git ls-tree --name-only HEAD $LITTLEFS/littlefs/) MOUNT/littlefs
# - ls MOUNT/littlefs
# - CFLAGS="-Wno-format" make -CMOUNT/littlefs -B test_dirs test_files QUIET=1
# # Compile and find the code size with smallest configuration
# - cd $TRAVIS_BUILD_DIR/$LITTLEFS/littlefs
# - make clean size
# CC='arm-none-eabi-gcc -mthumb'
# OBJ="$(ls lfs*.o | tr '\n' ' ')"
# CFLAGS+="-DLFS_NO_ASSERT -DLFS_NO_DEBUG -DLFS_NO_WARN -DLFS_NO_ERROR"
# | tee sizes
# after_success:
# # update status if we succeeded, compare with master if possible
# - |
# CURR=$(tail -n1 sizes | awk '{print $1}')
# PREV=$(curl -u "$MBED_BOT" https://api.github.com/repos/$TRAVIS_REPO_SLUG/status/master \
# | jq -re "select(.sha != \"$TRAVIS_COMMIT\")
# | .statuses[] | select(.context == \"travis-ci/$NAME\").description
# | capture(\"code size is (?<size>[0-9]+)\").size" \
# || echo 0)

STATUSM="Passed, code size is ${CURR}B"
if [ "$PREV" -ne 0 ]
then
STATUSM="$STATUSM ($(python -c "print '%+.2f' % (100*($CURR-$PREV)/$PREV.0)")%)"
fi
- bash -c "$STATUS" success "$STATUSM"
# STATUSM="Passed, code size is ${CURR}B"
# if [ "$PREV" -ne 0 ]
# then
# STATUSM="$STATUSM ($(python -c "print '%+.2f' % (100*($CURR-$PREV)/$PREV.0)")%)"
# fi
# - bash -c "$STATUS" success "$STATUSM"

- env:
- NAME=gitattributestest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ class UnlockedSPI : public SPI {
public:
UnlockedSPI(PinName mosi, PinName miso, PinName sclk) :
SPI(mosi, miso, sclk) { }
virtual void lock() { }
virtual bool lock() { return true; }
virtual void unlock() { }
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class UnlockedSPI : public SPI {
public:
UnlockedSPI(PinName sdi, PinName sdo, PinName sclk) :
SPI(sdi, sdo, sclk) { }
virtual void lock() { }
virtual bool lock() { return true; }
virtual void unlock() { }
};

Expand Down
Loading