diff --git a/SConstruct b/SConstruct index ab6b2b08..257498d7 100644 --- a/SConstruct +++ b/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 = +# cpu = +# board = cpu= +if boardname == '' and cputype == '': + print "Must specifiy board, cpu, or both" + sys.exit( -1 ) +elif boardname != '' and cputype != '': + # board = cpu= + # 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 = + # Find CPU + if not board_list.has_key( boardname ): + print "Unknown board", boardname + sys.exit( -1 ) + cputype = board_list[ boardname ][ 0 ] +else: + # cpu = + # 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': diff --git a/src/platform/lpc288x/conf.py b/src/platform/lpc288x/conf.py index bc2e0d60..777d6e96 100644 --- a/src/platform/lpc288x/conf.py +++ b/src/platform/lpc288x/conf.py @@ -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 diff --git a/src/shell.c b/src/shell.c index effb53eb..9031d817 100644 --- a/src/shell.c +++ b/src/shell.c @@ -9,15 +9,8 @@ #include #include #include -#include #include "platform.h" -#ifdef USE_MULTIPLE_ALLOCATOR -#include "dlmalloc.h" -#else -#include -#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 } };