Shop OBEX P1 Docs P2 Docs Learn Events
"Out-of-the-box" gcc memory model / hardware? — Parallax Forums

"Out-of-the-box" gcc memory model / hardware?

__red____red__ Posts: 470
edited 2013-03-20 16:05 in Propeller 1
I'm building a simple "hackerspace-branded" board to introduce hacking with the propeller. Given that a number of my students will be familar with C and arduino I wanted to give them the opportunity to use gcc.

As I understand it, to get to reasonable-sized applications you need external memory. My question is a simple:

What the is 'default' / 'out-of-the-box' / 'simplest' configuration for larger memory model hardware?

Thanks,



Red

Comments

  • ersmithersmith Posts: 6,092
    edited 2013-03-12 07:21
    __red__ wrote: »
    As I understand it, to get to reasonable-sized applications you need external memory. My question is a simple:

    What the is 'default' / 'out-of-the-box' / 'simplest' configuration for larger memory model hardware?

    I'm not sure I agree that you need external memory. The default configuration for PropGCC is to use hub memory for code and data (LMM mode). Another hub-only mode is CMM (compressed memory model) which lets you fit about twice as much code in, which is enough for many interesting projects.

    For bigger (external) memory there are a variety of options. A lot of our development is done on C3 boards, so having SPI flash and/or RAM like the C3 would probably be a good choice.

    Eric
  • David BetzDavid Betz Posts: 14,516
    edited 2013-03-12 09:46
    ersmith wrote: »
    I'm not sure I agree that you need external memory. The default configuration for PropGCC is to use hub memory for code and data (LMM mode). Another hub-only mode is CMM (compressed memory model) which lets you fit about twice as much code in, which is enough for many interesting projects.

    For bigger (external) memory there are a variety of options. A lot of our development is done on C3 boards, so having SPI flash and/or RAM like the C3 would probably be a good choice.

    Eric

    I agree with all of this except that I'd suggest you not emulate the C3's chip select mechanism, just use a simple CS pin for the flash and/or SRAM chip.

    Edit: Even though I don't recommend the counter-based CS scheme that the C3 uses, you can certainly and probably should share the rest of the SPI pins between the flash and SRAM chip if you choose to support both

    There is a cache driver that is provided with PropGCC that allows a SPI flash chip to be used as external memory by just configuring the pins used for CS, MISO, MOSI, and CLK. You don't need to write any code.
  • Dave HeinDave Hein Posts: 6,347
    edited 2013-03-12 10:02
    The simplest approach for external memory is to use a 64Kbyte or 128Kbyte EEPROM. However, you'll get better speed performance with an SPI flash or RAM, and you'll also be able to run larger programs.
  • SRLMSRLM Posts: 5,045
    edited 2013-03-12 10:05
    I don't think you need external memory. I'm doing a fairly large project (so far, I have about 20 classes) with C++ in PropGCC and I'm doing fine using CMM.
  • David BetzDavid Betz Posts: 14,516
    edited 2013-03-12 10:22
    SRLM wrote: »
    I don't think you need external memory. I'm doing a fairly large project (so far, I have about 20 classes) with C++ in PropGCC and I'm doing fine using CMM.
    Certainly using only on-chip memory will give the best performance if your program will fit.
  • Ken GraceyKen Gracey Posts: 7,400
    edited 2013-03-14 09:29
    __red__ wrote: »
    I'm building a simple "hackerspace-branded" board to introduce hacking with the propeller. Given that a number of my students will be familar with C and arduino I wanted to give them the opportunity to use gcc.

    As I understand it, to get to reasonable-sized applications you need external memory. My question is a simple:

    What the is 'default' / 'out-of-the-box' / 'simplest' configuration for larger memory model hardware?

    Thanks,


    Red

    Red, it's a timely effort! I'm under a bit of a gag order on the forums, but I think we should immediately connect off-line via e-mail so I can lend you even more support and make your project go quicker. We have a special opportunity for you at the moment, and I'm not selling you anything. . .

    And to the memory model question, I'm using a PropBOE with XMMC External Flash Code Main RAM Data.

    Drop me an e-mail, below.

    Thanks,

    Ken Gracey
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2013-03-16 23:52
    I'm going to go right back to being a newbie and blog this as I go.

    Four reasons.
    1) Limiting factor with so many of my propeller projects in the past has been the number of pins, but experiments are going very well with multiple propeller chips and abstracting the idea of a propeller with as many pins and cogs as one wants.
    2) I just ran a really large complex Spin program (Kyedos) through Spin2cc and there were no errors. I think that means that every bit of code in the obex may now be available for C programmers.
    3) Microchip have recently released larger SPI ram chips.
    4) Ken Gracey is up to something and I want to find out what!!

    So - my hardware is very simple - 4 pins for TV, 2 for keyboard, 4 for SD card and 4 for a SPI ram chip.

    For the very simplest experiment, one could leave out the SD card, keyboard and TV and debug through the download port.

    I want to put the program in the SPI ram chip. I'll start with a 32k chip and the chip is in a socket so it will be easier to drop in chips with larger memory as needed.

    I just uninstalled PropGCC and SimpleIDE as the versions I had were from late last year.

    Download the simpleIDE package https://sites.google.com/site/propellergcc/downloads/windows-download 77mb

    Run the setup program. I've accepted all the defaults except I checked the box that added a desktop icon. It is installing at the moment. The default workspace folder is "C:/Documents and Settings/Administrator/My Documents/SimpleIDE" and just to remind me where things are, I'm going to copy that folder onto the desktop and put the icon next to simpleIDE,

    Ok, we have a demo hello world on the screen. Bottom left corner are a whole lot of boards that one can use (even one of mine, the Dracblade). Hit the light blue triangle at the top of the screen and it will compile and run. Change boards and change to LMM and change to c++ and all runs fine. I'm going to be putting the C program in external ram, so when this is working, the memory model will be XMMC and it will be caching the program from the ram. But first, need to connect add the ram which is an 8 pin 23K256 chip.

    Addit: At this point I am going to cheat, as I happen to know that the config files for the boards are contained in the directory c:\propgcc\propeller-load. I've told windows that .cfg files should be opened with notepad so it is quick to scan through these files.

    David Betz in post #3 said
    There is a cache driver that is provided with PropGCC that allows a SPI flash chip to be used as external memory by just configuring the pins used for CS, MISO, MOSI, and CLK. You don't need to write any code.

    But I think I need a driver for a SPI ram chip (23K256), not an SPI flash chip.

    I'm a bit stuck at this point. Any help would be most appreciated.
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2013-03-20 03:58
    Just a quick update for __red__, David Betz is being extremely helpful with some PM messages and we are getting very close to the "simplest configuration". It appears the quickplayer option in SimpleIDE is going to be the hardware model. We are just decoding the protocol in the .cfg file, as there appears to be two long hex parameters, with 3 values in the first hex long determining 3 of the 4 pins, and the second hex long determining the fourth pin. There is one value in the first hex long that is some sort of protocol value that we need to decode.

    The purpose is to built something simple. A single 23k256 sram spi 8pin chip. Connect to any 4 propeller pins and in any order. Just need to decode the .cfg file and I am really hoping we will be able to test this on some hardware and get it working.
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2013-03-20 04:01
    Just a quick update for __red__, David Betz is being extremely helpful with some PM messages and we are getting very close to the "simplest configuration". It appears the quickplayer option in SimpleIDE is going to be the hardware model. We are just decoding the protocol in the .cfg file, as there appears to be two long hex parameters, with 3 values in the first hex long determining 3 of the 4 pins, and the second hex long determining the fourth pin. There is one value in the first hex long that is some sort of protocol value that we need to decode.

    The purpose is to built something simple. A single 23k256 sram spi 8pin chip. Connect to any 4 propeller pins and in any order. Just need to decode the .cfg file and I am really hoping we will be able to test this on some hardware and get it working.
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2013-03-20 06:18
    Thanks to some very kind PM messages from David Betz, we have a working solution!

    Ok, add a single 23K256 spi sram chip. There are 8 pins on that chip. Pin 7 and 8 are 3v3. Pin 4 is Gnd. Pin 3 is not connected. You can connect the other 4 pins to any propeller pins you like. I chose to connect pin 1 (CS) to propeller pin 4, pin 5 (MOSI) to propeller pin 5, pin 6 (CLK) to propeller pin 6, and pin 2 (MISO) to propeller pin 7.

    Go to directory c:\propgcc\propeller-load. Open the file quickplayer.cfg. I changed it to this
    # quickplayer.cfg
        clkfreq: 80000000
        clkmode: XTAL1+PLL16X
        baudrate: 115200
        rxpin: 31
        txpin: 30
        cache-driver: spi_sram_cache.dat
        cache-size: 8K
        cache-param1: 0x05070601 # 0xooiiccpp - oo=mosi ii=miso cc=sck pp=cs-protocol
        cache-param2: 0x04000000 # 0xssxxxxxx - ss=cs
        load-target: ram
    

    where cache param1 is mosi, miso, clk and then the last byte is 01 which is the protocol byte.
    cache param2 is the cs pin and the other values are zero.

    Note these pin numbers are in hex, so pin 16 would be 10.

    The open SimpleIDE, and at the bottom left corner, board type is quickplayer, compiler type is C++, Memory model is XMMC and optimisation is for size.

    The hit the blue 'compile' triangle and it should download and run. You can confirm it really is running from ram by powering down, removing the ram chip and then trying to download.

    This really is super simple. One 8 pin chip and larger C programs can be run. And there are larger ram chips available in the same package, so just put the ram chip in a socket and it is easy to fix if running out of code space.
  • David BetzDavid Betz Posts: 14,516
    edited 2013-03-20 06:58
    Dr_Acula wrote: »
    Thanks to some very kind PM messages from David Betz, we have a working solution!

    Ok, add a single 23K256 spi sram chip. There are 8 pins on that chip. Pin 7 and 8 are 3v3. Pin 4 is Gnd. Pin 3 is not connected. You can connect the other 4 pins to any propeller pins you like. I chose to connect pin 1 (CS) to propeller pin 4, pin 5 (MOSI) to propeller pin 5, pin 6 (CLK) to propeller pin 6, and pin 2 (MISO) to propeller pin 7.

    Go to directory c:\propgcc\propeller-load. Open the file quickplayer.cfg. I changed it to this
    # quickplayer.cfg
        clkfreq: 80000000
        clkmode: XTAL1+PLL16X
        baudrate: 115200
        rxpin: 31
        txpin: 30
        cache-driver: spi_sram_cache.dat
        cache-size: 8K
        cache-param1: 0x05070601 # 0xooiiccpp - oo=mosi ii=miso cc=sck pp=cs-protocol
        cache-param2: 0x04000000 # 0xssxxxxxx - ss=cs
        load-target: ram
    

    where cache param1 is mosi, miso, clk and then the last byte is 01 which is the protocol byte.
    cache param2 is the cs pin and the other values are zero.

    Note these pin numbers are in hex, so pin 16 would be 10.

    The open SimpleIDE, and at the bottom left corner, board type is quickplayer, compiler type is C++, Memory model is XMMC and optimisation is for size.

    The hit the blue 'compile' triangle and it should download and run. You can confirm it really is running from ram by powering down, removing the ram chip and then trying to download.

    This really is super simple. One 8 pin chip and larger C programs can be run. And there are larger ram chips available in the same package, so just put the ram chip in a socket and it is easy to fix if running out of code space.
    Congratulations on getting this working! You probably don't want to modify the quickplayer.cfg configuration file though. It would be better to create a new file for your board.
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2013-03-20 16:05
    You probably don't want to modify the quickplayer.cfg configuration file though. It would be better to create a new file for your board.

    Good idea. I copied quickplayer.cfg into a new file (could be any name, I chose sram_spi.cfg) and pasted it in the same directory. It comes up in the list of board types, but not in alphabetical order (it is at the start). However it is there so this is by far the neatest solution.

    I hope this helps our original poster.
Sign In or Register to comment.