Propeller GCC - TV Demo
Baggers
Posts: 3,019
Hi All,
I've got my driver initially converted to run with the C stuff.
It's still working from TOP of memory for it's buffers for now.
But if you unzip this demo, and copy the Graphics folder to the SD card
then in a prompt of the MAC/PC that has Propeller-gcc setup, type
make run
Which will then make the demo, and run it.
It will then scan the Graphics folder and load every BMP file it comes across.
Make sure the BMPs are 32bit, and 768 pixels wide ( although it only shows 640 of the 768 pixels ), and 480+ deep.
http://www.jimbagley.co.uk/P2_BMP_Viewer.zip
This is the updated version, which is a BMP viewer, you unzip, copy the Drivers, Fonts, Graphics folder to your SD card, ( careful not overwriting any old graphics files for those on Macs )
Assuming you have the C setup installed, you can compile it with
make run
Or just run it manually with P2Load as the object is pre-built
p2load -b 115200 -r 1, TVGraphicsDemo.elf -t
Navigate with Key3 down and Key1 up, and Key2 select, then Key2 when you've finished looking at the pic, to go back to the file select
You can also load new fonts, if you have old 1bit ( two colour ) fonts, any size up to 256 chars ( 8x8 )
I've left the old version, as this has the Graphics folder still saves me adding all the graphics each time.
http://www.jimbagley.co.uk/TVGraphicsDemo.zip
I've got my driver initially converted to run with the C stuff.
It's still working from TOP of memory for it's buffers for now.
But if you unzip this demo, and copy the Graphics folder to the SD card
then in a prompt of the MAC/PC that has Propeller-gcc setup, type
make run
Which will then make the demo, and run it.
It will then scan the Graphics folder and load every BMP file it comes across.
Make sure the BMPs are 32bit, and 768 pixels wide ( although it only shows 640 of the 768 pixels ), and 480+ deep.
http://www.jimbagley.co.uk/P2_BMP_Viewer.zip
This is the updated version, which is a BMP viewer, you unzip, copy the Drivers, Fonts, Graphics folder to your SD card, ( careful not overwriting any old graphics files for those on Macs )
Assuming you have the C setup installed, you can compile it with
make run
Or just run it manually with P2Load as the object is pre-built
p2load -b 115200 -r 1, TVGraphicsDemo.elf -t
Navigate with Key3 down and Key1 up, and Key2 select, then Key2 when you've finished looking at the pic, to go back to the file select
You can also load new fonts, if you have old 1bit ( two colour ) fonts, any size up to 256 chars ( 8x8 )
I've left the old version, as this has the Graphics folder still saves me adding all the graphics each time.
http://www.jimbagley.co.uk/TVGraphicsDemo.zip
Comments
And it validates the PropGCC build I did last week. Nice. I'm up on Snow Leopard.
@all: If you don't get a successful read on the SD, format it and drop the Graphics folder on there. Should work then. FAT16, 2GB is what I used.
I had the same issue, didn't work first time.
Formatted the SD card then it worked just great.
FAT32 16GB (Sandisk Utra SDHC)
Regards,
Coley
@Baggers: I'm gonna break out the scope and I've made some test cards for the driver. The new one renders nicely on a digital NTSC HDTV, but isn't centered. Tears on an analog one with component option turned on. Composite looks good, and I got a coupla pictures. Crappy ones, but I'll send 'em along later tonight when I get another pass at this.
I strongly suspect the pixels are coming too early in the scan line for NTSC, but can't confirm it yet. I'm gonna have a nice DVD player that does the full frame, output a few test images for me to look at on the scope to see what is what.
I'll have another go late tonite. We are just out of sync time zone wise. I found the C fiddly, due to the fixed addressing. Sometimes I can modify code, sometimes I can't.
For a quick test, I just ran the SPIN older driver and this one in C. The good news is ordinary composite seems to look equally good on my displays! The basics are deffo there. I'll catch up with you on SKYPE once I know something.
@Coley, FAT 32? Sweet! That means an ordinary format operation on Windows and Mac OS will work great. Did you format the card to 32GB, or smaller?
I'm gonna work on making it all use a PAR to the COG to set the structure for the hub ram layout. this could fix the problem, before we go searching around the PropGCC filesystem code.
I was speaking more about the allocator algorithm. How does it handle allocation and consolidation? Is it a standard buddy allocator?
I was reading up on the buddy allocator system recently, and it make for an interesting and efficient system of memory allocation, but I was thinking of another approach that was brought on by this thread.
The buddy allocator performs binary division of the heap to dice up blocks of memory that are the minimum required size. It keeps a free heap list for each memory block size available, if a block is unavailable, it breaks down one of the next larger blocks, working its way up the list if necessary. When freeing, it checks to see if the buddy block in the same larger allocation unit is free, then recombines them.
In the context of the Propeller, you might have 2 different types of allocator needs, the "runtime" heap and the "system" heap. The idea would be that you could use the buddy system to first divide the HEAP into heap1 and heap2. heap1 would be for "frequent" allocations and heap2 would be for "static", or infrequent, allocations. Objects like frame buffers or network devices would allocate static buffers, but may be unloaded.
The runtime would try and allocate only from heap1 unless it encounters memory pressure, then heap2 would handle the overflow. But the point is to try and allocate large contiguous chunks from heap2 and allow heap1 to become fragmented.
Another option would be to choose heap2 vs heap1 based on the size of requested allocation. By default the large requests would be satisfied from heap2 and small from heap1, with the probability being that small allocations lead to more turnover and fragmentation, while large allocations are typically longer lived and benefit from contiguous blocks.
Forget about realloc, that's a mess an a half if you are handling large blocks!
I don't know that my ideas are any better, I just have a hunch.
You should probably call opendir from your main routine, and getfilename would just have to get the next file in the directory instead of having to scan through the directory each time it is called. Another solution would be to do strcpy(filename, dp->d_name) before calling closedir, where filename would be declared at the top of your program as "char filename[13]".
As for the d_name after, was a mistake, as it was going through changes, and I wanted to get a first version out for others to see.
As I have it being able to select a file, from the list, and navigate through directories.
I just need to get some time to get the memory buffers for the display driver to be allocated, and all in a PAR that's passed to the driver.
Hopefully this weekend.
David, can the -t terminal be run in a specific cog? as it seems to start itself in COG0, and gets over written by the TV driver now, don't know what I did different to make it do that?
Is there any chance, you can make it do -t4 to make it start in cog4?
Cheers
Jim.
-r 1,
Btw, what is running in Cog0? anything?
I'm curios as to why the file IO is stopping on doing an opendir now.
How about this?
I couldn't find the binary value in instructions.spin for JMP, there's JMPRET but no JMP as I was going to do it as a single int, included in the C. I ended up using a 2K pre-cleared buffer ( part of the screen ), so it'll be nops, until it gets to the sysvars I'll fix it in next update.
HAHA nice one on licensing!
Works a treat now anyway, even with the 0s for the coginit.
Will fire up the PC later, and do a jmp #$
Updated the first post enjoy!