[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

1. General


1.1 Introduction

vbcc is a highly optimizing portable and retargetable ISO C compiler. It supports ISO C according to ISO/IEC 9899:1989 and a subset of the new standard ISO/IEC 9899:1999 (C99).

It is split into a target-independent and a target-dependent part, and provides complete abstraction of host- and target-arithmetic. Therefore, it fully supports cross-compiling for 8, 16, 32 and 64bit architectures.

Embedded systems are supported by features like different pointer-sizes (e.g. differently sized function- and object-pointers or near- and far-pointers), ROM-able code, inline-assembly, bit-types, interrupt-handlers, section-attributes, stack-calculation and many others (depending on the backend).

vbcc provides a large set of aggressive high-level optimizations (see section Optimizations) as well as target-specific optimizations to produce faster or smaller code. Rather than restricting analysis and optimization to single functions or files, vbcc is able to optimize across functions and even modules. Target-independent optimizations include:


1.2 Legal

vbcc is copyright in 1995-2011 by Volker Barthelmann.

This archive may be redistributed without modifications and used for non-commercial purposes.

Distributing modified versions and commercial usage needs my written consent.

This copyright applies to vc, vbcc and vsc.

This archive may contain other tools (e.g. assemblers or linkers) which do not fall under this license. Please consult the corresponding documentation of these tools.

vbcc contains the preprocessor ucpp by Thomas Pornin. Included is the copyright notice of ucpp (note that this license does not apply to vbcc or any other part of this distribution):

 
/*
 * (c) Thomas Pornin 1999, 2000
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 4. The name of the authors may not be used to endorse or promote
 *    products derived from this software without specific prior written
 *    permission.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 */

1.3 Installation

The vbcc directory tree looks as follows:

vbcc/bin

The executables.

vbcc/config

Config files for the frontend.

vbcc/targets/<target>

Subdirectory containing all files specific to a certain target (e.g. m68k-amigaos or ppc-eabi).


1.3.1 Installing for Unix

  1. Extract the archive.
  2. Set the environment variable VBCC to the vbcc directory. Depending on your shell this might be done e.g. by
     
            VBCC=<prefix>/vbcc
            

    or

     
            setenv VBCC <prefix>/vbcc
            
  3. Include <prefix>/vbcc/bin to your search-path. Depending on your shell this might be done e.g. by
     
            PATH=<prefix>/vbcc/bin:"$PATH"
            

    or

     
            setenv PATH <prefix>/vbcc/bin:"$PATH"
            

1.3.2 Installing for DOS/Windows

  1. Extract the archive.
  2. Set the environment variable VBCC to the vbcc directory.
     
            set VBCC=<prefix>\vbcc
            
  3. Include <prefix>/vbcc/bin to your search-path.
     
            set PATH=<prefix>\vbcc\bin;%PATH%
            

1.3.3 Installing for AmigaOS

Since vbcc 0.8g there is an Amiga Installer, which lets you install the binary and target archives with a simple mouse click. vbcc for AmigaOS/MorphOS is divided into the following packages:

vbcc_bin_amigaos68k

Binaries for AmigaOS 2.x/3.x (680x0).

vbcc_bin_amigaosppc

Binaries for AmigaOS 4.x (PowerPC).

vbcc_bin_morphos

Binaries for MorphOS (PowerPC).

vbcc_bin_powerup

Additional PPC-native binaries using the PowerUp kernel for AmigaOS 3.x.

vbcc_bin_warpos

Additional PPC-native binaries using the WarpOS kernel for AmigaOS 3.x.

vbcc_target_m68k-amigaos

Header files and libraries for AmigaOS/M68k.

vbcc_target_ppc-amigaos

Header files and libraries for AmigaOS 4.x.

vbcc_target_ppc-morphos

Header files and libraries for MorphOS.

vbcc_target_ppc-powerup

Header files and libraries for PowerUp.

vbcc_target_ppc-warpos

Header files and libraries for WarpOS.

Usually you will install the binary archive for your host architecture of choice, then add as many target archives you need.

When installing manually it is recommended to add the following assigns to your ‘s:User-Startup’ file (only do the assignments required for the installed targets):

 
assign >NIL: vbcc: <path to vbcc directory>
assign >NIL: C: vbcc:bin add
 
assign >NIL: vincludeos3: vbcc:targets/m68k-amigaos/include
assign >NIL: vincludeos3: <path to your AmigaOS3 header files> ADD
assign >NIL: vlibos3: vbcc:targets/m68k-amigaos/lib

assign >NIL: vincludeos4: vbcc:targets/ppc-amigaos/include
assign >NIL: vincludeos4: <path to your AmigaOS4 header files> ADD
assign >NIL: vlibos4: vbcc:targets/ppc-amigaos/lib

assign >NIL: vincludemos: vbcc:targets/ppc-morphos/include
assign >NIL: vincludemos: <path to your MorphOS header files> ADD
assign >NIL: vlibmos: vbcc:targets/ppc-morphos/lib

assign >NIL: vincludepup: vbcc:targets/ppc-powerup/include
assign >NIL: vincludepup: <path to your AmigaOS3 header files> ADD
assign >NIL: vlibpup: vbcc:targets/ppc-powerup/lib

assign >NIL: vincludewos: vbcc:target/ppc-warpos/include
assign >NIL: vincludewos: <path to your AmigaOS3 header files> ADD
assign >NIL: vlibwos: vbcc:target/ppc-warpos/lib

Also, the stack-size has to be increased from the default, for those binaries which don’t do that automatically (e.g. AmigaOS4). 64KB is a sensible value, for very large projects higher values might be necessary.

For writing AmigaOS/MorphOS programs you will need the appropriate system header files. Please use NDK 3.9 or later for AmigaOS/68k, as the proto/inline headers have been created with it.

There are different configuration files provided in the ‘config’-subdirectory to choose different targets (i.e. the system you want to generate programs for) and hosts (i.e. the system you want the compiler an tools to run on). The general naming-scheme for these files ist <target>_<host>.

Available config files, when all targets are installed, are ‘aos68k’ (AmigaOS on M68k), ‘aosppc’ (AmigaOS4 on PPC using vclib), ‘newlib’ (AmigaOS4 on PPC using newlib), ‘morphos’ (PPC systems running MorphOS), ‘powerup’ (PPC boards using the PowerUp system), ‘warpos’ (PPC boards using the WarpOS system).

You can choose one of these systems using the ‘+’-option of vc, e.g.

 
    vc +aos68k_powerup ...

will compile for AmigaOS/68k using the compiler running on PowerUp.

You may choose to create copies of some of these configuration files with simpler names. E.g. if you usually want the compiler to run on WarpOS you could copy ‘aos68k_warpos’ to ‘aos68k’, ‘warpos_warpos’ to ‘warpos’ and so on. Then you can just specify the target and your preferred host system will be chosen automatically.

Additionally, you may copy the configuration file for your preferred host/target-combination to ‘vc.config’. This configuration will be chosen by default if you do not specify anything.

By default, the target-only-specifications use 68k-native tools on AmigaOS 2.x/3.x, e.g. ‘+warpos’ will create code for WarpOS, but the compiler and tools will run on the 68k. The default ‘vc.config’ will then create code for 68k using tools running on 68k. Having installed the MorphOS-native binary archive instead, the default ‘vc.config’ will create PPC code for MorphOS using tools running on MorphOS.


1.4 Tutorial

Now you should be able to use vbcc. To compile and link the program ‘hello.c’, type

 
        vc hello.c

The file ‘hello.c’ will be compiled and linked to create the executable a.out in the current directory.

 
        vc hello.c -o hello

will do the same, but the created executable will be called ‘hello’.

 
        vc -c t1.c t2.c

will compile ‘t1.c’ and ‘t2.c’ without linking, creating the object files ‘t1.o’ and ‘t2.o’.

 
        vc t1.o t2.o -o tt

will link them together and create the executable ‘tt’.

If your program uses floating point, you may have to link with a math-library. The details are dependent on the target, but usually ‘-lm’ will be suitable (for AmigaOS on m68k choose one of ‘-lmieee’, ‘-lm881’ or ‘-lm040’).

 
        vc calc.c -o calc -lmieee

[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated by vb on January 3, 2015 using texi2html 1.82.