1
0
mirror of https://github.com/elua/elua.git synced 2025-01-08 20:56:17 +08:00

Updates to the eLua simulator

This PR updates the Linux version of eLua (aka "the simulator") to
compile with a more recent toolchain. The changes shouldn't affect the
other eLua targets.
This commit is contained in:
Bogdan Marinescu 2018-04-26 23:02:18 +03:00
parent 6a71bb62c7
commit a539f8fe62
6 changed files with 23 additions and 6 deletions

1
.gitignore vendored
View File

@ -26,3 +26,4 @@ sdcard.img
core
luarpc*
*.map
wofs.img

View File

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

View File

@ -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' }

View File

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

View File

@ -9,6 +9,7 @@
#include <errno.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#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;
}

View File

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