Question about threads
pedward
Posts: 1,642
I was reading the propeller lib info and had a question about threads.
Will the PropGCC kernel automatically launch threads on unused COGs to help distribute cycles among free COGs?
By definition, if you are using pthreads you assume that the threads can run simultaneously or serially, depending on the architecture.
The way the documentation is written, I am getting the feeling that pthreads run on the COG they are invoked from.
BTW, very nice work. It's clear that most of the PropGCC effort isn't in the compiler, but rather the kernel that implements the runtime interface, eg: XMM, device drivers, pthreads, libc/libm.
Will the PropGCC kernel automatically launch threads on unused COGs to help distribute cycles among free COGs?
By definition, if you are using pthreads you assume that the threads can run simultaneously or serially, depending on the architecture.
The way the documentation is written, I am getting the feeling that pthreads run on the COG they are invoked from.
BTW, very nice work. It's clear that most of the PropGCC effort isn't in the compiler, but rather the kernel that implements the runtime interface, eg: XMM, device drivers, pthreads, libc/libm.
Comments
Yes, using pthreads with LMM mode gives you full SMP (Symmetric Multiprocessing) ability. That is, all threads get evenly distributed across all COGs. However, in XMM modes (XMMC, XMM-SINGLE, XMM-SPLIT), multi-threading is limited to one COG.
Thanks.
Also, I wanted to ask about packaging GCC on your USB key later after General Availability. One of the reasons I started a USB stick design last year was to create a demo/distribution package for Propeller GCC. Maybe we could use yours?
One thing I added was a couple of QuadSPI flash chips to demo XMMC mode - that design beats everything I've seen so far in performance. Even EEPROM XMMC beats SD Card XMMC performance.
An alternate XMMC or XMM-SINGLE solution is to use an FRAM chip - FRAM only comes in SOIC-8 though. It's pricey, but competitively priced with other solutions. Assuming you might be interested in that, a GCC special edition might be worth the extra effort/FRAM cost.
--Steve
The only thing that doesn't seem intuitive is creating projects where you mix COG, LMM, and XMMC code in the same project. To take advantage of LMM code, but XMMC for the main body of code. Launch a pthread in LMM, run main code from XMMC, have drivers in COG.
Yeah, the PropKey makes for a great dev platform for PropGCC. I think a QR code to download the SIDE would go a long way towards getting adoption.
I tested COG, LMM, and XMMC with EEPROM and SD on the PropKey, all worked well. The PK runs at 96 Mhz, so a little faster than the convention and it has 64KB of EEPROM, though this can be made larger.
A SIP daughter card would give you some SPI flash, since power an the P31-P20 are on the same side of the board.
The SD card pins are brought out too, so you could hang SPI off of those pins too.
Actually that makes a difference. We can use up to about 124KB of a 128KB part for programs. ST makes a 256KB part.
I was going to ask you if you could squeeze in a couple of SOIC8 QuadSPI chips for 4MB+ Flash, but figured you didn't need such a distraction or wouldn't have room. I've done this on a board already, but need to change to the SSOP16 FTDI chip. My fingers are too fat for QFN.
The way it's done now is: set the memory model to XMMC, put LMM code into HUBTEXT sections, and add COG C code in foo.cogc (or use PASM in a .spin file). Add files to the project and build with the hammer.
Will PropGCC use SPI ram effectively in this scenario?
I can easily make a little board that plugs on top, that has flash. The XMMSIP it could be called.
If you wanted 8 bit SPI, P20-P27 are free, it would be a 16 pin SIP module that plugged vertically on the right side of the board.
You could steal the clock line for I2C or perhaps the SD card. Too bad a CS wastes a pin.
LOL, that said, I can make a daughter board and put memory on that for less than the cost of the FRAM.
How does 16MB of dual qSPI flash sound? The chips are around ~$3.75 each, initial estimates would be $25 assembled I think.
http://media.digikey.com/pdf/Data Sheets/Winbond PDFs/W25Q64FV.pdf
The part above supports QPI, so you can transmit the commands 4 bits at a time, which should help with XMMC a lot, they specifically callout XIP as something that can benefit. XIP and XMM are the same thing basically.
If you want to make an adapter board for QuadSPI it's ok by me. I may revive my design from last year with the new SSOP16 FTDI part since it would be cheaper.
FRAM as you note would be a drop-in replacement for existing EEPROM, and a new driver would be used for speed. Some folks think it could also be used like an SRAM for XMM-SINGLE mode. I cringe at the price, but it has some utility.
Thanks,
--Steve
As it stands, I have to order about 75 boards for a general release, and I have to get the order in May 14th, which is cutting it close from the time I'll get the latest release candidate back.
I will design a daughter board, and depending on the demand for it, I can incorporate the FLASH and new FT230X/FT231X into version 1.2.