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

77 Commits

Author SHA1 Message Date
Dado Sutter
a38076bb91 - Added copyright years to shell welcome message
- Project's reference changed to www.eluaproject.org on the same msg
2010-02-23 17:18:06 +00:00
Dado Sutter
15daebf98e - Added a Lua-like first-prompt welcome message to the eLua shell
- Main menu refactored to reduce info levels. Old "tutorials" are now part
of the "More Information" (which already contained tutorials) on eLua
Internals
- Shell help command adapted to rw filesystems addition (ls lists all files
of all filesystems)
- Minor order and name changes on main menu sub-items
- Minor refinements in some doc pages
2010-02-22 20:18:21 +00:00
Bogdan Marinescu
e7702bb0e2 Manual merge of remotefs/ into trunk. Tested with the simulator and (partially) on a ET-STM32 board. Other changes:
- FAT changed to support the new opendir/readdir/closedir mechanism, and to use lseek directly instead of ioctl (also fixed a bug in FAT's lseek that always returned 0 instead of file position).
- ET-STM32 console moved to UART2@19200bps (to allow RFS to run on UART0). If UART0 is needee for console, remember to disable RFS.
- freed 700+ bytes of RAM by changing the devman implementation to keep pointers instead of actual DM_DEVICE structures
- other minor code changes and fixes
2010-02-01 18:47:41 +00:00
James Snyder
0bb6552c73 Additional missing header. 2010-01-27 00:58:08 +00:00
James Snyder
47f9d97079 Missing platform_conf.h. 2010-01-27 00:56:17 +00:00
James Snyder
125af9f8b8 Desktop Builds Get platform_conf.h
luarpc & cross compiler builds now have a platform_conf.h which should help in
keeping ifdefs down in common source files.
2010-01-26 00:23:57 +00:00
James Snyder
8b58611c6b Merge branch 'post07' 2010-01-25 23:44:40 +00:00
James Snyder
51221f8b4c Merge 0.7 changes to trunk. 2010-01-25 23:43:05 +00:00
Bogdan Marinescu
42ec61613b pio.port.setval bugfix (thanks, Teo! :)) 2009-12-16 19:43:34 +00:00
James Snyder
c85e3a1d2d Starting Cleanup of LuaRPC for 0.7 release.
- added some more documentation (not yet done)
- alternate uarts can be selected (boot mode defaults to console uarts)
- renamed "remote" references to "rpc" (may as well keep the original name)
- switch default error handler to luaL_error (presumably wasn't available for
  old 4.x LuaRPC)
- tweaks to exception handling to make things more consistent (hopefully)
2009-12-04 01:46:47 +00:00
James Snyder
d04fb2b2bb Add initial refman entry for can module. 2009-11-14 22:56:23 +00:00
James Snyder
bd1465ca50 Merge 0.6 branch to trunk.
Conflicts:
	SConstruct
	doc/en/arch_platform.html
	doc/en/comunity.html
	doc/en/overview.html
	doc/en/refman.html
	doc/en/refman_gen.html
	doc/en/status.html
	doc/en/tut_bootstick.html
	doc/images/lng_pt.png
	doc/images/minusnode.png
	doc/images/next.png
	doc/images/node.png
	doc/images/nodelast.png
	doc/images/plusnode.png
	doc/images/plusnodelast.png
	doc/images/previous.png
	doc/images/showall.png
	doc/images/sync.png
	doc/images/vertline.png
	doc/pt/arch.html
	doc/pt/arch_coding.html
	doc/pt/arch_con_term.html
	doc/pt/arch_newport.html
	doc/pt/arch_overview.html
	doc/pt/arch_platform.html
	doc/pt/arch_tcpip.html
	doc/pt/building.html
	doc/pt/comunity.html
	doc/pt/dl_binaries.html
	doc/pt/dl_old.html
	doc/pt/dl_sources.html
	doc/pt/downloads.html
	doc/pt/examples.html
	doc/pt/faq.html
	doc/pt/installing_i386.html
	doc/pt/installing_lm3s.html
	doc/pt/news.html
	doc/pt/overview.html
	doc/pt/refman_dep.html
	doc/pt/refman_gen.html
	doc/pt/status.html
	doc/pt/tc_386.html
	doc/pt/toolchains.html
	doc/pt/tut_openocd.html
	doc/pt/using.html
	romfs/LM3S.lua
	romfs/led.lua
	romfs/morse.lua
	romfs/pong.lua
	src/lua/linit.c
	src/modules/auxmods.h
	src/platform/lm3s/platform.c
	src/platform/lm3s/platform_conf.h
	src/platform/sim/platform_conf.h
2009-10-13 02:14:27 +00:00
James Snyder
b1c0df120a Style adjustments, switch some types to be more explicit, common error string
stored once.
2009-09-15 17:44:48 +00:00
James Snyder
9b3db70e72 Fixes:
- anonymous unions aren't part of C99, luaR_key's uinion of key ids is now in
  a union called id
- silence some other compiler complaints
2009-09-06 23:41:31 +00:00
James Snyder
3248f45307 Some cleanup of unused/unnecessary code thanks to Clang/LLVM's static analyzer. 2009-09-06 23:41:21 +00:00
James Snyder
9b2eac34aa Shorten some error messages, slightly tighter memory usage. 2009-08-27 01:13:37 +00:00
James Snyder
907de5b818 Working CAN support for STM32. 2009-06-26 23:38:02 +00:00
James Snyder
8939b99545 Commit of initial working RPC.
- disabled by default (enable on a target-by-target basis) so it shouldn't
  cause much breakage for non-rpc users
- some modifications to the binary chunk reader which should allow reading of
  chunks encoded on various platforms (with certain limitations like lualong
can't read float lua bytecode, one must generate lualong bytecode from a float
lua)
- other misc changes.
2009-06-22 23:49:21 +00:00
James Snyder
bd2e819368 ADC Updated
- adc_wait_samples now returns the actual number of samples available at the
  time it returns.  this simplifies a pattern where one would wait on samples
  if blocking and then subsequently check the number of available samples.
- adc.insertsamples(id, table, idx, count) function now available to take
  samples and insert them into a table.  this is slightly slower than
  assignment for single values in a table, but can avoid having to use
  getsamples (returning new tables) for certain situations
  idx: starting index in table where values will be inserted
  count: number of samples to get from channel id
2009-04-22 15:36:50 +00:00
James Snyder
709399a324 System buffer-free version of ADC should now work. Doing so, saves about 1kb
of flash space.

NOTE: getsamples function is disabled since this is dependant on having a
buffer to get more than one sample.

Side note: single sampling without the buffer is faster by about 5-10
us/channel.  It should be possible to sidestep the buffer in certain
situations for buffer enabled mode and get a similar benefit at the cost of
some additional complexity.
2009-03-25 22:56:39 +00:00
Bogdan Marinescu
9c15d2e4fc - XMODEM and term code moved from main.c to common.c
- added full term support to the i386 platform (I was bored with all the docs ... :) )
- documentation updated
2009-03-23 21:07:49 +00:00
James Snyder
94438ff64b ADC for STM32 + Misc Fixes & Build Adjustments
- ADC adjusted to work with sequenced acquisition setups.  It should now
  accomodate both sequenced and non-sequenced approaches on the backend.
  A few more adjustments should be made to handle multiple sequencers
  but right now neither LM3S or STM32 platforms use more than one sequencer.

- Added adcpoll.lua to demonstrate a simple approach for using clocked
  acquisition and displaying results as they become available.

- ADC now works for STM32 (all 16 channels!). This should receive more
  extensive testing, but everything should be working at this stage.

- the build system now pays attention to changes in header files meaning that
  if any headers change or if the romfs changes (since it is generated as a
  header) these changes will get recompiled without having to do a clean.
2009-03-21 19:59:49 +00:00
Bogdan Marinescu
00ee06e90f generic stdio fix: now you should be able to use your terminal emulator with any kind of line endings on send (previously it only accepted CR+LF line endings) 2009-03-10 20:39:51 +00:00
James Snyder
1f2ffb2bfd Minor rearrangements for ADC.
Removed flush function.  Setting smoothing will now flush the buffers.
2009-03-06 20:38:26 +00:00
James Snyder
b4290c4aa4 Added timer compatibility check.
Smoothing resize checks that no operations are pending.
2009-03-05 07:06:59 +00:00
James Snyder
f1feb1e113 Name change, makes more sense as prepchannel rather than primechannel. 2009-03-05 07:06:16 +00:00
James Snyder
3fc868b534 ADC Changes
- removed getsmoothing, setfreerunning, samplesready
- isdone has returned so that one can check if the reason why the buffer is
  dry is because no more samples are being collected
- smoothing should support fairly large lengths now (as long as you have the
  memory)
- added support to adc.sample to take a table as the first argument so that a
  set of channels can be started at closer to the same time.
    example:
    adcchannels = {0,1,2,3}
    adc.sample(adcchannels,8)

    this should collect samples on all 4 channels starting nearly at the same
    time.

- more comments added to elua_adc.c to describe behavior.

Misc
- remove rndpow2, not being used
2009-03-03 01:23:45 +00:00
Bogdan Marinescu
d0657f08ff More work on the docs:
- "building" page completely rewritten
- a new page about the toolchains used in eLua
- a graphical representation of the system architecture (doc/wb_img/elua_arch.png) that will be used in a soon to come page about the eLua architecture

Also:

- validate.h updated with some new tests (still needs more work)
- "arm-gcc-eabi" toolchain name changed to "codesourcery", since this is obviously way more intuitive :)
2009-02-24 22:09:22 +00:00
James Snyder
554dd7126b ADC can now run in freerunning mode (keep collecting samples after ring buffer
is full). Clock and sampling frequency have been moved to a separate function
from burst.  There is now one function to initiate sampling called sample
which takes a channel and count.  setclock takes a channel, clock_id, and
frequency.  Adjustments should be made to make channel groupings somewhat
cleaner, but this is functional.

Suggestions are welcome for simplification :-)

I'll try and make some doc updates in the coming day or so to reflect
finalized adjustments.
2009-02-24 07:58:10 +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
Bogdan Marinescu
f253c9003f - fixed a small AVR32 syntax error
- added newlines to the end of some files to avoid GCC errors
2009-02-17 18:57:05 +00:00
James Snyder
5a6a4d017e Switch byte copying in buf.c to a Duff's device. This seems to work as well
for me as memcpy did.

Check out inc/utils.h, since this Duff's device is implemented as a macro
which could be used for unrolling other loops selectively.
2009-02-17 03:52:29 +00:00
James Snyder
b3f6110150 ADC bugfixes, and change to sample and burst being non-blocking. Samples are
acquired with getsamples.
2009-02-16 23:01:32 +00:00
Bogdan Marinescu
42ff856578 - the "pio" module is now called "gpio" (Dado will be finally happy :) )
- new addition to the PIO module: now you can use pin ranges in PIO expressions. For example:

  gpio.PA_3_6_DIR = gpio.OUTPUT -- make pins 3-6 from PORTA outputs
  gpio.PB_0_30_PULL = gpio.PULLUP -- activate pullups on all but the last pin of PORTB
  gpio.PB_3_6 = 11 -- set value 10 (1011) to pins 3-6 of PB (so PB.6 == 1, PB.5 == 0, PB.4 == 1, PB.3 == 1 )
  value = gpio.PB_2_9 -- read the value of pins 2-9 of PB into 'value'

  Of course, one can still specify a single pin instead of a range.
  This is still tested, but seems to work fine for now.
- romfs/ samples updated to work with the new module name and syntax
- small fix to buf.c (in the BUF_MOD_INCR macro).
2009-02-16 20:18:48 +00:00
James Snyder
db423ba662 ADC fixes and temporary workarounds for handling buffer resizing. 2009-02-16 07:37:28 +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
Bogdan Marinescu
45285ea064 - LTR: even if we (obviously) can't set new keys/values in a rotable, we still respect the __newindex metamethod. This allows for interesting tricks, like the one shown below :)
- complete rewrite of the PIO module. New usage:

pio.PA = 10 -- set the value of PA to 10
pio.PB_1 = 1 -- set the value of pin 1 of PB to 1

local value = pio.PB -- get the value of PB
local value = pio.PB_3 -- get the value of pin 3 of PB

pio.PA_DIR = pio.OUTPUT/pio.INPUT - set the direction of PA
pio.dir[ pio.PA ] = pio.OUTPUT/pio.INPUT - same as above

pio.PA_2_DIR = pio.OUTPUT/pio.INPUT - set the direction of pin 2 of PA
pio.dir[ pio.PA_2 ] = pio.OUTPUT/pio.INPUT - same as above

pio.PA_PULL = pio.PULLUP/pio.PULLDOWN/pio.NOPULL - set pulls on PA
pio.pull[ pio.PA ] = pio.PULLUP/pio.PULLDOWN/pio.NOPULL - same as above

pio.P0_3_PULL = pio.PULLUP/pio.PULLDOWN/pio.NOPULL - set pulls on pin 3 of P0
pio.pull[ pio.P0_3 ] = pio.PULLUP/pio.PULLDOWN/pio.NOPULL - same as above

- samples modified to use the new PIO syntax
- bugfix in AT91SAM7X256 UART int handler
- fixed yet another bug in AVR32's libc (actually replaced strcmp (which is broken on AVR32) with a custom version).
2009-02-10 17:54:01 +00:00
James Snyder
a973e8f4e9 Modification of buf.c so that logsize^2 represents number of bytes in buffer.
Element byte counts must be a power of 2.
2009-02-10 05:50:48 +00:00
James Snyder
c6fd54ce7e - Buffer refactored to handle multibyte data.
Code which was previously using buffer has been updated to work with the
  changes.
  API has also changed in accordance:

  int buf_set(unsigned resid, unsigned resnum, u8 logsize, size_t dsize);
  int buf_is_enabled( unsigned resid, unsigned resnum );
  unsigned buf_get_size( unsigned resid, unsigned resnum );
  unsigned buf_get_count( unsigned resid, unsigned resnum );
  int buf_write( unsigned resid, unsigned resnum, t_buf_data *data, size_t dsize );
  int buf_read( unsigned resid, unsigned resnum, t_buf_data *data, size_t dsize  );

  Essentially buf_rx_cb and buf_get_char have been renamed to buf_write and
  buf_read.  For these, one now passes a pointer to where the data is coming
  from or going to, and a dsize parameter indicating how many bytes should be
  copied.  Also, buf_set takes this same dsize parameter, and keeps it in the
  struct.  This allows us to ensure that when data is read or written the
  number of bytes matches the buffer element size.

  I thought about maintaining compatibility functions to provide the original
  buf_rx_cb and buf_get_byte API calls, however there weren't a large number
  of uses of buf, so it wasn't hard to convert things.

  One caveat: BUF_MOD_INCR assumes that byte counts for alternate type sizes
  will be powers of 2.

  Also, BUF_SIZE_xx's are assumed to refer to element counts.

- UART buffering enabled on LM3S

This doesn't include switching the ADC code over to using these buffers quite
yet.

I'm open to comments on these modifications if theres a better or simpler
approach.  I've checked to make sure buffers work on LM3S, but I don't own any
other platforms to make sure there aren't unintended side-effects.
2009-02-09 03:43:47 +00:00
James Snyder
709d18c080 Updated ADC Module:
- now uses bitfields rather than HWREGBITW for keeping track of state
- started generalizing functionality for smoothing, state tracking etc... into
  separate functions
- burst mode now works, including with smoothing enabled (only operates in a
  blocking mode, non-blocking to come later)
2009-01-31 21:04:08 +00:00
James Snyder
da35498b02 - ADC now runs with an interrupt handler, which manages samples from each
channel.  Smoothing support (rolling average) has been added. adcscope has
  been updated to reflect these changes, and show output from 4 channels at
  once.

- fix for typo in stm32/platform.c
2009-01-27 20:49:45 +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
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
c1d88386dc many fixed to the AVR32 backend, update if you need AVR32 support 2008-12-14 21:39:51 +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
Dado Sutter
13d6993b43 Code added for an "ls" (or "dir") shell command 2008-11-24 13:48:46 +00:00
Bogdan Marinescu
967722761a ready for 0.5 2008-11-01 18:32:37 +00:00