projects:vlam:pbcc:pbcc

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.

VLAM supports the work on PBCC. 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.

By downloading any of the following files, you agree with its GNU GPL v3 license (see GNU General Public License 3):

  • version 2011-10-24 (fifth public version, beta (SVN rev #59, based on SDCC 3.0.1)
  • version 2011-09-01 (fourth public version, beta (SVN rev #58), based on SDCC 3.0.1)
    • Binary package: pbccv2-bin-win32-cygwin-2011-09-01.zip (4.9 MB)
    • Source code: 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
  • 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

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)

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;
}

PicoAsm is open source assembler for Xilinx PicoBlaze-3 from George Smith (see the homepage). We improved this tool to be able to work properly with VLAM IDE and its Makefiles.

    • Feel free to 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)
  • openPICIDE Homepage - IDE for developing assembly code for PicoBlaze
  • pblazeasm - assembler command-line tool for PicoBlaze-3 and PicoBlaze-6 with several useful extensions
  • Mediatronix Tools - tools and new graphical simulator for PicoBlaze-3 and PicoBlaze-6
  • FIDEx - new IDE for soft-core processors (supports PicoBlaze-3, -6 and its clones)
  • projects/vlam/pbcc/pbcc.txt
  • Last modified: 2017/08/30 12:09
  • by krivka