1
0
mirror of https://github.com/elua/elua.git synced 2025-01-25 01:02:54 +08:00

Fix defines that were needed by platform data module.

This commit is contained in:
James Snyder 2010-05-11 21:34:09 +00:00
parent c5e5ece1cd
commit df8c814ab8

View File

@ -146,6 +146,7 @@ file_list = { 'SAM7-EX256' : [ 'bisect', 'hangman' , 'led', 'piano', 'hello', 'i
'MBED' : [ 'bisect', 'hangman', 'hello', 'info', 'led', 'pwmled', 'dualpwm', 'life' ], 'MBED' : [ 'bisect', 'hangman', 'hello', 'info', 'led', 'pwmled', 'dualpwm', 'life' ],
} }
VariantDir('build', 'src')
comp = Environment( OBJSUFFIX = ".o", comp = Environment( OBJSUFFIX = ".o",
PROGSUFFIX = ".elf", PROGSUFFIX = ".elf",
ENV = os.environ, ENV = os.environ,
@ -178,37 +179,38 @@ def MatchEnumVariable(key, help, default, allowed_values, map={}):
# Add Configurable Variables # Add Configurable Variables
vars = Variables('build-setup.conf') vars = Variables('build-setup.conf')
vars.AddVariables(MatchEnumVariable('target', vars.AddVariables(
'build "regular" float lua or integer-only "lualong"', MatchEnumVariable('target',
'lua', 'build "regular" float lua or integer-only "lualong"',
allowed_values = [ 'lua', 'lualong' ] ), 'lua',
MatchEnumVariable('cpu', allowed_values = [ 'lua', 'lualong' ] ),
'build for the specified CPU (board will be inferred, if possible)', MatchEnumVariable('cpu',
'auto', 'build for the specified CPU (board will be inferred, if possible)',
allowed_values = cpu_list + [ 'auto' ] ), 'auto',
MatchEnumVariable('allocator', allowed_values = cpu_list + [ 'auto' ] ),
'select memory allocator', MatchEnumVariable('allocator',
'auto', 'select memory allocator',
allowed_values=[ 'newlib', 'multiple', 'simple', 'auto' ] ), 'auto',
MatchEnumVariable('board', allowed_values=[ 'newlib', 'multiple', 'simple', 'auto' ] ),
'selects board for target (cpu will be inferred)', MatchEnumVariable('board',
'auto', 'selects board for target (cpu will be inferred)',
allowed_values=board_list.keys() + [ 'auto' ] ), 'auto',
MatchEnumVariable('toolchain', allowed_values=board_list.keys() + [ 'auto' ] ),
'specifies toolchain to use (auto=search for usable toolchain)', MatchEnumVariable('toolchain',
'auto', 'specifies toolchain to use (auto=search for usable toolchain)',
allowed_values=toolchain_list.keys() + [ 'auto' ] ), 'auto',
BoolVariable( 'optram', allowed_values=toolchain_list.keys() + [ 'auto' ] ),
'enables Lua Tiny RAM enhancements', BoolVariable( 'optram',
True ), 'enables Lua Tiny RAM enhancements',
MatchEnumVariable('boot', True ),
'boot mode, standard will boot to shell, luarpc boots to an rpc server', MatchEnumVariable('boot',
'standard', 'boot mode, standard will boot to shell, luarpc boots to an rpc server',
allowed_values=[ 'standard' , 'luarpc' ] ), 'standard',
MatchEnumVariable('romfs', allowed_values=[ 'standard' , 'luarpc' ] ),
'ROMFS compilation mode', MatchEnumVariable('romfs',
'verbatim', 'ROMFS compilation mode',
allowed_values=[ 'verbatim' , 'compress', 'compiled' ] ) ) 'verbatim',
allowed_values=[ 'verbatim' , 'compress', 'compiled' ] ) )
vars.Update(comp) vars.Update(comp)
@ -269,7 +271,7 @@ if not GetOption( 'help' ):
# if 'auto' try to match a working toolchain with target # if 'auto' try to match a working toolchain with target
usable_chains = [toolchain_list[ toolchain ][ 'compile' ] for toolchain in platform_list[ platform ]['toolchains']] usable_chains = [toolchain_list[ toolchain ][ 'compile' ] for toolchain in platform_list[ platform ]['toolchains']]
comp['CC'] = comp.Detect( usable_chains ) comp['CC'] = comp.Detect( usable_chains )
if comp['CC']: if comp['CC'] and conf.CheckCC():
comp['toolchain'] = platform_list[ platform ]['toolchains'][usable_chains.index(comp['CC'])] comp['toolchain'] = platform_list[ platform ]['toolchains'][usable_chains.index(comp['CC'])]
comp['AS'] = comp['CC'] comp['AS'] = comp['CC']
toolset = toolchain_list[ comp['toolchain'] ] toolset = toolchain_list[ comp['toolchain'] ]
@ -316,21 +318,25 @@ if not GetOption( 'help' ):
output = 'elua_' + comp['target'] + '_' + comp['cpu'].lower() output = 'elua_' + comp['target'] + '_' + comp['cpu'].lower()
comp.Append(CPPDEFINES = { 'ELUA_CPU' : comp['cpu'],
'ELUA_BOARD' : comp['board'],
'ELUA_PLATFORM' : platform.upper() } )
comp.Append(CPPDEFINES = {'__BUFSIZ__' : 128}) comp.Append(CPPDEFINES = {'__BUFSIZ__' : 128})
# Also make the above into direct defines (to use in conditional C code) # Also make the above into direct defines (to use in conditional C code)
comp.Append(CPPDEFINES = ["ELUA_CPU_" + cnorm( comp['cpu'] ), "ELUA_BOARD_" + cnorm( comp['board'] ), "ELUA_PLATFORM_" + cnorm( platform )]) conf.env.Append(CPPDEFINES = ["ELUA_CPU_" + cnorm( comp['cpu'] ), "ELUA_BOARD_" + cnorm( comp['board'] ), "ELUA_PLATFORM_" + cnorm( platform )])
if comp['allocator'] == 'multiple': if comp['allocator'] == 'multiple':
comp.Append(CPPDEFINES = ['USE_MULTIPLE_ALLOCATOR']) conf.env.Append(CPPDEFINES = ['USE_MULTIPLE_ALLOCATOR'])
elif comp['allocator'] == 'simple': elif comp['allocator'] == 'simple':
comp.Append(CPPDEFINES = ['USE_SIMPLE_ALLOCATOR']) conf.env.Append(CPPDEFINES = ['USE_SIMPLE_ALLOCATOR'])
if comp['boot'] == 'luarpc': if comp['boot'] == 'luarpc':
comp.Append(CPPDEFINES = ['ELUA_BOOT_RPC']) conf.env.Append(CPPDEFINES = ['ELUA_BOOT_RPC'])
# Special macro definitions for the SYM target # Special macro definitions for the SYM target
if platform == 'sim': if platform == 'sim':
comp.Append(CPPDEFINES = ['ELUA_SIMULATOR',"ELUA_SIM_" + cnorm( comp['cpu'] ) ] ) conf.env.Append(CPPDEFINES = ['ELUA_SIMULATOR',"ELUA_SIM_" + cnorm( comp['cpu'] ) ] )
# Lua source files and include path # Lua source files and include path
lua_files = """lapi.c lcode.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c lmem.c lobject.c lopcodes.c lua_files = """lapi.c lcode.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c lmem.c lobject.c lopcodes.c
@ -341,10 +347,10 @@ if not GetOption( 'help' ):
comp.Append(CPPPATH = ['inc', 'inc/newlib', 'inc/remotefs', 'src/lua']) comp.Append(CPPPATH = ['inc', 'inc/newlib', 'inc/remotefs', 'src/lua'])
if comp['target'] == 'lualong': if comp['target'] == 'lualong':
comp.Append(CPPDEFINES = ['LUA_NUMBER_INTEGRAL']) conf.env.Append(CPPDEFINES = ['LUA_NUMBER_INTEGRAL'])
comp.Append(CPPPATH = ['src/modules', 'src/platform/%s' % platform]) conf.env.Append(CPPPATH = ['src/modules', 'src/platform/%s' % platform])
comp.Append(CPPDEFINES = {"LUA_OPTIMIZE_MEMORY" : ( comp['optram'] != 0 and 2 or 0 ) } ) conf.env.Append(CPPDEFINES = {"LUA_OPTIMIZE_MEMORY" : ( comp['optram'] != 0 and 2 or 0 ) } )
# Additional libraries # Additional libraries
local_libs = '' local_libs = ''