mirror of
https://github.com/elua/elua.git
synced 2025-01-25 01:02:54 +08:00
modified the build system. Also removed the 'mem' command from the shell, as it was very confusing
This commit is contained in:
parent
86ecb7bbe2
commit
0c6731db5b
62
SConstruct
62
SConstruct
@ -1,6 +1,6 @@
|
||||
import os, sys
|
||||
target = ARGUMENTS.get( 'target', 'lua' ).lower()
|
||||
cputype = ARGUMENTS.get( 'cpu', 'at91sam7x256' ).upper()
|
||||
cputype = ARGUMENTS.get( 'cpu', '' ).upper()
|
||||
allocator = ARGUMENTS.get( 'allocator', '' ).lower()
|
||||
boardname = ARGUMENTS.get( 'board' , '').upper()
|
||||
|
||||
@ -12,15 +12,48 @@ cpu_list = { 'at91sam7x' : [ 'AT91SAM7X256', 'AT91SAM7X512' ],
|
||||
'lpc288x' : [ 'LPC2888' ]
|
||||
}
|
||||
|
||||
# List of default board names
|
||||
# List of board/CPU combinations
|
||||
board_list = { 'SAM7-EX256' : [ 'AT91SAM7X256', 'AT91SAM7X512' ],
|
||||
'EK-LM3S8962' : [ 'LM3S8962' ],
|
||||
'EK-LM3S6965' : [ 'LM3S6965' ],
|
||||
'STR9-comStick' : [ 'STR912FW44' ],
|
||||
'STR9-COMSTICK' : [ 'STR912FW44' ],
|
||||
'PC' : [ 'I386' ],
|
||||
'LPC-H2888' : [ 'LPC2888' ]
|
||||
}
|
||||
|
||||
# Variants: board = <boardname>
|
||||
# cpu = <cpuname>
|
||||
# board = <boardname> cpu=<cpuname>
|
||||
if boardname == '' and cputype == '':
|
||||
print "Must specifiy board, cpu, or both"
|
||||
sys.exit( -1 )
|
||||
elif boardname != '' and cputype != '':
|
||||
# board = <boardname> cpu=<cpuname>
|
||||
# Check if the board, cpu pair is correct
|
||||
if not board_list.has_key( boardname ):
|
||||
print "Unknown board", boardname
|
||||
sys.exit( -1 )
|
||||
if not cputype in board_list[ boardname ]:
|
||||
print "Invalid CPU %s for board %s" % ( cputype, boardname )
|
||||
sys.exit( -1 )
|
||||
elif boardname != '':
|
||||
# board = <boardname>
|
||||
# Find CPU
|
||||
if not board_list.has_key( boardname ):
|
||||
print "Unknown board", boardname
|
||||
sys.exit( -1 )
|
||||
cputype = board_list[ boardname ][ 0 ]
|
||||
else:
|
||||
# cpu = <cputype>
|
||||
# Find board name
|
||||
for b, v in board_list.items():
|
||||
if cputype in v:
|
||||
boardname = b
|
||||
break
|
||||
else:
|
||||
print "CPU %s not found" % cputype
|
||||
sys.exit( -1 )
|
||||
|
||||
platform = None
|
||||
# Look for the given CPU in the list of platforms
|
||||
for p, v in cpu_list.items():
|
||||
@ -37,16 +70,6 @@ else:
|
||||
print
|
||||
sys.exit( -1 )
|
||||
|
||||
# If the board is not specified, use the default value
|
||||
if boardname == '':
|
||||
for b, v in board_list.items():
|
||||
if cputype in v:
|
||||
boardname = b
|
||||
break
|
||||
else:
|
||||
print "Please specify a board"
|
||||
sys.exit( -1 )
|
||||
|
||||
# CPU/allocator mapping (if allocator not specified)
|
||||
if allocator == '':
|
||||
if cputype == 'LPC2888':
|
||||
@ -58,7 +81,18 @@ elif allocator not in [ 'newlib', 'multiple' ]:
|
||||
print "Allocator can be either 'newlib' or 'multiple'"
|
||||
sys.exit( -1 )
|
||||
|
||||
|
||||
# User report
|
||||
if not GetOption( 'clean' ):
|
||||
print
|
||||
print "*********************************"
|
||||
print "Compiling eLua ..."
|
||||
print "CPU: ", cputype
|
||||
print "Board: ", boardname
|
||||
print "Platform: ", platform
|
||||
print "Allocator: ", allocator
|
||||
print "*********************************"
|
||||
print
|
||||
|
||||
output = 'elua_' + target + '_' + cputype.lower()
|
||||
cdefs = '-DELUA_CPU=%s -DELUA_BOARD=%s -DELUA_PLATFORM=%s' % ( cputype, boardname, platform.upper() )
|
||||
if allocator == 'multiple':
|
||||
|
@ -5,7 +5,7 @@ cpumode = ARGUMENTS.get( 'cpumode', 'arm' ).lower()
|
||||
specific_files = "lpc28xx.s platform.c target.c uart.c"
|
||||
|
||||
# Check CPU
|
||||
if cputype == 'lpc2888':
|
||||
if cputype == 'LPC2888':
|
||||
ldscript = "lpc2888.lds"
|
||||
else:
|
||||
print "Invalid LPC288x CPU %s", cputype
|
||||
|
27
src/shell.c
27
src/shell.c
@ -9,15 +9,8 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <malloc.h>
|
||||
#include "platform.h"
|
||||
|
||||
#ifdef USE_MULTIPLE_ALLOCATOR
|
||||
#include "dlmalloc.h"
|
||||
#else
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
#include "build.h"
|
||||
#ifdef BUILD_SHELL
|
||||
|
||||
@ -50,7 +43,6 @@ static void shell_help( char* args )
|
||||
printf( " lua [args] - run Lua with the given arguments\n" );
|
||||
printf( " recv - receive a file (XMODEM) and execute it\n" );
|
||||
printf( " ver - print eLua version\n" );
|
||||
printf( " mem - RAM usage data\n" );
|
||||
printf( " exit - exit from this shelll\n" );
|
||||
}
|
||||
|
||||
@ -166,24 +158,6 @@ static void shell_ver( char* args )
|
||||
printf( "For more information go to http://elua.berlios.de\n" );
|
||||
}
|
||||
|
||||
static void shell_mem( char* args )
|
||||
{
|
||||
unsigned i = 0;
|
||||
u32 lstart, lend;
|
||||
struct mallinfo allocdata;
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
if( ( lstart = ( u32 )platform_get_first_free_ram( i ) ) == 0 )
|
||||
break;
|
||||
lend = ( u32 )platform_get_last_free_ram( i );
|
||||
printf( "Start:0x%08lX Size:%8ld ", lstart, lend - lstart + 1 );
|
||||
allocdata = mallinfo();
|
||||
printf( "Used:%8ld Free:%8ld\n", ( long )allocdata.uordblks, ( long )allocdata.fordblks );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Insert shell commands here
|
||||
static const SHELL_COMMAND shell_commands[] =
|
||||
{
|
||||
@ -191,7 +165,6 @@ static const SHELL_COMMAND shell_commands[] =
|
||||
{ "lua", shell_lua },
|
||||
{ "recv", shell_recv },
|
||||
{ "ver", shell_ver },
|
||||
{ "mem", shell_mem },
|
||||
{ "exit", NULL },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user