AN5277(Using an External GCC Toolchain)
AN5277(Using an External GCC Toolchain)
Application Note
1. Introduction Contents
1. Introduction .......................................................1
This document explains how to use an external GNU 2. Preliminary background...................................2
compiler collection (GCC) toolchain with CodeWarrior 3. Installing SDK standalone toolchain...............2
for Power Architecture. This process is only applicable 4. Working with a Power Architecture Linux
to the Linux version of CodeWarrior. application project ............................................2
5. Importing existing code as a Makefile project9
2. Preliminary background
CodeWarrior for Power Architecture may or may not include the Freescale PPC or GCC binary
toolchain. If you are developing a Linux user space application with CodeWarrior, then you should use
the toolchain supplied with the Freescale Linux SDK.
$ cd <sdk_install_path>
$ source ./fsl-setup-env –m <machine>
$ cd build_<machine>_release
$ bitbake fsl-toolchain
$ cd build_<machine>_release/tmp/deploy/sdk
$ ./fsl-networking-eglibc-<host-system>-<core>-toolchain-
<release>.sh
NOTE The default installation path for the standalone toolchain is: /opt/fsl-
networking/. You need to specify this path while installing the standalone
toolchain.
For additional information about building and installing the standalone toolchain
with Yocto, see SDK Knowledge Center.
See Change toolchain for using SDK standalone toolchain as the default build tool in CodeWarrior.
2. Choose File > New > CodeWarrior Linux Project Wizard from the CodeWarrior IDE menu
bar. CodeWarrior Linux Project Wizard starts.
3. Specify the project name and location.
4. Select the processor and project output.
5. Configure the build settings.
6. Configure the connection details and click Finish to create the Linux application project.
NOTE To create Linux application projects, you need to install Linux build tool.
CodeWarrior does not provide Linux project wizard for the MPC8323 processor. If
you need to create a new Linux project using the 8323 processor, then choose any
processor at step 4 and follow the steps from next section.
Importing an example project can also be a starting point for creating a Linux
application.
Using an External GCC Toolchain with CodeWarrior for Power Architecture Application Note
Freescale Semiconductor 3
Working with a Power Architecture Linux application project
Using an External GCC Toolchain with CodeWarrior for Power Architecture Application Note
4 Freescale Semiconductor
Working with a Power Architecture Linux application project
NOTE A dialog appears, asking you whether you want to copy tool settings or not. You are
recommended to copy compatible tool settings into the current toolchain.
5. Click Apply to apply the new toolchain.
6. Select C/C++ Build > Settings in the left pane and click the Build Tool Versions tab in the right
pane, as shown in the figure below.
Figure 3. Add new toolchain
7. Click Add and browse for the new toolchain location. The default installation path for Freescale
Linux SDK standalone toolchain is: /opt/fsl-networking/QorIQ-SDK-
<release>/sysroot/<host-system>/usr/bin/powerpc-fsl-linux/
8. Click Apply to apply the new toolchain.
9. Select the new toolchain and click Set As Default, as shown in the figure below. This will make
the new toolchain as the default toolchain for the project.
Using an External GCC Toolchain with CodeWarrior for Power Architecture Application Note
Freescale Semiconductor 5
Working with a Power Architecture Linux application project
2. Choose the correct architecture type from the Architecture menu on the Architecture page of the
Tool Settings page. If the desired architecture type is not available for selection, then choose
Using an External GCC Toolchain with CodeWarrior for Power Architecture Application Note
6 Freescale Semiconductor
Working with a Power Architecture Linux application project
none and specify the architecture type as compiler options on the Miscellaneous page, as shown
in the figure below.
Figure 6. Specify architecture type as compiler options
NOTE The example shown in the figure above is for the MPC8323 processor.
3. For PowerPC Linux assembler, compiler, linker, preprocessor, and disassembler, verify if the
command is same as in the external toolchain (see the figure below).
Using an External GCC Toolchain with CodeWarrior for Power Architecture Application Note
Freescale Semiconductor 7
Working with a Power Architecture Linux application project
NOTE Some build options may not be valid for a specific toolchain. For example, -
fdebug-unwind-tables is not a valid option for the e300c2 toolchain. You can
remove this option using the Other flags field on the C/C++ Build > Settings >
Tool Settings > Power Linux Compiler > Miscellaneous page of the Properties
dialog.
The SDK toolchain is a sysrooted toolchain. It means that toolchain will start to look for target fragments
and libraries starting from the path specified by the sysroot option. To have a working build
configuration, follow these steps:
1. Go to the C/C++ Build > Settings > Tool Settings > Power Linux Compiler > Miscellaneous
page of the Properties dialog and specify --sysroot=“<path_to_target_sysroot>”
in the Other flags field.
2. Go to the C/C++ Build > Settings > Tool Settings > Power Linux Linker > Miscellaneous
page and specify --sysroot=“<path_to_target_sysroot>” in the Linker flags field.
below.
Figure 8. Build project
Using an External GCC Toolchain with CodeWarrior for Power Architecture Application Note
Freescale Semiconductor 9
Importing existing code as a Makefile project
4. Click Finish. The Makefile Locations dialog appears asking for Makefile.
Using an External GCC Toolchain with CodeWarrior for Power Architecture Application Note
10 Freescale Semiconductor
Importing existing code as a Makefile project
Using an External GCC Toolchain with CodeWarrior for Power Architecture Application Note
Freescale Semiconductor 11
Information in this document is provided solely to enable system and software implementers to use
Freescale Semiconductor products. There are no express or implied copyright licenses granted
hereunder to design or fabricate any integrated circuits or integrated circuits based on the information in
this document.
nxp.com
Freescale reserves the right to make changes without further notice to any products herein. Freescale
makes no warranty, representation, or guarantee regarding the suitability of its products for any
nxp.com/support
particular purpose, nor does Freescale assume any liability arising out of the application or use of any
product or circuit, and specifically disclaims any and all liability, including without limitation
consequential or incidental damages. “Typical” parameters that may be provided in Freescale data
sheets and/or specifications can and do vary in different applications, and actual performance may vary
over time. All operating parameters, including “typicals,” must be validated for each customer application
by customer's technical experts. Freescale does not convey any license under its patent rights nor the
rights of others. Freescale sells products pursuant to standard terms and conditions of sale, which
can be found at the following address: nxp.com/SalesTermsandConditions.
Freescale, the Freescale logo, CodeWarrior, QorIQ, QorIQ Qonverge, and StarCore are trademarks of
Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. All other product or service names are the
property of their respective owners. The Power Architecture and Power.org word marks and the Power
and Power.org logos and related marks are trademarks and service marks licensed by Power.org.