mirror of
https://github.com/elua/elua.git
synced 2025-01-25 01:02:54 +08:00
89 lines
4.5 KiB
Plaintext
89 lines
4.5 KiB
Plaintext
(NOTE: view this file with a monospaced font)
|
|
|
|
Prerequisites
|
|
================================================================================
|
|
|
|
Before you start, you might want to check if the list of platform modules and
|
|
eLua components are set according to your needs. See docs/platform_modules.txt
|
|
and docs/elua_components.txt for details. By default, all the relevant
|
|
modules and components for a given target are included in the build.
|
|
|
|
Building eLua
|
|
================================================================================
|
|
|
|
To build eLua you'll need:
|
|
|
|
- a GCC/Newlib toolchain for your target (see http://elua.berlios.de for
|
|
instructions on how to build your own toolchain). 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.
|
|
- Linux. Compiling under windows should be possible, however this isn't tested.
|
|
I'm using Ubuntu, so I'm also using "apt-get". If you're using a distro with a
|
|
different package manager you'll need to translate the "apt-get" calls to your
|
|
specific distribution.
|
|
- python. It should be already installed; if it's not:
|
|
|
|
$ sudo apt-get install python
|
|
|
|
- scons. eLua uses scons instead of make and makefiles, because I find scons
|
|
much more "natural" and easier to use than make. To install it:
|
|
|
|
$ sudo apt-get install scons
|
|
|
|
- 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":
|
|
|
|
$ sudo apt-get install nasm
|
|
|
|
For each platform, eLua assumes a certain name for the compiler/linker/assembler
|
|
executable files, as shown below.
|
|
|
|
================================================================================
|
|
| Tool | Compiler | Linker | Assembler |
|
|
|------------|---------------------|----------------------|--------------------|
|
|
| Platform | | | |
|
|
|============|=====================|======================|====================|
|
|
| ARM (all) | arm-elf-gcc | arm-elf-gcc | arm-elf-gcc |
|
|
|============|=====================|======================|====================|
|
|
| i386 | i686-elf-gcc | i686-elf-gcc | nasm |
|
|
|============|=====================|======================|====================|
|
|
| Cortex-M3 | arm-elf-gcc | arm-elf-gcc | arm-elf-gcc |
|
|
|============|=====================|======================|====================|
|
|
| STR9 | arm-elf-gcc | arm-elf-gcc | arm-elf-gcc |
|
|
================================================================================
|
|
|
|
If your toolchain uses different names, you have to modify the "conf.py" file
|
|
from src/platform/[your platform].
|
|
|
|
To build, go to the directory where you unpacked your eLua distribution and
|
|
invoke scons:
|
|
|
|
$ scons [target=lua | lualong]
|
|
[cpu=at91sam7x256 | at91sam7x512 | i386 | str912fw44 | lm3s8962 | lm3s6965]
|
|
[cpumode=arm | thumb]
|
|
[prog]
|
|
|
|
- target=lua | lualong: specify if you want to build full Lua (with floating
|
|
point support) or integer only Lua (lualong). The default is "lua".
|
|
- cpu=at91sam7x256 | at91sam7x512 | i386 | str912fw44 | lm3s8962 | lm3s6965:
|
|
specify what CPU to build for. The default is AT91SAM7X256.
|
|
- cpumode=arm | thumb: for ARM target (not Cortex) this specifies the
|
|
compilation mode. Its default value is 'thumb' for AT91SAM7X targets and
|
|
'arm' for STR9 targets.
|
|
- prog: by default, the above 'scons' command will build only the 'elf' 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_[target]_[cpu].elf (and also another
|
|
file with the same name but ending in .bin if "prog" was specified for platforms
|
|
that need .bin 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. "scons -c" is also recommended
|
|
after you change the list of modules/components to build for your target (see
|
|
section "prerequisites" of this document), as scons seems to "overlook" the
|
|
changes to these files on some occasions.
|