1
0
mirror of https://github.com/elua/elua.git synced 2025-01-08 20:56:17 +08:00

94 Commits

Author SHA1 Message Date
James Snyder
2c175a72cb ADC updates & EABI Compiler Support for LM3S
ADC:
- getsamples split into getsamples and getsample.  getsamples always returns a
  table of results.  getsample returns single values (if available).

EABI compiler support:
- added a parameter to SConstruct called cprefix, which allows one to define a
  prefix other than the arm-elf used by some platforms.  Currently the only
  platform that does anything with this parameter is LM3S, conf.py scripts can
  be updated to handle the default toolchain prefix, and accommodate alternate
  ones if needed.
- Added sections to lm3s.ld (originally committed by Jesus Alvarez) to handle
  linking properly for arm-eabi targets.
2009-02-20 21:41:30 +00:00
Bogdan Marinescu
59c35cc20d Added a very simple allocator to eLua. It's probably the most basic version of a chained blocks allocator. It's slow and it won't handle fragmentation nearly as well as dlmalloc(), but it's much smaller and it doesn't need the extra book-keeping space needed by dlmalloc (about 1KB for each memory space).
Recommended only for systems with very low memory (Flash/RAM), and prefferably systems running only precompiled Lua (if you need to compile the code, you might get into stack overflows, and this allocator is much more sensitive to this kind of stuff than dlmalloc()). In fact, this allocator seems to suggest that one should set the stack to at least 4k for the Lua parser to run properly even on small programs. I won't do this just yet, rather I'll keep on trying to move the Lua parser data structures from stack to heap. For now we're OK with the current configuration.
The allocator can handle multiple memory spaces.
Enable with "allocator=simple" on the scons command line.

...oh yes, also added a newline to the end of elua_adc.c :) (to avoid some annoying warnings)
2009-02-18 22:13:48 +00:00
James Snyder
fbe307e12a Fairly large number of changes in here to make adc work with lua's provided
buf.c.

The smoothing buffer is still kept separate from the main buffering system,
but as samples come in via interrupt, they are placed into a "standard" elua
buf.  The size of this buf is configured according to whether one is grabbing
a bunch of samples rapidly (burst), or singly in order to accommodate the
expected number of incoming samples.  If smoothing is enabled, incoming
samples are claimed until the smoothing buffer is full, and then remaining
samples are left in the main buffer until they are collected.  This means that
whether one is collecting single samples or samples at burst rate, and
smoothing is enabled, the filter will only be providing samples that have
enough history.

Added a function to manually flush both smoothing and main buffers.
This would be useful if you know your state has changed and you only want
fresh samples that are going to be collected after a flush.

Also, a lot of functionality moved into elua_adc.c and common.c
(boundaries for what belongs where, might be evaluated), reducing the number
of platform.c specific functions dramatically.

Basic functionality seems to be working, but some more testing should be done.

Also, given that there's now a dynamic buffer behind everything, a shift in
the way sampling is handled could be done:
sample and burst functions could be made to be non-blocking, and to never
return anything except for errors.
a separate getsamples function could be used for removing samples collected by
either function from the buffer.
Suggestions are welcome as it would be nice to keep usage paradigms stable
after the 0.6 release.
2009-02-16 00:53:00 +00:00
Dado Sutter
989e87d2e6 Restoring a wrongly commited file (sorry guys) 2009-02-12 03:56:20 +00:00
Dado Sutter
a592452dba New site sections added
Minor corrections
Site content will begin to migrate soon now
Ongoing work
2009-02-12 03:52:46 +00:00
Bogdan Marinescu
afa96dcc25 I was bored during a long training, so I added partial ANSI term support to i386. Now you can life.lua on it :) 2009-01-28 17:53:33 +00:00
Bogdan Marinescu
0d9fcf9909 - lua parsing: lparser.c was modified to allocate some of its structures to
the heap instead of the stack. Also, the stack size was bumped to at least
  2048 bytes on all backends. Hopefully this will take care of most issues
  related to stack overflows.

- new buffering system available. Originally I planned to make it fully
  generic, but I came to the conclusions that this would take too much
  development work and system resources (RAM/Flash) if done properly, so
  currently it's only used on UART RX (although it could be easily extended
  for other peripherals). For an example of use check the AT91SAM7X and
  AVR32 backend (platform_init and associated interrupt handlers and also
  platform_conf.h).

- new XMODEM implementation. Better, cleaner, bug fixed, and BSD instead of
  GPL.

- AVR32 can use the huge (32MBytes) SDRAM on the board as system memory now.

- fixed an error in elua_sbrk/_sbrk_r (and revised the compilation options
  for dlmalloc).

- added the CPU module and interrupt support on the STR9 platform.

- uart module changes: 'sendstr' is out, but the regular 'send' will send
  strings instead of simple chars (which makes sense since Lua doesn't have
  a "char" type). Also, the 'timer_id' and 'timout' parameters of the 'recv'
  function are now optional.
2009-01-22 19:46:47 +00:00
James Snyder
cd2e9e1cf0 Initial ADC implementation. 2009-01-21 23:40:34 +00:00
Bogdan Marinescu
f729155fce - Lua Tiny RAM (LTR) patch is now integrated in eLua and is enabled by default
- all eLua modules updated to work with LTR
- "cpu" module added to avr32, at91sam7x, str7
- "disp" module no longer generic (now stays in src/modules/lm3s). For this reason, the "disp" platform interface was also removed.
- the "modcommon" mechanism in STM32 (ROM loader) was depreciated in favour of the Lua Tiny RAM patch (and the "stm3210lcd" module from the STM32 backend now uses LTR).
- small bugfixes
2009-01-11 20:43:02 +00:00
Bogdan Marinescu
fca447cb12 New feature: per-board file system specifications (which means that not all the files from romfs/ will end up in your binary, you now need to specify
in SConstruct what files (or rather samples) you need to be included in the
ROM file system for each board).
2009-01-08 15:20:05 +00:00
Bogdan Marinescu
58da9ac870 - factored out common code from all backends in src/common.c
- added virtual timers (on LM3S, AVR32 and AT91SAM7 for now)
- added interrupt handling code for AT91SAM7 and AVR32
- fixed two serious bugs that prevented the eLua image to run on both STR9 and LPC2888 (linker command file issues)
- fixed line endings (DOS->UNIX) in the STM32 library files
- fixed preprocessor errors (hopefully all of them) like #if ELUA_CPU == LM3S8962
- other minor or less than minor fixes :)
2009-01-07 20:17:18 +00:00
Bogdan Marinescu
edac46fcd6 preliminary AVR32 port 2008-12-13 23:31:40 +00:00
Dado Sutter
9083b3171c - Added support for RIT128x96x4 OLED Display on LM3S8962 platform, on module "disp"
- ls shell command enhanced with column aligned file sizes and total size report
- New section on CHANGELOG for ongoing dev changes, to ease up next release
- pong.lua added to examples in romfs
- minor URL and e-mail updates, to reflect the new eluaproject.net domain
2008-11-30 22:30:06 +00:00
Mike Panetta
fd7cbd0109 * Finished stm3210lcd module.
* Added systick functions (for stm3210lcd module)
 * Created modcommon.{c,h} which contain module helper functions and module loader
 * Created lstm32_mod.c which demonstrates module helper functions and module loader (in addition to lua_lcd.c)
 * Added a .lua_init section to the stm32.ld linker script to facilitate platform module loading (see modcommon and lstm32_mod)
 * Updated conf.py auxmods.h and SConstruct to build the new files.
 * Modified linit.c to add support for require and package back in so that require 'stm3210lcd' would work.
2008-11-12 04:53:10 +00:00
Mike Panetta
599651e5cf Checking in changes for new STM32 platform. Added the stm32 platform and the STM3210E-EVAL board. 2008-11-08 07:14:51 +00:00
Bogdan Marinescu
539fb1764d added preliminary support for STR711FR2 (STR71x CPUs from ST) 2008-10-02 21:21:39 +00:00
Bogdan Marinescu
d2c5756200 - added the "CPU" module. its role: access data directly (read/write) for 32/16/8 bits variables, and also provide access to CPU constants (should be defined in platform_cpu.h, see lm3s code)
- the "clock" method is now part of the CPU module, thus is out of the platform data module. pd becomes a fully platform independent module.
2008-09-26 20:41:11 +00:00
Bogdan Marinescu
a10ac9c656 removed uip-split.c from the build, since it's not used anymore. And yey, we're at SVN revision 100 :) 2008-09-23 19:41:20 +00:00
Bogdan Marinescu
05ddf01cf3 - fixed a serious bug in the implementation of the eLua UIP support code. Now one can have multiple TCP/IP connection _without_ mixing the data buffers between them :)
- added the resolver application (src/uip/resolv.*) to eLua (configurable by BUILD_DNS in build.h) to allow DNS lookups
- more functions in the "net" module, more tests, it seems to work fine now in both "server mode" and "client mode"
- console over TCP works once again, or should I say "now works". It turns out that it never worked with the code in SVN, because I committed a wrong file a while ago.
2008-09-23 19:39:14 +00:00
Bogdan Marinescu
c1c5e58904 added the 'net' module for eLua, ONLY VERY BRIEFLY TESTED. Finally, we have TCP/IP from eLua 2008-09-22 21:17:44 +00:00
Bogdan Marinescu
c28cbf108c added support for dynamic IP configuration (DHCP), enabled by default (so far) on LM3S 2008-09-20 15:14:05 +00:00
Bogdan Marinescu
4793225724 eLua now works over TCP/IP instead of serial connection. This is basically printf/scanf over TCP/IP instead of UART, so it should look&feel just like "regular" Lua, except that you don't have
ANSI terminal support (yet) and "recv" doesn't work anymore because XMODEM doesn't work over TCP/IP. Only for LM3S8962/LM3S6965 for now, but it should straightforward (not easy though)
to port it to other platforms. Only static IP for now. More TCP/IP functions need to be implemented (and an eLua module must be written to access them). To enable console over TCP:

- enable "BUILD_CON_TCP" in build.h, also disable "BUILD_XMODEM" and "BUILD_TERM" in build.h (you'll get an error if you don't)
- disable "BUILD_CON_GENERIC" in build.h (you'll get an error if you don't)
- edit your network settings in build.h
- build the image&burn it
- telnet to the address configured in build.h. Be sure to use a decent telnet client, like the one in Linux or putty. Don't try with telnet from Windows, as it surely won't work. Also, it might
  not work with the telnet client from Tera Term Pro (didn't test this).
- type 'exit' from shell to terminate the connection.

Also, note that from this point on you'll need a newer version of binutils to compile for Cortex. I'm using binutils-2.19.50.tar.bz2 (from the snapshots page). 2.18 might work too, but I didn't
test it.
2008-09-18 20:22:15 +00:00
Bogdan Marinescu
e80bed4b04 _PRELIMINARY_ TCP/IP support, for now only on Cortex, only with uIP, only ping (ICMP) handling, no actual TCP/IP data transfer. 2008-09-15 21:54:14 +00:00
Bogdan Marinescu
747da02673 - made the math lib configurable with the "platform libs" mechanism. This way one can have a floating point Lua (thus being able to use fundamental floating point operations), but without the
mathlib (sin, cos, tan and all the other functions from there).
- corrected "pwmled.lua" (removed a debug print)
- bumped version number to minor versn 0.4.1
2008-09-10 18:41:31 +00:00
Bogdan Marinescu
a775de5032 updated the build script to work with the new directory structure 2008-09-10 18:01:26 +00:00
Bogdan Marinescu
c66273ca92 updated to Lua 5.1.4 2008-09-10 17:57:24 +00:00
Bogdan Marinescu
fc70505266 renamed files to romfs, now it's much less confusing hopefully 2008-09-01 13:32:05 +00:00
Bogdan Marinescu
0c6731db5b modified the build system. Also removed the 'mem' command from the shell, as it was very confusing 2008-09-01 13:21:06 +00:00
Bogdan Marinescu
b5f59efa8e - added "board" as a compile time parameter, it will specify a name for the board on which eLua works. This helps if the same CPU is used on more than one board with different
I/O setup. 
- the pd() module has a new method (board) and gets it CPU, platform and board name directly from the build system (command line macros). It's much easier to work like this.
- the samples (examples/) were updated to check pd.board() rather than pd.platform()/pd.cpu(), which is a much more logical way to do things, since it ties the sample to a 
  specific I/O configuration, not with a CPU.
- updated PWM code for AT91SAM7X, now the "piano" example works for both LM3Sxxxx and AT91SAM7X256.
- added 3 new methods to the PIO module: pullup(), pulldown(), ad nopullup(), their meaning is obvious.
2008-08-27 20:05:09 +00:00
Bogdan Marinescu
b6e7ade77c - malloc.c/.h are now dlmalloc.c/.h
- new shell command: mem
- new module: bit (for bit operations)
- removed UARTx, TMRx, SPIx, PWMx constants from the respectives modules, as they only waste memory space. But now the same
  modules will return an error (via luaL_error) if an invalid resource ID is used. Note that this does not apply to PIO, since
  PIO uses special encodings for ports/pins.
- new methods in pio: port and pin to return the port/pin encoded in a pio value.
2008-08-27 13:39:10 +00:00
Bogdan Marinescu
3379b15660 added LHF's lpack module 2008-08-18 17:43:26 +00:00
Bogdan Marinescu
3ce5487a73 added the PWM module, so far supported only on LM3S 2008-08-18 16:29:09 +00:00
Bogdan Marinescu
7f7315adfd Finally added support for multiple memory spaces (preliminary). It works on my
LPC2888 board. The allocator used is dlmalloc, just as in Newlib, but it's a 
newer version than can handle non-contiguous memory spaces (2.8.3, as opposed
to 2.6.4 in Newlib 1.16.0, I really have no idea why they're using such an
ancient version of dlmalloc). To use it add "allocator=multiple" to your scons
command line (default for LPC2888).
2008-08-16 22:27:02 +00:00
Bogdan Marinescu
660418c23d Tried two different TLSF implementations, none of them works properly. Will try to
use a different dlmalloc version for multiple memory spaces. In any case, TLSF is
OUT.
2008-08-16 15:50:16 +00:00
Bogdan Marinescu
75311aec51 TLSF allocator from rtportal, not working properly 2008-08-14 07:38:30 +00:00
Bogdan Marinescu
09ac410a02 Added support for multiple RAM spaces using the TLSF allocator.
This takes care of my LPC2888 board (any many other board out there)
that have RAM both on the CPU itself and on a separate chip.
To use it add "allocator=tlsf" to your scons build command.
Even though the code for all the platform was modified, the new code
should not modify the "old" allocator behaviour.
Also added a new "mem" command to the shell, it gives information about
the current RAM state (total, used, free).
NOT YET TESTED !!! So use with care.
2008-08-13 13:42:57 +00:00
Bogdan Marinescu
5efc3cb2ac Adding the new LPC2888 platform 2008-08-11 13:34:59 +00:00
Frédéric Thomas
05122bca58 Add support for lm3s6965. 2008-08-06 08:57:26 +00:00
Bogdan Marinescu
a3b3d3f7dc added term module to Lua, various fixes 2008-08-05 19:58:19 +00:00
Bogdan Marinescu
4e6be0bc64 added prelimiary support for terminal functions 2008-08-04 13:45:38 +00:00
Bogdan Marinescu
095b4d42ae added conditional compilation for different components 2008-08-04 12:04:36 +00:00
Bogdan Marinescu
b0d76b66c9 changed build system 2008-08-02 17:52:11 +00:00
Frédéric Thomas
90d2c37184 Our LM3S8962 support works for most LM3S chips. Replace specific
platform with generic LM3S support.
2008-08-02 15:08:34 +00:00
Bogdan Marinescu
3eb530b4eb initial import 2008-07-29 11:08:54 +00:00