2008-12-13 23:31:40 +00:00
|
|
|
import os, sys
|
|
|
|
target = ARGUMENTS.get( 'target', 'lua' ).lower()
|
2008-09-01 13:21:06 +00:00
|
|
|
cputype = ARGUMENTS.get( 'cpu', '' ).upper()
|
2008-08-16 22:27:02 +00:00
|
|
|
allocator = ARGUMENTS.get( 'allocator', '' ).lower()
|
2008-08-27 20:05:09 +00:00
|
|
|
boardname = ARGUMENTS.get( 'board' , '').upper()
|
2009-02-23 13:56:21 +00:00
|
|
|
toolchain = ARGUMENTS.get( 'toolchain', '')
|
2009-01-11 20:43:02 +00:00
|
|
|
optram = int( ARGUMENTS.get( 'optram', '1' ) )
|
2008-07-29 11:08:54 +00:00
|
|
|
|
2009-02-23 13:56:21 +00:00
|
|
|
# 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'
|
|
|
|
},
|
2009-03-05 22:48:08 +00:00
|
|
|
'arm-eabi-gcc' : {
|
2009-03-05 22:47:58 +00:00
|
|
|
'compile' : 'arm-eabi-gcc',
|
|
|
|
'link' : 'arm-eabi-ld',
|
|
|
|
'asm' : 'arm-eabi-as',
|
|
|
|
'bin' : 'arm-eabi-objcopy',
|
|
|
|
'size' : 'arm-eabi-size'
|
|
|
|
},
|
2009-02-24 22:09:22 +00:00
|
|
|
'codesourcery' : {
|
2009-02-23 13:56:21 +00:00
|
|
|
'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'
|
|
|
|
},
|
|
|
|
'avr32-gcc' : {
|
|
|
|
'compile' : 'avr32-gcc',
|
|
|
|
'link' : 'avr32-ld',
|
|
|
|
'asm' : 'avr32-as',
|
|
|
|
'bin' : 'avr32-objcopy',
|
|
|
|
'size' : 'avr32-size'
|
|
|
|
},
|
|
|
|
'i686-gcc' : {
|
|
|
|
'compile' : 'i686-elf-gcc',
|
|
|
|
'link' : 'i686-elf-ld',
|
|
|
|
'asm' : 'nasm',
|
|
|
|
'bin' : 'i686-elf-objcopy',
|
|
|
|
'size' : 'i686-elf-size'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-05 22:48:08 +00:00
|
|
|
# Toolchain Aliases
|
|
|
|
toolchain_list['devkitarm'] = toolchain_list['arm-eabi-gcc']
|
|
|
|
|
|
|
|
|
2009-02-23 13:56:21 +00:00
|
|
|
# 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 = {
|
2009-03-05 22:48:08 +00:00
|
|
|
'at91sam7x' : { 'cpus' : [ 'AT91SAM7X256', 'AT91SAM7X512' ], 'toolchains' : [ 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ] },
|
2009-08-03 18:37:38 +00:00
|
|
|
'lm3s' : { 'cpus' : [ 'LM3S8962', 'LM3S6965', 'LM3S6918', 'LM3S9B92' ], 'toolchains' : [ 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ] },
|
2009-03-05 22:48:08 +00:00
|
|
|
'str9' : { 'cpus' : [ 'STR912FAW44' ], 'toolchains' : [ 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ] },
|
2009-02-23 13:56:21 +00:00
|
|
|
'i386' : { 'cpus' : [ 'I386' ], 'toolchains' : [ 'i686-gcc' ] },
|
Modified Robert's 'linux' platform:
- code cleanup
- the platform is now named 'sim'. You build it like this:
$ scons cpu=linux
The idea is to support more than one host OS by changing the "cpu" variable
above (for example cpu=osx, or cpu=win32). Also, a crude "host interface" was
defined in hostif.h. In theory, a host OS should only implement that interface
in order to run the eLua simulator. The implementation must reside in a file
called hostif_{os}.c (in this case hostif_linux.c). Too bad I don't have a MAC,
I would've loved to try this :)
REMEMBER: whem implementing a host interface, you CAN NOT rely on your regular
libc! You'll have to rewrite the syscalls (see host.c for an example on how to
do this in Linux).
- after you build it, don't start it directly, use the new "run_elua_sim.sh"
script to run it. It will set the terminal to raw mode, no echo, so it will
behave more like "traditional" eLua (even hangman.lua will run in this mode :) ).
Remember to run in on an ANSI capable terminal (although most of them support
ANSI emulation nowadays).
- you can exit from the simulator with "exit". You can't do this with CTRL+C if
you run it with "run_elua_sim.sh".
All in all, this looks pretty good and it's an excellent test platform. It will
do wonders when we integrate our own libc and we won't be able to figure out why
it doesn't work :)
2009-05-12 14:09:29 +00:00
|
|
|
'sim' : { 'cpus' : [ 'LINUX' ], 'toolchains' : [ 'i686-gcc' ] },
|
2009-03-05 22:48:08 +00:00
|
|
|
'lpc288x' : { 'cpus' : [ 'LPC2888' ], 'toolchains' : [ 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ] },
|
|
|
|
'str7' : { 'cpus' : [ 'STR711FR2' ], 'toolchains' : [ 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ] },
|
|
|
|
'stm32' : { 'cpus' : [ 'STM32F103ZE', 'STM32F103RE' ], 'toolchains' : [ 'arm-gcc', 'codesourcery', 'devkitarm', 'arm-eabi-gcc' ] },
|
2009-02-23 13:56:21 +00:00
|
|
|
'avr32' : { 'cpus' : [ 'AT32UC3A0512' ], 'toolchains' : [ 'avr32-gcc' ] }
|
|
|
|
}
|
2008-08-27 20:05:09 +00:00
|
|
|
|
2008-09-01 13:21:06 +00:00
|
|
|
# List of board/CPU combinations
|
2008-12-13 23:31:40 +00:00
|
|
|
board_list = { 'SAM7-EX256' : [ 'AT91SAM7X256', 'AT91SAM7X512' ],
|
2008-08-27 20:05:09 +00:00
|
|
|
'EK-LM3S8962' : [ 'LM3S8962' ],
|
|
|
|
'EK-LM3S6965' : [ 'LM3S6965' ],
|
2009-08-03 18:37:38 +00:00
|
|
|
'EK-LM3S9B92' : [ 'LM3S9B92' ],
|
2009-02-25 21:29:40 +00:00
|
|
|
'STR9-COMSTICK' : [ 'STR912FAW44' ],
|
2008-08-27 20:05:09 +00:00
|
|
|
'PC' : [ 'I386' ],
|
Modified Robert's 'linux' platform:
- code cleanup
- the platform is now named 'sim'. You build it like this:
$ scons cpu=linux
The idea is to support more than one host OS by changing the "cpu" variable
above (for example cpu=osx, or cpu=win32). Also, a crude "host interface" was
defined in hostif.h. In theory, a host OS should only implement that interface
in order to run the eLua simulator. The implementation must reside in a file
called hostif_{os}.c (in this case hostif_linux.c). Too bad I don't have a MAC,
I would've loved to try this :)
REMEMBER: whem implementing a host interface, you CAN NOT rely on your regular
libc! You'll have to rewrite the syscalls (see host.c for an example on how to
do this in Linux).
- after you build it, don't start it directly, use the new "run_elua_sim.sh"
script to run it. It will set the terminal to raw mode, no echo, so it will
behave more like "traditional" eLua (even hangman.lua will run in this mode :) ).
Remember to run in on an ANSI capable terminal (although most of them support
ANSI emulation nowadays).
- you can exit from the simulator with "exit". You can't do this with CTRL+C if
you run it with "run_elua_sim.sh".
All in all, this looks pretty good and it's an excellent test platform. It will
do wonders when we integrate our own libc and we won't be able to figure out why
it doesn't work :)
2009-05-12 14:09:29 +00:00
|
|
|
'SIM' : [ 'LINUX' ],
|
2008-10-02 21:21:39 +00:00
|
|
|
'LPC-H2888' : [ 'LPC2888' ],
|
2008-11-08 07:14:51 +00:00
|
|
|
'MOD711' : [ 'STR711FR2' ],
|
2008-12-13 23:31:40 +00:00
|
|
|
'STM3210E-EVAL' : [ 'STM32F103ZE' ],
|
2009-02-23 13:56:21 +00:00
|
|
|
'ATEVK1100' : [ 'AT32UC3A0512' ],
|
2009-02-23 15:28:56 +00:00
|
|
|
'ET-STM32' : [ 'STM32F103RE' ],
|
|
|
|
'EAGLE-100' : [ 'LM3S6918' ]
|
2008-08-02 17:52:11 +00:00
|
|
|
}
|
2008-08-14 07:38:30 +00:00
|
|
|
|
2009-02-21 23:02:39 +00:00
|
|
|
# ROMFS file list "groups"
|
2009-02-27 10:57:58 +00:00
|
|
|
# To include a file in a ROMFS build, include it in a group here (or create one
|
|
|
|
# if you need) and make sure the group is included on your platform's file_list
|
|
|
|
# definition (right after this).
|
2009-02-21 23:02:39 +00:00
|
|
|
romfs = { 'bisect' : [ 'bisect.lua' ],
|
|
|
|
'hangman' : [ 'hangman.lua' ],
|
|
|
|
'lhttpd' : [ 'index.pht', 'lhttpd.lua', 'test.lua' ],
|
|
|
|
'pong' : [ 'pong.lua', 'LM3S.lua' ],
|
|
|
|
'led' : [ 'led.lua' ],
|
|
|
|
'piano' : [ 'piano.lua' ],
|
|
|
|
'pwmled' : [ 'pwmled.lua' ],
|
|
|
|
'tvbgone' : [ 'tvbgone.lua', 'codes.bin' ],
|
|
|
|
'hello' : [ 'hello.lua' ],
|
|
|
|
'info' : [ 'info.lua' ],
|
|
|
|
'morse' : [ 'morse.lua' ],
|
|
|
|
'dualpwm' : [ 'dualpwm.lua' ],
|
|
|
|
'adcscope' : [ 'adcscope.lua' ],
|
2009-03-21 19:59:49 +00:00
|
|
|
'adcpoll' : [ 'adcpoll.lua' ],
|
2009-02-21 23:02:39 +00:00
|
|
|
'life' : [ 'life.lua' ]
|
|
|
|
}
|
|
|
|
|
2009-01-08 15:20:05 +00:00
|
|
|
# List of board/romfs data combinations
|
|
|
|
file_list = { 'SAM7-EX256' : [ 'bisect', 'hangman' , 'led', 'piano', 'hello', 'info', 'morse' ],
|
2009-03-21 19:59:49 +00:00
|
|
|
'EK-LM3S8962' : [ 'bisect', 'hangman', 'lhttpd', 'pong', 'led', 'piano', 'pwmled', 'tvbgone', 'hello', 'info', 'morse', 'adcscope','adcpoll' ],
|
|
|
|
'EK-LM3S6965' : [ 'bisect', 'hangman', 'lhttpd', 'pong', 'led', 'piano', 'pwmled', 'tvbgone', 'hello', 'info', 'morse', 'adcscope','adcpoll' ],
|
2009-08-03 18:37:38 +00:00
|
|
|
'EK-LM3S9B92' : [ 'bisect', 'hangman', 'lhttpd', 'led', 'hello', 'info', 'adcscope','adcpoll' ],
|
2009-01-08 15:20:05 +00:00
|
|
|
'STR9-COMSTICK' : [ 'bisect', 'hangman', 'led', 'hello', 'info' ],
|
2009-03-23 21:07:49 +00:00
|
|
|
'PC' : [ 'bisect', 'hello', 'info', 'life', 'hangman' ],
|
Modified Robert's 'linux' platform:
- code cleanup
- the platform is now named 'sim'. You build it like this:
$ scons cpu=linux
The idea is to support more than one host OS by changing the "cpu" variable
above (for example cpu=osx, or cpu=win32). Also, a crude "host interface" was
defined in hostif.h. In theory, a host OS should only implement that interface
in order to run the eLua simulator. The implementation must reside in a file
called hostif_{os}.c (in this case hostif_linux.c). Too bad I don't have a MAC,
I would've loved to try this :)
REMEMBER: whem implementing a host interface, you CAN NOT rely on your regular
libc! You'll have to rewrite the syscalls (see host.c for an example on how to
do this in Linux).
- after you build it, don't start it directly, use the new "run_elua_sim.sh"
script to run it. It will set the terminal to raw mode, no echo, so it will
behave more like "traditional" eLua (even hangman.lua will run in this mode :) ).
Remember to run in on an ANSI capable terminal (although most of them support
ANSI emulation nowadays).
- you can exit from the simulator with "exit". You can't do this with CTRL+C if
you run it with "run_elua_sim.sh".
All in all, this looks pretty good and it's an excellent test platform. It will
do wonders when we integrate our own libc and we won't be able to figure out why
it doesn't work :)
2009-05-12 14:09:29 +00:00
|
|
|
'SIM' : [ 'bisect', 'hello', 'info', 'life', 'hangman' ],
|
2009-01-08 15:20:05 +00:00
|
|
|
'LPC-H2888' : [ 'bisect', 'hangman', 'led', 'hello', 'info' ],
|
2009-01-11 20:43:02 +00:00
|
|
|
'MOD711' : [ 'bisect', 'hangman', 'led', 'hello', 'info', 'dualpwm' ],
|
2009-01-08 15:20:05 +00:00
|
|
|
'STM3210E-EVAL' : [ 'bisect', 'hello', 'info' ],
|
2009-02-23 13:56:21 +00:00
|
|
|
'ATEVK1100' : [ 'bisect', 'hangman', 'led', 'hello', 'info' ],
|
2009-07-08 23:40:12 +00:00
|
|
|
'ET-STM32' : [ 'hello', 'hangman', 'info', 'bisect','adcscope','adcpoll', 'dualpwm', 'pwmled' ],
|
2009-02-23 15:28:56 +00:00
|
|
|
'EAGLE-100' : [ 'bisect', 'hangman', 'lhttpd', 'led', 'hello', 'info' ]
|
2009-01-08 15:20:05 +00:00
|
|
|
}
|
|
|
|
|
2008-09-01 13:21:06 +00:00
|
|
|
# Variants: board = <boardname>
|
|
|
|
# cpu = <cpuname>
|
|
|
|
# board = <boardname> cpu=<cpuname>
|
|
|
|
if boardname == '' and cputype == '':
|
|
|
|
print "Must specifiy board, cpu, or both"
|
|
|
|
sys.exit( -1 )
|
|
|
|
elif boardname != '' and cputype != '':
|
|
|
|
# board = <boardname> cpu=<cpuname>
|
|
|
|
# Check if the board, cpu pair is correct
|
|
|
|
if not board_list.has_key( boardname ):
|
|
|
|
print "Unknown board", boardname
|
|
|
|
sys.exit( -1 )
|
2008-12-13 23:31:40 +00:00
|
|
|
if not cputype in board_list[ boardname ]:
|
2008-09-01 13:21:06 +00:00
|
|
|
print "Invalid CPU %s for board %s" % ( cputype, boardname )
|
|
|
|
sys.exit( -1 )
|
|
|
|
elif boardname != '':
|
|
|
|
# board = <boardname>
|
|
|
|
# Find CPU
|
|
|
|
if not board_list.has_key( boardname ):
|
|
|
|
print "Unknown board", boardname
|
2008-12-13 23:31:40 +00:00
|
|
|
sys.exit( -1 )
|
2008-09-01 13:21:06 +00:00
|
|
|
cputype = board_list[ boardname ][ 0 ]
|
2008-12-13 23:31:40 +00:00
|
|
|
else:
|
2008-09-01 13:21:06 +00:00
|
|
|
# cpu = <cputype>
|
|
|
|
# Find board name
|
|
|
|
for b, v in board_list.items():
|
|
|
|
if cputype in v:
|
|
|
|
boardname = b
|
|
|
|
break
|
|
|
|
else:
|
|
|
|
print "CPU %s not found" % cputype
|
|
|
|
sys.exit( -1 )
|
|
|
|
|
2008-12-13 23:31:40 +00:00
|
|
|
# Look for the given CPU in the list of platforms
|
2009-02-23 13:56:21 +00:00
|
|
|
platform = None
|
|
|
|
for p, v in platform_list.items():
|
|
|
|
if cputype in v[ 'cpus' ]:
|
2008-08-02 17:52:11 +00:00
|
|
|
platform = p
|
|
|
|
break
|
|
|
|
else:
|
|
|
|
print "Unknown CPU %s" % cputype
|
|
|
|
print "List of accepted CPUs: "
|
2009-02-23 13:56:21 +00:00
|
|
|
for p, v in platform_list.items():
|
2008-12-13 23:31:40 +00:00
|
|
|
print " ", p, "-->",
|
2009-02-23 13:56:21 +00:00
|
|
|
for cpu in v[ 'cpus' ]:
|
2008-08-02 17:52:11 +00:00
|
|
|
print cpu,
|
|
|
|
print
|
2008-07-29 11:08:54 +00:00
|
|
|
sys.exit( -1 )
|
2008-08-16 22:27:02 +00:00
|
|
|
|
2009-02-23 13:56:21 +00:00
|
|
|
# Check the toolchain
|
|
|
|
if toolchain != '':
|
|
|
|
if not toolchain in platform_list[ platform ][ 'toolchains' ]:
|
|
|
|
print "Invalid toolchain '%s' for CPU '%s'" % ( toolchain, cputype )
|
|
|
|
sys.exit( -1 )
|
|
|
|
else:
|
|
|
|
toolchain = platform_list[ platform ][ 'toolchains' ][ 0 ]
|
|
|
|
toolset = toolchain_list[ toolchain ]
|
|
|
|
|
2008-08-16 22:27:02 +00:00
|
|
|
# CPU/allocator mapping (if allocator not specified)
|
|
|
|
if allocator == '':
|
2009-01-22 19:46:47 +00:00
|
|
|
if boardname == 'LPC-H2888' or boardname == 'ATEVK1100':
|
2008-08-16 22:27:02 +00:00
|
|
|
allocator = 'multiple'
|
|
|
|
else:
|
|
|
|
allocator = 'newlib'
|
2009-02-18 22:13:48 +00:00
|
|
|
elif allocator not in [ 'newlib', 'multiple', 'simple' ]:
|
2008-08-16 22:27:02 +00:00
|
|
|
print "Unknown allocator", allocator
|
2009-02-18 22:13:48 +00:00
|
|
|
print "Allocator can be either 'newlib', 'multiple' or 'simple'"
|
2008-08-16 22:27:02 +00:00
|
|
|
sys.exit( -1 )
|
|
|
|
|
2009-01-08 15:20:05 +00:00
|
|
|
|
2008-09-01 13:21:06 +00:00
|
|
|
# User report
|
|
|
|
if not GetOption( 'clean' ):
|
|
|
|
print
|
|
|
|
print "*********************************"
|
|
|
|
print "Compiling eLua ..."
|
|
|
|
print "CPU: ", cputype
|
|
|
|
print "Board: ", boardname
|
|
|
|
print "Platform: ", platform
|
|
|
|
print "Allocator: ", allocator
|
2009-02-23 13:56:21 +00:00
|
|
|
print "Target: ", target == 'lua' and 'fplua' or 'target'
|
|
|
|
print "Toolchain: ", toolchain
|
2008-09-01 13:21:06 +00:00
|
|
|
print "*********************************"
|
2008-12-13 23:31:40 +00:00
|
|
|
print
|
2008-09-01 13:21:06 +00:00
|
|
|
|
2008-08-27 20:05:09 +00:00
|
|
|
output = 'elua_' + target + '_' + cputype.lower()
|
2008-09-22 21:17:44 +00:00
|
|
|
cdefs = '-DELUA_CPU=%s -DELUA_BOARD=%s -DELUA_PLATFORM=%s -D__BUFSIZ__=128' % ( cputype, boardname, platform.upper() )
|
2008-08-16 22:27:02 +00:00
|
|
|
if allocator == 'multiple':
|
|
|
|
cdefs = cdefs + " -DUSE_MULTIPLE_ALLOCATOR"
|
2009-02-18 22:13:48 +00:00
|
|
|
elif allocator == 'simple':
|
|
|
|
cdefs = cdefs + " -DUSE_SIMPLE_ALLOCATOR"
|
2008-08-02 17:52:11 +00:00
|
|
|
|
Modified Robert's 'linux' platform:
- code cleanup
- the platform is now named 'sim'. You build it like this:
$ scons cpu=linux
The idea is to support more than one host OS by changing the "cpu" variable
above (for example cpu=osx, or cpu=win32). Also, a crude "host interface" was
defined in hostif.h. In theory, a host OS should only implement that interface
in order to run the eLua simulator. The implementation must reside in a file
called hostif_{os}.c (in this case hostif_linux.c). Too bad I don't have a MAC,
I would've loved to try this :)
REMEMBER: whem implementing a host interface, you CAN NOT rely on your regular
libc! You'll have to rewrite the syscalls (see host.c for an example on how to
do this in Linux).
- after you build it, don't start it directly, use the new "run_elua_sim.sh"
script to run it. It will set the terminal to raw mode, no echo, so it will
behave more like "traditional" eLua (even hangman.lua will run in this mode :) ).
Remember to run in on an ANSI capable terminal (although most of them support
ANSI emulation nowadays).
- you can exit from the simulator with "exit". You can't do this with CTRL+C if
you run it with "run_elua_sim.sh".
All in all, this looks pretty good and it's an excellent test platform. It will
do wonders when we integrate our own libc and we won't be able to figure out why
it doesn't work :)
2009-05-12 14:09:29 +00:00
|
|
|
# Special macro definitions for the SYM target
|
|
|
|
if platform == 'sim':
|
|
|
|
cdefs = cdefs + " -DELUA_SIMULATOR -DELUA_SIM_%s" % cputype
|
|
|
|
|
2008-07-29 11:08:54 +00:00
|
|
|
# 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
|
2009-01-11 20:43:02 +00:00
|
|
|
ldblib.c liolib.c lmathlib.c loslib.c ltablib.c lstrlib.c loadlib.c linit.c lua.c lrotable.c"""
|
2008-09-10 17:57:24 +00:00
|
|
|
if target == 'lualong' or target == 'lua':
|
2008-09-10 18:01:26 +00:00
|
|
|
lua_full_files = " " + " ".join( [ "src/lua/%s" % name for name in lua_files.split() ] )
|
2009-03-21 19:59:49 +00:00
|
|
|
local_include = ['inc', 'inc/newlib', 'src/lua']
|
2008-09-10 17:57:24 +00:00
|
|
|
if target == 'lualong':
|
|
|
|
cdefs = cdefs + ' -DLUA_NUMBER_INTEGRAL'
|
2008-07-29 11:08:54 +00:00
|
|
|
else:
|
|
|
|
print "Invalid target", target
|
|
|
|
sys.exit( 1 )
|
2009-03-21 19:59:49 +00:00
|
|
|
|
|
|
|
local_include += ['src/modules', 'src/platform/%s' % platform]
|
2009-01-11 20:43:02 +00:00
|
|
|
cdefs = cdefs + " -DLUA_OPTIMIZE_MEMORY=%d" % ( optram != 0 and 2 or 0 )
|
2008-07-29 11:08:54 +00:00
|
|
|
|
|
|
|
# Additional libraries
|
|
|
|
local_libs = ''
|
2008-12-13 23:31:40 +00:00
|
|
|
|
2008-07-29 11:08:54 +00:00
|
|
|
# Application files
|
2009-06-22 23:49:21 +00:00
|
|
|
app_files = " src/main.c src/romfs.c src/xmodem.c src/shell.c src/term.c src/common.c src/buf.c src/elua_adc.c src/dlmalloc.c src/salloc.c src/luarpc_elua_uart.c "
|
2008-12-13 23:31:40 +00:00
|
|
|
|
|
|
|
# Newlib related files
|
2008-09-18 20:22:15 +00:00
|
|
|
newlib_files = " src/newlib/devman.c src/newlib/stubs.c src/newlib/genstd.c src/newlib/stdtcp.c"
|
2008-07-29 11:08:54 +00:00
|
|
|
|
2008-09-15 21:54:14 +00:00
|
|
|
# UIP files
|
2008-09-23 19:41:20 +00:00
|
|
|
uip_files = "uip_arp.c uip.c uiplib.c dhcpc.c psock.c resolv.c"
|
2008-09-15 21:54:14 +00:00
|
|
|
uip_files = " src/elua_uip.c " + " ".join( [ "src/uip/%s" % name for name in uip_files.split() ] )
|
2009-03-21 19:59:49 +00:00
|
|
|
local_include += ['src/uip']
|
2008-09-15 21:54:14 +00:00
|
|
|
|
2008-07-29 11:08:54 +00:00
|
|
|
# Lua module files
|
2009-06-26 23:38:02 +00:00
|
|
|
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"
|
2008-09-22 21:17:44 +00:00
|
|
|
module_files = " " + " ".join( [ "src/modules/%s" % name for name in module_names.split() ] )
|
2008-12-13 23:31:40 +00:00
|
|
|
|
2008-07-29 11:08:54 +00:00
|
|
|
# Optimizer flags (speed or size)
|
|
|
|
#opt = "-O3"
|
|
|
|
opt = "-Os -fomit-frame-pointer"
|
|
|
|
|
|
|
|
# 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
|
2008-09-18 20:22:15 +00:00
|
|
|
source_files = app_files + specific_files + newlib_files + uip_files + lua_full_files + module_files
|
2008-12-13 23:31:40 +00:00
|
|
|
|
2008-07-29 11:08:54 +00:00
|
|
|
# Make filesystem first
|
|
|
|
if not GetOption( 'clean' ):
|
|
|
|
print "Building filesystem..."
|
2009-01-08 15:20:05 +00:00
|
|
|
flist = []
|
|
|
|
for sample in file_list[ boardname ]:
|
|
|
|
flist = flist + romfs[ sample ]
|
2008-07-29 11:08:54 +00:00
|
|
|
import mkfs
|
2009-01-08 15:20:05 +00:00
|
|
|
mkfs.mkfs( "romfs", "romfiles", flist )
|
2008-09-10 18:41:31 +00:00
|
|
|
print
|
2008-09-01 13:32:05 +00:00
|
|
|
os.system( "mv -f romfiles.h inc/" )
|
2008-07-29 11:08:54 +00:00
|
|
|
os.system( "rm -f src/fs.o" )
|
2008-12-13 23:31:40 +00:00
|
|
|
|
2008-07-29 11:08:54 +00:00
|
|
|
# Env for building the program
|
2008-12-13 23:31:40 +00:00
|
|
|
comp = Environment( CCCOM = tools[ platform ][ 'cccom' ],
|
2008-07-29 11:08:54 +00:00
|
|
|
ASCOM = tools[ platform ][ 'ascom' ],
|
|
|
|
LINKCOM = tools[ platform ][ 'linkcom' ],
|
2008-12-13 23:31:40 +00:00
|
|
|
OBJSUFFIX = ".o",
|
2008-07-29 11:08:54 +00:00
|
|
|
PROGSUFFIX = ".elf",
|
2009-03-21 19:59:49 +00:00
|
|
|
CPPPATH = local_include,
|
2008-07-29 11:08:54 +00:00
|
|
|
ENV = os.environ )
|
2008-09-22 21:17:44 +00:00
|
|
|
# comp.TargetSignatures( 'content' )
|
|
|
|
# comp.SourceSignatures( 'MD5' )
|
2009-03-31 11:19:50 +00:00
|
|
|
comp[ 'INCPREFIX' ] = "-I"
|
2009-03-21 19:59:49 +00:00
|
|
|
Default( comp.Program( target = output, source = Split( source_files ) ) )
|
2008-09-22 21:17:44 +00:00
|
|
|
Decider( 'MD5' )
|
2008-07-29 11:08:54 +00:00
|
|
|
|
|
|
|
# Programming target
|
|
|
|
prog = Environment( BUILDERS = { 'program' : Builder( action = Action ( tools[ platform ][ 'progfunc' ] ) ) }, ENV = os.environ )
|
|
|
|
prog.program( "prog", output + ".elf" )
|