====== PicoBlaze C Compiler ======
PicoBlaze C Compiler (PBCC) is a cross-compiler of C language for 8-bit soft-core Xilinx PicoBlaze-3 processor.
PBCC is based on Small Device C Compiler (SDCC) as a new port for this compiler framework.
The current version is possible to run on Windows 32-bit Cygwin platform and Unix-based systems.
===== About VLAM Project =====
VLAM supports the work on PBCC. [[http://www.vlam.cz/index.html.en|Virtual Laboratory of Microprocessor Technology Application]] (VLAM) is a research project founded by Czech Ministry of Education, Youth and Sports. The project has been approved under National research program II with number MSMT 2C06008. The main goal is to introduce and implement new ways of the education in the embedded system topics.
===== History =====
* [[pbcc20100215|PBCCv1]] (version 2010-02-15)
===== Requirements =====
* [[http://www.microsoft.com|Microsoft]] Windows XP/Vista/7, 32-bit platform
* [[http://sdcc.sourceforge.net|Small Device C Compiler with PicoBlaze port]] (binary included in the package)
* [[http://www.xilinx.com/picoblaze|Xilinx PicoBlaze Assembler]]
* [[http://www.mediatronix.com/pBlazeIDE.htm|pBlazeIDE]] (simulation tool for Windows, optionally)
===== Download =====
By downloading any of the following files, you agree with its GNU GPL v3 license (see [[http://www.gnu.org/licenses/gpl.html|GNU General Public License 3]]):
* version 2011-10-24 (fifth public version, beta (SVN rev #59, based on SDCC 3.0.1)
* Binary package: {{:projects:vlam:pbcc:pbccv2-bin-win32-cygwin-2011-10-24.zip|pbccv2-bin-win32-cygwin-2011-09-01.zip}} (5.1 MB)
* Source code: {{:projects:vlam:pbcc:pbccv2-src-2011-09-01.zip|pbccv2-src-2011-10-24.zip}} (11.4 MB)
* Changes:
* Several bug fixes concerning the comparison of signed integers
* version 2011-09-01 (fourth public version, beta (SVN rev #58), based on SDCC 3.0.1)
* Binary package: {{:projects:vlam:pbcc:pbccv2-bin-win32-cygwin-2011-09-01.zip|pbccv2-bin-win32-cygwin-2011-09-01.zip}} (4.9 MB)
* Source code: {{:projects:vlam:pbcc:pbccv2-src-2011-09-01.zip|pbccv2-src-2011-09-01.zip}} (9.3 MB)
* Changes:
* new command-line parameter --port-kw=PORTARRAYID
to set the keyword used to identify the virtual array to access PicoBlaze ports using INPUT/OUPUT instruction from C code by setting PORTARRAYID[0] = 0x20;
or reading int val = PORTARRAYID[255];
To use this code, add to the begining of your source extern volatile char PBLAZEPORT[];
* fixed bug with duplicity of labels
* version 2011-06-12 (third public version, beta (SVN rev #52), based on SDCC 3.0.1)
* Binary package: {{:projects:vlam:pbcc:pbccv2-bin-win32-cygwin-2011-06-12.zip|pbcc-bin-win32-cygwin-2011-06-12.zip}} (4.3 MB)
* Source code: {{:projects:vlam:pbcc:pbccv2-src-2011-06-12.zip|pbccv2-src-2011-06-12.zip}} (11.4 MB)
* version 2011-02-10 (second public version, beta (SVN rev #32), based on SDCC 3.0.1)
* Binary package: {{:projects:vlam:pbcc:pbcc-bin-win32-cygwin-2011-02-10.zip|pbcc-bin-win32-cygwin-2011-02-10.zip}}
* Source code: [[krivka@fit.vutbr.cz|Write me an email if you are interested]] (GNU GPL-like licenses)
* version 2010-02-15 (first public version, alfa (SVN rev #181, MC rev #89))
* Binary package: {{:projects:vlam:pbcc:pbcc-bin-win32-2010-02-15.zip}}
* Front-end Source: {{:projects:vlam:pbcc:sdccpb-src-2010-02-15.zip}} (GNU GPL v2)
* Back-end Binary: {{:projects:vlam:pbcc:pbccb-bin-win32-2010-02-15.zip}} (Freeware)
* version 2009-01-01 (see internal private pages)
==== Add-ons ====
* {{:projects:vlam:pbcc:pspad_kcpsm3.zip|KCPSM3 and PBCC JSON Syntax Highlighting Files}} for [[http://www.pspad.com/en/|PSPad 4.5.3]] (updated 2010-02-06)
* inluding Colors configuration for KCPSM3 and PBCC JSON Highlighters (partial copy of %LOCAL_USER%\Roaming\PSpad\PSPad.INI), merge it with you PSPad.INI or just set the configuration in GUI
===== Documentation =====
* {{:projects:vlam:pbcc:pbccv2_user_manual.pdf|PicoBlaze C Compiler v2 User Manual}} (revision 2, 2011/02/10)
* {{:projects:vlam:pbcc:pbcc_user_manual.pdf|PicoBlaze C Compiler User Manual}} (revision 1, 2010/02/07)
* [[http://sdcc.sourceforge.net/doc/sdccman.html/|SDCC User Manual]]
* [[http://www.xilinx.com/support/documentation/ip_documentation/ug129.pdf|Xilinx PicoBlaze-3 Processor Manual]]
==== Limits of the compiler ====
* no linkage - PicoBlaze-3 processsor is so small that linkage has no practical use, you can use only text-based header/source include using #include directive for the preprocessor
* no standard library - there is no implementation for standard C library such as stdio, string, etc. (most of the functions are just too big to fit into its small memory)
* no dynamic allocation - there is no malloc or free function to do the memory management
==== Known bugs ====
As the compiler still has many bugs and missing features, it is good to know them:
* Global variables just partially supported (working on register allocation optimizations along with the support of global variables)
* Optimized switch does not work (JUMPTABLE)
* Missing: Get highest bit, get value at address, pointer set, address of (SDCC iCodes)
* Inlining not supported yet
* Problems with passing array as a function argument
* Generated invalid interrupt vector jump code (as a trivial IVT)
==== Code Examples ====
To make better overview what can be used in C language and validly processed by PBCC, see following code examples:
void __port_write(volatile char port, volatile char arg) {
unsigned volatile char p;
unsigned volatile char a;
p = port;
a = arg;
__asm
OUTPUT _a, _p
__endasm;
}
#define LCD_wr(arg) __port_write(0x40, (arg));__port_write(0x41, 01)
int main(void) {
char ch = 0x41;
LCD_wr(ch);
return 0;
}
* Set of {{:projects:vlam:pbcc:demos_tests.zip|Examples to download}} (14 files).
===== PicoAsm =====
PicoAsm is open source assembler for Xilinx PicoBlaze-3 from George Smith ([[http://marksix.home.xs4all.nl/picoasm.html|see the homepage]]). We improved this tool to be able to work properly with VLAM IDE and its Makefiles.
==== PicoAsm Download ====
* version 2011-10-27 (based on [[http://marksix.home.xs4all.nl/downloads/Picoasm_29mar08.tar.gz|Picoasm_29mar08.tar.gz]])
* Binary package: {{:projects:vlam:pbcc:picoasm-bin-win32-2011-10-27.zip}} (493 KB)
* Source code: {{:projects:vlam:pbcc:picoasm-src-2011-10-27.zip}} (23 KB) (GNU GPL v2)
* Modifications by [[http://www.fit.vutbr.cz/~vasicek|Zdeněk Vašíček]]:
* New command-line argument -o that denotes output file without extension (.hex is added)
===== License =====
* PBCCv2 license is inherited from SDCC v3.0.1 as [[http://www.ohloh.net/p/sdcc/analyses/latest|GPL version 2, mostly]] (see COPYING in the package)
===== Author =====
* [[krivka@fit.vutbr.cz|Zbyněk Křivka]] ([[http://www.fit.vutbr.cz/~krivka/index.php.en|See homepage]])
* Feel free to [[krivka@fit.vutbr.cz|contact me]], if you have some suggestions.
* Jakub Horník
* Main programmer of the SDCC port written in C language (as a part of his Master thesis)
===== Related links =====
* [[http://openpicide.org/content/about/|openPICIDE Homepage]] - IDE for developing assembly code for PicoBlaze
* [[http://code.google.com/p/pblazasm/|pblazeasm]] - assembler command-line tool for PicoBlaze-3 and PicoBlaze-6 with several useful extensions
* [[http://www.mediatronix.org/pages/Tools|Mediatronix Tools]] - tools and new graphical simulator for PicoBlaze-3 and PicoBlaze-6
* [[https://www.fautronix.com/en/fidex|FIDEx]] - new IDE for soft-core processors (supports PicoBlaze-3, -6 and its clones)