PicoBlaze FAQ – Is there a C-Compiler?
There is no official C compiler currently available (September 2007). There have been independent offerings which have been made available to the PicoBlaze community but to my knowledge nothing has been professionally developed or made consistently available. Of course something my have been released since posting this message so please do add any updates that you are aware of to this thread.
Whilst on the subject of compilers it is worth considering if they are really suitable for PicoBlaze anyway. Please understand that I am not against having a compiler but we should keep in mind that it does only support a program space of 1024 instructions and has a scratch pad memory of only 64-bytes. There are micro controllers on the market with less or similar resources to PicoBlaze for which compilers are available. However, we must also recognise that such small micro controllers are quite physically constrained as to what applications they can be used for and consequently the compilers have generally been highly optimised to suit those classes of application. Likewise it is reasonable to expect such a compiler to constrain you to using 8-bit or 16-bit integer math’s rather than IEEE 32-bit floating point ‘real’ numbers and with such a constraint it really isn’t so different to writing assembler which actually provides you the flexibility to implement the precision you require for each variable.
The question you should also ask yourself is even if there were a C compiler, would PicoBlaze be viable? Remember it is an 8-bit processor with 1K-instruction space so are you looking at the size of code that will fit? May be you actually need to look at MicroBlaze with its comprehensive set of tools (EDK) where the C language is the standard coding method.
Assuming PicoBlaze is viable for your application then writing at the assembler level is not so difficult given the maximum size of the programs. Very often PicoBlaze is used to control hardware and working at the assembler level combined with a processor which always executes every instruction in 2 clock cycles leads to 100% predictable timing if and when you need that ultimate control. The architecture and instruction set of KCPSM3 was also created with the ease of assembly programming in mind. Having 16 registers which can be used in all instructions without restrictions makes handling of local variables very easy to manage. The automatic call/return stack enables subroutines to be nested to a depth of 31 levels and is something you can take it for granted. In contrast, if you used a processor without an automatic stack then you would definitely feel the need to have a compiler which would manage (hide) the details of implementing a software stack for you. All I ask is that you give it a try; my only warning being that it is often such fun that it becomes addictive!
Regards,
Ken Chapman