summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/plugin.c2
-rw-r--r--firmware/include/file.h12
-rw-r--r--firmware/test/fat/Makefile17
-rw-r--r--firmware/test/fat/main.c5
4 files changed, 15 insertions, 21 deletions
diff --git a/apps/plugin.c b/apps/plugin.c
index 129fd69..96b008c 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -63,7 +63,7 @@
#elif defined (APPLICATION)
#define PREFIX(_x_) app_ ## _x_
#else
-#define PREFIX
+#define PREFIX(_x_) _x_
#endif
#if defined (APPLICATION)
diff --git a/firmware/include/file.h b/firmware/include/file.h
index 198fccb..0ff94a8 100644
--- a/firmware/include/file.h
+++ b/firmware/include/file.h
@@ -82,17 +82,15 @@ extern int fsync(int fd);
extern ssize_t read(int fd, void *buf, size_t count);
extern off_t lseek(int fildes, off_t offset, int whence);
extern int file_creat(const char *pathname);
-#if (CONFIG_PLATFORM & PLATFORM_NATIVE) && !defined(__PCTOOL__)
-/* posix compatibility function */
-static inline int creat(const char *pathname, mode_t mode)
-{
- (void)mode;
- return file_creat(pathname);
-}
+#if ((CONFIG_PLATFORM & PLATFORM_NATIVE) && !defined(__PCTOOL__)) || \
+ defined(TEST_FAT)
+#define creat(x, y) file_creat(x)
+
#if !defined(CODEC) && !defined(PLUGIN)
#define open(x, y, ...) file_open(x,y)
#endif
#endif
+
extern ssize_t write(int fd, const void *buf, size_t count);
extern int remove(const char* pathname);
extern int rename(const char* path, const char* newname);
diff --git a/firmware/test/fat/Makefile b/firmware/test/fat/Makefile
index 74d2628..3e04724 100644
--- a/firmware/test/fat/Makefile
+++ b/firmware/test/fat/Makefile
@@ -1,26 +1,21 @@
FIRMWARE = ../..
-export BUILDDATE=$(shell date -u +'-DYEAR=%Y -DMONTH=%m -DDAY=%d')
-export CPU=arm
-export TARGET=-DIPOD_VIDEO
-export TARGET_INC=-I$(FIRMWARE)/target/arm/ipod/video -I$(FIRMWARE)/target/arm/ipod -I$(FIRMWARE)/target/arm
-
DRIVERS = ../../drivers
EXPORT = ../../export
-INCLUDE = -I$(EXPORT) -I$(FIRMWARE)/include
-
-DEFINES = -DTEST_FAT -DDEBUG -DCRT_DISPLAY -DDISK_WRITE -DHAVE_FAT16SUPPORT -D__PCTOOL__
+BUILDDATE=$(shell date -u +'-DYEAR=%Y -DMONTH=%m -DDAY=%d')
+INCLUDE = -I$(EXPORT) -I$(FIRMWARE)/include -I$(FIRMWARE)/target/hosted -I$(FIRMWARE)/target/hosted/sdl
+DEFINES = -DTEST_FAT -DDEBUG -DDISK_WRITE -DHAVE_FAT16SUPPORT -D__PCTOOL__
-CFLAGS = -g -Wall -std=gnu99 -Wno-pointer-sign $(DEFINES) -I. $(INCLUDE) $(BUILDDATE) -I$(FIRMWARE)/libc/include
-SIMFLAGS = -g -Wall -std=gnu99 -Wno-pointer-sign $(DEFINES) -I. $(INCLUDE)
+CFLAGS = -g -m32 -Wall -std=gnu99 -Wno-pointer-sign $(DEFINES) $(BUILDDATE) -I. $(INCLUDE) -I$(FIRMWARE)/libc/include
+SIMFLAGS = -g -m32 -Wall -std=gnu99 -Wno-pointer-sign $(DEFINES) -I. $(INCLUDE)
TARGET = fat
all: $(TARGET)
$(TARGET): fat.o ata-sim.o main.o disk.o dir.o file.o ctype.o unicode.o strlcpy.o
- gcc -g -o fat $+ -lfl
+ gcc -g -m32 -o fat $+
fat.o: $(DRIVERS)/fat.c $(EXPORT)/fat.h $(EXPORT)/ata.h
$(CC) $(CFLAGS) -c $< -o $@
diff --git a/firmware/test/fat/main.c b/firmware/test/fat/main.c
index a9220d1..756f326 100644
--- a/firmware/test/fat/main.c
+++ b/firmware/test/fat/main.c
@@ -9,6 +9,7 @@
#include "dir.h"
#include "file.h"
#include "ata.h"
+#include "storage.h"
void dbg_dump_sector(int sec);
void dbg_dump_buffer(unsigned char *buf, int len, int offset);
@@ -432,7 +433,7 @@ void dbg_tail(char* name)
if( rc > 0 )
{
buf[rc]=0;
- printf("%d:\n%s\n", strlen(buf), buf);
+ printf("%d:\n%s\n", (int)strlen(buf), buf);
}
else if ( rc == 0 ) {
DEBUGF("EOF\n");
@@ -463,7 +464,7 @@ int dbg_head(char* name)
if( rc > 0 )
{
buf[rc]=0;
- printf("%d:\n%s\n", strlen(buf), buf);
+ printf("%d:\n%s\n", (int)strlen(buf), buf);
}
else if ( rc == 0 ) {
DEBUGF("EOF\n");