Shop OBEX P1 Docs P2 Docs Learn Events
New user having problems — Parallax Forums

New user having problems

RsadeikaRsadeika Posts: 3,837
edited 2012-02-17 10:46 in Propeller 1
I am testing propgcc on my Windows XP SP3 computer. I am using the "Hello world" example, and I get the following:

Verifying ... Upload OK!
[Entering terminal mode. Type ESC ...

But, I do not get "Hello world" displayed on the screen.

I tried 'propeller-load -p com5 hello -r -t', and 'propeller-load -p com5 -b C3 hello -r -t' , to get the same results, nothing on the screen. So, am I doing something wrong, or did I miss a step?

Ray
«134

Comments

  • jazzedjazzed Posts: 11,803
    edited 2012-01-29 09:38
    Rsadeika wrote: »
    I tried 'propeller-load -p com5 hello -r -t', and 'propeller-load -p com5 -b C3 hello -r -t' , to get the same results, nothing on the screen. So, am I doing something wrong, or did I miss a step?

    Ray

    Hi Ray.

    What GCC package/version are you using?
    Is the hello example from the INSTALL.txt?
    Can you list the files in your hello directory?
    Can I assume you are using your C3?

    Thanks,
    --Steve
  • RsadeikaRsadeika Posts: 3,837
    edited 2012-01-29 10:27
    -windows-i686-propgcc_v0_2_2
    -readme_windows.txt
    -hello.c, hello (I ran hello.c with propeller-elf-gcc -o hello hello.c)
    -Yes, I am using the C3.
  • jazzedjazzed Posts: 11,803
    edited 2012-01-29 11:13
    Hi Ray,

    I downloaded the latest v0_2_2 package and followed the directions which worked on Windows7.

    I need to find my Windows XP Netbook and try it. It is locked in my daughter's room right now.
    I'll post again when I've tried that - I have other commitments today so it will be later.

    One question. How did you start your command window?
    I double-clicked the propgcc.bat file. That automatically sets the path.

    Also, I don't use the -p comx option much anymore now that propeller-load automatically detects and uses the first USB COM port.
    So, for example i just say: c:\propgcc\propeller-load -r -t hello

    The auto-detect only detects ports right now and may stall a while if a Propeller is not found. We are adding a more efficient auto-detect propeller soon.
  • RsadeikaRsadeika Posts: 3,837
    edited 2012-01-29 11:34
    I tried the program below, using:
    propeller-elf-gcc -o ledonoff ledonoff.c
    propeller-load -p com5 ledonoff -r -t
    which seem to work, I was seeing 'LED on', 'LED off' on the screen. So, I am not sure why your example is not working for me.

    Ray
    #include <stdio.h>
    #include <propeller.h>
    
    #define INPUT 0
    #define OUTPUT 1
    
    #define LOW 0
    #define HIGH 1
    
    #ifndef __cplusplus
    #define bool _Bool
    #endif
    
    int pinMode(int pin, bool mode)
    {
      DIRA = (mode << pin);
      return(DIRA);
    }
    
    int digitalWrite(int pin, bool state)
    {
      OUTA = (state << pin);
      return(OUTA);
    }
    
    void pause()
    {
      waitcnt(CLKFREQ+CNT);
    }
    
    int main()
    {
      const int pin = 7;
      pinMode(pin, OUTPUT);
    
      while(1)
      {
        digitalWrite(pin, HIGH);
        pause();
        printf("LED On");
        digitalWrite(pin, LOW);
        pause();
        printf("LED off");
      }
      return 0;
    }
    
    
  • jazzedjazzed Posts: 11,803
    edited 2012-01-29 12:18
    Ray, can you change your hello.c file to use printf("Hello World\n"); ? That is add \n after the message.
  • RsadeikaRsadeika Posts: 3,837
    edited 2012-01-29 12:19
    Since the above program works, what are the steps to have it load into LMM,XMM,and XMMC? Can propgcc use command line arguments? An example would be, with the above program, ledonoff 7 2000, which means use pin 7, and pause for 2 seconds. The other thought that I have is, will there be a driver for using the xbee modules? I guess my general question is, will there be drivers for all the things that Parallax sells, and will it be on a timely basis? I have noticed that there has always been a problem with Parallax supplying drivers for all the things that they sell.
  • RsadeikaRsadeika Posts: 3,837
    edited 2012-01-29 12:42
    Well, I just discovered the new user problem is, the new user does not know how to read the instructions correctly. Now, when I tried the example program, it works as intended. The big lesson - first you have to compile the program using propeller-elf-gcc, then you can run the program by using propeller-load. When will that GUI IDE be ready? Now I guess I have to prepare some bat file(s), so I can automate this compile and load process.

    Ray
  • jazzedjazzed Posts: 11,803
    edited 2012-01-29 12:49
    Rsadeika wrote: »
    Since the above program works, what are the steps to have it load into LMM,XMM,and XMMC?
    The default mode is LMM, so your program would be running with that now.

    For XMM today, you would say:

    propeller-elf-gcc -mxmmc -o ledonoff ledonoff.c
    propeller-load -p com5 ledonoff -r -t -b C3F

    or

    propeller-elf-gcc -mxmm -o ledonoff ledonoff.c
    propeller-load -p com5 ledonoff -r -t -b C3

    XMMC mode is "code only" mode. That is the program is saved in flash and data lives in HUB ram. With that mode you use board type -b C3F for better performance, but -b C3 would also work. XMM mode uses Flash and SRAM and is often much slower.


    Another mode is COG and your program will run entirely from a single COG.

    propeller-elf-gcc -mcog -o ledonoff ledonoff.c
    propeller-load -p com5 ledonoff -r -t

    Rsadeika wrote: »
    Can propgcc use command line arguments? An example would be, with the above program, ledonoff 7 2000, which means use pin 7, and pause for 2 seconds.

    You mean passed from the loader? That's an interesting idea, but no we don't allow that today.

    The Propeller GCC program can accept parameters in main as int main(int argc, char* argv[]), so it may be possible to have the loader do that in a future release. Generally, we have to setup the pins and other parameters in the program today.
    Rsadeika wrote: »
    The other thought that I have is, will there be a driver for using the xbee modules?
    I guess my general question is, will there be drivers for all the things that Parallax sells, and will it be on a timely basis?

    We talked about making pre-built libraries last week. The first libraries will be for the PropBOE board. We will add other libraries after that. I can not make specific promises in this area, but I do know that PropBOE has an XBEE socket.
    Rsadeika wrote: »
    I have noticed that there has always been a problem with Parallax supplying drivers for all the things that they sell.
    It would be useful to get Ken Gracey involved in this part of the conversation. I'll send him a pointer.
  • jazzedjazzed Posts: 11,803
    edited 2012-01-29 12:51
    Rsadeika wrote: »
    When will that GUI IDE be ready? Now I guess I have to prepare some bat file(s), so I can automate this compile and load process.
    The GUI IDE will be ready for testing soon.
  • jazzedjazzed Posts: 11,803
    edited 2012-01-29 12:55
    Rsadeika wrote: »
    Well, I just discovered the new user problem is, the new user does not know how to read the instructions correctly. Now, when I tried the example program, it works as intended. The big lesson - first you have to compile the program using propeller-elf-gcc, then you can run the program by using propeller-load.

    Glad you got this sorted out!

    I'm a little confused though. If the hello program was not already built what got loaded before?

    Regardless, I have benefited greatly from this thread.

    Thanks,
    --Steve
  • RsadeikaRsadeika Posts: 3,837
    edited 2012-01-29 13:29
    I cannot remember the exact sequence, but I think the first thing that I tried was, propeller-load -p com5 -b C3 hello.c -r -t, and I believe it got loaded. But this is starting to sound like a guess on part.

    Since I am using a C3 board, are there functional SD card drivers? I noticed that somebody did a very, very basic full_duplex_serial driver, so when I add an RS-232 breakout to my C3, I will try to improve on the serial driver. Maybe now I can put my C3 board to some use, providing that there are drivers for the SD card.

    Ray
  • jazzedjazzed Posts: 11,803
    edited 2012-01-29 13:31
    Rsadeika wrote: »
    I cannot remember the exact sequence, but I think the first thing that I tried was, propeller-load -p com5 -b C3 hello.c -r -t, and I believe it got loaded. But this is starting to sound like a guess on part.

    Funny, I've done that too and it used to crash.
    Rsadeika wrote: »
    Since I am using a C3 board, are there functional SD card drivers? I noticed that somebody did a very, very basic full_duplex_serial driver, so when I add an RS-232 breakout to my C3, I will try to improve on the serial driver. Maybe now I can put my C3 board to some use, providing that there are drivers for the SD card.

    There are examples in the demo package.
  • RsadeikaRsadeika Posts: 3,837
    edited 2012-01-30 04:03
    I decide I would try the filetest.c program in the demo package. I am having problems...

    -propeller-elf-gcc -o fileteast filetest.c
    crashes: ... region 'hub' overflowed by 9896 bytes
    collect2: Id returned 1 exit status

    -propeller-elf-gcc -mxmm -o filetest filetest.c
    compiles
    -propeller-load -p com5 -b C3 filetest -r -t
    loads, but I do not see anything on the screen, like the contents of the help() function.

    The SD card that I am using is functional, because I just ran it in a SPIN environment using fsrw.

    It seems like using the -t is a hit or miss situation.

    Ray
  • Dave HeinDave Hein Posts: 6,347
    edited 2012-01-30 04:52
    Ray,

    I assume you are using the filetest.c program in demos/c3files/src. In the LMM mode, the filetest program uses a smaller version of printf that's located in the source directory along with filetest.c. The standard library printf takes up too much room in memory. Also, the default optimization does not produce compact code, so it makes the executable too large. You should compile the LMM version as follows:

    propeller-elf-gcc -Os -o filetest filetest.c printf.c

    I tried this, and it worked for me.

    I'm not sure why the XMM mode did not work for you. It works OK for me. Note, along with the c3files/src directory there are lmm, xmm, xmmc directories. These contain makefiles that will build the various memory models in those directories. Have you tried running make in one of those directories?

    Dave
  • RsadeikaRsadeika Posts: 3,837
    edited 2012-01-30 04:54
    Below is a short, which compiles, but nothing appears on the screen, so I guess the program just hangs for some reason.
    /* test1.c */
    
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <cog.h>
    #include <propeller.h>
    #include <unistd.h>
    #include <sys/stat.h>
    #include <dirent.h>
    
    extern _Driver _SimpleSerialDriver;
    extern _Driver _FileDriver;
    
    _Driver * _driverlist[] = {
    &_SimpleSerialDriver,
    &_FileDriver,
    NULL
    };
    
    char *FindChar(char *ptr, int val);
    
    FILE *stdinfile;
    FILE *stdoutfile;
    
    void Help()
    {
      printf("Hello, World!\n");
    }
    int main()
    {
     /* printf("Hello, World."); */
    
      int num;
      char *tokens[20];
      uint8_t buffer[80];
    
      stdinfile = stdin;    /* Not sure, but this may be a problem */
      stdoutfile = stdout; /* Same here */
    
    #ifdef __PROPELLER_LMM__
    #ifdef SPINNERET_CARD
      buffer[0] = 16;
      buffer[1] = 21;
      buffer[2] = 20;
      buffer[3] = 19;
      LoadSDDriver(buffer);
    #else
      LoadSDDriver(0);
    #endif
    #endif
    
      dfs_mount();
    
      printf("\n");
      Help();
      return 0;
    }
    
    
  • Dave HeinDave Hein Posts: 6,347
    edited 2012-01-30 05:04
    Ray,

    I tried your test1 program, and it works on my C3 card. The program must be hanging on LoadSDDriver or dfs_mount in your case. Can you add debug prints before these calls to see where it's hanging? Did you try LMM or XMM? in XMM mode, LoadSDDriver is not used since the SD Driver is already included in the cache driver.

    Dave
  • RsadeikaRsadeika Posts: 3,837
    edited 2012-01-30 05:06
    I narrowed it down some more, and it seems like the dfs_mount() is causing the program to hang. I looked for the function in the header files, but I did not find it. Maybe I was looking in the wrong place.
  • Dave HeinDave Hein Posts: 6,347
    edited 2012-01-30 05:18
    dfs_mount is located in propgcc/lib/dirvers/FileDriver.c. I have attached a copy of it here in case you don't have the PropGCC source tree. Put this in the same directory as filetest.c and compile it along with filetest.c. The linker should use your local copy instead of the one in the library. This way you can add some debug prints to FileDriver.c.
  • Dave HeinDave Hein Posts: 6,347
    edited 2012-01-30 05:23
    You will need dosfs.h also.
    h
    h
    15K
    dosfs.h 14.8K
  • RsadeikaRsadeika Posts: 3,837
    edited 2012-01-30 06:58
    What is the command line for compiling more than one file? I just tried putting in a space and then add FileDriver.c, the compiler did not like that.

    -propeller-elf-gcc -o test1 test1.c FileDriver.c
  • RsadeikaRsadeika Posts: 3,837
    edited 2012-01-30 07:53
    I finally got the two files to compile, I think, but it is still hanging. I tried removing dfs_mount(), and compiling the two files, but it still hangs. I guess there is something in FileDriver.c that is causing the program to hang.

    The propgcc zip file did not have a Drivers folder in propgcc/lib, hopefully all this will be taken care in the next release. But, in the mean time ...

    Ray
  • Dave HeinDave Hein Posts: 6,347
    edited 2012-01-30 09:05
    Ray,

    Try commenting out the call to LoadSDDriver as well as dfs_mount in test1.c. Maybe it's LoadSDDDriver that's causing the problem. Also, try other SD cards.

    Dave
  • RsadeikaRsadeika Posts: 3,837
    edited 2012-01-30 11:16
    ****** Disregard I found it ******
    One of these days somebody will have to standardize SD cards, and SD card readers! The problem was the SD card, I tried a different one and it works, or at least the program does not hang.

    I am testing the program in small pieces, next puzzle to solve is:
    ... : undefined reference to '_tokenize'
    collect2: Id returned 1 exit status

    What header file is this in?

    Ray
  • Dave HeinDave Hein Posts: 6,347
    edited 2012-01-30 14:54
    Keep that SD card around. At some point it would be good to understand why dfs_mount hung on it. Maybe later on after you becomve more familiar with PropGCC you can add some prints to FileDriver.c or dosfs.c to see where it runs into a problem.

    tokenize is a function defined in filetest.c that extracts tokens from a string using the space character as a delimiter.
  • RsadeikaRsadeika Posts: 3,837
    edited 2012-01-31 02:51
    Last night I compiled test1.c, and It was working. This morning I just tied this:
    -propeller-load -p com5 test1 -r -t
    loader complains - error: no cache driver to load external image
    error: load failed
    I am not sure what is going on now.

    For the SD example program, I noticed that there are no commands for creating a file, was that intentional? Since I am new at this I doubt that I have enough skill to do it myself.

    What is the propGCC team using as an editor to work with files. I noticed yesterday when I was retyping the functions I missed some ')' and some '}', man it was a pain trying to find the problem. Any editors out there that catch that sort of stuff?

    Ray
  • RsadeikaRsadeika Posts: 3,837
    edited 2012-01-31 03:38
    The next mystery, for me anyways, in the ledonoff program I changed the printf("LED On ") and printf((LED Off ") to printf("LED On\n") and printf("LED Off\n"). When it displays to the screen, the first line is at the y,0 position, the next line(s) are at the y,1 position. I am not sure what is moving the cursor by 1. Is it something in the digitalWrite function, or when you use the digitalWrite function with a printf function?

    Ray
  • RsadeikaRsadeika Posts: 3,837
    edited 2012-01-31 04:42
    I just tried to run my ledonoff program on my GG HUB Platform board, the results:

    -propeller-load -p com6 ledonoff -r -t
    error writing port
    a device attached to the system is not functioning

    The big problem is, that propgcc hangs the CLI window, the task manager can not kill the task. The only way to get out is with a shutdown, gets to be little annoying after awhile.

    Ray
  • jazzedjazzed Posts: 11,803
    edited 2012-01-31 07:45
    Rsadeika wrote: »
    Last night I compiled test1.c, and It was working. This morning I just tied this:
    -propeller-load -p com5 test1 -r -t
    loader complains - error: no cache driver to load external image
    error: load failed
    I am not sure what is going on now.
    When you compile a program using -mxmm or -mxmmc, you must provide a board type. For example:
    propeller-load -p com5 test1 -r -t -b c3
    Rsadeika wrote: »
    For the SD example program, I noticed that there are no commands for creating a file, was that intentional? Since I am new at this I doubt that I have enough skill to do it myself.
    I'm not sure exactly what you mean. PropGCC is not an O/S. Dave's filetest.c program has a "cat" command though.
    Rsadeika wrote: »
    What is the propGCC team using as an editor to work with files. I noticed yesterday when I was retyping the functions I missed some ')' and some '}', man it was a pain trying to find the problem. Any editors out there that catch that sort of stuff?

    Ray

    There are some tools to help keep track of braces { and }. Try Notepad++ as shown below.
    You can set C from Menu Language->C, and it will add braces tracking for you.


    attachment.php?attachmentid=89125&d=1328024127


    The parentheses ( and ) are a little harder to keep track of and notepad++ does not have tracking for that.

    In any case using good indentation practice helps to get the braces right in any editor.

    The Eclipse IDE and plugin will have braces and parentheses tracking features.
    A package will be available that does all the setups for the IDE soon.
    550 x 459 - 116K
  • jazzedjazzed Posts: 11,803
    edited 2012-01-31 07:51
    Rsadeika wrote: »
    The next mystery, for me anyways, in the ledonoff program I changed the printf("LED On ") and printf((LED Off ") to printf("LED On\n") and printf("LED Off\n"). When it displays to the screen, the first line is at the y,0 position, the next line(s) are at the y,1 position. I am not sure what is moving the cursor by 1. Is it something in the digitalWrite function, or when you use the digitalWrite function with a printf function?

    Ray

    It is possible that toggling pin 31 of Propeller can put extra characters on a terminal. Usually they are not spaces though.
    Are you using the propeller-load terminal -t ? If you're using another terminal some settings may need to be adjusted.
  • jazzedjazzed Posts: 11,803
    edited 2012-01-31 07:54
    Rsadeika wrote: »
    I just tried to run my ledonoff program on my GG HUB Platform board, the results:

    -propeller-load -p com6 ledonoff -r -t
    error writing port
    a device attached to the system is not functioning

    The big problem is, that propgcc hangs the CLI window, the task manager can not kill the task. The only way to get out is with a shutdown, gets to be little annoying after awhile.

    Ray

    Ray, this problem is very serious and should not happen. I trust that it did happen of course, and we need to know why so we can fix it.

    Can you please try to recall all steps you took before this happened? For instance, did you have another terminal attached to your COM port?

    Thanks,
    --Steve
Sign In or Register to comment.