mirror of
https://github.com/elua/elua.git
synced 2025-01-08 20:56:17 +08:00
Simple RPC-only boot mode settable by boot=luaremote with scons
This commit is contained in:
parent
975862f49e
commit
9eaa3ceb03
13
SConstruct
13
SConstruct
@ -5,6 +5,7 @@ allocator = ARGUMENTS.get( 'allocator', '' ).lower()
|
||||
boardname = ARGUMENTS.get( 'board' , '').upper()
|
||||
toolchain = ARGUMENTS.get( 'toolchain', '')
|
||||
optram = int( ARGUMENTS.get( 'optram', '1' ) )
|
||||
boot = ARGUMENTS.get( 'boot', '').lower()
|
||||
|
||||
# List of toolchains
|
||||
toolchain_list = {
|
||||
@ -186,6 +187,14 @@ elif allocator not in [ 'newlib', 'multiple', 'simple' ]:
|
||||
print "Allocator can be either 'newlib', 'multiple' or 'simple'"
|
||||
sys.exit( -1 )
|
||||
|
||||
# Check boot mode selection
|
||||
if boot == '':
|
||||
boot = 'standard'
|
||||
elif boot not in ['standard', 'luaremote']:
|
||||
print "Unknown boot mode: ", boot
|
||||
print "Boot mode can be either 'standard' or 'luaremote'"
|
||||
sys.exit( -1 );
|
||||
|
||||
|
||||
# User report
|
||||
if not GetOption( 'clean' ):
|
||||
@ -196,6 +205,7 @@ if not GetOption( 'clean' ):
|
||||
print "Board: ", boardname
|
||||
print "Platform: ", platform
|
||||
print "Allocator: ", allocator
|
||||
print "Boot Mode: ", boot
|
||||
print "Target: ", target == 'lua' and 'fplua' or 'target'
|
||||
print "Toolchain: ", toolchain
|
||||
print "*********************************"
|
||||
@ -208,6 +218,9 @@ if allocator == 'multiple':
|
||||
elif allocator == 'simple':
|
||||
cdefs = cdefs + " -DUSE_SIMPLE_ALLOCATOR"
|
||||
|
||||
if boot == 'luaremote':
|
||||
cdefs += " -DELUA_BOOT_REMOTE"
|
||||
|
||||
# Special macro definitions for the SYM target
|
||||
if platform == 'sim':
|
||||
cdefs = cdefs + " -DELUA_SIMULATOR -DELUA_SIM_%s" % cputype
|
||||
|
16
src/main.c
16
src/main.c
@ -20,6 +20,16 @@
|
||||
|
||||
extern char etext[];
|
||||
|
||||
|
||||
void boot_remote( void )
|
||||
{
|
||||
lua_State *L = lua_open();
|
||||
luaL_openlibs(L); /* open libraries */
|
||||
lua_getglobal( L, "rpc" );
|
||||
lua_getfield( L, -1, "server" );
|
||||
lua_pcall( L, 0, 0, 0 );
|
||||
}
|
||||
|
||||
// ****************************************************************************
|
||||
// Program entry point
|
||||
|
||||
@ -48,6 +58,10 @@ int main( void )
|
||||
lua_main( 2, lua_argv );
|
||||
}
|
||||
|
||||
#ifdef ELUA_BOOT_REMOTE
|
||||
boot_remote();
|
||||
#else
|
||||
|
||||
// Run the shell
|
||||
if( shell_init() == 0 )
|
||||
{
|
||||
@ -58,6 +72,7 @@ int main( void )
|
||||
}
|
||||
else
|
||||
shell_start();
|
||||
#endif // #ifdef ELUA_BOOT_REMOTE
|
||||
|
||||
#ifdef ELUA_SIMULATOR
|
||||
hostif_exit(0);
|
||||
@ -66,4 +81,3 @@ int main( void )
|
||||
while( 1 );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -5,8 +5,8 @@ end
|
||||
rpc.on_error (error_handler);
|
||||
|
||||
--slave,err = rpc.connect ("/dev/tty.usbserial-FTE3HV7L");
|
||||
slave,err = rpc.connect ("/dev/tty.usbserial-ftCYPMYJ");
|
||||
-- slave,err = rpc.connect("/dev/tty.usbserial-04110857B")
|
||||
-- slave,err = rpc.connect ("/dev/tty.usbserial-ftCYPMYJ");
|
||||
slave,err = rpc.connect("/dev/tty.usbserial-04110857B")
|
||||
--slave,err = rpc.connect ("/dev/ttys0");
|
||||
|
||||
print("Platform: " .. slave.pd.platform())
|
||||
|
Loading…
x
Reference in New Issue
Block a user