Shop OBEX P1 Docs P2 Docs Learn Events
Understanding Program Info — Parallax Forums

Understanding Program Info

HumanoidoHumanoido Posts: 5,770
edited 2010-09-09 07:03 in Propeller 1
I have some information returned by the software tool about a spin program.

program: 2106 Longs
variable: 112 Longs
Stack/Free: 5970 Longs


* I can add up the VAR statements and it equals exactly 112 Longs. Ok.

* But how to get the 2106 Longs in the program? How can this be verified? i.e. I want to manually count something to add up to 2106.

Is this counting the program size in HUB RAM from the one cog?

If so, it looks like there's more room in the HUB. But, what if other programs load into all other cogs that take up the same space?

* Also, what is the Stack/Free statements telling us? The slash is for what?

Thank you in advance. Humanoido

Comments

  • kuronekokuroneko Posts: 3,623
    edited 2010-09-09 03:32
    Humanoido wrote: »
    * But how to get the 2106 Longs in the program? How can this be verified? i.e. I want to manually count something to add up to 2106.

    Is this counting the program size in HUB RAM from the one cog?

    Do you have Show Hex enabled (Propeller Tool, F8 window)?
  • HumanoidoHumanoido Posts: 5,770
    edited 2010-09-09 03:37
    No. F8 brings up the information I mentioned.
  • kuronekokuroneko Posts: 3,623
    edited 2010-09-09 03:41
    Humanoido wrote: »
    No. F8 brings up the information I mentioned.

    What if you enable it?
    800 x 465 - 86K
    hex.jpg 85.5K
  • Heater.Heater. Posts: 21,230
    edited 2010-09-09 04:04
    Humanoido:
    Is this counting the program size in HUB RAM from the one cog?

    Not sure I quite get what you mean. The "Program" size you see there includes all the Spin byte codes of all the objects you have written. Plus all the data in DAT sections, could be data could be PASM code. It really does not matter which bits of code is eventually run in which COG.
    Also, what is the Stack/Free statements telling us? The slash is for what?

    The stack required by you programs Spin code is placed at the end of all the code, data, and variables. The Stack grows upwards from there.

    So if you program has 1000 longs Stack/Free and it only actually uses 20 LONGs for stack then you have 980 LONGs of unused, free, space at the top of HUB.
    I want to manually count something to add up to 2106.

    Compile your program with BST and have a look in the listing window. There you will see all the resulting byte codes, variables PASM etc etc.
  • HumanoidoHumanoido Posts: 5,770
    edited 2010-09-09 05:35
    from compiled binary file
    674 x 392 - 78K
    2.jpg 77.8K
  • kuronekokuroneko Posts: 3,623
    edited 2010-09-09 05:51
    Humanoido wrote: »
    from compiled binary file

    Well, I hope you can see that program space is colour coded with red. If you need a second opinion about the validity of the long count just count the red area in the hex dump and divide by four. I still don't get why you don't trust the initial info ...
  • HumanoidoHumanoido Posts: 5,770
    edited 2010-09-09 06:37
    kuroneko wrote: »
    Well, I hope you can see that program space is colour coded with red. If you need a second opinion about the validity of the long count just count the red area in the hex dump and divide by four. I still don't get why you don't trust the initial info ...
    Thanks Kuroneko, I found the Hex dump in the Parallax Software Tool version but is there an easy way to count Longs in Hex? I trust the numerical information implicitly, however the information is just a number. My Propeller project thinking is completely visual and the information must be turned into a visual prospect for complete understanding.
  • kuronekokuroneko Posts: 3,623
    edited 2010-09-09 06:40
    Humanoido wrote: »
    Thanks Kuroneko, I found the Hex dump in the Parallax Software Tool version but is there an easy way to count Longs in Hex?

    Is the address difference (last red minus first red + 1) acceptable? :) If that's not what you mean, please explain.

    In my screenshot it's $CF - $10 + 1 = $C0 (192 bytes -> 48 longs).
  • HumanoidoHumanoido Posts: 5,770
    edited 2010-09-09 06:49
    Heater, thank you. I'm trying to know what the memory usage is. The Hex dump window shows a memory bar that says "RAM USAGE" with red program, yellow variables, and blue free space. So this is all 32K HUB ram? My question is, if this shows one program loaded into one cog, where is the view of 8 programs loaded into 8 cogs? My goal is to have a simple way to know what total memory is used, and what memory remains (all cogs). If you look at the blue, you can see 8 times the red + yellow will not fit.
  • Heater.Heater. Posts: 21,230
    edited 2010-09-09 07:03
    Humanoid,
    So this is all 32K HUB ram?

    Yes.
    ...if this shows one program loaded into one cog,...

    No it does not.

    What you see in the hex dump is what gets loaded into HUB RAM from start up, either from the Prop Tool or from EEPROM.

    That loading process does not load anything into COGs except the Spin interpreter into COG 0 which starts to run your programs main method.

    The other COGs are empty until your code loads them with something using COGINIT or COGNEW.

    That "something" is the PASM code you have written and is sitting there in HUB RAM, along with everything else, waiting to be loaded into some COG by your program.

    So we see that if you want 8 COGs all running different PASM programs of maximum size then you have 16K bytes of PASM instructions sitting in that 32K HUB RAM on start up.

    If you want 8 COGs all running the same object then the Prop Tool will only put one copy of it into the HUB image.
Sign In or Register to comment.