Shop OBEX P1 Docs P2 Docs Learn Events
Question about _free — Parallax Forums

Question about _free

Mike GreenMike Green Posts: 23,101
edited 2006-07-19 19:41 in Propeller 1
Is there any documentation on just where the stack and free memory are located in RAM? In many systems, the stack begins at the end of the program and extends towards higher addresses while free memory begins at the last address and extends towards the stack. In other systems, the opposite is true. I'm interested in that I'm trying to set up an overlay system that allows video, keyboard, and mouse operation to continue while switching between SPIN programs. The video buffers and some control information will need to be allocated in "free" memory so they can continue to be referenced by various I/O cogs.

Comments

  • Paul BakerPaul Baker Posts: 6,351
    edited 2006-07-19 18:38
    I think that the original spin cog is the only unbound process as far as the stack is concerned. If I remember correctly the stack for this process starts at the end of the declared space and grows upwards. This unbound process can be replaced with a bound spin process by using coginit to replace the original process.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ...
  • Mike GreenMike Green Posts: 23,101
    edited 2006-07-19 19:41
    I believe you're correct, but it would be nice to get a definitive answer. Also, Chip gave an example of a minimal boot prefix for loading assembly language into a cog. There's a field "vbase" which is supposed to be the total number of bytes loaded. I assume this includes the boot prefix (in other words, from location 0 through the last byte of assembly). Is this field treated the same way for SPIN programs? In other words, the EEPROM and "hardware boot" store 32K bytes, but the IDE seems to only transmit the amount of data actually needed. I'd like to use the value in "vbase" to limit the amount of data loaded from other sources.
Sign In or Register to comment.