Skip to content

Commit

Permalink
change docs gcc toolchain for legacy
Browse files Browse the repository at this point in the history
Signed-off-by: Telukula Jeevan Kumar Sahu <[email protected]>
  • Loading branch information
jeevantelukula committed Nov 22, 2024
1 parent aa7a0ed commit 1406fef
Showing 1 changed file with 80 additions and 69 deletions.
149 changes: 80 additions & 69 deletions source/linux/Overview/GCC_ToolChain.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,22 @@ GCC ToolChain Setup
Before compiling any of the sources referenced in this document, set the cross compiler paths to the toolchains packaged in the Processor SDK [Recommended] as shown below. Refer to :ref:`yocto-toolchain` section for more details on usage.

.. code-block:: console
.. ifconfig:: CONFIG_part_variant in ('AM335X', 'AM437X')

.. code-block:: console
host# export CROSS_COMPILE_64="${SDK_INSTALL_DIR}/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/aarch64-oe-linux/aarch64-oe-linux-"
host# export SYSROOT_64="${SDK_INSTALL_DIR}/linux-devkit/sysroots/aarch64-oe-linux"
host# export CC_64="${CROSS_COMPILE_64}gcc --sysroot=${SYSROOT_64}"
host# export CROSS_COMPILE_32="${SDK_INSTALL_DIR}/k3r5-devkit/sysroots/x86_64-arago-linux/usr/bin/arm-oe-eabi/arm-oe-eabi-"
host# export CROSS_COMPILE_64="${SDK_INSTALL_DIR}/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/arm-oe-linux-gnueabi/arm-oe-linux-gnueabi-"
host# export SYSROOT_64="${SDK_INSTALL_DIR}/linux-devkit/sysroots/armv7at2hf-neon-oe-linux-gnueabi"
host# export CC_64="${CROSS_COMPILE_64}gcc --sysroot=${SYSROOT_64}"
.. ifconfig:: CONFIG_part_variant not in ('AM335X', 'AM437X')

.. code-block:: console
host# export CROSS_COMPILE_64="${SDK_INSTALL_DIR}/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/aarch64-oe-linux/aarch64-oe-linux-"
host# export SYSROOT_64="${SDK_INSTALL_DIR}/linux-devkit/sysroots/aarch64-oe-linux"
host# export CC_64="${CROSS_COMPILE_64}gcc --sysroot=${SYSROOT_64}"
host# export CROSS_COMPILE_32="${SDK_INSTALL_DIR}/k3r5-devkit/sysroots/x86_64-arago-linux/usr/bin/arm-oe-eabi/arm-oe-eabi-"
If the Processor SDK is not installed, the Arm GNU toolchains can be downloaded and setup. Refer to :ref:`external-arm-toolchain` section for more details on usage.

Expand Down Expand Up @@ -46,22 +56,41 @@ The |__SDK_FULL_NAME__| package comes with this toolchain preinstalled at linux-
directory within the SDK. Below paths are relative to the <SDK_INSTALL_DIR> and will be
referred to using the first column in the following sections.

.. list-table:: Linux Devkit Contents
:widths: 20 30 50
:header-rows: 1

* - Variable
- Location
- Description
* - CROSS_COMPILE_64
- linux-devkit/sysroots/x86_64-arago-linux/usr/bin/aarch64-oe-linux/aarch64-oe-linux-
- Cross compiler toolchain for the ARMv8 architecture
* - SYSROOT_64
- linux-devkit/sysroots/aarch64-oe-linux/
- Sysroot with the cross compiled libraries and headers for the ARMv8 architecture with Linux OS
* - ENV_SETUP_64
- linux-devkit/environment-setup-aarch64-oe-linux
- Shell script that sets environment variables to compile binaries for the ARMv8 linux target
.. ifconfig:: CONFIG_part_variant in ('AM335X', 'AM437X')
.. list-table:: Linux Devkit Contents
:widths: 20 30 50
:header-rows: 1

* - Variable
- Location
- Description
* - CROSS_COMPILE_64
- linux-devkit/sysroots/x86_64-arago-linux/usr/bin/arm-oe-linux-gnueabi/arm-oe-linux-gnueabi-
- Cross compiler toolchain for the ARMv8 architecture
* - SYSROOT_64
- linux-devkit/sysroots/armv7at2hf-neon-oe-linux-gnueabi/
- Sysroot with the cross compiled libraries and headers for the ARMv8 architecture with Linux OS
* - ENV_SETUP_64
- linux-devkit/environment-setup-armv7at2hf-neon-oe-linux-gnueabi
- Shell script that sets environment variables to compile binaries for the ARMv8 linux target

.. ifconfig:: CONFIG_part_variant not in ('AM335X', 'AM437X')
.. list-table:: Linux Devkit Contents
:widths: 20 30 50
:header-rows: 1

* - Variable
- Location
- Description
* - CROSS_COMPILE_64
- linux-devkit/sysroots/x86_64-arago-linux/usr/bin/aarch64-oe-linux/aarch64-oe-linux-
- Cross compiler toolchain for the ARMv8 architecture
* - SYSROOT_64
- linux-devkit/sysroots/aarch64-oe-linux/
- Sysroot with the cross compiled libraries and headers for the ARMv8 architecture with Linux OS
* - ENV_SETUP_64
- linux-devkit/environment-setup-aarch64-oe-linux
- Shell script that sets environment variables to compile binaries for the ARMv8 linux target

.. rubric:: Target Sysroot
:name: cross-compiled-libraries
Expand Down Expand Up @@ -145,40 +174,20 @@ libraries.
- **Compile Directly** : Cross-compile the **helloworld.c** file using the
cross-compile toolchain directly

.. ifconfig:: CONFIG_part_variant in ('AM335X', 'AM437X')

.. code-block:: console
host# ${CROSS_COMPILE_64}gcc ${CFLAGS} --sysroot=${SYSROOT_64} helloworld.c -o helloworld
Pass the CFLAGS: :file:`-march=armv7-a` :file:`-mthumb` :file:`-mfpu=neon` :file:`-mfloat-abi=hard`
to the cross compiler to avoid the build issues.

.. ifconfig:: CONFIG_part_variant not in ('AM335X', 'AM437X')
.. code-block:: console
.. code-block:: console
host# ${CROSS_COMPILE_64}gcc --sysroot=${SYSROOT_64} helloworld.c -o helloworld
host# ${CROSS_COMPILE_64}gcc --sysroot=${SYSROOT_64} helloworld.c -o helloworld
Be sure to give the correct path to the gcc cross compiler and target
sysroot as listed earlier.

- **Using the environement setup script** : Cross-compile after sourcing
the setup script

.. ifconfig:: CONFIG_part_variant in ('AM335X', 'AM437X')

.. code-block:: console
host# source ${ENV_SETUP_64}
host# ${CC} ${CFLAGS} helloworld.c -o helloworld
.. ifconfig:: CONFIG_part_variant not in ('AM335X', 'AM437X')

.. code-block:: console
.. code-block:: console
host# source ${ENV_SETUP_64}
host# ${CC} helloworld.c -o helloworld
host# source ${ENV_SETUP_64}
host# ${CC} helloworld.c -o helloworld
3. After the above steps are run you should now have a **helloworld**
executable in your directory that has been compiled for the ARM. A
Expand All @@ -195,32 +204,34 @@ libraries.

.. _k3r5-devkit:

k3r5-devkit
^^^^^^^^^^^
.. ifconfig:: CONFIG_part_variant not in ('AM335X', 'AM437X')

.. rubric:: Overview
k3r5-devkit
^^^^^^^^^^^

The |__SDK_FULL_NAME__| package comes with an ARMv7 toolchain preinstalled at k3r5-devkit/
directory within the SDK. Below paths are relative to the <SDK_INSTALL_DIR>.

.. list-table:: k3r5 Devkit Contents
:widths: 20 30 50
:header-rows: 1

* - Variable
- Location
- Description
* - CROSS_COMPILE_32
- k3r5-devkit/sysroots/x86_64-arago-linux/usr/bin/arm-oe-eabi/arm-oe-eabi-
- Cross compiler toolchain for the ARMv7 architecture
* - SYSROOT_32
- k3r5-devkit/sysroots/armv7at2hf-vfp-oe-eabi/
- Sysroot with the cross compiled libraries and headers for the ARMv7 architecture
* - ENV_SETUP_32
- k3r5-devkit/environment-setup-armv7at2hf-vfp-oe-eabi
- Shell script that sets environment variables to compile binaries for the target
.. rubric:: Overview

|
The |__SDK_FULL_NAME__| package comes with an ARMv7 toolchain preinstalled at k3r5-devkit/
directory within the SDK. Below paths are relative to the <SDK_INSTALL_DIR>.

.. list-table:: k3r5 Devkit Contents
:widths: 20 30 50
:header-rows: 1

* - Variable
- Location
- Description
* - CROSS_COMPILE_32
- k3r5-devkit/sysroots/x86_64-arago-linux/usr/bin/arm-oe-eabi/arm-oe-eabi-
- Cross compiler toolchain for the ARMv7 architecture
* - SYSROOT_32
- k3r5-devkit/sysroots/armv7at2hf-vfp-oe-eabi/
- Sysroot with the cross compiled libraries and headers for the ARMv7 architecture
* - ENV_SETUP_32
- k3r5-devkit/environment-setup-armv7at2hf-vfp-oe-eabi
- Shell script that sets environment variables to compile binaries for the target

|

.. _external-arm-toolchain:
Expand Down

0 comments on commit 1406fef

Please sign in to comment.