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

1056 Commits

Author SHA1 Message Date
Bogdan Marinescu
82eab855dd Style changes
- remove stray printf
- use a consistent naming scheme for MMCFS_NUM_CARDS
2013-01-07 23:31:13 +02:00
Bogdan Marinescu
1d8f66faed Added support for multiple SD cards
The MMCFS implementation can now handle more than one MMC card. To
use this feature, define these macros in platform_conf.h:

MMCFS_NUM_CARDS - the total number of cards
MMCFS_CS_PORT_ARRAY - array of CS ports
MMCFS_CS_PIN_ARRAY - array of CS pins
MMCFS_SPI_NUM_ARRAY - array of SPI port numbers

For example:
 #define MMCFS_NUM_CARDS          2
 #define MMCFS_CS_PORT_ARRAY      { 7, 2 }
 #define MMCFS_CS_PIN_ARRAY       { 0, 5 }
 #define MMCFS_SPI_NUM_ARRAY      { 0, 0 }

defines a system with 2 MMC cards. The first one uses SPI0 and has its
CS on PG0. The second one also uses SPI0 (this is perfectly possible)
but has its CS on PC5. This was the configuration used to test this
feature on a EK-LM3S8962 board.
2013-01-07 23:30:28 +02:00
Bogdan Marinescu
d05a3ae0e9 Lua-based build system improvements
The build system now accepts a single C file as a target and compiles that
file only. For example:

$ lua build_elua.lua board=ek-lm3s8962 src/main.c

Two other switches were added to the build sysem (both of which work only
with the single file target shown above):

"-E": preprocess file instead of compiling it
"-S": generate assembler source for the file instead of compiling it
2012-10-28 20:53:14 +02:00
Bogdan Marinescu
b38a1fb40e Small memory optimization in Lua strings
Get rid of the "reserved" byte in the TString data type. Might actually
save more than one byte, depdending on the compiler structure alignment
rules (and the architecture). Tested with the Lua 5.1 test suite.
2012-10-28 20:06:07 +02:00
Bogdan Marinescu
4b710c1031 added MMCFS emulation under the simulator 2012-10-01 00:30:59 +03:00
Bogdan Marinescu
9e7f1ab4cd Preliminary directory support
- For now only supported for MMCFS
- 'dir' function in shell augmented to show directories and
  to traverse a path recursively if requested
- new command 'mkdir' in shell
2012-09-10 19:12:15 +03:00
James Snyder
402bc4c6c0 fix handling of rotables in luarpc 2012-09-05 16:16:19 -05:00
Bogdan Marinescu
030e8d7ef4 Merge pull request #12 from molnarkares/master
stext and etex fix (tracker #44)
2012-08-24 10:24:32 -07:00
molnarkares
ae99eab04d stext and etext fix 2012-08-24 16:56:24 +02:00
Bogdan Marinescu
7603cc05f2 LM3S platform specific PIO fixes
Changed the LM3S platform specific PIO module to be consistent with
the generic PIO module's API.
2012-08-17 20:27:40 +03:00
Bogdan Marinescu
6b7116caf0 added explicit GPIO mappings for UART 2012-08-17 20:27:22 +03:00
Bogdan Marinescu
53f5807cee LM3S platform fixes
1. fixed "uart_setup" function
2. enabled UART buffering
3. changed invalid keys in lm3s.pio
2012-08-15 21:55:13 +03:00
Bogdan Marinescu
26989d4bb8 LM3S: timer interrupt support 2012-08-08 20:38:51 +03:00
Bogdan Marinescu
135146eef6 removed debugging printf statements 2012-08-06 23:57:13 +03:00
Bogdan Marinescu
b5e32d4334 GPIO interrupt support on LM3S + systimer fix on 9B92/9D92 2012-08-06 23:52:41 +03:00
Bogdan Marinescu
da8510601f fixed compilation issue when INT_TMR_MATCH is not declared 2012-08-06 23:52:11 +03:00
Bogdan Marinescu
9f894fd937 LM3S platform specific PIO module
New module on the LM3S platform which deals with platform
specific PIO setup functionality.
2012-08-01 00:18:27 +03:00
Bogdan Marinescu
89f16dc601 Fixed integer-only Newlib stubs
Newer Newlib versions use different functions to implement integer-only versions
of printf/scanf. Our stubs were modified to take advantage of these changes and
keep the code size low in integer-only versions of eLua.
2012-07-29 13:11:13 +03:00
Martin Guy
0e1db09385 Revert "Fixed the configuration file in order to work with the web
builder"

This reverts commit fc57957f7ac5fdf0ceebfd7acf300a8325569d44 which was
meant to be applied to the web-builder branch but ended up in the master
branch by mistake.
See https://github.com/elua/elua/commit/fc57957f#commitcomment-1552828
2012-07-18 12:06:10 +02:00
Bogdan Marinescu
0aac4509eb Changed flash sector sizes to 32 bits 2012-07-16 17:32:55 +03:00
Bogdan Marinescu
86465389fb RO string bug fix
Fixed bug reported by Tim Van der Hulst:

-------------------------------------------------------------------------------
dofile('/mmc/test.lua') -- OK
require('test') -- Fail!!

-------------
/mmc
test.txt                       5 bytes
gprs.lua                       2910 bytes
util.lua                       385 bytes
test.lua                       385 bytes

Total on /mmc: 3685 bytes

-------------

Error: [string "xmodem"]:23: module 'test' not found:
        no field package.preload['test']
        no file '/mmc/test.lua;/mmc/test.lc;/rom/test.lua;/rom/test.lc'
        no file '/mmc/test.lc;/rom/test.lua;/rom/test.lc'
        no file '/rom/test.lua;/rom/test.lc'
        no file '/rom/test.lc'
-------------------------------------------------------------------------------

The problem was actually in the way read-only strings were created. If a read-only
string creation call specified a size which was different than the actual (C) size
of the string, the string didn't get null-terminated, which in turn led to some
interesting errors (like the one above).
2012-07-10 13:41:34 +03:00
Bogdan Marinescu
f791ee22c5 LM3S platform changes
1. Flash configuration is described in a file named flash_conf.h.
   This helps keeping things less confusing with WOFS.
2. WOFS enabled for LM3S9D92
2012-06-27 21:20:21 +03:00
Bogdan Marinescu
97c8821301 Merge branch 'master' of github.com:elua/elua 2012-06-27 21:12:27 +03:00
Bogdan Marinescu
a4cb128366 Bumped CPU frequency to 80MHz for LM3S9B92/LM3S9D92 2012-06-27 20:59:33 +03:00
Martin Guy
1ba7839a93 Use canonical Mizar32 web page URL 2012-06-27 14:36:16 +02:00
Bogdan Marinescu
d190763c7c added board EK-LM3S9D92 from TI (LM3S9D92) 2012-06-27 00:45:04 +03:00
Bogdan Marinescu
5a26274a6e WOFS documentation, last part + another style change 2012-06-27 00:34:58 +03:00
Bogdan Marinescu
df85a35a44 WOFS documentation, part II + a small style change 2012-06-26 13:27:15 +03:00
Bogdan Marinescu
c5f3033fb2 WOFS documentation, part I 2012-06-26 01:13:26 +03:00
Bogdan Marinescu
b705904ecd fixed compilation when BUILD_WOFS is not defined 2012-06-26 01:00:56 +03:00
Bogdan Marinescu
6877890892 renamed INTERNAL_FLASH_BLK_SIZE to INTERNAL_FLASH_UNIT_SIZE 2012-06-26 01:00:32 +03:00
Bogdan Marinescu
c2227a7645 fixed check for remaining size on WOFS 2012-06-26 00:57:55 +03:00
Bogdan Marinescu
a9ebeac525 WOFS fix: at most one file opened in write mode
Due to the nature of WOFS, at most one file can be opened on WOFS
in write mode at any given time.
2012-06-25 20:32:29 +03:00
Bogdan Marinescu
e35df54fda Fixed WOFS compilation on sim (Linux) 2012-06-25 10:50:32 +03:00
Bogdan Marinescu
e9a24cac11 Added WOFS + other stuff
This should really be more than one commit, but I wrote everything in one
shot and I don't feel like arranging the changes logically into different
commits. So, these are the changes:

- added WOFS (Write Once File System). This is a writeable file system that
  exists in the MCU's internal Flash memory and allows files to be written,
  but only once, in a single shot. More details to follow.
- the platform interface has a new MCU flash access interface.
- added WOFS "reference implementations" for two CPUs: LM3S8962 and
  STM32F103RE. They are easily extendable to other CPUs in the same platform
  and can be taken as a model for other platforms.
- the ROMFS file layout in memory was slightly changed.
- the simulator (src/platform/sim) got a new function (lseek).
- shell: now each shell command receives its arguments in a C-main-style
  (argc, argv) pair. This was originally Marcelo's idea and it finally
  made it to the master (although this particular implementation is mine),
  after I got fed up with all the argument parsing in the shell functions.
- new shell command: wofmt ("formats" a WOFS, effectively clearing it).
- a couple of small fixes in the shell code
2012-06-24 23:07:32 +03:00
Bogdan Marinescu
a378b8943e shell: multiple fixes
1. the filename for 'recv <filename>' was not set correctly
2. error messages for 'cp' were not always correct
3. check for copy errors and issue a message accordingly
2012-06-21 00:20:58 +03:00
Bogdan Marinescu
01a8dcd9a5 Changed the ROMFS terminator char
The ROMFS termination char is now 0xFF instead of 0x00 (in preparation
of WOFS).
2012-06-19 16:21:14 +03:00
Bogdan Marinescu
ed54aec47a Added FS registration data as argument to all FS functions
All the functions that implement a FS receive the instance data
of the FS (given at registration time to dm_register) as their
last argument. ROMFS was changed to take advantage of this.
2012-06-19 00:51:56 +03:00
Bogdan Marinescu
a199d47615 Changed FS registration mechanism
Now it's possible to have more than one instance of a given file
system. For example, one could use more that one ROM file system
in different physical locations (a possible configuration is
internal Flash and external serial memories). This mechanism is
currently implemented only in the device manager (devman.c),
actual instance implementation require per-FS support (to be
implemented later).
2012-06-17 14:04:51 +03:00
Nuccio Raciti
fc57957f7a Fixed the configuration file in order to work with the web builder
Signed-off-by: Nuccio Raciti <raciti.nuccio@gmail.com>
2012-06-15 17:47:43 +02:00
Bogdan Marinescu
2658f7cf77 Fixed timer counting direction on all platforms
On some platforms, the hardware timers were counting down instead
of up, which broke the assumptions of the new timer implementation.
Fixed by inverting the timer value (relative to its maximum value).
2012-05-26 00:45:18 +03:00
Bogdan Marinescu
d54659b572 RAM optimizations: pseudo RO strings, functions in Flash
This patch adds more RAM optimizations to eLua:

- direct file memory mapping: files in ROMFS will be read directly from Flash,
  without allocating any additional buffers. This doesn't help with RAM
  consumption in itself, but enables the set of optimizations below.

- pseudo read-only strings. These are still TStrings, but the actual string
  content can point directly to Flash. Original Lua strings are kept in
  TStrings structures (lobject.h):

  typedef union TString {
    L_Umaxalign dummy;  /* ensures maximum alignment for strings */
    struct {
      CommonHeader;
      lu_byte reserved;
      unsigned int hash;
      size_t len;
    } tsv;
  } TString;

  The actual string content comes right after the union TString above.
  Pseudo RO strings have the same header, but instead of having the string
  content after TString, they have a pointer that points to the actual
  string content (which should exist in a RO memory (Flash) that is directly
  accesbile from the MCU bus (like its internal Flash memory)). lua_newlstr
  detects automatically if it should create a regular string or a pseudo RO
  string by checking if the string pointer comes from the Flash region of the
  MCU. This optimization works for both precompiled (.lc) files that exist in
  ROMFS and for internal Lua strings (C code).

- functions in Flash: for precompiled (.lc) files that exist in ROMFS, the code
  of the functions and a part of the debug information will be read directly
  from Flash.

- ROMFS was changed to support files that are larger than 2**16 bytes and it
  aligns all its files to an offset which is a multiple of 4 in order to prevent
  data alignment issues with precompiled Lua code.

- the Lua bytecode dumper was changed to align all the instructions in a Lua
  function and a part of the debug information to an offset which is a multiple
  of 4. This might slightly increase the size of the precompiled Lua file.

These changes were succesfully checked against the Lua 5.1 test suite.
These changes were tested in eLua on LM3S and AVR32.
2012-05-10 00:39:42 +03:00
Sokolov Yura
1a5b04e2c3 NaN packing for TValues
From the Lua Power Patches page:

"Use NaN packing for TValue on x86 to reduce memory usage
and tiny performance gain (same as in LuaJIT i2).
It's fully ABI compatible with standard Lua libraries.
On one test script memory consumption reduced from 28Mb
to 21Mb and performance improved about 3.5-5%"

Added support for big endian architectures and LTR compatibility.
2012-04-19 00:04:10 +03:00
Yuki Tamura
c8b89a46d9 Fix possible Lua stack corruption issue
luaD_checkstack could damage the stack, possibly making further
references to 'func' invalid. Fix this by using the information
inside the CallInfo structure instead of 'func'.
2012-04-19 00:01:47 +03:00
James Snyder
fbebb2949e Correct issues with remote indexing and catch incorrect calls for LuaRPC
helper_remote_index() contained an error which allowed for incorrect
calculation of the string length to be sent. This should now be
fixed. Additionally, read_cmd_call() did not check whether indexing
was successful at each step, we now check whether the indexed result
is callable or a table and attempt to provide an indication of the
type of error made by the user.
2012-03-26 20:56:12 -05:00
James Snyder
7771e05fb2 clean up trailing whitespace 2012-03-26 19:17:40 -05:00
Martin Guy
59f9a2616b Added documentation file for mizar32 rtc module
Forgot to git-add it in the previous commit. Oops.
2012-03-25 13:43:53 +02:00
Thiago Naves
edf5b7a5ff Merge pull request #10 from mwilbur/rpc-client
Fix CR->NL and NL->CR transations on linux
2012-03-22 12:11:59 -07:00
Matt Wilbur
800a94db16 Fix CR->NL and NL->CR transations on linux 2012-03-22 10:12:51 -04:00
Martin Guy
6dd64a0dc6 New mizar32.rtc platform module
Methods: mizar32.rtc.get() returns a table like Lua's os.date()
and os.time() with fields year, monthm day, wday, hour min, sec
and mizar32.rtc.set() takes a similar table, only changing the
fields that are present in the table.
Works with DS1337 and PCF8563 clock chips.
2012-03-19 23:49:39 +01:00