Shop OBEX P1 Docs P2 Docs Learn Events
Propeller Problems with Large Code — Parallax Forums

Propeller Problems with Large Code

rcm14rcm14 Posts: 11
edited 2012-05-02 12:47 in Propeller 1
Has anyone ever had problems with the Propeller not operating correctly with large codes?

I wrote a large program which will ONLY work if I separate the program into halves and run each half on its own cog. The flow is: go through the first half, initialize the second half in a new cog, shut down the first half, go through the second half, initialize the first half in a new cog (only when prompted by a user from the serial terminal), and finally shut the second half down.

This seems ridiculous. I am not sure what the problem is. Any thoughts or suggestions?

Thanks.

Comments

  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-05-02 12:36
    I've heard the Prop starts to have trouble if there isn't much empty space at the end of the program.

    I believe this space is used as the stack for cog 0 when the Prop starts so if you don't have any empty space the stack over runs part of the program.

    There are options of using external memory where you start out with part of your program and the lauch a different program from EEPROM or a SD card. There are a couple of programs out there to do this. I've used a modified version of Dr_A's KyeDos myself. I think Cluso99 also has a multi program OS for the Prop (I think he leaves this "OS" on the EEPROM (which is write protected) which in turn runs programs from SD cards).
  • Mike GreenMike Green Posts: 23,101
    edited 2012-05-02 12:43
    The only thing that makes sense is that the program uses a lot of stack space and, by forcing the program into two separately executed pieces (but still sitting in memory together), you don't use as much stack space. The space from the end of the program to the end of RAM is used for the default stack for the initial cog (usually cog 0). When you do a COGNEW, you have to supply a stack for that cog to use and that stack has to be defined somewhere as a variable with its size determining the size of the stack (with no checking done).
  • Dave HeinDave Hein Posts: 6,347
    edited 2012-05-02 12:46
    There are many things that can cause weirdness. The solution you are using is most likely masking the problem, but it shouldn't be required to fix the problem. Post your code.
  • Mike GMike G Posts: 2,702
    edited 2012-05-02 12:47
    rcm14, sounds like you are overrunning a buffer. I have some applications that run with ~100 free longs and use all 8 COGs.

    Post your code.
Sign In or Register to comment.