1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-20 10:54:14 +01:00

Yaffs or dosfs now conditional linkage for simposix yaffs testing

This commit is contained in:
Alex Beck 2014-10-28 08:48:38 +11:00
parent b4e3fe137b
commit e2b38d0d7d
3 changed files with 26 additions and 5 deletions

View File

@ -35,6 +35,17 @@ static xSemaphoreHandle mutex = 0;
struct flashfs_logfs_cfg;
/**
* glue macros for file IO
**/
#define FILEINFO FILE *
#define PIOS_FOPEN_READ(filename, file) (file = fopen((char *)filename, "r")) == NULL
#define PIOS_FOPEN_WRITE(filename, file) (file = fopen((char *)filename, "w")) == NULL
#define PIOS_FREAD(file, bufferadr, length, resultadr) (*resultadr = fread((uint8_t *)bufferadr, 1, length, *file)) != length
#define PIOS_FWRITE(file, bufferadr, length, resultadr) *resultadr = fwrite((uint8_t *)bufferadr, 1, length, *file)
#define PIOS_FCLOSE(file) fclose(file)
#define PIOS_FUNLINK(file) unlink((char *)filename)
/**
* Get an 8 character (plus extension) filename for the object.

View File

@ -70,8 +70,12 @@ UAVOBJSYNTHDIR = $(OUTDIR)/../uavobject-synthetics/flight
# optional component libraries
include $(PIOS)/common/libraries/FreeRTOS/library.mk
include $(PIOS)/common/libraries/yaffs2/library.mk
include $(PIOS)/posix/libraries/yaffs2/yaffs_impl.mk
ifeq ($(USE_YAFFS),YES)
SRC += $(PIOSCORECOMMON)/pios_logfs.c # Used for yaffs testing
include $(PIOS)/common/libraries/yaffs2/library.mk # Only required for yaffs testing
include $(PIOS)/posix/libraries/yaffs2/yaffs_impl.mk # Only required for yaffs testing
endif
#include $(FLIGHTLIB)/PyMite/pymite.mk
# List C source files here. (C dependencies are automatically generated.)
@ -105,7 +109,11 @@ SRC += $(MATHLIB)/mathmisc.c
SRC += $(MATHLIB)/butterworth.c
SRC += $(PIOSCORECOMMON)/pios_task_monitor.c
SRC += $(PIOSCORECOMMON)/pios_logfs.c
ifeq ($(USE_YAFFS),YES)
SRC += $(PIOSCORECOMMON)/pios_logfs.c # Used for yaffs testing
else
SRC += $(PIOSCORECOMMON)/pios_dosfs_logfs.c
endif
SRC += $(PIOSCORECOMMON)/pios_trace.c
SRC += $(PIOSCORECOMMON)/pios_debuglog.c
SRC += $(PIOSCORECOMMON)/pios_callbackscheduler.c

View File

@ -120,12 +120,14 @@ void PIOS_Board_Init(void)
/* Delay system */
PIOS_DELAY_Init();
// Initialize logfs for settings. This will be /dev0 with settings stored
// Initialize logfs for settings.
// If linking in yaffs for testing, this will be /dev0 with settings stored
// via the logfs object api in /dev0/logfs/
if (PIOS_FLASHFS_Logfs_Init(&pios_uavo_settings_fs_id, NULL, NULL, 0)) {
PIOS_DEBUG_Assert(0);
}
// re-use the simposix yaffs /dev0 nor simulation, which does not support being instanced twice.
// If linking in yaffs for testing, this will re-use the simposix yaffs /dev0 nor
// simulation, which does not support being instanced twice.
pios_user_fs_id = pios_uavo_settings_fs_id;
/* Initialize the task monitor */