diff --git a/.gitignore b/.gitignore index aeb592ae..4bbc64b9 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,4 @@ sdcard.img core luarpc* *.map +wofs.img diff --git a/src/newlib/stubs.c b/src/newlib/stubs.c index 65dfbdb2..334c82ca 100644 --- a/src/newlib/stubs.c +++ b/src/newlib/stubs.c @@ -386,6 +386,11 @@ int _kill( int pid, int sig ) { return -1; } +int kill( int pid, int sig ) +{ + return -1; +} + #endif // If LUA_NUMBER_INTEGRAL is defined, "redirect" printf/scanf calls to their diff --git a/src/platform/sim/conf.lua b/src/platform/sim/conf.lua index 16ee6cc5..8077de3c 100644 --- a/src/platform/sim/conf.lua +++ b/src/platform/sim/conf.lua @@ -15,6 +15,7 @@ local ldscript = sf( "src/platform/%s/%s", platform, ldscript ) addcf{ '-ffunction-sections', '-fdata-sections', '-fno-strict-aliasing', '-Wall' } addlf{ '-nostartfiles', '-nostdlib', '-T', ldscript, '-Wl,--gc-sections', '-Wl,--allow-multiple-definition' } addlib{ 'c','gcc','m' } +addm({"_READ_WRITE_RETURN_TYPE=_ssize_t"}) local target_flags = { '-march=i386','-mfpmath=387','-m32' } diff --git a/src/platform/sim/cpu_linux.h b/src/platform/sim/cpu_linux.h index 89d9f4c4..d508366d 100644 --- a/src/platform/sim/cpu_linux.h +++ b/src/platform/sim/cpu_linux.h @@ -24,7 +24,12 @@ // (start address and end address) extern void *memory_start_address; extern void *memory_end_address; -#define MEM_LENGTH (1024 * 1024) + +// Default to 1M of memory if not specified +#ifndef SIM_MEM_SIZE +#define SIM_MEM_SIZE (1024 * 1024) +#endif + #define INTERNAL_RAM1_FIRST_FREE ( void* )memory_start_address #define INTERNAL_RAM1_LAST_FREE ( void* )memory_end_address diff --git a/src/platform/sim/platform.c b/src/platform/sim/platform.c index d8e57401..15ecb8ea 100644 --- a/src/platform/sim/platform.c +++ b/src/platform/sim/platform.c @@ -9,6 +9,7 @@ #include #include #include +#include #include "term.h" // Platform specific includes @@ -91,12 +92,13 @@ void *memory_end_address = 0; void platform_ll_init( void ) { // Initialise heap memory region. - memory_start_address = hostif_getmem( MEM_LENGTH ); - memory_end_address = memory_start_address + MEM_LENGTH; + memory_start_address = hostif_getmem( SIM_MEM_SIZE ); + memory_end_address = memory_start_address + SIM_MEM_SIZE; } int platform_init() -{ +{ + char memdata[80]; if( memory_start_address == NULL ) { hostif_putstr( "platform_init(): mmap failed\n" ); @@ -115,7 +117,10 @@ int platform_init() term_clrscr(); term_gotoxy( 1, 1 ); - + // Show memory information + snprintf( memdata, 80, "RAM size is %u bytes (%uKB)\r\n", (unsigned)SIM_MEM_SIZE, (unsigned)SIM_MEM_SIZE / 1024 ); + hostif_putstr( memdata ); + // All done return PLATFORM_OK; } diff --git a/src/romfs.c b/src/romfs.c index 398b7434..a3f65bf6 100644 --- a/src/romfs.c +++ b/src/romfs.c @@ -24,7 +24,7 @@ static FD fd_table[ TOTAL_MAX_FDS ]; static int romfs_num_fd; #ifdef ELUA_CPU_LINUX static int wofs_sim_fd; -#define WOFS_FNAME "/tmp/wofs.dat" +#define WOFS_FNAME "wofs.img" #define WOFS_SIZE (256 * 1024) #endif