Buildspy – For gcc/g++ Users

We have added a new feature to this weekend’s build (623) of Understand called Buildspy that allows gcc/g++ users to create an Understand project during the build. Buildspy picks up files, includes, and macros from the compiler so you don’t have to enter them manually. This can save time and improve project accuracy.

To use Buildspy, you first need to change your compiler from gcc/g++ to gccwrapper/g++wrapper in your makefile or build system. Alternatively, it is possible to override these settings from the command line without having to touch the Makefile using a command like:

buildspy –db example.udb –cmd “make <additional_Make_Options>”

buildspy

You may also need to add the /SciTools/bin/linux32/buildspy directory to your path.Then, starting with a clean build, run:

buildspy –db path/name.udb –cmd <command to compile project>

For example:

image

This allows Buildspy to receive information from gccwrapper/g++wrapper to build a complete project. The wrappers will then call the corresponding compiler. To change the compiler edit the Buildspy.ini file located at $HOME/.config/SciTools on Linux systems and $HOME/Library/Preferences on Mac.

image

The wrappers will work with any compiler that has gcc-like syntax. To finish, simply open the project in Understand and Analyze All. Those tedious includes and macros are now set.

Cygwin/Windows Users

We have added support for Buildspy on Windows using Cygwin as of build 633. However, when the buildspy command results in this error:

gcc – Process failed to start: Access is denied.

extra setup is required.  Cygwin uses a symlink to access the gcc executable and the actual name of the executable is required in the configuration file.  Trace the symlink until the executable is found in order to get the actual name.  In my case, the executable was named gcc-3.

gccSymLink

On Windows, the configuration file is located in C:Users<USERNAME>AppDataRoamingSciTools and is called Buildspy.ini.  Open the Buildspy.ini file and change the compiler name appropriately.

buildpyINI

Once this is done, Buildspy should work as expected.

Any feedback on this new feature is welcome and appreciated.

 

Comments are closed on this post but I want to post some helpful feedback from one of our customers using Buildspy (12/6/13):

 

I thank SciTools for creating buildspy. I have successfully created a project that appears to be accurate for an embedded Linux kernel.

The steps below allow a consistent approach for a couple different build items. I believe this embedded Linux build could be done more like the description on SciTools web page but some of my other builds worked better using the steps below. I am providing the steps I took in case they will be of use to you or others:

Created arm-poky-linux-gnueabi-gcc and arm-poky-linux-gnueabi-cpp from gccwrapper and g++wrapper in /opt/Understand/bin/linux64/bu
ildspy. The arm-poky-linux-gnueabi-gcc wrapper script contents are:
#!/bin/bash
export LD_LIBRARY_PATH=/opt/Understan
d/bin/linux64/buildspy
${LD_LIBRARY_PATH}/gccwrapper.
bin “$@”

The arm-poky-linux-gnueabi-cpp wrapper script contents are:

#!/bin/bash

export LD_LIBRARY_PATH=/opt/Understand-3.1/bin/linux64
${LD_LIBRARY_PATH}/buildspy/g+
+wrapper.bin “$@”

Appended “.” to the cross-development environment arm-poky-linux-gnueabi-gcc and arm-poky-linux-gnueabi-cpp in the Yocto ./build/tmp/sysroots/x86_64-linux/usr/bin/armv7a-vfp-neon-poky-linux-gnueabi directory.

Created ~/.config/SciTools/Buildspy.ini with these contents:
[General]
ccCompiler=arm-poky-linux-gnueabi-gcc.
cxxCompiler=arm-poky-linux-gnueabi-g++.

sourced the Yocto cross-development environment setup script:
source ./oe*env
bitbake -c devshell virtual/kernel

Before running buildspy in the cross-development environment shell, changed the user name in /opt/Understand/conf/license/users.txt to root. Afterwards, restore it to the normal user.

In the cross-development environment development shell:
export STIHOME=/opt/Understand
export PATH=/opt/Understand/bin/linux64/buildspy:${PATH}
buildspy -db ../../../../../../_kernel.orig.udb -cmd ‘make -B -k -j 4 zImage CC=”arm-poky-linux-gnueabi-gcc  -mno-thumb-interwork -marm” LD=”arm-poky-linux-gnueabi-ld.bfd “‘

Remember to restore the username in /opt/Understand/conf/license/users.txt and restore the original executable names in the Yocto ./build/tmp/sysroots/x86_64-linux/usr/bin/armv7a-vfp-neon-po

ky-linux-gnueabi directory.