elua / elua

eLua Project on GitHub
http://www.eluaproject.net/
Other
906 stars 294 forks source link

Add support for TI CC3200 #68

Closed vudangngoc closed 1 year ago

vudangngoc commented 9 years ago

CC3200 use ARM Cortex-M4, and eLua also supported Cortex-M3. Is it possible to use the toolchain cortexm? If I create new port from Cortex-M3 boad, is it more easy?

jsnyder commented 9 years ago

I've not done any work on CC3200, so I'm not sure if there are any challenges with using a GCC Cortex-M4 capable toolchain with it. I'd imagine the only limitations might be related to using any supporting libraries from TI and whether those can be built with GCC.

As for what might be the easiest way to get started, you could refer to existing Cortex-M3 ports or Cortex-M4 ports (in the master branch STM32F4 is a Cortex-M4 platform). I would presume that most of the porting effort should be related to supporting the particular peripherals of this platform and perhaps working with the platform's external flash (I don't believe any of the CC3200's have internal flash). Most of the current ports run out of internal flash and make use of that flash being memory mapped to economize on SRAM usage. If the external flash isn't mapped in the microcontroller's memory space it should be possible to make things work, but you will likely want to make some trade-offs in included functionality to leave enough SRAM for the Lua VM.

vudangngoc commented 9 years ago

Thank for your information, CC3200 have "Dedicated External SPI Interface for Serial Flash" working with various chip: S25FL208K, W25Q16V, AT25DF081A, N25Q128-A13BSE40. I'm working on ESP8266 but I think it doesn't stable enough, so that I will switch to study CC3200. Could you please give me some document link or referent? It will reduce a lot of my effort with googling. Thank you in advance ^_^

ecdr commented 9 years ago

The big challenge will probably be RAM. Since CC3200 does not have a lot (by eLua standards), and the code, as well as data, as well as network things all have to be in RAM.

One possible starting point would be the Tiva/Stellaris port of eLua (see my github repository https://github.com/ecdr/elua). (Or possibly the LM3 platform.) The libraries are different for the CC3200, but some of the peripherals might be similar. (And is Cortex M3/M4).

You might start by seeing how small you can make the eLua image (strip out as much function as you can, remove peripherals, integer only, etc.). More ambitious - consider doing virtual memory (paged or segmented) or if memory controller doesn't give you enough support for that, try a virtual machine with virtual memory. Either way I suspect it would be a fair bit of work to get anything but a very stripped down version going.

Or, you could try adding CC3100 support to the Tiva/Stellaris version of eLua. (I am not sure how much RAM the CC3100 drivers need, may need to use one of the chips with more RAM, like the connected launchpad.)

Another option - have you considered the EMW3162? http://hackaday.com/2015/03/24/emw3162-wifi-120mhz-needs-attention/ Flash is in the memory space, so a lot less memory constrained. (Obvious place to start a port would be one of the STM32 platforms.) I have no experience with this chip, so don't know what such a port would entail.

vudangngoc commented 9 years ago

Thank you for your suggestion, CC3200 have 256KB RAM which is better than emw3162, and have "Dedicated External SPI Interface for Serial Flash" ( I bough a development board have additional 1MB ROM). Is it better EMW3162? and is it still easy to port eLua? I have just bough a development board of CC3200, I will start with this board first and work with EMW3162 after that http://www.aliexpress.com/item/IV-CC3200MOD-CC3200-Wifi-Module-CC3200-LAUNCHXL-CC3200R1M2RGC/32306551340.html

TI CC3200 diagram
soc_block_dia_swas032

martinwguy commented 9 years ago

On 02/06/2015, guttso notifications@github.com wrote:

CC3200 have 256KB RAM "Dedicated External SPI Interface for Serial Flash" ( I bough a development board have additional 1MB ROM).

eLua is very good at low-RAM situations thanks to Bogdan's many low-ram patches: we had it running fine in 32K. How are you for ROM? 256KB is plenty for eLua unless you want lots of data in the ROM filesystem.

If you need code-size hacks, check the commits on the old Mizar32 branch https://github.com/elua/elua/commits/Mizar32-v0.9 many of these are code-size related, particularly the ones commented "Add luaconf.h defined" which strip out sections of code.

Good luck!

M

azdle commented 9 years ago

The 3200 uses an external SFLASH and I think the dev boards have several MB of space, but that means that you need to load everything into RAM before you can run it, so you have to subtract your code size from the available RAM.

@vudangngoc let me know when you get something basic up and running, I'd be willing to help port some of the libraries and things. This is something I've been thinking about doing for ages.

Also, here's some notes that I've been talking (along with a few others) about using programming the 3200 under linux: https://hackpad.com/Using-the-CC3200-Launchpad-Under-Linux-Rrol11xo7NQ some of it may be out of date, I haven't touch any of it since the initial 1.0.0 release of the SDK. Feel free to edit anything that you find is incorrect.