Code Sourcery G++ Lite

From ITRS
Jump to: navigation, search

Sourcery CodeBench Lite Edition

Unless you:

  1. Already got a GCC toolchain as part of an SDK
  2. Are hacking on GCC yourself
  3. Work for a microprocessor design company
  4. You need an ARMv7 toolchain that uses the armv7hf hard floating point ABI (try Linaro)

you probably want to use CodeSourcery G++ Light to start embedded Linux or Non-OS development. CodeSourcery does a lot of upstream gcc, binutils, eglibc, gdb, qemu work and they test their toolchains.

Read Chapter 3 of {arm,ia32,mips}-2012.03/share/doc/*/pdf/getting-started.pdf for the command line options to choose the correct:

  • architecture (arm: -mcpu cortex-a9, x86_64: -m64)
  • endianess (mipsel: -EL)
  • floating point ABI (mips: -msoft-float, arm VFPv3 with NEON: -mfloat-abi=softfp -mfpu=neon) and
  • C library (mips: -muclibc)

Use "gcc -print-multi-directory" to print the directory name of the "multilib" variant you want and copy it to your embedded device.

Here's a table of the configurations supported:

arm-2012.03
ARMv5TE - Little-Endian, Soft-Float, GLIBC
Command-line option(s):     default (-march=armv5te)
	Sysroot subdirectory:       ./
	Dynamic linker:             lib/ld-linux.so.3
ARMv4T - Little-Endian, Soft-Float, GLIBC
Command-line option(s):      -march=armv4t
	Sysroot subdirectory:        armv4t/
	Dynamic linker:              lib/ld-linux.so.3
	Notes:                       This should also be used for ARMv5T cores such as the ARM1020T.
ARMv7-A Thumb-2 - Little-Endian, Soft-Float, GLIBC
Command-line option(s):      -mthumb -march=armv7-a
	Sysroot subdirectory:        thumb2/
	Dynamic linker:              lib/ld-linux.so.3
NOTE: while the compiler supports the "hard float" ABI (-mfloat-abi=hard)
no compatible runtime libraries are provided in the Lite version. 
Get the Linaro toolchain linked to below if you want hard float ABI support.

mips-2012.03
MIPS32 revision 2 - Big-Endian, O32
Command-line option(s):        default
	Sysroot subdirectory:          ./
	Dynamic linker:                lib/ld.so.1
MIPS32 revision 2 - Big-Endian, N64
Command-line option(s):        -mabi=64
	Sysroot subdirectory:          ./
	Dynamic linker:                lib64/ld.so.1
MIPS32 revision 2 - Little-Endian, O32
Command-line option(s):        -EL
	Sysroot subdirectory:          el/
	Dynamic linker:                lib/ld.so.1
MIPS32 revision 2 - Little-Endian, N64
Command-line option(s):        -EL -mabi=64
	Sysroot subdirectory:          el/
	Dynamic linker:                lib64/ld.so.1
MIPS32 revision 2 - Big-Endian, Soft-Float, O32
Command-line option(s):        -msoft-float
	Sysroot subdirectory:          soft-float/
	Dynamic linker:                lib/ld.so.1
MIPS32 revision 2 - Big-Endian, Soft-Float, N64
Command-line option(s):        -msoft-float -mabi=64
	Sysroot subdirectory:          soft-float/
	Dynamic linker:                lib64/ld.so.1
MIPS32 revision 2 - Little-Endian, Soft-Float, O32
Command-line option(s):        -EL -msoft-float
	Sysroot subdirectory:          soft-float/el/
	Dynamic linker:                lib/ld.so.1
< ... microMIPs: -mmicroimps, MIPS16: -mips16 ...>
MIPS32 revision 2 - uClibc, Big-Endian, O32
Command-line option(s):        -muclibc
	Sysroot subdirectory:          uclibc/
	Dynamic linker:                lib/ld-uClibc.so.0
MIPS32 revision 2 - uClibc, Little-Endian, O32
Command-line option(s):        -muclibc -EL
	Sysroot subdirectory:          uclibc/el/
	Dynamic linker:                lib/ld-uClibc.so.0
MIPS32 revision 2 - uClibc, Big-Endian, Soft-Float, O32
Command-line option(s):        -muclibc -msoft-float
	Sysroot subdirectory:          uclibc/soft-float/
	Dynamic linker:                lib/ld-uClibc.so.0
MIPS32 revision 2 - uClibc, Little-Endian, Soft-Float, O32
Command-line option(s):        -muclibc -EL -msoft-float
	Sysroot subdirectory:          uclibc/soft-float/el/
	Dynamic linker:                lib/ld-uClibc.so.0


ia32-2012.03
Intel Pentium 4 - GLIBC, 32-bit
Command-line option(s):       default
	Sysroot subdirectory:         ./
	Dynamic linker:               lib/ld-linux.so.2
Intel Xeon (Nocona) - GLIBC, 64-bit
Command-line option(s):       -m64
	Sysroot subdirectory:         ./
	Dynamic linker:               lib64/ld-linux-x86-64.so.2
Intel Atom - GLIBC, 32-bit
Command-line option(s):       -march=atom
	Sysroot subdirectory:         atom/
	Dynamic linker:               lib/ld-linux.so.2
Intel Core 2 - GLIBC, 64-bit
Command-line option(s):       -march=core2 -m64
	Sysroot subdirectory:         core2/
	Dynamic linker:               lib64/ld-linux-x86-64.so.2

Remote Debugging

  • (gdb) set sysroot SYSROOT-SUBDIRECTORY
    • This helps GDB find the debuginfo and allows you to strip the copy on your target device.

See Also

Comments

blog comments powered by Disqus

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox