Combining two source codes in one program
propwell
Posts: 87
Hi together,
i want to combine the codes of the Graphics Demo and Terry-Hitts OSD-Code in one program. With the mouse plugged in, you should be able to switch between these programs.
Unfortunately, the Propeller Tool tells me, that the memory limit exceeds...
Anyone an idea?
Thank you very much!
i want to combine the codes of the Graphics Demo and Terry-Hitts OSD-Code in one program. With the mouse plugged in, you should be able to switch between these programs.
Unfortunately, the Propeller Tool tells me, that the memory limit exceeds...
Anyone an idea?
Thank you very much!
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
24 bit LCD Breakout Board coming soon. $21.99 has backlight driver and touch sensitive decoder.
Thanks,
max
Is it necessary to switch with the mouse? Is it for a product or just for demo? If the answers are no/demo, then you could think about a hardware solution. Have another EEPROM in parallel to the existing one (I2C is a bus). Then you only need a switch and 2 resistors which alternately pull the adress-line of one or the other EEPROM to high. Switch EEPROM1 + reset and code in EEPROM1 is booted and runs / switch EEPROM2 + reset and code in EEPROM2 runs.
Nice thing here .. the propeller tool works perfectly with this solution. Switch to the desired EEPROM and you can load any program into it. The other one is untouched.
If you need a professional version, you can use a bigger EEPROM + an I2C driver written in PASM. (The I2C driver in PASM is important as you want to reload the whole HUB-RAM, which would overwrite SPIN code.) Then you can use the same technique as the FSRWfemto SD card driver (see Femto-Basic in ObEx) to restart the propeller with new code.
But here you have the problem of putting·program 2 in the upper part of the EEPROM. That's not supported by the Propeller Tool.·
What's the size of the resulting code? In other words how many longs do we need to save?
A possibility to save memory is to put COG-code and SPIN-code in separate sections of the EEPROM ( the COG-code in the upper-part of EEPROM). The SPIN code can load the COG code into the graphics buffer and then start the COG with it one after another during initialization. 1st graphics driver, 2nd keyboard/mouse-driver, 3rd tv-driver, 4th whatever ......
This saves up to 2kB per COG - which might be enough to have the SPIN code of both programs + graphics buffer in HUB-RAM.
How to put PASM sections into upper EEPROM memory? Have a look at PASMStore (last post of this thread http://forums.parallax.com/forums/default.aspx?f=25&m=338494 )
Terry's code uses a slightly modified graphics driver. So with a plain merge of both codes you would have two different graphics drivers running - each with roundabout 3000 longs as screen buffer.
So, first thing is to use the same graphics object in both. Then the propeller tool can optimize.
Do you need the GPS driver?
Do you need the serial driver?
Do you need keyboard?
Serial Recv Buffer Inverted and Serial Recv Buffer True seem to be verry equal. The minor differences could propably be handeled in the PASM, so that you only need one of the drivers and use it two times.
In graphics.spin a lot of SPIN functions do the same thing - calling setcommand. Get rid of these functions and call setcommand directly.
Get rid of all SPIN-functions that are not needed.
Put all the drivers in upper EEPROM and use the graphics buffer to load them in the beginning.
thank you for your answer!
Yeah, i think the screenbuffers do much of the problem. Unfortunately, i don't know how to make them use the same buffers:
The OSD-Code uses:
and the graphics-one:
I can't really find anything, that they have in common! I don't need GPS, serial and keyboard, but without it, it still calls me the error.
Maybe it's easier to understand my problems with my source codes.
So i attached the 2 programs i want to combine!
Thank you so much for your help!
propwell