Shop OBEX P1 Docs P2 Docs Learn Events
SimpleIDE and filetest.c — Parallax Forums

SimpleIDE and filetest.c

RsadeikaRsadeika Posts: 3,837
edited 2012-04-10 15:15 in Propeller 1
I am running into a problem with the filetest.c program that I cannot resolve. It does not matter what uSD card that I use, and what board that I use, it always comes up with an - ' ./: I/O error '. Yes, I have some test1.txt file(s) on the cards that I have tried, and I also reformatted one of the cards to make sure it was fresh. I have tried the program below with the C3 board, which used to work with my SanDisk card, and now it does not. I am using the latest SimpleIDE 0-6-2 program, is it something with side, or is the program itself corrupting the uSD card? Hopefully somebody can test this out using the latest SimpleIDE to verify that it actually works on somebodies system.

Ray

Comments

  • denominatordenominator Posts: 242
    edited 2012-04-10 07:20
    Ray,

    You are using an obsolete version of filetest.c. We made a lot of changes in the SD driver - it now handles SDHC cards, works much more robustly with subdirectories, and supports shared a SPI bus more completely (by supporting locking and consistently supporting SPI addressing schemes throughout the PropGCC loading and running process).

    Unfortunately, the 0.6.2 release occurred during the flux of the changes. I can't tell you what is the proper source file is without a lot of work.

    I think the best solution is for you might be to upgrade to 0.6.4 (download it from http://code.google.com/p/propside/downloads/list). Then, grab the latest filetest.c source from http://code.google.com/p/propgcc/source/browse/demos/c3files/src/filetest.c (use the "view raw file" link at the lower right). Be sure to look for the new "mount" routine and change your config parameters accordingly if you are not using a C3 card.

    I've tested this and it works for me. And, thanks for trying this out!

    - Ted
  • RsadeikaRsadeika Posts: 3,837
    edited 2012-04-10 10:54
    I just installed the Windows SimpleIDE 0-6-4, and the new filetest.c, works as expected. I ran it in LMM mode with printf.c, that worked. I also ran it in XMM, and XMMC mode without printf.c add in, that also worked. I wonder if there is way to run it in LMM mode with printf.c being within filetest.c main code? I wonder if you could add the printf.c code to an .h file, and then do a ifdef _LMM_ to get at it when you are using LMM mode? Not sure if that would work, but at least it would be one less thing to worry about.

    Ray
  • Dave HeinDave Hein Posts: 6,347
    edited 2012-04-10 11:14
    You could add a "#include "printf.c"", though it's not normal coding practice to include a C file. You could also use printf.c with the XMM and XMMC modes. That would work as well.
  • RsadeikaRsadeika Posts: 3,837
    edited 2012-04-10 11:32
    I guess the reason there is an "printf.c" is so filetest.c can be run in LMM mode. If I am going to be using XMM mode, then I would want to take advantage of the full implementation "printf", and not have "printf.c" compiled with the program.

    I just stuck in a 4GB uSD card, and that worked as expected. I think that is the largest uSD card that I have. To bad the boards do not support an SD card reader, I do have a 32GB SD card, that would be interesting.

    Now the question is, is there a way of using, lets say, 1 GB of the uSD card within XMM or XMMC mode?

    Ray
  • Dave HeinDave Hein Posts: 6,347
    edited 2012-04-10 12:15
    You could do

    #ifdef __PROPELLER_LMM__
    #include "printf.c"
    #endif

    or if you don't want to mess with a separate printf.c file you could copy the entire text of printf.c to filetest.c with a #ifdef __PROPELLER_LMM__ to enable it at compile time. The LMM mode needs it so that it will fit in 32K of RAM.

    I don't understand your question about using 1GB of the uSD card for XMM/XMMC. It is possible to run XMMC programs directly from an SD card. Is that what you want to do? I forget the exact details, but you need to convert the ELF file to a PEX file and write it to the SD card.
  • RsadeikaRsadeika Posts: 3,837
    edited 2012-04-10 12:57
    On the C3 board you have a 1MB flash which the XMM/XMMC mode makes use of for creating large programs. On the QSboard you have a 64KB EEPROM which you can use XMMC mode to make use of for larger programs. So, if you have an uSD reader attached to the QSboard, could it be possible to use the uSD card with XMM/XMMC mode to be used for larger programs? So I guess what I am asking is if it can use XMMC or XMM mode to access the uSD card for more program space instead of the EEPROM? A pseudo 1GB EEPROM that is configured on the uSD card?

    In the old days a PC, because of limited RAM, would use the hard drive to extend the available RAM. My thinking is, use the uSD card to extend the available program space. Now I am not sure if that could be accomplished on the Propeller as it exists today.

    Looking at the C3 docs I noticed that there are two 32KB SRAM chips, can that be accessed, with some added feature of filetest.c? I am still not sure of how SRAM chips could be used within the scope of PropGCC programming.

    Ray
  • denominatordenominator Posts: 242
    edited 2012-04-10 12:59
    Rsadeika wrote: »
    I guess the reason there is an "printf.c" is so filetest.c can be run in LMM mode. If I am going to be using XMM mode, then I would want to take advantage of the full implementation "printf", and not have "printf.c" compiled with the program.

    I just stuck in a 4GB uSD card, and that worked as expected. I think that is the largest uSD card that I have. To bad the boards do not support an SD card reader, I do have a 32GB SD card, that would be interesting.

    Now the question is, is there a way of using, lets say, 1 GB of the uSD card within XMM or XMMC mode?

    Ray

    Ray,

    The printf is definitely there to make the program fit in LMM mode. If you tried to use the library's printf you'd overflow the 32K memory. Dave's solution with the #ifdef/#include is perfect for your needs.

    Parallax does sell a "full size" SD card reader, though it's a kit - you have to solder some surface mount resistors. Or you can get one elsewhere. Either way, you then attach it to your favorite board - it takes 6 wires. I've done this myself and it's not too much of a hassle.

    If you want to run a 1GB program, the magic you're looking for is the "propeller-load -z", which works for XMMC mode only. Here's an example:

    propeller-elf-gcc somebigprog.c -mxmmc -o somebigprog.elf
    propeller-load -z somebigprog.elf -b <yourboard> -r -t

    This could be very slow if you actually have a 1GB program, because it tries to send the 1GB program over the serial link. If you want to do this, you might want to try the alternative:

    propeller-elf-gcc somebigprog.c -mxmmc -o somebigprog.elf
    propeller-load -x somebigprog.elf
    < at this point, transfer somebigprog.pex to your SD card's root directory and name it AUTORUN.PEX >
    propeller-load -z -b <yourboard> -r -t

    I don't know how to run programs with the -z flag using the SIDE - maybe Steve can help out here.

    Two other notes:

    The -z flag says "run the program in XMMC mode using the SD card as the cache backing store." This means that the XMMC kernel pulls in your program in 512-byte chunks from the SD card. Because the cache lines are so big, it is one of the slower caching schemes in PropGCC.

    If you want to use the SD card in -z mode (e.g. the filetest.c program), you must pass 0 to the call to dfs_mount(). That tells the SD routines in the library that the SD card handler is already installed and initialized (because it is handling the cache misses). You can see code for this in filetest.c if you search for SD_IS_USING_SD_CACHE_DRIVER.

    - Ted
  • denominatordenominator Posts: 242
    edited 2012-04-10 13:01
    Rsadeika wrote: »
    Looking at the C3 docs I noticed that there are two 32KB SRAM chips, can that be accessed, with some added feature of filetest.c? I am still not sure of how SRAM chips could be used within the scope of PropGCC programming.
    Ray

    Ray,

    The SRAM is for XMM mode (as opposed to XMMC mode). This allows you to have a program with data that exceeds 32K. However, because both code and data need to be cached, your program experiences more cache misses and runs slower.

    - Ted
  • jazzedjazzed Posts: 11,803
    edited 2012-04-10 15:15
    I'm free to post again ....

    Ray,

    In addition to C3 XMM (uses flash and ram) and C3F XMMC (uses only flash), you can use SimpleIDE C3F-SDXMMC board type with XMMC memory model. C3F uses all of cache for Flash. You can also attach SDCard to a Quickstart if you like - more info on this later.

    Look here for the SimpleIDE user guide section that talks about board type. More information is being added.

    For now, you should be able to choose board type C3F-SDXMMC for your XMMC memory model program. When you click Burn (green down v arrow), Run (green right -> arrow), or Run Console (blue right > arrow or play button), SimpleIDE will automatically compile, download to SDcard, and run the program. You can also use the download button to send files to your SD card (this will also compile a .pex before download).

    I'll be demoing lots of this SimpleIDE stuff Friday.

    --Steve
Sign In or Register to comment.