Fix fat test program not compiling (FS#12646).

This changes the way creat() is wrapped around in native builds
so more experienced devs should look at it.

This patch forces to compile fat test in 32bit mode. Building
natively on x86-64 works just fine but our fat code apparently
can't deal with 64bit pointers/ints correctly.

Change-Id: I000015094f7db957ce826c22672608cd419908b0
Reviewed-on: http://gerrit.rockbox.org/228
Reviewed-by: Thomas Martitz <kugel@rockbox.org>
This commit is contained in:
Marcin Bukat 2012-05-03 07:08:43 +02:00
parent dae7a29b35
commit 10829b2f78
4 changed files with 15 additions and 21 deletions

View file

@ -63,7 +63,7 @@
#elif defined (APPLICATION)
#define PREFIX(_x_) app_ ## _x_
#else
#define PREFIX
#define PREFIX(_x_) _x_
#endif
#if defined (APPLICATION)

View file

@ -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);

View file

@ -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
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__
DEFINES = -DTEST_FAT -DDEBUG -DCRT_DISPLAY -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 $@

View file

@ -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");