mirror of
https://github.com/elua/elua.git
synced 2025-01-08 20:56:17 +08:00
Working on the new build system
- Deleted the Python build files - Main documentation updated with information about how to use build_elua - CSS updated to provide a bit of free space at the top of <h2> headings. - Added rpc-lua.lua - Fixed cross-compilation errors References to scons still exist in the docs, they'll have to be removed.
This commit is contained in:
parent
463f0bceda
commit
958f357257
2
.gitignore
vendored
2
.gitignore
vendored
@ -22,4 +22,4 @@ luac.cross*
|
||||
boards/*.h
|
||||
sdcard.img
|
||||
core
|
||||
|
||||
luarpc*
|
||||
|
463
SConstruct
463
SConstruct
@ -1,463 +0,0 @@
|
||||
import os, sys, shutil, string
|
||||
import platform as syspl
|
||||
import glob, re, subprocess
|
||||
|
||||
# Helper: "normalize" a name to make it a suitable C macro name
|
||||
def cnorm( name ):
|
||||
name = name.replace( '-', '' )
|
||||
name = name.replace( ' ', '' )
|
||||
return name.upper()
|
||||
|
||||
def gen_header( name, defines ):
|
||||
hname = os.path.join( os.getcwd(), "inc", name.lower() + ".h" )
|
||||
h = open( hname, "w" )
|
||||
h.write("// eLua " + name + " definition\n\n")
|
||||
h.write("#ifndef __" + name.upper() + "_H__\n")
|
||||
h.write("#define __" + name.upper() + "_H__\n\n")
|
||||
|
||||
for key, value in defines.iteritems():
|
||||
h.write("#define %-25s%-19s\n" % (key.upper(), value,))
|
||||
|
||||
h.write("\n#endif\n")
|
||||
h.close()
|
||||
|
||||
# List of toolchains
|
||||
toolchain_list = {
|
||||
'arm-gcc' : {
|
||||
'compile' : 'arm-elf-gcc',
|
||||
'link' : 'arm-elf-ld',
|
||||
'asm' : 'arm-elf-as',
|
||||
'bin' : 'arm-elf-objcopy',
|
||||
'size' : 'arm-elf-size',
|
||||
'cross_cpumode' : 'little',
|
||||
'cross_lua' : 'float_arm 64',
|
||||
'cross_lualong' : 'int 32'
|
||||
},
|
||||
'arm-eabi-gcc' : {
|
||||
'compile' : 'arm-eabi-gcc',
|
||||
'link' : 'arm-eabi-ld',
|
||||
'asm' : 'arm-eabi-as',
|
||||
'bin' : 'arm-eabi-objcopy',
|
||||
'size' : 'arm-eabi-size',
|
||||
'cross_cpumode' : 'little',
|
||||
'cross_lua' : 'float 64',
|
||||
'cross_lualong' : 'int 32'
|
||||
},
|
||||
'codesourcery' : {
|
||||
'compile' : 'arm-none-eabi-gcc',
|
||||
'link' : 'arm-none-eabi-ld',
|
||||
'asm' : 'arm-none-eabi-as',
|
||||
'bin' : 'arm-none-eabi-objcopy',
|
||||
'size' : 'arm-none-eabi-size',
|
||||
'cross_cpumode' : 'little',
|
||||
'cross_lua' : 'float 64',
|
||||
'cross_lualong' : 'int 32'
|
||||
},
|
||||
'avr32-gcc' : {
|
||||
'compile' : 'avr32-gcc',
|
||||
'link' : 'avr32-ld',
|
||||
'asm' : 'avr32-as',
|
||||
'bin' : 'avr32-objcopy',
|
||||
'size' : 'avr32-size',
|
||||
'cross_cpumode' : 'big',
|
||||
'cross_lua' : 'float 64',
|
||||
'cross_lualong' : 'int 32'
|
||||
},
|
||||
'avr32-unknown-none-gcc' : {
|
||||
'compile' : 'avr32-unknown-none-gcc',
|
||||
'link' : 'avr32-unknown-none-ld',
|
||||
'asm' : 'avr32-unknown-none-as',
|
||||
'bin' : 'avr32-unknown-none-objcopy',
|
||||
'size' : 'avr32-unknown-none-size',
|
||||
'cross_cpumode' : 'big',
|
||||
'cross_lua' : 'float 64',
|
||||
'cross_lualong' : 'int 32'
|
||||
},
|
||||
'i686-gcc' : {
|
||||
'compile' : 'i686-elf-gcc',
|
||||
'link' : 'i686-elf-ld',
|
||||
'asm' : 'nasm',
|
||||
'bin' : 'i686-elf-objcopy',
|
||||
'size' : 'i686-elf-size',
|
||||
'cross_cpumode' : 'little',
|
||||
'cross_lua' : 'float 64',
|
||||
'cross_lualong' : 'int 32'
|
||||
}
|
||||
}
|
||||
|
||||
# Toolchain Aliases
|
||||
toolchain_list['devkitarm'] = toolchain_list['arm-eabi-gcc']
|
||||
|
||||
# List of platform/CPU/toolchains combinations
|
||||
# The first toolchain in the toolchains list is the default one
|
||||
# (the one that will be used if none is specified)
|
||||
platform_list = {
|
||||
'at91sam7x' : { 'cpus' : [ 'AT91SAM7X256', 'AT91SAM7X512' ], 'toolchains' : [ 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ], 'big_endian': False },
|
||||
'lm3s' : { 'cpus' : [ 'LM3S1968', 'LM3S8962', 'LM3S6965', 'LM3S6918', 'LM3S9B92', 'LM3S9D92' ], 'toolchains' : [ 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ], 'big_endian': False },
|
||||
'str9' : { 'cpus' : [ 'STR912FAW44' ], 'toolchains' : [ 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ], 'big_endian': False },
|
||||
'i386' : { 'cpus' : [ 'I386' ], 'toolchains' : [ 'i686-gcc' ], 'big_endian': False },
|
||||
'sim' : { 'cpus' : [ 'LINUX' ], 'toolchains' : [ 'i686-gcc' ], 'big_endian': False },
|
||||
'lpc288x' : { 'cpus' : [ 'LPC2888' ], 'toolchains' : [ 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ], 'big_endian': False },
|
||||
'str7' : { 'cpus' : [ 'STR711FR2' ], 'toolchains' : [ 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ], 'big_endian': False },
|
||||
'stm32' : { 'cpus' : [ 'STM32F103ZE', 'STM32F103RE' ], 'toolchains' : [ 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ], 'big_endian': False },
|
||||
'avr32' : { 'cpus' : [ 'AT32UC3A0512', 'AT32UC3A0256', 'AT32UC3A0128', 'AT32UC3B0256' ], 'toolchains' : [ 'avr32-gcc', 'avr32-unknown-none-gcc' ], 'big_endian': True },
|
||||
'lpc24xx' : { 'cpus' : [ 'LPC2468' ], 'toolchains' : [ 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ], 'big_endian': False },
|
||||
'lpc17xx' : { 'cpus' : [ 'LPC1768' ], 'toolchains' : [ 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ], 'big_endian': False }
|
||||
}
|
||||
|
||||
# List of board/CPU combinations
|
||||
board_list = { 'SAM7-EX256' : [ 'AT91SAM7X256', 'AT91SAM7X512' ],
|
||||
'EK-LM3S1968' : [ 'LM3S1968' ],
|
||||
'EK-LM3S8962' : [ 'LM3S8962' ],
|
||||
'EK-LM3S6965' : [ 'LM3S6965' ],
|
||||
'EK-LM3S9B92' : [ 'LM3S9B92' ],
|
||||
'SOLDERCORE' : [ 'LM3S9D92' ],
|
||||
'STR9-COMSTICK' : [ 'STR912FAW44' ],
|
||||
'STR-E912' : [ 'STR912FAW44' ],
|
||||
'PC' : [ 'I386' ],
|
||||
'SIM' : [ 'LINUX' ],
|
||||
'LPC-H2888' : [ 'LPC2888' ],
|
||||
'MOD711' : [ 'STR711FR2' ],
|
||||
'STM3210E-EVAL' : [ 'STM32F103ZE' ],
|
||||
'ATEVK1100' : [ 'AT32UC3A0512' ],
|
||||
'ATEVK1101' : [ 'AT32UC3B0256' ],
|
||||
'ET-STM32' : [ 'STM32F103RE' ],
|
||||
'EAGLE-100' : [ 'LM3S6918' ],
|
||||
'ELUA-PUC' : ['LPC2468' ],
|
||||
'MBED' : ['LPC1768'],
|
||||
'MIZAR32' : [ 'AT32UC3A0256', 'AT32UC3A0512', 'AT32UC3A0128' ],
|
||||
'NETDUINO' : [ 'AT91SAM7X512' ],
|
||||
'EK-LM3S9D92' : [ 'LM3S9D92' ]
|
||||
}
|
||||
|
||||
cpu_list = sum([board_list[i] for i in board_list],[])
|
||||
|
||||
comp = Environment( tools = [],
|
||||
OBJSUFFIX = ".o",
|
||||
PROGSUFFIX = ".elf",
|
||||
ENV = os.environ,
|
||||
CPPDEFINES = {} )
|
||||
|
||||
if comp['PLATFORM'] == 'win32':
|
||||
Tool('mingw')(comp)
|
||||
else:
|
||||
Tool('default')(comp)
|
||||
|
||||
# Replacement for standard EnumVariable functionality to derive case from original list
|
||||
class InsensitiveString(object):
|
||||
def __init__(self, s):
|
||||
self.s = s
|
||||
def __cmp__(self, other):
|
||||
return cmp(self.s.lower(), other.lower())
|
||||
|
||||
def _validator(key, val, env, vals):
|
||||
if not val in vals:
|
||||
raise SCons.Errors.UserError(
|
||||
'Invalid value for option %s: %s' % (key, val))
|
||||
|
||||
def MatchEnumVariable(key, help, default, allowed_values, map={}):
|
||||
help = '%s (%s)' % (help, string.join(allowed_values, '|'))
|
||||
|
||||
validator = lambda key, val, env, vals=allowed_values: \
|
||||
_validator(key, InsensitiveString(val), env, vals)
|
||||
|
||||
converter = lambda val, map=map: \
|
||||
map.get(val, allowed_values[allowed_values.index(InsensitiveString(val))])
|
||||
|
||||
return (key, help, default, validator, converter)
|
||||
|
||||
|
||||
# Add Configurable Variables
|
||||
vars = Variables()
|
||||
|
||||
vars.AddVariables(
|
||||
MatchEnumVariable('bootloader',
|
||||
'Build for bootloader usage, default is none.',
|
||||
'none',
|
||||
allowed_values = [ 'none', 'emblod' ] ),
|
||||
MatchEnumVariable('target',
|
||||
'build "regular" float lua, 32 bit integer-only "lualong" or 64-bit integer-only "lualonglong"',
|
||||
'lua',
|
||||
allowed_values = [ 'lua', 'lualong', 'lualonglong' ] ),
|
||||
MatchEnumVariable('cpu',
|
||||
'build for the specified CPU (board will be inferred, if possible)',
|
||||
'auto',
|
||||
allowed_values = cpu_list + [ 'auto' ] ),
|
||||
MatchEnumVariable('allocator',
|
||||
'select memory allocator',
|
||||
'auto',
|
||||
allowed_values=[ 'newlib', 'multiple', 'simple', 'auto' ] ),
|
||||
MatchEnumVariable('board',
|
||||
'selects board for target (cpu will be inferred)',
|
||||
'auto',
|
||||
allowed_values=board_list.keys() + [ 'auto' ] ),
|
||||
MatchEnumVariable('toolchain',
|
||||
'specifies toolchain to use (auto=search for usable toolchain)',
|
||||
'auto',
|
||||
allowed_values=toolchain_list.keys() + [ 'auto' ] ),
|
||||
BoolVariable( 'optram',
|
||||
'enables Lua Tiny RAM enhancements',
|
||||
True ),
|
||||
MatchEnumVariable('boot',
|
||||
'boot mode, standard will boot to shell, luarpc boots to an rpc server',
|
||||
'standard',
|
||||
allowed_values=[ 'standard' , 'luarpc' ] ),
|
||||
MatchEnumVariable('romfs',
|
||||
'ROMFS compilation mode',
|
||||
'verbatim',
|
||||
allowed_values=[ 'verbatim' , 'compress', 'compile' ] ) )
|
||||
|
||||
|
||||
vars.Update(comp)
|
||||
|
||||
if not GetOption( 'help' ):
|
||||
|
||||
conf = Configure(comp)
|
||||
|
||||
# Variants: board = <board>
|
||||
# cpu = <cpuname>
|
||||
# board = <board> cpu=<cpuname>
|
||||
if comp['board'] == 'auto' and comp['cpu'] == 'auto':
|
||||
print "Must specifiy board, cpu, or both"
|
||||
Exit( -1 )
|
||||
elif comp['board'] != 'auto' and comp['cpu'] != 'auto':
|
||||
# Check if the board, cpu pair is correct
|
||||
if not comp['cpu'] in board_list[ comp['board'] ]:
|
||||
print "Invalid CPU %s for board %s" % ( comp['cpu'], comp['board'] )
|
||||
Exit( -1 )
|
||||
elif comp['board'] != 'auto':
|
||||
# Find CPU
|
||||
comp['cpu'] = board_list[ comp['board'] ][ 0 ]
|
||||
else:
|
||||
# cpu = <cputype>
|
||||
# Find board name
|
||||
for b, v in board_list.items():
|
||||
if comp['cpu'] in v:
|
||||
comp['board'] = b
|
||||
break
|
||||
else:
|
||||
print "CPU %s not found" % comp['cpu']
|
||||
Exit( -1 )
|
||||
|
||||
# Look for the given CPU in the list of platforms
|
||||
platform = None
|
||||
for p, v in platform_list.items():
|
||||
if comp['cpu'] in v[ 'cpus' ]:
|
||||
platform = p
|
||||
break
|
||||
else:
|
||||
print "Unknown CPU %s" % comp['cpu']
|
||||
print "List of accepted CPUs: "
|
||||
for p, v in platform_list.items():
|
||||
print " ", p, "-->",
|
||||
for cpu in v[ 'cpus' ]:
|
||||
print cpu,
|
||||
print
|
||||
Exit( -1 )
|
||||
|
||||
# Check the toolchain
|
||||
if comp['toolchain'] != 'auto':
|
||||
if not comp['toolchain'] in platform_list[ platform ][ 'toolchains' ]:
|
||||
print "Invalid toolchain '%s' for CPU '%s'" % ( comp['toolchain'], comp['cpu'] )
|
||||
Exit( -1 )
|
||||
toolset = toolchain_list[ comp['toolchain'] ]
|
||||
comp[ 'CC' ] = toolset[ 'compile' ]
|
||||
comp[ 'AS' ] = toolset[ 'compile' ]
|
||||
else:
|
||||
# if 'auto' try to match a working toolchain with target
|
||||
usable_chains = [toolchain_list[ toolchain ][ 'compile' ] for toolchain in platform_list[ platform ]['toolchains']]
|
||||
comp['CC'] = comp.Detect( usable_chains )
|
||||
if comp['CC']:
|
||||
comp['toolchain'] = platform_list[ platform ]['toolchains'][usable_chains.index(comp['CC'])]
|
||||
comp['AS'] = comp['CC']
|
||||
toolset = toolchain_list[ comp['toolchain'] ]
|
||||
else:
|
||||
print "Unable to find usable toolchain in your path."
|
||||
print "List of accepted toolchains (for %s):" % ( comp['cpu'] )
|
||||
print ', '.join(usable_chains)
|
||||
Exit( -1 )
|
||||
|
||||
if not conf.CheckCC():
|
||||
print "Test compile failed with selected toolchain: %s" % (comp['toolchain'])
|
||||
Exit( -1 )
|
||||
|
||||
# CPU/allocator mapping (if allocator not specified)
|
||||
if comp['allocator'] == 'auto':
|
||||
if comp['board'] in ['MIZAR32'] and comp['cpu'] in ['AT32UC3A0128']:
|
||||
comp['allocator'] = 'simple'
|
||||
elif comp['board'] in ['LPC-H2888', 'ATEVK1100', 'MIZAR32', 'MBED']:
|
||||
comp['allocator'] = 'multiple'
|
||||
else:
|
||||
comp['allocator'] = 'newlib'
|
||||
|
||||
# Build the compilation command now
|
||||
compcmd = ''
|
||||
if comp['romfs'] == 'compile':
|
||||
if comp['target'] == 'lualonglong':
|
||||
print "Cross-compilation is not yet supported in 64-bit mode"
|
||||
Exit( -1 )
|
||||
if syspl.system() == 'Windows':
|
||||
suffix = '.exe'
|
||||
else:
|
||||
suffix = '.elf'
|
||||
# First check for luac.cross in the current directory
|
||||
if not os.path.isfile( "luac.cross" + suffix ):
|
||||
print "The eLua cross compiler was not found."
|
||||
print "Build it by running 'scons -f cross-lua.py'"
|
||||
Exit( -1 )
|
||||
compcmd = os.path.join( os.getcwd(), 'luac.cross%s -ccn %s -cce %s -o %%s -s %%s' % ( suffix, toolset[ 'cross_%s' % comp['target'] ], toolset[ 'cross_cpumode' ] ) )
|
||||
elif comp['romfs'] == 'compress':
|
||||
compcmd = 'lua luasrcdiet.lua --quiet --maximum --opt-comments --opt-whitespace --opt-emptylines --opt-eols --opt-strings --opt-numbers --opt-locals -o %s %s'
|
||||
|
||||
# Determine build version
|
||||
try:
|
||||
elua_vers = subprocess.check_output(["git", "describe", "--always"]).strip()
|
||||
# If purely hexadecimal (no tag reference) prepend 'dev-'
|
||||
if re.match("^[0-9a-fA-F]+$",elua_vers):
|
||||
elua_vers = 'dev-' + elua_vers
|
||||
gen_header("git_version",{'elua_version': elua_vers, 'elua_str_version': "\"%s\"" % elua_vers } )
|
||||
conf.env.Append(CPPDEFINES = ['USE_GIT_REVISION'])
|
||||
except:
|
||||
print "WARNING: unable to determine version from repository"
|
||||
elua_vers = "unknown"
|
||||
|
||||
|
||||
# User report
|
||||
if not GetOption( 'clean' ):
|
||||
print
|
||||
print "*********************************"
|
||||
print "Compiling eLua ..."
|
||||
print "CPU: ", comp['cpu']
|
||||
print "Board: ", comp['board']
|
||||
print "Platform: ", platform
|
||||
print "Allocator: ", comp['allocator']
|
||||
print "Boot Mode: ", comp['boot']
|
||||
print "Target: ", comp['target']
|
||||
print "Toolchain: ", comp['toolchain']
|
||||
print "ROMFS mode: ", comp['romfs']
|
||||
print "Version: ", elua_vers
|
||||
print "*********************************"
|
||||
print
|
||||
|
||||
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})
|
||||
|
||||
# Also make the above into direct defines (to use in conditional C code)
|
||||
conf.env.Append(CPPDEFINES = ["ELUA_CPU_" + cnorm( comp['cpu'] ), "ELUA_BOARD_" + cnorm( comp['board'] ), "ELUA_PLATFORM_" + cnorm( platform )])
|
||||
|
||||
if comp['allocator'] == 'multiple':
|
||||
conf.env.Append(CPPDEFINES = ['USE_MULTIPLE_ALLOCATOR'])
|
||||
elif comp['allocator'] == 'simple':
|
||||
conf.env.Append(CPPDEFINES = ['USE_SIMPLE_ALLOCATOR'])
|
||||
|
||||
if comp['boot'] == 'luarpc':
|
||||
conf.env.Append(CPPDEFINES = ['ELUA_BOOT_RPC'])
|
||||
|
||||
# Special macro definitions for the SYM target
|
||||
if platform == 'sim':
|
||||
conf.env.Append(CPPDEFINES = ['ELUA_SIMULATOR',"ELUA_SIM_" + cnorm( comp['cpu'] ) ] )
|
||||
|
||||
# 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
|
||||
lparser.c lstate.c lstring.c ltable.c ltm.c lundump.c lvm.c lzio.c lauxlib.c lbaselib.c
|
||||
ldblib.c liolib.c lmathlib.c loslib.c ltablib.c lstrlib.c loadlib.c linit.c lua.c lrotable.c legc.c"""
|
||||
|
||||
lua_full_files = " " + " ".join( [ "src/lua/%s" % name for name in lua_files.split() ] )
|
||||
|
||||
comp.Append(CPPPATH = ['inc', 'inc/newlib', 'inc/remotefs', 'src/platform', 'src/lua'])
|
||||
if comp['target'] == 'lualong' or comp['target'] == 'lualonglong':
|
||||
conf.env.Append(CPPDEFINES = ['LUA_NUMBER_INTEGRAL'])
|
||||
if comp['target'] == 'lualonglong':
|
||||
conf.env.Append(CPPDEFINES = ['LUA_INTEGRAL_LONGLONG'])
|
||||
if comp['target'] != 'lualong' and comp['target'] != 'lualonglong':
|
||||
conf.env.Append(CPPDEFINES = ['LUA_PACK_VALUE'])
|
||||
if platform_list[platform]['big_endian']:
|
||||
conf.env.Append(CPPDEFINES = ['ELUA_ENDIAN_BIG'])
|
||||
else:
|
||||
conf.env.Append(CPPDEFINES = ['ELUA_ENDIAN_LITTLE'])
|
||||
conf.env.Append(CPPPATH = ['src/modules', 'src/platform/%s' % platform])
|
||||
conf.env.Append(CPPDEFINES = {"LUA_OPTIMIZE_MEMORY" : ( comp['optram'] != 0 and 2 or 0 ) } )
|
||||
|
||||
# Additional libraries
|
||||
local_libs = ''
|
||||
|
||||
# Shell files
|
||||
shell_files = """ src/shell/shell.c src/shell/shell_adv_cp_mv.c src/shell/shell_adv_rm.c src/shell/shell_cat.c src/shell/shell_help.c
|
||||
src/shell/shell_ls.c src/shell/shell_lua.c src/shell/shell_mkdir.c src/shell/shell_recv.c src/shell/shell_ver.c
|
||||
src/shell/shell_wofmt.c """
|
||||
|
||||
# Application files
|
||||
app_files = """ src/main.c src/romfs.c src/semifs.c src/xmodem.c src/term.c src/common.c src/common_tmr.c src/buf.c src/elua_adc.c src/dlmalloc.c
|
||||
src/salloc.c src/luarpc_elua_uart.c src/elua_int.c src/linenoise.c src/common_uart.c src/eluarpc.c """
|
||||
|
||||
# Newlib related files
|
||||
newlib_files = " src/newlib/devman.c src/newlib/stubs.c src/newlib/genstd.c src/newlib/stdtcp.c"
|
||||
|
||||
# UIP files
|
||||
uip_files = "uip_arp.c uip.c uiplib.c dhcpc.c psock.c resolv.c uip-neighbor.c"
|
||||
uip_files = " src/elua_uip.c " + " ".join( [ "src/uip/%s" % name for name in uip_files.split() ] )
|
||||
comp.Append(CPPPATH = ['src/uip'])
|
||||
|
||||
# FatFs files
|
||||
app_files = app_files + "src/elua_mmc.c src/mmcfs.c src/fatfs/ff.c src/fatfs/ccsbcs.c "
|
||||
comp.Append(CPPPATH = ['src/fatfs'])
|
||||
|
||||
# Lua module files
|
||||
module_names = "pio.c spi.c tmr.c pd.c uart.c term.c pwm.c lpack.c bit.c net.c cpu.c adc.c can.c luarpc.c bitarray.c elua.c i2c.c"
|
||||
module_files = " " + " ".join( [ "src/modules/%s" % name for name in module_names.split() ] )
|
||||
|
||||
# Remote file system files
|
||||
rfs_names = "remotefs.c client.c elua_os_io.c elua_rfs.c"
|
||||
rfs_files = " " + " ".join( [ "src/remotefs/%s" % name for name in rfs_names.split() ] )
|
||||
|
||||
# Optimizer flags (speed or size)
|
||||
comp.Append(CCFLAGS = ['-Os','-fomit-frame-pointer'])
|
||||
#opt += " -ffreestanding"
|
||||
#opt += " -fconserve-stack" # conserve stack at potential speed cost, >=GCC4.4
|
||||
|
||||
# Toolset data (filled by each platform in part)
|
||||
tools = {}
|
||||
|
||||
# We get platform-specific data by executing the platform script
|
||||
execfile( "src/platform/%s/conf.py" % platform )
|
||||
|
||||
# Complete file list
|
||||
source_files = Split( app_files + specific_files + newlib_files + uip_files + lua_full_files + module_files + rfs_files + shell_files )
|
||||
|
||||
comp = conf.Finish()
|
||||
|
||||
romfs_exclude = [ '.DS_Store' ]
|
||||
|
||||
# Make ROM File System first
|
||||
if not GetOption( 'clean' ):
|
||||
print "Building ROM File System..."
|
||||
flist = []
|
||||
os.chdir( "romfs" );
|
||||
for sample in glob.glob("*"):
|
||||
if sample not in romfs_exclude:
|
||||
flist += [ sample ]
|
||||
os.chdir( ".." )
|
||||
import mkfs
|
||||
mkfs.mkfs( "romfs", "romfiles", flist, comp['romfs'], compcmd )
|
||||
print
|
||||
if os.path.exists( "inc/romfiles.h" ):
|
||||
os.remove( "inc/romfiles.h" )
|
||||
shutil.move( "romfiles.h", "inc/" )
|
||||
if os.path.exists( "src/fs.o" ):
|
||||
os.remove( "src/fs.o" )
|
||||
|
||||
# comp.TargetSignatures( 'content' )
|
||||
# comp.SourceSignatures( 'MD5' )
|
||||
comp[ 'INCPREFIX' ] = "-I"
|
||||
Default( comp.Program( target = output, source = source_files ) )
|
||||
Decider( 'MD5-timestamp' )
|
||||
|
||||
# Programming target
|
||||
prog = Environment( BUILDERS = { 'program' : Builder( action = Action ( tools[ platform ][ 'progfunc' ] ) ) }, ENV = os.environ )
|
||||
prog.program( "prog", output + ".elf" )
|
||||
|
||||
Help(vars.GenerateHelpText(comp))
|
26
cross-lua.py
26
cross-lua.py
@ -1,26 +0,0 @@
|
||||
import os, sys
|
||||
|
||||
output = 'luac.cross'
|
||||
cdefs = '-DLUA_CROSS_COMPILER'
|
||||
|
||||
# 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
|
||||
lparser.c lstate.c lstring.c ltable.c ltm.c lundump.c lvm.c lzio.c lauxlib.c lbaselib.c
|
||||
ldblib.c liolib.c lmathlib.c loslib.c ltablib.c lstrlib.c loadlib.c linit.c luac.c print.c lrotable.c"""
|
||||
lua_full_files = " " + " ".join( [ "src/lua/%s" % name for name in lua_files.split() ] )
|
||||
local_include = "-Isrc/lua -Iinc/desktop -Iinc"
|
||||
|
||||
# Compiler/linker options
|
||||
cccom = "gcc -O2 %s -Wall %s -c $SOURCE -o $TARGET" % ( local_include, cdefs )
|
||||
linkcom = "gcc -o $TARGET $SOURCES -lm"
|
||||
|
||||
# Env for building the program
|
||||
comp = Environment( CCCOM = cccom,
|
||||
LINKCOM = linkcom,
|
||||
ENV = os.environ )
|
||||
if comp['PLATFORM'] == 'win32':
|
||||
suffix = ".exe"
|
||||
else:
|
||||
suffix = ".elf"
|
||||
Decider( 'MD5' )
|
||||
Default( comp.Program( output + suffix, Split( lua_full_files ) ) )
|
@ -54,6 +54,8 @@ h1, h2, h3, h4, h5 {
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
h2 { margin-top: 10px;}
|
||||
|
||||
h3 {font-size:21px;}
|
||||
|
||||
a[href]:link, a[href]:visited {
|
||||
|
@ -1,7 +1,11 @@
|
||||
// $$HEADER$$
|
||||
Building eLua
|
||||
-------------
|
||||
If you decide to build your own binary image instead of link:downloads.html"[downloading one], then you will need to download the source code
|
||||
|
||||
IMPORTANT: Starting with eLua 0.10, a new Lua-based build system replaces the previous Python based (scons) build system. You'll need to use the
|
||||
new build system to build eLua, as per the instructions link:#buildoptions[here].
|
||||
|
||||
If you decide to build your own binary image instead of link:downloads.html[downloading one], then you will need to download the source code
|
||||
(see link:downloads.html#source[here] for details) and follow the platform specific eLua build instructions (provided for link:building_unix.html[Linux]
|
||||
and link:building_win.html[Windows]) to setup your build environment.
|
||||
|
||||
@ -325,39 +329,35 @@ One more thing you might want to configure for your build is the contents of the
|
||||
[[buildoptions]]
|
||||
Invoking the build system
|
||||
-------------------------
|
||||
Once you have everything in place, all you have to do is to invoke the build system (scons) with the right arguments. This is a fairly easy step, although it might look intimidating
|
||||
because of the multitude of options than can be given to scons. They are used to fine tune the final image to your specific needs, but unless your needs are very special you won't need
|
||||
Once you have everything in place, all you have to do is to invoke the build system (build_elua) with the right arguments. This is a fairly easy step, although it might look intimidating
|
||||
because of the multitude of options than can be given to build_elua. They are used to fine tune the final image to your specific needs, but unless your needs are very special you won't need
|
||||
to modify them, so don't worry about the apparent complexity. The examples at the end of this section will show how easy it is to use the build system in practice.
|
||||
|
||||
------------------------------------
|
||||
$ scons
|
||||
[target=lua | lualong | lualonglong]
|
||||
[cpu=<cpuname>]
|
||||
$ lua build_elua.lua
|
||||
[board=<boardname>]
|
||||
[target=lua | lualong | lualonglong]
|
||||
[allocator=newlib | multiple | simple]
|
||||
[toolchain=<toolchain name>]
|
||||
[optram=true | false]
|
||||
[boot=standard | luarpc]
|
||||
[romfs=verbatim | compress | compile]
|
||||
[cpumode=arm | thumb]
|
||||
[allocator = newlib | multiple | simple]
|
||||
[toolchain = <toolchain name>]
|
||||
[optram = 0 | 1]
|
||||
[romfs = verbatim | compress | compile]
|
||||
[bootloader=none | emblod]
|
||||
[output_dir=<directory>]
|
||||
[romfs_dir=<directory>]
|
||||
[board_config_file=<file>]
|
||||
[skip_conf=true | false]
|
||||
[-E | -S]
|
||||
[prog]
|
||||
------------------------------------
|
||||
|
||||
Your build target is specified by two paramters: *cpu* and *board*. "cpu" gives the name of your CPU, and "board" the name of the board. A board can be associated with more than
|
||||
one CPU. This allows the build system to be very flexible. You can use these two options together or separately, as shown below:
|
||||
|
||||
* **cpu=name**: build for the specified CPU. A board name will be assigned by the build system automatically.
|
||||
* **board=name**: build for the specified board. The CPU name will be inferred by the build system automatically.
|
||||
* **cpu=name board=name**: build for the specified board and CPU. The build script won't allow invalid CPU/board combinations.
|
||||
|
||||
For board/CPU assignment, look at the beginning of the SConstruct file (the _platform_list_), it's self-explanatory. +
|
||||
The other options are as follows:
|
||||
Your build target is specified by *board*. The other options are as follows:
|
||||
|
||||
* **target=lua | lualong | lualonglong**: specify if you want to build "regular" Lua (with floating point support). 32 bit integer only Lua (lualong) or 64 bit integer only Lua (lualonglong,
|
||||
starting with version 0.9). The default is "lua". "lualong" and "lualonglong" run faster on targets that don't have a floating point co-processor, but they completely lack support for floating
|
||||
point operations, they can only handle integers. Also, "lualonglong" doesn't support cross-compilation of Lua source files to bytecode (check link:arch_romfs.html#mode[here] for details).
|
||||
|
||||
* **cpumode=arm | thumb**: for ARM targets (not Cortex) this specifies the compilation mode. Its default value is 'thumb' for AT91SAM7X targets and 'arm' for STR9, LPC2888 and LPC2468 targets.
|
||||
|
||||
* **allocator = newlib | multiple | simple**: choose between the default newlib allocator (newlib) which is an older version of dlmalloc, the multiple memory spaces allocator (multiple)
|
||||
which is a newer version of dlmalloc that can handle multiple memory spaces, and a very simple memory allocator (simple) that is slow and doesn't handle fragmentation very well, but it
|
||||
requires very few resources (Flash/RAM). You should use the 'multiple' allocator only if you need to support multiple memory spaces (for example boards that have external RAM). You should
|
||||
@ -365,54 +365,80 @@ The other options are as follows:
|
||||
|
||||
* **toolchain=<toolchain name>**: this specifies the name of the toolchain used to build the image. See link:toolchains.html#configuration[this link] for details.
|
||||
|
||||
* **optram=0 | 1**: enables of disables the LTR patch, see the link:arch_ltr.html[LTR documentation] for more details. The default is 1, which enables the LTR patch.
|
||||
|
||||
* *prog*: by default, the above 'scons' command will build only the 'elf' (executable) file. Specify "prog" to build also the platform-specific programming file where appropriate
|
||||
(for example, on a AT91SAM7X256 this results in a .bin file that can be programmed in the CPU).
|
||||
|
||||
* **romfs = verbatim | compress | compile**: ROMFS compilation mode, check link:arch_romfs.html#mode[here] for details (*new in 0.7*).
|
||||
* **optram=true | false**: enables of disables the LTR patch, see the link:arch_ltr.html[LTR documentation] for more details. The default is true, which enables the LTR patch. Keep LTR enabled
|
||||
unless you have a very good reason to do otherwise, eLua might not function properly with LTR disabled.
|
||||
|
||||
* **boot = standard | luarpc**: Boot mode. 'standard' will boot to either a shell or lua interactive prompt. 'luarpc' boots with a waiting rpc server, using a UART & timer as specified in
|
||||
link:building.html#static[static configuration data] (*new in 0.7*).
|
||||
|
||||
The output will be a file named elua_**[target]**_**[cpu]**.elf (and also another file with the same name but ending in .bin/.hex if "prog" was specified for platforms that need these files
|
||||
* **romfs = verbatim | compress | compile**: ROMFS compilation mode, check link:arch_romfs.html#mode[here] for details (*new in 0.7*).
|
||||
|
||||
* **cpumode=arm | thumb**: for ARM targets (not Cortex) this specifies the compilation mode. Its default value is 'thumb' for AT91SAM7X targets and 'arm' for STR9, LPC2888 and LPC2468 targets.
|
||||
|
||||
* **bootloader = none | emblod**: 'emblod' generates an image suitable for loading with the 'emblod' boot loader. AVR32 only.
|
||||
|
||||
* **output_dir=<directory>**: changes the directory where the firmware image will be written. The default is the root directory of the eLua source tree.
|
||||
|
||||
* **romfs_dir=<directory>**: the directory with the link:arch_romfs.html[romfs] files. The default is "romfs".
|
||||
|
||||
* **board_config_file=<file>**: the configuration file for the board. This will ignore the configuration file generated by the Lua configurator and use the user-specified one instead. For more details
|
||||
about the configurator, see link:configurator.html[this link].
|
||||
|
||||
* **skip_conf=true | false**: don't call the Lua configurator at all, use whatever configuration file is present in the system instead. This can be used for manually editing the configuration file: run
|
||||
the build normally (with skip_conf=false) once, edit the generated configuration header file, then run the build again with skip_conf=true.
|
||||
|
||||
* **-E | -S**: see the link:#singlefile[single file compilation] section below.
|
||||
|
||||
* **prog**: by default, the above 'build_elua' command will build only the 'elf' (executable) file. Specify "prog" to build also the platform-specific programming file where appropriate
|
||||
(for example, on a AT91SAM7X256 this results in a .bin file that can be programmed in the CPU).
|
||||
|
||||
The output will be a file named elua_**board**.elf (and also another file with the same name but ending in .bin/.hex if "prog" was specified for platforms that need these files
|
||||
for programming). +
|
||||
If you want the equivalent of a "make clean", invoke "scons" as shown above, but add a "-c" at the end of the command line. +
|
||||
If you want the equivalent of a "make clean", invoke "build_elua" as shown above, but add a "-c" at the end of the command line. +
|
||||
|
||||
**A few examples:**
|
||||
|
||||
---------------------------
|
||||
$ scons cpu=at91sam7x256 -c
|
||||
---------------------------
|
||||
Clear previously built intermediate files.
|
||||
|
||||
------------------------
|
||||
$ scons cpu=at91sam7x256
|
||||
------------------------
|
||||
Build eLua for the AT91SAM7X256 CPU. The board name is detected as sam7-ex256.
|
||||
|
||||
|
||||
------------------------
|
||||
$ scons board=sam7-ex256
|
||||
------------------------
|
||||
Build eLua for the SAM7-EX256 board. The CPU is detected as AT91SAM7X256.
|
||||
------------------------------------------
|
||||
$ lua build_elua.lua board=sam7-ex256 prog
|
||||
------------------------------------------
|
||||
Build eLua for the SAM7-EX256 board. Also, the bin/hex file(s) required for target programming are generated.
|
||||
|
||||
-----------------------------------------
|
||||
$ scons board=sam7-ex256 cpu=at91sam7x512
|
||||
$ lua build_elua.lua board=lpc-h2888 prog
|
||||
-----------------------------------------
|
||||
Build eLua for the SAM7-EX256 board but "overwrite" the default CPU. This is useful when you'd like to see how the specified board would behave (in terms of resources) with a different
|
||||
CPU. In the case of the SAM7-EX256 board, it's possible to switch the on-board AT91SAM7X256 CPU for an AT91SAM7X512 which has the same pinout but comes with more Flash/RAM memory.
|
||||
Build eLua for the lpc2888 CPU. The allocator is automatically detected as "multiple".
|
||||
|
||||
------------------------
|
||||
$ scons cpu=lpc2888 prog
|
||||
------------------------
|
||||
Build eLua for the lpc2888 CPU. The board name is detected as LPC-H2888. Also, the bin file required for target programming is generated. The allocator is automatically detected as "multiple".
|
||||
|
||||
------------------------------------------------
|
||||
$ scons cpu=lm3s8962 toolchain=codesourcery prog
|
||||
------------------------------------------------
|
||||
------------------------------------------------------------------
|
||||
$ lua build_elua.lua board=ek-lm3s8962 toolchain=codesourcery prog
|
||||
------------------------------------------------------------------
|
||||
Build the image for the Cortex LM3S8962 CPU, but use the CodeSourcery toolchain instead of the default toolchain (which is a "generic" ARM GCC toolchain, usually the one built by following
|
||||
the tutorials from this site.
|
||||
|
||||
---------------------------------------
|
||||
$ lua build_elua.lua board=mbed prog -c
|
||||
---------------------------------------
|
||||
Clean the intermediary build files for the mbed board, as well as the outputs (firmware files).
|
||||
|
||||
[[singlefile]]
|
||||
Single file compilation
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
For various reasons, it is often useful to compile a single file instead of the whole image. *build_elua* can do that by specifying the path toward a source file as a target name. It also provides
|
||||
options to precompile or generate the assembler source for single files. Examples:
|
||||
|
||||
------------------------------------------
|
||||
$ lua build_elua.lua board=mbed src/main.c
|
||||
------------------------------------------
|
||||
Compile only src/main.c for the 'mbed' board.
|
||||
|
||||
---------------------------------------------
|
||||
$ lua build_elua.lua board=mbed -E src/main.c
|
||||
---------------------------------------------
|
||||
Preprocess src/main.c, using 'mbed' as the target board.
|
||||
|
||||
---------------------------------------------
|
||||
$ lua build_elua.lua board=mbed -E src/main.c
|
||||
---------------------------------------------
|
||||
Generate the assembler source file for src/main.c, using 'mbed' as the target board.
|
||||
|
||||
// $$FOOTER$$
|
||||
|
||||
|
@ -2,6 +2,9 @@
|
||||
Building eLua in Linux
|
||||
----------------------
|
||||
|
||||
IMPORTANT: Starting with eLua 0.10, a new Lua-based build system replaces the previous Python based (scons) build system. You'll need to update
|
||||
your machine environment accordingly, as per the instructions below.
|
||||
|
||||
Building eLua in Linux is fairly easy. This tutorial assumes that Ubuntu is used for building, however any distro should be fine, you just need to
|
||||
convert the "apt-get" calls to your distro's package manager equivalent. You need a few packages installed to build eLua:
|
||||
|
||||
@ -9,22 +12,28 @@ convert the "apt-get" calls to your distro's package manager equivalent. You nee
|
||||
* *a toolchain*: check link:toolchains.html[the toolchains page] for toolchain instructions. Please note that even if you already have a compiled toolchain, the differences in the Newlib configure flags (mainly the --disable-newlib-supplied-syscalls flags) might prevent eLua for building properly on your machine.
|
||||
|
||||
|
||||
* *Python*: it should be already installed. If it's not, use
|
||||
apt-get to install it:
|
||||
* *Lua*: it should be already installed. If it's not, use apt-get to install it:
|
||||
+
|
||||
-----------------------------
|
||||
$ sudo apt-get install python
|
||||
-----------------------------
|
||||
------------------------------
|
||||
$ sudo apt-get install lua5.1
|
||||
------------------------------
|
||||
|
||||
* *scons* - eLua uses scons instead of make and makefiles, because we find scons much more "natural" and easier to use than make. To install it:
|
||||
* *luarocks*: a simple package manager for Lua. Again, use apt-get to install it:
|
||||
+
|
||||
----------------------------
|
||||
$ sudo apt-get install scons
|
||||
----------------------------
|
||||
-------------------------------
|
||||
$ sudo apt-get install luarocks
|
||||
-------------------------------
|
||||
|
||||
* *luafilesystem, lpack, md5* - various Lua modules needed by the builder. Use luarocks to install them:
|
||||
+
|
||||
-------------------------------------
|
||||
$ sudo luarocks install luafilesystem
|
||||
$ sudo luarocks install lpack
|
||||
$ sudo luarocks install md5
|
||||
-------------------------------------
|
||||
|
||||
* your toolchain's "bin" directory (this is generally something like /usr/local/cross-arm/bin, where /usr/local/cross-arm is the directory in which you installed your toolchain) must be in $PATH.
|
||||
|
||||
|
||||
* if you're building for the i386 platform, you'll also need "nasm":
|
||||
+
|
||||
---------------------------
|
||||
@ -39,9 +48,9 @@ sudo apt-get install build-essential
|
||||
+
|
||||
Then build the eLua cross compiler by executing this command:
|
||||
+
|
||||
---------------------
|
||||
scons -f cross-lua.py
|
||||
---------------------
|
||||
-----------------
|
||||
lua cross-lua.lua
|
||||
-----------------
|
||||
|
||||
After you setup your build environment as described above, follow link:building.html#configuring[this tutorial] to build your eLua image.
|
||||
|
||||
|
@ -2,6 +2,9 @@
|
||||
Building eLua in Windows
|
||||
------------------------
|
||||
|
||||
IMPORTANT: Starting with eLua 0.10, a new Lua-based build system replaces the previous Python based (scons) build system. You'll need to update
|
||||
your machine environment accordingly, as per the instructions below.
|
||||
|
||||
Starting with version 0.7, building eLua in Windows is officially supported. The following instructions were tested in Windows 7 Professional, but they should work with little or no modification in any version of Windows 7, Vista or XP. You need to download and install a few things first:
|
||||
|
||||
* *a toolchain*: building a GCC-based toolchain under Windows is possible but not easy. We found that the easiest thing to do is to download a pre-built toolchain and install it. Currently, all the targets supported by eLua (except i386) have at least one toolchain that runs under Windows:
|
||||
@ -11,20 +14,15 @@ Starting with version 0.7, building eLua in Windows is officially supported. The
|
||||
|
||||
** AVR32 has its own Windows based GNU toolchain that can be downloaded from Atmel link:http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4118[here].
|
||||
|
||||
* *Python*: my favourite Windows distribution of Python is link:http://www.activestate.com/activepython/[ActivePython]. Simply download it and install it. ActivePython
|
||||
2.6.4.8 will be used in this tutorial. Other Python distribution might work equally as well.
|
||||
|
||||
* *scons*: download the Windows installer package from link:http://www.scons.org/download.php[here]. For this tutorial, scons 1.2.0 will be used. Remember to install scons *after* you install Python.
|
||||
|
||||
* *lua*: a very good and versatile Lua distribution for Windows is "Lua for Windows", it can be downloaded from link:http://luaforwindows.luaforge.net/[here]. Besides Lua itself, it includes a lot of very useful Lua modules, so I highly recommend it. Version 5.1.4.30 of Lua for Windows will be used in this tutorial.
|
||||
|
||||
* *git*: if you need to checkout the *eLua* source code from the link:https://github.com/elua/elua[project git repository], then you will need to install git for Windows. The instructions at GitHub describing how to link:http://help.github.com/win-set-up-git/[set up git] for Windows should work well. You will only need the ssh key setup section if you want to push code to GitHub. For a version of git that integrates with the Windows shell (similar to TortoiseSVN), check out link:http://code.google.com/p/tortoisegit/[TortoiseGIT].
|
||||
|
||||
* *gcc*: if you want to use the ROMFS pre-compiled feature (see link:arch_romfs.html#mode[here] for details), then you will need to build an image for the eLua cross compiler, and you will need an i386 toolchain for this. I'm using MinGW for this task. It can be downloaded from link:http://www.mingw.org/[here]. This tutorial uses MinGW version 5.1.6. Note that you don't need to install MSYS; MinGW should be enough. Cygwin should work equally as well, or even Microsoft's Visual Studio (not tested). To build the cross compiler, run this command from the command line:
|
||||
+
|
||||
-----------------------
|
||||
$ scons -f cross-lua.py
|
||||
-----------------------
|
||||
-------------------
|
||||
$ lua cross-lua.lua
|
||||
-------------------
|
||||
|
||||
Make sure that all the programs listed above are added to %PATH%. Most of them do this automatically, or have an option to do this automatically, but some (for example MinGW and SCons) do not and you will need to add them to %PATH% manually.
|
||||
|
||||
|
141
mkfs.py
141
mkfs.py
@ -1,141 +0,0 @@
|
||||
# A script to convert an entire directory to a C array, in the "romfs" format
|
||||
import os, sys
|
||||
import re
|
||||
import struct
|
||||
|
||||
_crtline = ' '
|
||||
_numdata = 0
|
||||
_bytecnt = 0
|
||||
_fcnt = 0
|
||||
maxlen = 30
|
||||
alignment = 4
|
||||
|
||||
# Line output function
|
||||
def _add_data( data, outfile, moredata = True ):
|
||||
global _crtline, _numdata, _bytecnt, _fcnt
|
||||
_bytecnt = _bytecnt + 1
|
||||
_fcnt = _fcnt + 1
|
||||
if moredata:
|
||||
_crtline = _crtline + "0x%02X, " % data
|
||||
else:
|
||||
_crtline = _crtline + "0x%02X" % data
|
||||
_numdata = _numdata + 1
|
||||
if _numdata == 16 or not moredata:
|
||||
outfile.write( _crtline + '\n' )
|
||||
_crtline = ' '
|
||||
_numdata = 0
|
||||
|
||||
# dirname - the directory where the files are located.
|
||||
# outname - the name of the C output
|
||||
# flist - list of files
|
||||
# mode - preprocess the file system:
|
||||
# "verbatim" - copy the files directly to the FS as they are
|
||||
# "compile" - precompile all files to Lua bytecode and then copy them
|
||||
# "compress" - keep the source code, but compress it with LuaSrcDiet
|
||||
# compcmd - the command to use for compiling if "mode" is "compile"
|
||||
# Returns True for OK, False for error
|
||||
def mkfs( dirname, outname, flist, mode, compcmd ):
|
||||
# Try to create the output files
|
||||
outfname = outname + ".h"
|
||||
try:
|
||||
outfile = file( outfname, "wb" )
|
||||
except:
|
||||
print "Unable to create output file"
|
||||
return False
|
||||
|
||||
global _crtline, _numdata, _bytecnt, _fcnt
|
||||
_crtline = ' '
|
||||
_numdata = 0
|
||||
_bytecnt = 0
|
||||
# Generate headers
|
||||
outfile.write( "// Generated by mkfs.py\n// DO NOT MODIFY\n\n" )
|
||||
outfile.write( "#ifndef __%s_H__\n#define __%s_H__\n\n" % ( outname.upper(), outname.upper() ) )
|
||||
|
||||
outfile.write( "const unsigned char %s_fs[] = \n{\n" % ( outname.lower() ) )
|
||||
|
||||
# Process all files
|
||||
for fname in flist:
|
||||
if len( fname ) > maxlen:
|
||||
print "Skipping %s (name longer than %d chars)" % ( fname, maxlen )
|
||||
continue
|
||||
|
||||
# Get actual file name
|
||||
realname = os.path.join( dirname, fname )
|
||||
|
||||
# Ensure it actually is a file
|
||||
if not os.path.isfile( realname ):
|
||||
print "Skipping %s ... (not found or not a regular file)" % fname
|
||||
continue
|
||||
|
||||
# Try to open and read the file
|
||||
try:
|
||||
crtfile = file( realname, "rb" )
|
||||
except:
|
||||
outfile.close()
|
||||
os.remove( outfname )
|
||||
print "Unable to read %s" % fname
|
||||
return False
|
||||
|
||||
# Do we need to process the file?
|
||||
fextpart = ''
|
||||
if mode == "compile" or mode == "compress":
|
||||
fnamepart, fextpart = os.path.splitext( realname )
|
||||
if mode == "compress":
|
||||
newext = ".lua.tmp"
|
||||
else:
|
||||
newext = ".lc"
|
||||
if fextpart == ".lua":
|
||||
newname = fnamepart + newext
|
||||
if mode == "compress":
|
||||
print "Compressing %s to %s ..." % ( realname, newname )
|
||||
else:
|
||||
print "Cross compiling %s to %s ..." % ( realname, newname )
|
||||
os.system( compcmd % ( newname, realname ) )
|
||||
# TODO: this assumes that the cross compiler ended OK
|
||||
crtfile.close()
|
||||
try:
|
||||
crtfile = file( newname, "rb" )
|
||||
except:
|
||||
outfile.close()
|
||||
os.remove( outfname )
|
||||
print "Unable to read %s" % newname
|
||||
return False
|
||||
if mode == "compile":
|
||||
fnamepart, fextpart = os.path.splitext( fname )
|
||||
fname = fnamepart + ".lc"
|
||||
filedata = crtfile.read()
|
||||
crtfile.close()
|
||||
if fextpart == ".lua" and mode != "verbatim":
|
||||
os.remove( newname )
|
||||
|
||||
# Write name, size, id, numpars
|
||||
_fcnt = 0
|
||||
for c in fname:
|
||||
_add_data( ord( c ), outfile )
|
||||
_add_data( 0, outfile ) # ASCIIZ
|
||||
size_ll = len( filedata ) & 0xFF
|
||||
size_lh = ( len( filedata ) >> 8 ) & 0xFF
|
||||
size_hl = ( len( filedata ) >> 16 ) & 0xFF
|
||||
size_hh = ( len( filedata ) >> 24 ) & 0xFF
|
||||
# Round to a multiple of 4
|
||||
while _bytecnt & ( alignment - 1 ) != 0:
|
||||
_add_data( 0, outfile )
|
||||
# Write size
|
||||
_add_data( size_ll, outfile )
|
||||
_add_data( size_lh, outfile )
|
||||
_add_data( size_hl, outfile )
|
||||
_add_data( size_hh, outfile )
|
||||
# Then write the rest of the file
|
||||
for c in filedata:
|
||||
_add_data( ord( c ), outfile )
|
||||
|
||||
# Report
|
||||
print "Encoded file %s (%d bytes real size, %d bytes encoded size)" % ( fname, len( filedata ), _fcnt )
|
||||
|
||||
# All done, write the final "0xFF" (terminator)
|
||||
_add_data( 0xFF, outfile, False )
|
||||
outfile.write( "};\n\n#endif\n" );
|
||||
outfile.close()
|
||||
print "Done, total size is %d bytes" % _bytecnt
|
||||
return True
|
||||
|
33
mux.py
33
mux.py
@ -1,33 +0,0 @@
|
||||
import os, sys, platform
|
||||
|
||||
flist = "main.c"
|
||||
rfs_flist = "main.c server.c log.c deskutils.c rfs_transports.c"
|
||||
cdefs = "-DRFS_UDP_TRANSPORT -DRFS_INSIDE_MUX_MODE"
|
||||
socklib = ''
|
||||
ptlib = ''
|
||||
if platform.system() == "Windows":
|
||||
cdefs = cdefs + " -DWIN32_BUILD"
|
||||
rfs_flist = rfs_flist + " os_io_win32.c serial_win32.c net_win32.c"
|
||||
exeprefix = ".exe"
|
||||
socklib = '-lws2_32'
|
||||
else:
|
||||
rfs_flist = rfs_flist + " os_io_posix.c serial_posix.c net_posix.c"
|
||||
exeprefix = ""
|
||||
socklib = ''
|
||||
|
||||
output = "mux%s" % exeprefix
|
||||
|
||||
rfs_full_files = " " + " ".join( [ "rfs_server_src/%s" % name for name in rfs_flist.split() ] )
|
||||
full_files = " " + " ".join( [ "mux_src/%s" % name for name in flist.split() ] ) + rfs_full_files + " src/remotefs/remotefs.c src/eluarpc.c"
|
||||
local_include = "-Imux_src -Irfs_server_src -Iinc -Iinc/remotefs"
|
||||
|
||||
# Compiler/linker options
|
||||
cccom = "gcc -m32 -O0 -g %s -Wall %s -c $SOURCE -o $TARGET" % ( local_include, cdefs )
|
||||
linkcom = "gcc -m32 -o $TARGET $SOURCES %s" % socklib
|
||||
|
||||
# Env for building the program
|
||||
comp = Environment( CCCOM = cccom,
|
||||
LINKCOM = linkcom,
|
||||
ENV = os.environ )
|
||||
Decider( 'MD5' )
|
||||
Default( comp.Program( output, Split( full_files ) ) )
|
@ -1,44 +0,0 @@
|
||||
import os, sys, platform
|
||||
|
||||
sim = ARGUMENTS.get( 'sim', '0' )
|
||||
|
||||
flist = ""
|
||||
cdefs = "-DRFS_STANDALONE_MODE"
|
||||
socklib = ''
|
||||
if sim == '0':
|
||||
mainname = "main.c"
|
||||
else:
|
||||
mainname = 'main_sim.c'
|
||||
if platform.system() == "Windows":
|
||||
if sim == '1':
|
||||
print "SIM target not supported under Windows"
|
||||
os.exit( 1 )
|
||||
flist = "main.c server.c os_io_win32.c log.c net_win32.c serial_win32.c deskutils.c rfs_transports.c"
|
||||
cdefs = cdefs + " -DWIN32_BUILD"
|
||||
exeprefix = ".exe"
|
||||
socklib = '-lws2_32'
|
||||
else:
|
||||
flist = "%s server.c os_io_posix.c log.c net_posix.c serial_posix.c deskutils.c rfs_transports.c" % mainname
|
||||
exeprefix = ""
|
||||
|
||||
if sim == '0':
|
||||
output = 'rfs_server%s' % exeprefix
|
||||
else:
|
||||
output = 'rfs_sim_server%s' % exeprefix
|
||||
#endif
|
||||
|
||||
full_files = " " + " ".join( [ "rfs_server_src/%s" % name for name in flist.split() ] )
|
||||
full_files = full_files + " src/remotefs/remotefs.c src/eluarpc.c"
|
||||
local_include = "-Irfs_server_src -Iinc/remotefs -Iinc"
|
||||
|
||||
# Compiler/linker options
|
||||
cccom = "gcc -m32 -O0 -g %s -Wall %s -c $SOURCE -o $TARGET" % ( local_include, cdefs )
|
||||
linkcom = "gcc -m32 -o $TARGET $SOURCES %s" % socklib
|
||||
|
||||
# Env for building the program
|
||||
comp = Environment( CCCOM = cccom,
|
||||
LINKCOM = linkcom,
|
||||
ENV = os.environ )
|
||||
Decider( 'MD5' )
|
||||
Default( comp.Program( output, Split( full_files ) ) )
|
||||
|
35
rpc-lua.lua
Normal file
35
rpc-lua.lua
Normal file
@ -0,0 +1,35 @@
|
||||
local args = { ... }
|
||||
local b = require "utils.build"
|
||||
local builder = b.new_builder( ".build/rpc-lua" )
|
||||
local utils = b.utils
|
||||
local sf = string.format
|
||||
builder:init( args )
|
||||
builder:set_build_mode( builder.BUILD_DIR_LINEARIZED )
|
||||
|
||||
local output = 'luarpc'
|
||||
local cdefs = "-DLUA_CROSS_COMPILER -DLUA_RPC"
|
||||
|
||||
local lua_files = [[lapi.c lcode.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c lmem.c lobject.c lopcodes.c
|
||||
lparser.c lstate.c lstring.c ltable.c ltm.c lundump.c lvm.c lzio.c lauxlib.c lbaselib.c
|
||||
ldblib.c liolib.c lmathlib.c loslib.c ltablib.c lstrlib.c loadlib.c linit.c lua.c print.c lrotable.c]]
|
||||
lua_files = lua_files:gsub( "\n", "" )
|
||||
local lua_full_files = utils.prepend_path( lua_files, "src/lua" )
|
||||
lua_full_files = lua_full_files .. " src/modules/luarpc.c src/modules/lpack.c src/modules/bitarray.c src/modules/bit.c src/luarpc_desktop_serial.c "
|
||||
local local_include = "-Isrc/lua -Iinc -Isrc/modules -Iinc/desktop"
|
||||
|
||||
if utils.is_windows() then
|
||||
lua_full_files = lua_full_files .. " src/serial/serial_win32.c"
|
||||
cdefs = cdefs .. " -DWIN32_BUILD"
|
||||
else
|
||||
lua_full_files = lua_full_files .. " src/serial/serial_posix.c src/linenoise_posix.c"
|
||||
cdefs = cdefs .. " -DLUA_USE_LINENOISE "
|
||||
end
|
||||
|
||||
-- Compiler/linker options
|
||||
builder:set_compile_cmd( sf( "gcc -O2 -g %s -Wall %s -c $(FIRST) -o $(TARGET)", local_include, cdefs ) )
|
||||
builder:set_link_cmd( "gcc -o $(TARGET) $(DEPENDS) -lm" )
|
||||
|
||||
-- Build everything
|
||||
builder:make_exe_target( output, lua_full_files )
|
||||
builder:build()
|
||||
|
34
rpc-lua.py
34
rpc-lua.py
@ -1,34 +0,0 @@
|
||||
import os, sys, platform
|
||||
|
||||
output = 'luarpc'
|
||||
cdefs = "-DLUA_CROSS_COMPILER -DLUA_RPC"
|
||||
|
||||
# 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
|
||||
lparser.c lstate.c lstring.c ltable.c ltm.c lundump.c lvm.c lzio.c lauxlib.c lbaselib.c
|
||||
ldblib.c liolib.c lmathlib.c loslib.c ltablib.c lstrlib.c loadlib.c linit.c lua.c print.c lrotable.c"""
|
||||
lua_full_files = " " + " ".join( [ "src/lua/%s" % name for name in lua_files.split() ] )
|
||||
lua_full_files += " src/modules/luarpc.c src/modules/lpack.c src/modules/bitarray.c src/modules/bit.c src/luarpc_desktop_serial.c "
|
||||
|
||||
external_libs = '-lm'
|
||||
|
||||
if platform.system() == "Windows":
|
||||
lua_full_files += " src/serial/serial_win32.c"
|
||||
cdefs += " -DWIN32_BUILD"
|
||||
else:
|
||||
lua_full_files += " src/serial/serial_posix.c src/linenoise_posix.c"
|
||||
cdefs += " -DLUA_USE_LINENOISE "
|
||||
|
||||
local_include = "-Isrc/lua -Iinc -Isrc/modules -Iinc/desktop"
|
||||
|
||||
# Compiler/linker options
|
||||
cccom = "gcc -O2 -g %s -Wall %s -c $SOURCE -o $TARGET" % ( local_include, cdefs )
|
||||
linkcom = "gcc -o $TARGET $SOURCES %s" % external_libs
|
||||
|
||||
# Env for building the program
|
||||
comp = Environment( CCCOM = cccom,
|
||||
LINKCOM = linkcom,
|
||||
ENV = os.environ )
|
||||
# Debug
|
||||
Decider( 'MD5-timestamp' )
|
||||
Default( comp.Program( output, Split( lua_full_files ) ) )
|
@ -20,8 +20,9 @@
|
||||
#include "lualib.h"
|
||||
#include "lrotable.h"
|
||||
|
||||
#ifndef LUA_CROSS_COMPILER
|
||||
#include "platform_conf.h"
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
** If your system does not support `stdout', you can just remove this function.
|
||||
|
@ -14,7 +14,9 @@
|
||||
#include "lauxlib.h"
|
||||
#include "lrotable.h"
|
||||
#include "luaconf.h"
|
||||
#ifndef LUA_CROSS_COMPILER
|
||||
#include "platform_conf.h"
|
||||
#endif
|
||||
|
||||
// Dummy open function
|
||||
int luaopen_dummy(lua_State *L)
|
||||
|
@ -22,9 +22,9 @@
|
||||
#include "lstring.h"
|
||||
#include "ltable.h"
|
||||
#include "ltm.h"
|
||||
#include "platform_conf.h"
|
||||
// BogdanM: modified for Lua interrupt support
|
||||
#ifndef LUA_CROSS_COMPILER
|
||||
#include "platform_conf.h"
|
||||
#include "elua_int.h"
|
||||
#include "platform.h"
|
||||
#endif
|
||||
|
@ -12,11 +12,14 @@
|
||||
#include "lua.h"
|
||||
#include "lualib.h"
|
||||
#include "lauxlib.h"
|
||||
#include "platform_conf.h"
|
||||
|
||||
#include "luarpc_rpc.h"
|
||||
#include "serial.h"
|
||||
|
||||
#ifndef LUA_CROSS_COMPILER
|
||||
#include "platform_conf.h"
|
||||
#endif
|
||||
|
||||
void transport_open( Transport *tpt, const char *path );
|
||||
|
||||
#ifdef LUARPC_ENABLE_SERIAL
|
||||
|
@ -29,9 +29,9 @@ void *alloca(size_t);
|
||||
|
||||
#ifndef LUA_CROSS_COMPILER
|
||||
#include "platform.h"
|
||||
#include "platform_conf.h"
|
||||
#endif
|
||||
|
||||
#include "platform_conf.h"
|
||||
|
||||
#ifdef LUA_OPTIMIZE_MEMORY
|
||||
#include "lrotable.h"
|
||||
|
@ -1,51 +0,0 @@
|
||||
# Configuration file for the AT91SAM7X(256/512) backend
|
||||
|
||||
cpumode = ARGUMENTS.get( 'cpumode', 'thumb' ).lower()
|
||||
|
||||
specific_files = "board_cstartup.s board_lowlevel.c board_memories.c usart.c pmc.c pio.c platform.c tc.c pwmc.c aic.c platform_int.c pit.c"
|
||||
if comp[ 'cpu' ] == 'AT91SAM7X256':
|
||||
ldscript = "flash256.lds"
|
||||
comp.Append(CPPDEFINES = 'at91sam7x256')
|
||||
elif comp[ 'cpu' ] == 'AT91SAM7X512':
|
||||
ldscript = "flash512.lds"
|
||||
comp.Append(CPPDEFINES = 'at91sam7x512')
|
||||
else:
|
||||
print "Invalid AT91SAM7X CPU %s" % comp[ 'cpu' ]
|
||||
Exit( -1 )
|
||||
|
||||
comp.Append(CPPDEFINES = ['NOASSERT','NOTRACE'])
|
||||
|
||||
# Prepend with path
|
||||
specific_files = " ".join( [ "src/platform/%s/%s" % ( platform, f ) for f in specific_files.split() ] )
|
||||
specific_files += " src/platform/arm_utils.s src/platform/arm_cortex_interrupts.c"
|
||||
ldscript = "src/platform/%s/%s" % ( platform, ldscript )
|
||||
|
||||
comp.Append(CCFLAGS = ['-ffunction-sections','-fdata-sections','-fno-strict-aliasing','-Wall'])
|
||||
comp.Append(LINKFLAGS = ['-nostartfiles','-nostdlib','-T',ldscript,'-Wl,--gc-sections','-Wl,--allow-multiple-definition'])
|
||||
comp.Append(ASFLAGS = ['-x','assembler-with-cpp','-c','-Wall','$_CPPDEFFLAGS'])
|
||||
comp.Append(LIBS = ['c','gcc','m'])
|
||||
|
||||
TARGET_FLAGS = ['-mcpu=arm7tdmi']
|
||||
if cpumode == 'thumb':
|
||||
TARGET_FLAGS += ['-mthumb']
|
||||
comp.Append(CPPDEFINES = ['CPUMODE_THUMB'])
|
||||
else:
|
||||
comp.Append(CPPDEFINES = ['CPUMODE_ARM'])
|
||||
|
||||
# Configure General Flags for Target
|
||||
comp.Prepend(CCFLAGS = [TARGET_FLAGS])
|
||||
comp.Prepend(LINKFLAGS = [TARGET_FLAGS,'-Wl,-e,entry'])
|
||||
comp.Prepend(ASFLAGS = [TARGET_FLAGS,'-D__ASSEMBLY__'])
|
||||
|
||||
# Toolset data
|
||||
tools[ 'at91sam7x' ] = {}
|
||||
|
||||
# Programming function for LPC2888
|
||||
def progfunc_at91sam7x( target, source, env ):
|
||||
outname = output + ".elf"
|
||||
os.system( "%s %s" % ( toolset[ 'size' ], outname ) )
|
||||
print "Generating binary image..."
|
||||
os.system( "%s -O binary %s %s.bin" % ( toolset[ 'bin' ], outname, output ) )
|
||||
|
||||
tools[ 'at91sam7x' ][ 'progfunc' ] = progfunc_at91sam7x
|
||||
|
@ -1,54 +0,0 @@
|
||||
# Configuration file for the AVR32 microcontrollers
|
||||
|
||||
specific_files = "crt0.s trampoline.s platform.c exception.s intc.c pm.c flashc.c pm_conf_clocks.c usart.c gpio.c tc.c spi.c platform_int.c adc.c pwm.c i2c.c ethernet.c lcd.c rtc.c usb-cdc.c"
|
||||
comp.Append(CPPDEFINES = 'FORAVR32')
|
||||
|
||||
# See board.h for possible BOARD values.
|
||||
if comp[ 'board' ] == "ATEVK1100":
|
||||
specific_files += " sdramc.c"
|
||||
comp.Append(CPPDEFINES = {'BOARD' : 1})
|
||||
elif comp[ 'board' ] == "ATEVK1101":
|
||||
comp.Append(CPPDEFINES = {'BOARD' : 2})
|
||||
elif comp[ 'board' ] == "MIZAR32":
|
||||
specific_files += " sdramc.c"
|
||||
comp.Append(CPPDEFINES = {'BOARD' : 98})
|
||||
else:
|
||||
print "Invalid board for %s platform (%s)" %( platform, comp[ 'board' ] )
|
||||
sys.exit( -1 )
|
||||
|
||||
# Prepend with path
|
||||
specific_files = " ".join( [ "src/platform/%s/%s" % ( platform, f ) for f in specific_files.split() ] )
|
||||
|
||||
# Choose ldscript according to choice of bootloader
|
||||
if comp[ 'bootloader' ] == "none":
|
||||
print "Compiling for FLASH execution"
|
||||
ldscript = "src/platform/%s/%s.ld" % ( platform, comp[ 'cpu' ].lower() )
|
||||
else :
|
||||
print "Compiling for SDRAM execution"
|
||||
ldscript = "src/platform/%s/%s_%s.ld" % ( platform, comp[ 'cpu' ].lower(), comp[ 'bootloader'] )
|
||||
|
||||
# Standard GCC Flags
|
||||
comp.Append(CCFLAGS = ['-ffunction-sections','-fdata-sections','-fno-strict-aliasing','-Wall','-DBOOTLOADER_%s' %comp['bootloader'].upper()])
|
||||
comp.Append(LINKFLAGS = ['-nostartfiles','-nostdlib','-Wl,--gc-sections','-Wl,--allow-multiple-definition','-Wl,--relax','-Wl,--direct-data','-T',ldscript])
|
||||
comp.Append(ASFLAGS = ['-x','assembler-with-cpp','-c'])
|
||||
comp.Append(LIBS = ['c','gcc','m'])
|
||||
|
||||
# Target-specific Flags
|
||||
comp.Prepend(CCFLAGS = ['-mpart=%s' % (comp[ 'cpu' ][4:].lower())])
|
||||
comp.Prepend(ASFLAGS = ['-mpart=%s' % (comp[ 'cpu' ][4:].lower())])
|
||||
comp.Append(LINKFLAGS = ['-Wl,-e,crt0'])
|
||||
|
||||
# Toolset data
|
||||
tools[ 'avr32' ] = {}
|
||||
|
||||
# Programming function
|
||||
def progfunc_avr32( target, source, env ):
|
||||
outname = output + ".elf"
|
||||
os.system( "%s %s" % ( toolset[ 'size' ], outname ) )
|
||||
print "Generating binary image..."
|
||||
os.system( "%s -O ihex %s %s.hex" % ( toolset[ 'bin' ], outname, output ) )
|
||||
|
||||
# print "Programming..."
|
||||
# os.system( "batchisp -hardware usb -device %s -operation erase f memory flash blankcheck loadbuffer %s program verify start reset 0" % ( comp[ 'cpu' ].lower(), output + ".hex" ) )
|
||||
|
||||
tools[ 'avr32' ][ 'progfunc' ] = progfunc_avr32
|
@ -1,33 +0,0 @@
|
||||
# Configuration file for the i386 backend
|
||||
|
||||
specific_files = "boot.s common.c descriptor_tables.c gdt.s interrupt.s isr.c kb.c monitor.c timer.c platform.c"
|
||||
ldscript = "i386.ld"
|
||||
|
||||
# Prepend with path
|
||||
specific_files = " ".join( [ "src/platform/%s/%s" % ( platform, f ) for f in specific_files.split() ] )
|
||||
ldscript = "src/platform/%s/%s" % ( platform, ldscript )
|
||||
|
||||
|
||||
# Standard GCC Flags
|
||||
comp.Append(CCFLAGS = ['-ffunction-sections','-fdata-sections','-fno-strict-aliasing','-Wall'])
|
||||
comp.Append(LINKFLAGS = ['-nostartfiles','-nostdlib','-T',ldscript,'-Wl,--gc-sections','-Wl,--allow-multiple-definition'])
|
||||
#comp.Append(ASFLAGS = ['-x','assembler-with-cpp','-c','-Wall','$_CPPDEFFLAGS'])
|
||||
comp.Append(LIBS = ['c','gcc','m'])
|
||||
|
||||
TARGET_FLAGS = ['-march=i386','-mfpmath=387','-m32']
|
||||
|
||||
comp.Prepend(CCFLAGS = [TARGET_FLAGS,'-fno-builtin','-fno-stack-protector'])
|
||||
comp.Prepend(LINKFLAGS = [TARGET_FLAGS,'-Wl,-e,start'])
|
||||
comp['AS'] = toolset[ 'asm' ] # Need to force toolset
|
||||
comp.Prepend(ASFLAGS = ['-felf'])
|
||||
|
||||
# Toolset data
|
||||
tools[ 'i386' ] = {}
|
||||
|
||||
# Programming function for i386 (not needed, empty function)
|
||||
def progfunc_i386( target, source, env ):
|
||||
outname = output + ".elf"
|
||||
os.system( "%s %s" % ( toolset[ 'size' ], outname ) )
|
||||
print "Visit http://www.eluaproject.net for instructions on how to use your eLua ELF file"
|
||||
|
||||
tools[ 'i386' ][ 'progfunc' ] = progfunc_i386
|
@ -1,72 +0,0 @@
|
||||
# Configuration file for the LM3S microcontroller
|
||||
import fnmatch
|
||||
import glob
|
||||
import os
|
||||
|
||||
comp.Append(CPPPATH = ['src/platform/%s/inc' % platform])
|
||||
comp.Append(CPPPATH = ['src/platform/%s/driverlib' % platform])
|
||||
|
||||
# Only include USB headers/paths for boards which support it
|
||||
if comp[ 'cpu' ] == 'LM3S9B92' or comp[ 'cpu' ] == 'LM3S9D92':
|
||||
comp.Append(CPPPATH = ['src/platform/%s/usblib' % platform])
|
||||
comp.Append(CPPPATH = ['src/platform/%s/usblib/device' % platform])
|
||||
|
||||
fwlib_files = " ".join(glob.glob("src/platform/%s/driverlib/*.c" % platform))
|
||||
|
||||
specific_files = "startup_gcc.c platform.c platform_int.c lm3s_pio.c"
|
||||
|
||||
if comp[ 'board' ] == 'EK-LM3S1968' or comp[ 'board' ] == 'EK-LM3S6965' or comp[ 'board' ] == 'EK-LM3S8962':
|
||||
specific_files = specific_files + " rit128x96x4.c disp.c"
|
||||
comp.Append(CPPDEFINES = 'ENABLE_DISP')
|
||||
|
||||
|
||||
# The default for the Eagle 100 board is to start the image at 0x2000,
|
||||
# so that the built in Ethernet boot loader can be used to upload it
|
||||
if comp[ 'board' ] == 'EAGLE-100':
|
||||
comp.Append(LINKFLAGS = ['-Wl,-Ttext,0x2000'])
|
||||
|
||||
if comp[ 'cpu' ] == 'LM3S9B92' or comp[ 'cpu' ] == 'LM3S9D92':
|
||||
fwlib_files = fwlib_files + " " + " ".join(glob.glob("src/platform/%s/usblib/*.c" % platform))
|
||||
fwlib_files = fwlib_files + " " + " ".join(glob.glob("src/platform/%s/usblib/device/*.c" % platform))
|
||||
specific_files = specific_files + " usb_serial_structs.c"
|
||||
|
||||
|
||||
if comp[ 'board' ] == 'EK-LM3S9B92':
|
||||
ldscript = "lm3s-9b92.ld"
|
||||
elif comp[ 'board' ] == 'SOLDERCORE' or comp[ 'board' ] == 'EK-LM3S9D92':
|
||||
ldscript = "lm3s-9d92.ld"
|
||||
else:
|
||||
ldscript = "lm3s.ld"
|
||||
|
||||
# Prepend with path
|
||||
specific_files = fwlib_files + " " + " ".join( [ "src/platform/%s/%s" % ( platform, f ) for f in specific_files.split() ] )
|
||||
specific_files += " src/platform/cortex_utils.s src/platform/arm_cortex_interrupts.c"
|
||||
ldscript = "src/platform/%s/%s" % ( platform, ldscript )
|
||||
|
||||
comp.Append(CPPDEFINES = ["FOR" + comp[ 'cpu' ],'gcc'])
|
||||
comp.Append(CPPDEFINES = ['CORTEX_M3'])
|
||||
|
||||
# Standard GCC Flags
|
||||
comp.Append(CCFLAGS = ['-ffunction-sections','-fdata-sections','-fno-strict-aliasing','-Wall'])
|
||||
comp.Append(LINKFLAGS = ['-nostartfiles','-nostdlib','-T',ldscript,'-Wl,--gc-sections','-Wl,--allow-multiple-definition'])
|
||||
comp.Append(ASFLAGS = ['-x','assembler-with-cpp','-c','-Wall','$_CPPDEFFLAGS'])
|
||||
comp.Append(LIBS = ['c','gcc','m'])
|
||||
|
||||
TARGET_FLAGS = ['-mcpu=cortex-m3','-mthumb']
|
||||
|
||||
# Configure General Flags for Target
|
||||
comp.Prepend(CCFLAGS = [TARGET_FLAGS,'-mlittle-endian'])
|
||||
comp.Prepend(LINKFLAGS = [TARGET_FLAGS,'-Wl,-e,ResetISR','-Wl,-static'])
|
||||
comp.Prepend(ASFLAGS = TARGET_FLAGS)
|
||||
|
||||
# Toolset data
|
||||
tools[ 'lm3s' ] = {}
|
||||
|
||||
# Programming function
|
||||
def progfunc_lm3s( target, source, env ):
|
||||
outname = output + ".elf"
|
||||
os.system( "%s %s" % ( toolset[ 'size' ], outname ) )
|
||||
print "Generating binary image..."
|
||||
os.system( "%s -O binary %s %s.bin" % ( toolset[ 'bin' ], outname, output ) )
|
||||
|
||||
tools[ 'lm3s' ][ 'progfunc' ] = progfunc_lm3s
|
@ -1,52 +0,0 @@
|
||||
# Configuration file for the LPC17xx backend
|
||||
import fnmatch
|
||||
import glob
|
||||
import os
|
||||
|
||||
|
||||
comp.Append(CPPPATH = ['src/platform/%s/drivers/inc' % platform])
|
||||
|
||||
fwlib_files = " ".join(glob.glob("src/platform/%s/drivers/src/*.c" % platform))
|
||||
|
||||
specific_files = "startup_LPC17xx.c system_LPC17xx.c core_cm3.c platform.c mbed_pio.c"
|
||||
|
||||
# Check CPU
|
||||
if comp[ 'cpu' ] == 'LPC1768':
|
||||
ldscript = "LPC17xx.ld"
|
||||
else:
|
||||
print "Invalid LPC17xx CPU %s", comp[ 'cpu' ]
|
||||
Exit( -1 )
|
||||
|
||||
# Prepend with path
|
||||
specific_files = fwlib_files + " " + " ".join( [ "src/platform/%s/%s" % ( platform, f ) for f in specific_files.split() ] )
|
||||
specific_files += " src/platform/cortex_utils.s src/platform/arm_cortex_interrupts.c"
|
||||
ldscript = "src/platform/%s/%s" % ( platform, ldscript )
|
||||
|
||||
comp.Append(CPPDEFINES = ["FOR" + comp[ 'cpu' ],'gcc'])
|
||||
comp.Append(CPPDEFINES = ['CORTEX_M3'])
|
||||
|
||||
# Standard GCC Flags
|
||||
comp.Append(CCFLAGS = ['-ffunction-sections','-fdata-sections','-fno-strict-aliasing','-Wall'])
|
||||
comp.Append(LINKFLAGS = ['-nostartfiles','-nostdlib','-T',ldscript,'-Wl,--gc-sections','-Wl,--allow-multiple-definition'])
|
||||
comp.Append(ASFLAGS = ['-x','assembler-with-cpp','-c','-Wall','$_CPPDEFFLAGS'])
|
||||
comp.Append(LIBS = ['c','gcc','m'])
|
||||
|
||||
TARGET_FLAGS = ['-mcpu=cortex-m3','-mthumb']
|
||||
|
||||
# Configure General Flags for Target
|
||||
comp.Prepend(CCFLAGS = [TARGET_FLAGS,'-mlittle-endian'])
|
||||
comp.Prepend(LINKFLAGS = [TARGET_FLAGS,'-Wl,-e,Reset_Handler','-Wl,-static'])
|
||||
comp.Prepend(ASFLAGS = TARGET_FLAGS)
|
||||
|
||||
|
||||
# Toolset data
|
||||
tools[ 'lpc17xx' ] = {}
|
||||
|
||||
# Programming function for LPC17xx
|
||||
def progfunc_lpc17xx( target, source, env ):
|
||||
outname = output + ".elf"
|
||||
os.system( "%s %s" % ( toolset[ 'size' ], outname ) )
|
||||
print "Generating binary image..."
|
||||
os.system( "%s -O binary %s %s.bin" % ( toolset[ 'bin' ], outname, output ) )
|
||||
|
||||
tools[ 'lpc17xx' ][ 'progfunc' ] = progfunc_lpc17xx
|
@ -1,49 +0,0 @@
|
||||
# Configuration file for the LPC24xx backend
|
||||
|
||||
cpumode = ARGUMENTS.get( 'cpumode', 'arm' ).lower()
|
||||
|
||||
specific_files = "startup.s irq.c target.c platform.c platform_int.c"
|
||||
if comp[ 'cpu' ] == 'LPC2468':
|
||||
ldscript = "lpc2468.lds"
|
||||
else:
|
||||
print "Invalid CPU %s" % comp[ 'cpu' ]
|
||||
Exit( -1 )
|
||||
|
||||
# Prepend with path
|
||||
specific_files = " ".join( [ "src/platform/%s/%s" % ( platform, f ) for f in specific_files.split() ] )
|
||||
specific_files += " src/platform/arm_utils.s src/platform/arm_cortex_interrupts.c"
|
||||
ldscript = "src/platform/%s/%s" % ( platform, ldscript )
|
||||
|
||||
comp.Append(CPPDEFINES = ["FOR" + comp[ 'cpu' ],'gcc'])
|
||||
|
||||
# Standard GCC Flags
|
||||
comp.Append(CCFLAGS = ['-ffunction-sections','-fdata-sections','-fno-strict-aliasing','-Wall'])
|
||||
comp.Append(LINKFLAGS = ['-nostartfiles','-nostdlib','-T',ldscript,'-Wl,--gc-sections','-Wl,--allow-multiple-definition'])
|
||||
comp.Append(ASFLAGS = ['-x','assembler-with-cpp','-c','-Wall','$_CPPDEFFLAGS'])
|
||||
comp.Append(LIBS = ['c','gcc','m'])
|
||||
|
||||
# Special Target Configuration
|
||||
TARGET_FLAGS = ['-mcpu=arm7tdmi']
|
||||
if cpumode == 'thumb':
|
||||
TARGET_FLAGS += ['-mthumb']
|
||||
comp.Append(CPPDEFINES = ['CPUMODE_THUMB'])
|
||||
else:
|
||||
comp.Append(CPPDEFINES = ['CPUMODE_ARM'])
|
||||
|
||||
comp.Prepend(CCFLAGS = TARGET_FLAGS)
|
||||
comp.Prepend(LINKFLAGS = [TARGET_FLAGS,'-Wl,-e,entry'])
|
||||
comp.Prepend(ASFLAGS = [TARGET_FLAGS,'-D__ASSEMBLY__'])
|
||||
|
||||
|
||||
# Toolset data
|
||||
tools[ 'lpc24xx' ] = {}
|
||||
|
||||
# Programming function for LPC24xx
|
||||
def progfunc_lpx24xx( target, source, env ):
|
||||
outname = output + ".elf"
|
||||
os.system( "%s %s" % ( toolset[ 'size' ], outname ) )
|
||||
print "Generating binary image..."
|
||||
os.system( "%s -O ihex %s %s.hex" % ( toolset[ 'bin' ], outname, output ) )
|
||||
|
||||
tools[ 'lpc24xx' ][ 'progfunc' ] = progfunc_lpx24xx
|
||||
|
@ -1,54 +0,0 @@
|
||||
# Configuration file for the LPC288x backend
|
||||
|
||||
cpumode = ARGUMENTS.get( 'cpumode', 'arm' ).lower()
|
||||
|
||||
specific_files = "lpc28xx.s platform.c target.c uart.c"
|
||||
|
||||
# Check CPU
|
||||
if comp[ 'cpu' ] == 'LPC2888':
|
||||
ldscript = "lpc2888.lds"
|
||||
else:
|
||||
print "Invalid LPC288x CPU %s", comp[ 'cpu' ]
|
||||
Exit( -1 )
|
||||
|
||||
if cpumode == 'thumb':
|
||||
print "ERROR: due to a hardware limitation, it is not possible to run Thumb code from the LPC2888 internal flash."
|
||||
print "Compile again, this time with cpumode=arm"
|
||||
Exit( -1 )
|
||||
|
||||
# Prepend with path
|
||||
specific_files = " ".join( [ "src/platform/%s/%s" % ( platform, f ) for f in specific_files.split() ] )
|
||||
specific_files += " src/platform/arm_utils.s src/platform/arm_cortex_interrupts.c"
|
||||
ldscript = "src/platform/%s/%s" % ( platform, ldscript )
|
||||
|
||||
comp.Append(CPPDEFINES = ["FOR" + comp[ 'cpu' ],'gcc'])
|
||||
|
||||
# Standard GCC Flags
|
||||
comp.Append(CCFLAGS = ['-ffunction-sections','-fdata-sections','-fno-strict-aliasing','-Wall'])
|
||||
comp.Append(LINKFLAGS = ['-nostartfiles','-nostdlib','-T',ldscript,'-Wl,--gc-sections','-Wl,--allow-multiple-definition'])
|
||||
comp.Append(ASFLAGS = ['-x','assembler-with-cpp','-c','-Wall','$_CPPDEFFLAGS'])
|
||||
comp.Append(LIBS = ['c','gcc','m'])
|
||||
|
||||
# Special Target Configuration
|
||||
TARGET_FLAGS = ['-mcpu=arm7tdmi']
|
||||
if cpumode == 'thumb':
|
||||
TARGET_FLAGS += ['-mthumb']
|
||||
comp.Append(CPPDEFINES = ['CPUMODE_THUMB'])
|
||||
else:
|
||||
comp.Append(CPPDEFINES = ['CPUMODE_ARM'])
|
||||
|
||||
comp.Prepend(CCFLAGS = TARGET_FLAGS)
|
||||
comp.Prepend(LINKFLAGS = [TARGET_FLAGS,'-Wl,-e,HardReset'])
|
||||
comp.Prepend(ASFLAGS = [TARGET_FLAGS,'-D__ASSEMBLY__'])
|
||||
|
||||
# Toolset data
|
||||
tools[ 'lpc288x' ] = {}
|
||||
|
||||
# Programming function for LPC2888
|
||||
def progfunc_lpc288x( target, source, env ):
|
||||
outname = output + ".elf"
|
||||
os.system( "%s %s" % ( toolset[ 'size' ], outname ) )
|
||||
print "Generating binary image..."
|
||||
os.system( "%s -O binary %s %s.bin" % ( toolset[ 'bin' ], outname, output ) )
|
||||
|
||||
tools[ 'lpc288x' ][ 'progfunc' ] = progfunc_lpc288x
|
@ -1,35 +0,0 @@
|
||||
# Configuration file for the linux backend
|
||||
|
||||
specific_files = "boot.s utils.s hostif_%s.c platform.c host.c" % comp[ 'cpu' ].lower()
|
||||
ldscript = "i386.ld"
|
||||
|
||||
# override default optimize settings (-Os is broken right now)
|
||||
comp.Replace(OPTFLAGS = ['-O0'])
|
||||
comp.AppendUnique(CCFLAGS = ['-g'])
|
||||
|
||||
# Prepend with path
|
||||
specific_files = " ".join( [ "src/platform/%s/%s" % ( platform, f ) for f in specific_files.split() ] )
|
||||
ldscript = "src/platform/%s/%s" % ( platform, ldscript )
|
||||
|
||||
# Standard GCC Flags
|
||||
comp.Append(CCFLAGS = ['-ffunction-sections','-fdata-sections','-fno-strict-aliasing','-Wall'])
|
||||
comp.Append(LINKFLAGS = ['-nostartfiles','-nostdlib','-T',ldscript,'-Wl,--gc-sections','-Wl,--allow-multiple-definition'])
|
||||
#comp.Append(ASFLAGS = ['-x','assembler-with-cpp','-c','-Wall','$_CPPDEFFLAGS'])
|
||||
comp.Append(LIBS = ['c','gcc','m'])
|
||||
|
||||
TARGET_FLAGS = ['-march=i386','-mfpmath=387','-m32']
|
||||
|
||||
comp.Prepend(CCFLAGS = [TARGET_FLAGS,'-fno-builtin','-fno-stack-protector'])
|
||||
comp.Prepend(LINKFLAGS = [TARGET_FLAGS,'-Wl,-e,start','-Wl,-static'])
|
||||
comp['AS'] = toolset[ 'asm' ] # Need to force toolset
|
||||
comp.Prepend(ASFLAGS = ['-felf'])
|
||||
|
||||
# Toolset data
|
||||
tools[ 'sim' ] = {}
|
||||
|
||||
# Programming function for i386 (not needed, empty function)
|
||||
def progfunc_dummy( target, source, env ):
|
||||
print "Run the simulator and enjoy :)"
|
||||
|
||||
tools[ 'sim' ][ 'progfunc' ] = progfunc_dummy
|
||||
|
@ -1,48 +0,0 @@
|
||||
# Configuration file for the STM32 microcontroller
|
||||
import fnmatch
|
||||
import glob
|
||||
import os
|
||||
|
||||
comp.Append(CPPPATH = ['src/platform/%s/FWLib/library/inc' % platform])
|
||||
|
||||
fwlib_files = " ".join(glob.glob("src/platform/%s/FWLib/library/src/*.c" % platform))
|
||||
#print "FWLib: %s " % fwlib_files
|
||||
|
||||
specific_files = "core_cm3.c system_stm32f10x.c startup_stm32f10x_hd.s platform.c stm32f10x_it.c lcd.c lua_lcd.c platform_int.c enc.c"
|
||||
|
||||
ldscript = "stm32.ld"
|
||||
|
||||
# Prepend with path
|
||||
specific_files = fwlib_files + " " + " ".join( [ "src/platform/%s/%s" % ( platform, f ) for f in specific_files.split() ] )
|
||||
specific_files += " src/platform/cortex_utils.s src/platform/arm_cortex_interrupts.c"
|
||||
ldscript = "src/platform/%s/%s" % ( platform, ldscript )
|
||||
|
||||
comp.Append(CPPDEFINES = ["FOR" + cnorm( comp[ 'cpu' ] ),"FOR" + cnorm( comp[ 'board' ] ),'gcc'])
|
||||
comp.Append(CPPDEFINES = ['CORTEX_M3'])
|
||||
|
||||
# Standard GCC Flags
|
||||
comp.Append(CCFLAGS = ['-ffunction-sections','-fdata-sections','-fno-strict-aliasing','-Wall'])
|
||||
comp.Append(LINKFLAGS = ['-nostartfiles','-nostdlib','-T',ldscript,'-Wl,--gc-sections','-Wl,--allow-multiple-definition'])
|
||||
comp.Append(ASFLAGS = ['-x','assembler-with-cpp','-c','-Wall','$_CPPDEFFLAGS'])
|
||||
comp.Append(LIBS = ['c','gcc','m'])
|
||||
|
||||
TARGET_FLAGS = ['-mcpu=cortex-m3','-mthumb']
|
||||
|
||||
# Configure General Flags for Target
|
||||
comp.Prepend(CCFLAGS = [TARGET_FLAGS,'-mlittle-endian'])
|
||||
comp.Prepend(LINKFLAGS = [TARGET_FLAGS,'-Wl,-e,Reset_Handler','-Wl,-static'])
|
||||
comp.Prepend(ASFLAGS = TARGET_FLAGS)
|
||||
|
||||
# Toolset data
|
||||
tools[ 'stm32' ] = {}
|
||||
|
||||
# Programming function
|
||||
def progfunc_stm32( target, source, env ):
|
||||
outname = output + ".elf"
|
||||
os.system( "%s %s" % ( toolset[ 'size' ], outname ) )
|
||||
print "Generating binary image..."
|
||||
os.system( "%s -O binary %s %s.bin" % ( toolset[ 'bin' ], outname, output ) )
|
||||
os.system( "%s -O ihex %s %s.hex" % ( toolset[ 'bin' ], outname, output ) )
|
||||
|
||||
tools[ 'stm32' ][ 'progfunc' ] = progfunc_stm32
|
||||
|
@ -1,47 +0,0 @@
|
||||
# Configuration file for the STR7 backend
|
||||
|
||||
cpumode = ARGUMENTS.get( 'cpumode', 'thumb' ).lower()
|
||||
|
||||
specific_files = "platform.c crt0.s 71x_rccu.c 71x_uart.c 71x_apb.c 71x_gpio.c 71x_tim.c"
|
||||
if comp[ 'cpu' ] == 'STR711FR2':
|
||||
ldscript = "str711fr2.lds"
|
||||
else:
|
||||
print "Invalid STR7 CPU %s" % comp[ 'cpu' ]
|
||||
Exit( -1 )
|
||||
|
||||
# Prepend with path
|
||||
specific_files = " ".join( [ "src/platform/%s/%s" % ( platform, f ) for f in specific_files.split() ] )
|
||||
specific_files += " src/platform/arm_utils.s src/platform/arm_cortex_interrupts.c"
|
||||
ldscript = "src/platform/%s/%s" % ( platform, ldscript )
|
||||
|
||||
comp.Append(CPPDEFINES = ["FOR" + comp[ 'cpu' ],'gcc'])
|
||||
|
||||
# Standard GCC Flags
|
||||
comp.Append(CCFLAGS = ['-ffunction-sections','-fdata-sections','-fno-strict-aliasing','-Wall'])
|
||||
comp.Append(LINKFLAGS = ['-nostartfiles','-nostdlib','-T',ldscript,'-Wl,--gc-sections','-Wl,--allow-multiple-definition'])
|
||||
comp.Append(ASFLAGS = ['-x','assembler-with-cpp','-c','-Wall','$_CPPDEFFLAGS'])
|
||||
comp.Append(LIBS = ['c','gcc','m'])
|
||||
|
||||
# Special Target Configuration
|
||||
TARGET_FLAGS = ['-mcpu=arm7tdmi']
|
||||
if cpumode == 'thumb':
|
||||
TARGET_FLAGS += ['-mthumb']
|
||||
comp.Append(CPPDEFINES = ['CPUMODE_THUMB'])
|
||||
else:
|
||||
comp.Append(CPPDEFINES = ['CPUMODE_ARM'])
|
||||
|
||||
comp.Prepend(CCFLAGS = TARGET_FLAGS)
|
||||
comp.Prepend(LINKFLAGS = [TARGET_FLAGS,'-Wl,-e,entry'])
|
||||
comp.Prepend(ASFLAGS = [TARGET_FLAGS])
|
||||
|
||||
# Toolset data
|
||||
tools[ 'str7' ] = {}
|
||||
|
||||
# Programming function for LPC2888
|
||||
def progfunc_str7( target, source, env ):
|
||||
outname = output + ".elf"
|
||||
os.system( "%s %s" % ( toolset[ 'size' ], outname ) )
|
||||
print "Generating binary image..."
|
||||
os.system( "%s -O binary %s %s.bin" % ( toolset[ 'bin' ], outname, output ) )
|
||||
|
||||
tools[ 'str7' ][ 'progfunc' ] = progfunc_str7
|
@ -1,53 +0,0 @@
|
||||
# Configuration file for the STR9 backend
|
||||
|
||||
cpumode = ARGUMENTS.get( 'cpumode', 'arm' ).lower()
|
||||
|
||||
specific_files = "startup912.s startup_generic.s platform.c 91x_scu.c 91x_fmi.c 91x_gpio.c 91x_uart.c 91x_tim.c 91x_vic.c interrupt.c str9_pio.c 91x_i2c.c 91x_wiu.c 91x_adc.c platform_int.c 91x_ssp.c"
|
||||
|
||||
# Check CPU
|
||||
if comp[ 'cpu' ] == 'STR912FAW44':
|
||||
ldscript = "str912fw44.lds"
|
||||
else:
|
||||
print "Invalid STR9 CPU %s" % comp[ 'cpu' ]
|
||||
Exit( -1 )
|
||||
|
||||
# Prepend with path
|
||||
specific_files = " ".join( [ "src/platform/%s/%s" % ( platform, f ) for f in specific_files.split() ] )
|
||||
specific_files += " src/platform/arm_utils.s src/platform/arm_cortex_interrupts.c"
|
||||
ldscript = "src/platform/%s/%s" % ( platform, ldscript )
|
||||
|
||||
comp.Append(CPPDEFINES = ["FOR" + comp[ 'cpu' ],'gcc'])
|
||||
|
||||
# Standard GCC Flags
|
||||
comp.Append(CCFLAGS = ['-ffunction-sections','-fdata-sections','-fno-strict-aliasing','-Wall'])
|
||||
comp.Append(LINKFLAGS = ['-nostartfiles','-nostdlib','-T',ldscript,'-Wl,--gc-sections','-Wl,--allow-multiple-definition'])
|
||||
comp.Append(ASFLAGS = ['-x','assembler-with-cpp','-c','-Wall','$_CPPDEFFLAGS','$_CPPINCFLAGS'])
|
||||
comp.Append(LIBS = ['c','gcc','m'])
|
||||
|
||||
# Special Target Configuration
|
||||
TARGET_FLAGS = ['-mcpu=arm966e-s']
|
||||
if cpumode == 'thumb':
|
||||
TARGET_FLAGS += ['-mthumb']
|
||||
comp.Append(CPPDEFINES = ['CPUMODE_THUMB'])
|
||||
else:
|
||||
comp.Append(CPPDEFINES = ['CPUMODE_ARM'])
|
||||
|
||||
# toolchain 'arm-gcc' requires '-mfpu=fpa' for some reason
|
||||
if comp['toolchain'] == 'arm-gcc':
|
||||
TARGET_FLAGS += ['-mfpu=fpa']
|
||||
|
||||
comp.Prepend(CCFLAGS = TARGET_FLAGS)
|
||||
comp.Prepend(LINKFLAGS = [TARGET_FLAGS,'-Wl,-e,_startup'])
|
||||
comp.Prepend(ASFLAGS = [TARGET_FLAGS])
|
||||
|
||||
# Toolset data
|
||||
tools[ 'str9' ] = {}
|
||||
|
||||
# Programming function for STR9
|
||||
def progfunc_str9( target, source, env ):
|
||||
outname = output + ".elf"
|
||||
os.system( "%s %s" % ( toolset[ 'size' ], outname ) )
|
||||
print "Generating binary image..."
|
||||
os.system( "%s -O binary %s %s.bin" % ( toolset[ 'bin' ], outname, output ) )
|
||||
|
||||
tools[ 'str9' ][ 'progfunc' ] = progfunc_str9
|
Loading…
x
Reference in New Issue
Block a user