SD SPI: A small SPI library based on a stripped-down version of ChaN FatFs.
File functions: f_mount, f_open, f_close, f_read, f_write, f_lseek, f_sync, f_gets, f_putc, f_puts, f_printf, f_tell, f_eof, f_size, f_error.
File Open options: FA_READ, FA_WRITE, FA_OPEN_EXISTING, FA_CREATE_NEW, FA_CREATE_ALWAYS.
With f_seek to f_size you can append data to a file.
SD Flash: A small library to use a SD Card as NVRAM (non volatile memory).
You can find it on my website (items date:15 April 2014)
Looks very nice @onkie I’m sure @satishgn would like to have a look as well.
I’m trying to build this locally using the same directory structure as seen in my Spark Core SD card library and I’m using this make file in my src folder:
# This file is a makefile included from the top level makefile which
# defines the sources built for the target.
# Define the prefix to this directory.
# Note: The name must be unique within this build and should be
# based on the root of the project
TARGET_SD_PATH = libraries/SdSpi
TARGET_SD_SRC_PATH = $(TARGET_SD_PATH)/src
# Add include paths.
INCLUDE_DIRS += $(TARGET_SD_PATH)/inc
# C source files included in this build.
CSRC +=
# C++ source files included in this build.
CPPSRC += $(TARGET_SD_SRC_PATH)/ff.cpp
CPPSRC += $(TARGET_SD_SRC_PATH)/sdcard.cpp
# ASM source files included in this build.
ASRC +=
Unfortunately trying to compile the included example I’m getting this error:
Building file: ../src/application.cpp
Invoking: ARM GCC CPP Compiler
mkdir -p obj/src/
arm-none-eabi-gcc -g3 -gdwarf-2 -Os -mcpu=cortex-m3 -mthumb -I../libraries/SdSpi/inc -I../libraries/SdSpi/inc -I../inc -I../../core-common-lib/CMSIS/Include -I../../core-common-lib/CMSIS/Device/ST/STM32F10x/Include -I../../core-common-lib/STM32F10x_StdPe
riph_Driver/inc -I../../core-common-lib/STM32_USB-FS-Device_Driver/inc -I../../core-common-lib/CC3000_Host_Driver -I../../core-common-lib/SPARK_Firmware_Driver/inc -I../../core-communication-lib/lib/tropicssl/include -I../../core-communication-lib/src -I.
-ffunction-sections -Wall -fmessage-length=0 -MD -MP -MF obj/src/application.o.d -DUSE_STDPERIPH_DRIVER -DSTM32F10X_MD -DDFU_BUILD_ENABLE -DRELEASE_BUILD -fno-exceptions -fno-rtti -c -o obj/src/application.o ../src/application.cpp
make: *** No rule to make target `obj/libraries/SdSpi/src/File.o', needed by `core-firmware.elf'. Stop.
c:\Spark>
BDub, it looks like the file /SdSpi/src/File.cpp was found in the compile path but not included in your make file. Do you have other .cpp files in the path or another make file? It looks like the compiler found File.cpp in there!
I had my SD library and this new SdSpi library in my spark\libraries folder… I moved the SD library out and it compiles now. But I’m not sure why my SD library is sticking it nose in the build process. I haven’t included any of it’s header files.
BDub, the Spark make file looks for any .cpp file in the build path which includes “lib” and “libraries”. I still have not figured out how to not have it do that. Perhaps this is a tutorial and/or feature that should be made!
We already have started working on SD Card SPI library based on ST Microelectronics driver for STM32 and going to extend that into FAT32 file system using Chan’s FatFs library along with USB Mass Storage feature so that Core will be recognized as Flash disk when connected to host PC. This should be available on github as a feature branch soon.
kennethlimcp, the fork Satish is working on is not quite complete so it’s a little tricky to compile. I have a couple of things to fix and I will be able to run my test program. Once I get that going, I’ll update you.