Understanding Program Info
Humanoido
Posts: 5,770
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
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
Do you have Show Hex enabled (Propeller Tool, F8 window)?
What if you enable it?
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.
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.
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.
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 ...
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).
Yes.
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.