Pico C
Dave Hein
Posts: 6,347
Someone had asked about Pico C in another thread. I ported Pico C to the Prop about 9 months ago when I was looking into Forth. Pico C is an interactive C interpreter. C statements can be entered interactively and executed immediately. I played around with it a little bit, but I didn't pursue it very far. However, I thought I would post the code here in case someone else is interested in it. I modified the makefile that came with Pico C, and I built it from the command line. It may be possible to build it under SimpleIDE, but I didn't try that. It has to be built with the XMMC model. Check out the Pico C site at http://code.google.com/p/picoc/ if you're interested in trying it. There is a Wiki there with some information on how to use it.
Comments
I'm on an OS X machine, and was able to run make after adding /opt/parallax/bin/ to my path. picoc was generated and appears to be an elf file.
Should I be able to run this on a Quickstart board? I tried to load it with the following command (and some variations):
propeller-load -Dreset=dtr -I /opt/parallax/propeller-load/ -b QUICKSTART -p /dev/cu.usbserial-AH00OLRA picoc -r -e -t -D baudrate=115200
I just a few bytes of garbage in the terminal after using the above.
I don't know if the baud rate is correct, or if the eeprom on the Quickstart is sufficiently large. I can setup an SD card if necessary.
For fun I tried building the DDS BASIC Interpreter V1.0(a) from IOCCC in SimpleIDE and that came right up. (I just changed some numbers to reduce the memory requirements.)
Thanks,
Keith
No. As you suspect the EEPROM is too small. I've run the demo using SDXMMC, but it's quite slow.
The best XMMC solution for most people seems to be a DIP8 Flash on a bread-board. There are other possibilites though.
Is there a list of supported parts? The only flash reference I saw on the learn.parallax.com was to the C3 board. I would rather pick something that's already working. If I can pickup one in a DIP package then I'll do that just to have it as an option.
I'm assuming that Parallax doesn't think that this will be a common usage model, otherwise the Propeller Activity board would have one since it's being suggested as a good C platform? If a stock Activity board can't support Pico C well, then it's probably of little interest since there wouldn't be critical mass. I'll give it a go with an SD card and see how bad it is.
-Keith
The W25Q80 Winbond flash is the one most often used because it works in SingleBit and QuadBit SPI modes. The best performance so far is by adding two QuadSPI devices in parallel, but that uses 10 pins and the performance gain on average is only about 33% over single bit SPI which uses 4 pins.
Thanks,
Keith
My second favorite place in the valley
Don't know of any retail suppliers with SPI Flash in the Bay Area. I usually get parts through mouser or digikey - all I have now is SMD for the SSF PCB's.
Could you let me know what you did to run Pico C in SDXMMC mode? Did you have to change anything in the Makefile? Could you paste what loader options you used? I just unpacked my Activity Board so I can give this a shot.
Regards,
Keith
I've attached a SimpleIDE Picoc package to use for board type ACTIVITYBOARD-SDXMMC . It takes about 10 seconds to start up with SDXMMC. For comparison, it starts up in a few seconds on board type C3F and less than a second on SSF (dual QuadSPI).
I was wondering, should the Propeller loader be able to detect when you attempt to load an image that won't fit? It would seem that it could figure this out from the board type. e.g. when I tried to load this into an eeprom? Maybe something for the kanban queue?
Yes, we can put size tags in the board config file. Will check with David.
Normally size is checked in the linker, but we don't use board info in the build.
Thanks.
Here is a version of PicoC that will run from a 64KB EEPROM (most hardware except SpinStamp, PropellerMini, Demoboard which have 32KB EEPROMS).
File access is disabled.
Since the code is running from EEPROM, there is about 24KB of RAM available for user programs.
It is not possible to use #include in this example. It is also not possible as far as I can tell to access propeller hardware features (yet).
Now for adding Propeller hardware access ....
Replace library_unix.c with the code below and "Run with Terminal".
Then enter these lines on the picoc terminal to make P27 LED on the ActivityBoard blink once per second.
New contents of library_unix.c adds these library functions:
void high(int);
void low(int);
void output(int);
void input(int);
int pin(int);
void ctra(int);
void frqa(int);
void phsa(int);
void ctrb(int);
void frqb(int);
void phsb(int);
Other functions can be added following the examples given in the code.
Here is a version with all Propeller features for running on 64KB EEPROM.
Propeller features are accessible using the following library functions:
/*
* get the current CNT value.
*/
int cnt();
/*
* get the system clock frequency value.
*/
int clkfreq();
/*
* set outa pin high. use output(pin) to set dira so that outa appears on pin.
*/
void high(int pin);
/*
* set outa pin low. use output(pin) to set dira so that outa appears on pin.
*/
void low(int pin);
/*
* set dira pin high for output.
*/
void output(int pin);
/*
* set dira pin low for input.
*/
void input(int pin);
/*
* get value of pin(num).
*/
int pin(int num);
/*
* get value of all pins.
*/
int pins();
/*
* set ctra value.
*/
void ctra(int value);
/*
* set ctrb value.
*/
void ctrb(int value);
/*
* set frqa value.
*/
void frqa(int value);
/*
* set frqb value.
*/
void frqb(int value);
/*
* set phsa value.
*/
void phsa(int value);
/*
* set phsb value.
*/
void phsb(int value);
/*
* set vcfg value.
*/
void vcfg(int value);
/*
* set vscl value.
*/
void vscl(int value);
/*
* wait for cnt to be value. return value+adjust.
*/
int waitcnt(int value, int adjust);
/*
* wait for pins & mask to equal value.
*/
void waitpeq(int value, int mask);
/*
* wait for pins & mask to not equal value.
*/
void waitpne(int value, int mask);
/*
* wait for video generator.
*/
void waitvid(int value1, int value2);
Everything seems to work. It's a bit slow though.
There isn't much room for new user functions.
major flashback......
Yep - Anchor is right across from the Nvidia headquarters. (Not too far from the new football stadium)
I forget where the first Fry's w/ electronics in the area was - somewhere near Lakeshore drive? That was a funny blend - I first went in the mid-to-late 80's. Too bad the the dot com days blew up the Computer Literacy bookstore. There's a digital guru bookshop close to where that used to be, but it's not quite the same. St John's Bar and Grill is still there ;-)
Blossom Hill Rd. was a two laner between San Jose and the rest of Los Gatos. Used to beat the derailuers off of my Raleigh with the loop Almaden expwy dead end to calero-anderson-guadalupe dam ending near by the little IBM / 9hole golf course next to home. Probably could not find my anymore even if there was a map pasted to it with pictures. Miss what it was, likely could not stand what it has become though........
If I understand what you're referring to, I used to work at Weitek on Arques and my boss would take certain out of the country visitors there for business negotiations ;-)
Edited to add - Frank there's now an NFL football stadium "Levi's (tm)" in what used to be the Great America overflow parking lot right next to the 49er headquarters. It will be interesting to see how it messes up things this fall.
Probably made them feel at home. I ate lunch there once ... barf.
Yup, right across from David's and Santa Clara Muni Golf. There is a small-ish garage and a light-rail stop. I heard Cisco sold real-estate around Vista Montanya (my old stomping grounds) to facilitate building more parking structures ... parking will be tight regardless.
Blossom Hill road has been supplemented by Interstate 85.