Hardware requirements for running large C programs
wrmiller19
Posts: 17
Hey guys,
What type of non-volatile memory will support running large (>256k) C programs? I noticed that ICCV7 (ImageCraft) supports 'large' memory models. How exactly does this work. Are there better solutions?
I'm asking because I may have to support an existing product written in Spin, and I'd like to rewrite it if possible. Current implementation has 6 of the 7 top objects stored on a SD card, and they are loaded onto the Propeller as needed by a fat16 driver running in hub ram (I think).
If I wrote C program that compiled to say, 180k, how could I run this on a Propeller?
TIA,
Bill
What type of non-volatile memory will support running large (>256k) C programs? I noticed that ICCV7 (ImageCraft) supports 'large' memory models. How exactly does this work. Are there better solutions?
I'm asking because I may have to support an existing product written in Spin, and I'd like to rewrite it if possible. Current implementation has 6 of the 7 top objects stored on a SD card, and they are loaded onto the Propeller as needed by a fat16 driver running in hub ram (I think).
If I wrote C program that compiled to say, 180k, how could I run this on a Propeller?
TIA,
Bill
Comments
Large Memory Model (LMM) is something of a misnomer. It just means that special PASM variant programs can be saved in HUB memory and executed by a COG "interpreter". Instructions are read one at a time from HUB memory and executed "as-is" by the COG hardware in most cases. This method is considered "Large" relative to the amount of memory provided by a COG.
To run a program that is 180KB requires a compiler that can fetch/execute programs from an external device such as Flash or SRAM. This is called XMM (and/or XMMC in the case of Propeller GCC). The same kind of trick used by LMM is used for XMM programs except that code is fetched from external memory.
Propeller GCC is the only officially supported Parallax product that can do this today. Propeller GCC is entering Beta phase soon but is available for testing now. Propeller GCC XMMC mode supports relatively fast Flash, SdCard, and Eeprom program execution. XMMC programs can also be run from SRAM/SDRAM if necessary. Propeller GCC XMM programs are slower than XMMC programs but allows access to larger blocks of memory stored in program data space (XMMC data is limited to HUB memory).
There are also third-party alternatives such as Catalina and xBasic that support external memory programs. ICC for Propeller does not support XMM programs and is no longer supported by ImageCraft.
Hope this helps.
--Steve
Catalina compiles code to LMM/XMM PASM which is pasm instructions with special jumps. In LMM, each instruction (32bits) is fetched from hub into the cog and executed. Therefore it is slower than real pasm executing in a cog. XMM fetches the code from external memory such as SRAM into the cog for execution.
Catalina runs on my platforms such as the RamBlade and the new RamBlade3 and the older TriBlade. These are the fastest implementations (512KB of 55ns SRAM) but consume the whole propeller because the address lines are not latched - a microSD is on this prop. This method requires two props with the second prop performing the I/O. Catalina also runs on the DracBlade that uses a latched design and therefore has I/O available for the program to use.
I hope this helps.
In theory, any external memory chip that you can write a driver for. A 512k parallel chip is popular. There are a number of serial ram solutions, which are slower, but more recently there has been some fascinating work on caching that means the speed of the external ram is much less important. I believe Jazzed has even done a 32mb solution.
In both GCC and Catalina, there are drivers for different ram chips and these drivers generally run in a cog and fetch the data as needed. You can specify which driver to use when the program is compiled.
One nice feature of C is that you can write a little program and compile it to "hub", ie LMM, and then with one change to the compilation, recompile it for XMM. Both are useful, as downloading to hub ram is quicker, so you can test bits of code by running them in LMM, then put them all together and download a bigger XMM program.
I've written 200-300k sized programs and at that size, the download time is just starting to get a little tedious.
One question to consider with any external memory is how many propeller pins you want to use to talk to the memory, and how many other pins you need free to talk to other things like keyboard, mouse, display, sd card, real world I/O.
Hi Bill.
As others have said, you need to learn a little about LMM to understand how the Prop supports "large" C programs. LMM programs execute instructions out of the 32 kilobytes of Hub RAM rather than the 496 longs of Cog RAM, at speeds around 1/4 of Cog RAM programs (but something like 10 times faster than the equivalent Spin programs).
As well as LMM programs there are external memory (XMM) programs, where the program is executed out of RAM external to the Propeller chip itself. This is slower again than LMM, but allows programs to be megabytes in size.
ICC supported LMM programs (i.e. up to 32k) but not XMM programs - and support for this product has now been discontinued by the original supplier in any case.
I don't think anyone here would recommend ICC as a long term option. You should look at Catalina or GCC instead.
Ross.
I not sure what the SDRAM uses. Maybe Steve can comment on this. The C3 and C3F are the times on the C3 card. The C3F cache driver only supports the flash chip, whereas the C3 driver divides the cache memory between the flash and the external RAM. The EEPROM driver uses the Prop's boot PROM, and the SDCARD driver executes directly out of an SD card.
Will Hanno's ViewPort work with C programs? (think I read this somewhere?)
The SpinSocket-Flash (SSF) modules have byte-wide Quad-SPI Flash and have 18 free Propeller pins (20 if you count serial port pins). A Propeller Platform interconnect board is available for SSF. The free pins, fast startup time (SDCARD not requied), no default hardware connections except Flash/EEPROM/serial port, and small package differentiate the two designs.
As Dave's table shows, there is very little performance difference between the two designs with Propeller GCC XMMC. The SDRAM board will work with Propeller GCC XMM mode which uses volatile storage. There is an SSF-SRAM accessory board design that will be useful with XMM.
The key advantage to performance with most of these designs is the ability to read or write data with a single clock after setup which is a good match with caching.
ViewPort supports the Ross' excellent Catalina C compiler and integrates with the BlackCat debugger. See attached for screenshots of ViewPort's project editor, code highlighter. To compile/load either a single C file or complete project just click "run".
Hanno
Hi wrmiller,
Originally I think it was available in the forums, but I can't find that thread in a quick search - it may have been lost when we switched to the new forum software. According to this thread, it is also supposed to be available in the OBEX, but when I tried it says it is still locked awaiting approval. Since I already have a copy (as probably does Hanno) we never needed to download it, so we never noticed.
I'll check and see if there is a copy available elsewhere. Bob Anderson may still visit the forums - perhaps he will chime in as well.
Ross.
I'll shoot Bob and email to see if he's ok with me/Ross hosting it.
Hanno
Thanks, but it seems you cannot search the old forums. I tried scanning back manually, but I couldn't spot it.
Ross.
I managed to find it in the full ObEx zip file put together over a year ago -- see this thread. But just that package is just under 2 MB, while the entire ObEx from a year ago is almost 40 MB.
Last year Parallax pulled most of the C stuff out of the OBEX since ImageCraft no longer supports ICC.
They accidently took down the BlackCat package at that time. I found it in the archive posted in another thread.
Thanks, Jazzed!