CPROVER Manual TOC

## Build Systems and Libraries

### Example: Extracting Models from the Rockbox

The Rockbox is an open-source software package for common MP3 players, with about 1 million lines of code in total.

1. First of all, you will need to install one of the cross-compilers. Follow the instructions here.

2. You will then need to check out the Rockbox sources with GIT, and configure and compile the code. Follow these instructions. The build must succeed. We will assume that one of the ARM-based targets is used, and that the ARM cross-compiler is installed at /usr/local/bin/arm-elf-eabi-gcc.

3. Now download gcc-wrap.c:

   `lwp-download http://www.cprover.org/cprover-manual/gcc-wrap.c`

4. Open gcc-wrap.c in your favorite editor, and adjust the path to gcc (in the first line) to /usr/local/bin/arm-elf-eabi-gcc (it is important that the full path is given).

5. Now compile gcc-wrap:

   `gcc gcc-wrap.c -o gcc-wrap-arm-elf-eabi-gcc`
   `cp gcc-wrap-arm-elf-eabi-gcc ~/bin/`

   This assumes that the directory `~/bin` exists and is in your PATH variable.

6. Now re-compile the Rockbox code as follows:

   `make clean`
   `make CC=gcc-wrap-arm-elf-eabi-gcc`

   This will re-compile the Rockbox, but this time retaining the preprocessed source files.

7. You can now compile the preprocessed source files with goto-cc as follows:

   `find ./ -name \*.i > source-file-list`
   `for a in `cat source-file-list` ; do`
   `goto-cc -std=gnu99 -m32 -c $a -o $a.gb`
   `done`

   Note that it is important that the word-size of the target platform matches that of goto-cc. For a 32-bit target, pass the option -m32 to goto-cc.

The resulting `.gb` files can be passed to any of the CPROVER tools.