Reusing assembly space?
So I'm building some large, multi-object code, of which many of the objects will grab a cog permanently and load it up
with some assembly language.
Unfortunately, the assembly language ends up taking "main" RAM space even after the cog is loaded and started. I'd
really like to be able to reuse this space somehow.
Is there any way in SPIN to say, put this assembly language at the highest address possible (or something like that),
and aggregate it with any other so-marked code snippets, so after my cogs are all loaded I can clear and reuse that
chunk of RAM?
Or is the preferred design to have two "versions" of an object, one with the assembly, and one without that
assumes the cog is already launched and running? And then do a two-stage load, the first of which only loads and
sets up the cogs, and the second loads the "real" main that leaves those cogs running and therefore doesn't waste
memory on cog assembly?
Or is there something fundamental I'm missing?
The reason I ask is that it seems to me there is really about 64K of RAM in the propeller (loosely speaking), and
it would be very nice to be able to make more efficient use of it without playing really dirty tricks with the tool.
with some assembly language.
Unfortunately, the assembly language ends up taking "main" RAM space even after the cog is loaded and started. I'd
really like to be able to reuse this space somehow.
Is there any way in SPIN to say, put this assembly language at the highest address possible (or something like that),
and aggregate it with any other so-marked code snippets, so after my cogs are all loaded I can clear and reuse that
chunk of RAM?
Or is the preferred design to have two "versions" of an object, one with the assembly, and one without that
assumes the cog is already launched and running? And then do a two-stage load, the first of which only loads and
sets up the cogs, and the second loads the "real" main that leaves those cogs running and therefore doesn't waste
memory on cog assembly?
Or is there something fundamental I'm missing?
The reason I ask is that it seems to me there is really about 64K of RAM in the propeller (loosely speaking), and
it would be very nice to be able to make more efficient use of it without playing really dirty tricks with the tool.
Comments
· I was just about to ask the same question.
· Like you say, once the assembly code is loaded into COG ram, the hub ram (where it was loaded from EEPROM) is really free. But like you, I cannot figure out how to re-use it.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap used 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
SX-Video Display Modules www.sxvm.com
Stuff I'm selling on ebay http://search.ebay.com/_W0QQsassZhittconsultingQQhtZ-1
"USA Today has come out with a new survey - apparently, three out of every four people make up 75% of the population." - David Letterman
There is no easy way to reuse the space in HUB memory for something else. If all the assembly objects were grouped together in one source file (object file), you could use the DAT space for buffers, but that would be pretty much it. Another alternative would be for a setup program to write out several 512 word blocks to a 2nd page of EEPROM, one for each cog's contents and the actual program would not have the DAT sections, but would read these in one by one to a HUB RAM buffer, then start up a COG with the buffer contents.
Post Edited (Mike Green) : 12/18/2006 7:01:00 PM GMT
but also the code that loads them up. A two-phase load makes good sense, but the problem with this is we
don't have conditional compilation or anything, so it's hard to have one integral "object" that does both
phases.
In a way, the OS uses a great approach; you put as much generic infrastructure code as possible into COG
memory, which means the "application" program gets more memory for its own purposes.