[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: lua - running bytecode from an external ram space
- From: "imo" <imo@...>
- Date: Wed, 13 Jul 2011 20:42:02 +0200 (CEST)
Yea, I did of course a proof of concept.. I've connected 2mbit
FM25H20 (256kx8) serial SPI FRAM to a pic24HJ. You can access
randomly a long (32bit) for r/w in ~8usec. With a pic32mx (I am
running the pic32lua on it) or an arm or other fast small chip you
may get today ~2usec for the r/w access to a random long placed in
the SPI Fram (i.e. most serial memories have 20-66MHz spi clock).
Moreover, with such "virtualisation" via those C r/w calls you may
access any _other_ kind of external RAM with a proper HW interface.
Imagine you may run Lua bytecode on a pic32mx or other chip (with
on-chip 128kB flash and 32kB ram as a minimum) and run a xxMB big
script in it :). Of course slower than running it in the internal
ram (..you may not have soon in such capacity, though).
-imo
----- PŮVODNÍ ZPRÁVA -----
Od: "KHMan" <keinhong@gmail.com>
Komu: "Lua mailing list" <lua-l@lists.lua.org>
Předmět: Re: lua - running bytecode from an external ram space
Datum: 13.7.2011 - 19:35:43
> On 7/14/2011 12:59 AM, James Graves wrote:
> > imo wrote:
> >> Hi, as the Lua is a virtual machine based, let
> >> me kindly ask you
> >> >> following:
> >> 1.would it be possible to allocate the vm
> >> “working space”, or some
> >> >> parts of it (e.g. tables, functions) to an
> >> external ram, accessible
> >> >> to Lua via a c-interface, like:
> >> long ram_rd( long address);
> >> void ram_wr(long address, long data);
> >> so we may use _any_ type of an external ram
> >> (e.g. serial spi sram,
> >> >> fram) for running Lua byte code of almost
> >> _any_size_ then?
> >>
> The problem with this item is, the only serial SPI
> SRAM parts IIRC
> seems to be those two Microchip parts; 23A256 is
> 32KBytes only.
> Bigger 'uns and you'll start to need lots of I/O
> pins.
>
> Might as well stick to a 32-bit part with >=64KB
> RAM. I bought a
> few recently, USD3.44 per piece. Nowadays it's
> hard to beat
> single-chip choices with a multiple chip scheme.
>
> But if the OP can find FRAM of a few Mbits, I want
> to grab some
> too! :-)
>
> >> 2. is it even feasible to find such points in
> >> the Lua source code
> >> >> where we can interface such an external ram??
> >> Or it would require an
> >> >> rewrite of the entire vm?
> >> This may enable to run even very large scripts
> >> on small ucontrollers
> >> >> (e.g. with flash>128kB and ram>16kB) when speed
> >> is not a priority.
> >> >
> > This will require significant changes to the Lua
> > VM, and I don't think
> > > it will be worth the effort. You say speed is
> > not a priority, but
> > > running Lua on a microcontroller _that_ small
> > with so little memory
> > > will be very, very slow.
> >[snip]
>
> --
> Cheers,
> Kein-Hong Man (esq.)
> Kuala Lumpur, Malaysia
>
>