Skip to content

Commit 87aca91

Browse files
jeevantelukulacshilwant
authored andcommitted
fix: Update GCC_Toolchain instructions for AM335x/AM437x/AM57x
Fix the invalid architectural references and update cross-compile instructions. Signed-off-by: Telukula Jeevan Kumar Sahu <[email protected]>
1 parent 73ed697 commit 87aca91

File tree

1 file changed

+51
-20
lines changed

1 file changed

+51
-20
lines changed

source/linux/Overview/GCC_ToolChain.rst

Lines changed: 51 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ Before compiling any of the sources referenced in this document, set the cross c
1313
1414
host# export CROSS_COMPILE_32="${SDK_INSTALL_DIR}/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/arm-oe-linux-gnueabi/arm-oe-linux-gnueabi-"
1515
host# export SYSROOT_32="${SDK_INSTALL_DIR}/linux-devkit/sysroots/armv7at2hf-neon-oe-linux-gnueabi"
16-
host# export CC_32="${CROSS_COMPILE_32}gcc --sysroot=${SYSROOT_32}"
16+
host# export CFLAGS="-march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard"
17+
host# export CC_32="${CROSS_COMPILE_32}gcc ${CFLAGS} --sysroot=${SYSROOT_32}"
1718
1819
.. ifconfig:: CONFIG_part_variant not in ('AM335X', 'AM437X', 'AM57X')
1920

@@ -33,9 +34,17 @@ If the Processor SDK is not installed, the Arm GNU toolchains can be downloaded
3334
Yocto-built SDK Toolchains
3435
--------------------------
3536

36-
The |__SDK_FULL_NAME__| package contains cross compile toolchains for the ARMv8
37-
(:ref:`linux-devkit`) and ARMv7 (:ref:`k3r5-devkit`) architectures. These toolchains
38-
are used by the :ref:`top level makefile <top-level-makefile>` when
37+
.. ifconfig:: CONFIG_part_variant in ('AM335X', 'AM437X', 'AM57X')
38+
39+
The |__SDK_FULL_NAME__| package contains cross compile toolchain for the ARMv7
40+
(:ref:`linux-devkit`) architecture.
41+
42+
.. ifconfig:: CONFIG_part_variant not in ('AM335X', 'AM437X', 'AM57X')
43+
44+
The |__SDK_FULL_NAME__| package contains cross compile toolchains for the ARMv8
45+
(:ref:`linux-devkit`) and ARMv7 (:ref:`k3r5-devkit`) architectures.
46+
47+
These toolchains are used by the :ref:`top level makefile <top-level-makefile>` when
3948
compiling the binaries for the target. These also package an environment setup
4049
script that, when sourced, sets all the right variables to compile binaries for
4150
the target architecture. The toolchain installers are built through the yocto
@@ -65,13 +74,13 @@ referred to using the first column in the following sections.
6574
- Description
6675
* - CROSS_COMPILE_32
6776
- linux-devkit/sysroots/x86_64-arago-linux/usr/bin/arm-oe-linux-gnueabi/arm-oe-linux-gnueabi-
68-
- Cross compiler toolchain for the ARMv8 architecture
77+
- Cross compiler toolchain for the ARMv7 architecture
6978
* - SYSROOT_32
7079
- linux-devkit/sysroots/armv7at2hf-neon-oe-linux-gnueabi/
71-
- Sysroot with the cross compiled libraries and headers for the ARMv8 architecture with Linux OS
80+
- Sysroot with the cross compiled libraries and headers for the ARMv7 architecture with Linux OS
7281
* - ENV_SETUP_32
7382
- linux-devkit/environment-setup-armv7at2hf-neon-oe-linux-gnueabi
74-
- Shell script that sets environment variables to compile binaries for the ARMv8 linux target
83+
- Shell script that sets environment variables to compile binaries for the ARMv7 linux target
7584

7685
.. ifconfig:: CONFIG_part_variant not in ('AM335X', 'AM437X', 'AM57X')
7786

@@ -98,24 +107,36 @@ referred to using the first column in the following sections.
98107
The toolchain within the Linux SDK contains more than just the
99108
cross-compiler, it also contains pre-built libraries that can be used
100109
in your applications without requiring you to cross-compile them
101-
yourself. These libraries include packages from alsa to zlib.
102-
or a list of the
103-
libraries you can refer to the software manifest found in the **<SDK
104-
INSTALL DIR>/manifest** directory or look at the list of libraries
105-
available in the **<SYSROOT_64>/usr/lib** directory. You will
106-
also find the header files corresponding to these libraries in the
107-
**<SYSROOT_64>/usr/include** directory. As
108-
an example if your application wants access to the alsa asound library
109-
then you can now do the following command:
110+
yourself.
110111

111112
.. ifconfig:: CONFIG_part_variant in ('AM335X', 'AM437X', 'AM57X')
112113

114+
These libraries include packages from alsa to zlib.
115+
or a list of the
116+
libraries you can refer to the software manifest found in the **<SDK
117+
INSTALL DIR>/manifest** directory or look at the list of libraries
118+
available in the **<SYSROOT_32>/usr/lib** directory. You will
119+
also find the header files corresponding to these libraries in the
120+
**<SYSROOT_32>/usr/include** directory. As
121+
an example if your application wants access to the alsa asound library
122+
then you can now do the following command:
123+
113124
.. code-block:: console
114125
115126
host# ${CROSS_COMPILE_32}gcc -lasound app.c -o app.out
116127
117128
.. ifconfig:: CONFIG_part_variant not in ('AM335X', 'AM437X', 'AM57X')
118129

130+
These libraries include packages from alsa to zlib.
131+
or a list of the
132+
libraries you can refer to the software manifest found in the **<SDK
133+
INSTALL DIR>/manifest** directory or look at the list of libraries
134+
available in the **<SYSROOT_64>/usr/lib** directory. You will
135+
also find the header files corresponding to these libraries in the
136+
**<SYSROOT_64>/usr/include** directory. As
137+
an example if your application wants access to the alsa asound library
138+
then you can now do the following command:
139+
119140
.. code-block:: console
120141
121142
host# ${CROSS_COMPILE_64}gcc -lasound app.c -o app.out
@@ -194,7 +215,7 @@ libraries.
194215

195216
.. code-block:: console
196217
197-
host# ${CROSS_COMPILE_32}gcc --sysroot=${SYSROOT_32} helloworld.c -o helloworld
218+
host# ${CROSS_COMPILE_32}gcc -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard --sysroot=${SYSROOT_32} helloworld.c -o helloworld
198219
199220
.. ifconfig:: CONFIG_part_variant not in ('AM335X', 'AM437X', 'AM57X')
200221

@@ -227,10 +248,19 @@ libraries.
227248
simple way to check this is to run the "file" command. It should
228249
return an output similar to below:
229250

230-
.. code-block:: console
251+
.. ifconfig:: CONFIG_part_variant in ('AM335X', 'AM437X', 'AM57X')
252+
253+
.. code-block:: console
254+
255+
host# file helloworld
256+
helloworld: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, BuildID[sha1]=f163acd736f827b9743b27d9a94e431d63990711, for GNU/Linux 3.2.0, with debug_info, not stripped
257+
258+
.. ifconfig:: CONFIG_part_variant not in ('AM335X', 'AM437X', 'AM57X')
259+
260+
.. code-block:: console
231261
232-
host# file helloworld
233-
helloworld: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, BuildID[sha1]=bb96180ad71bd44e07fc148015a55c844134f30d, for GNU/Linux 3.14.0, with debug_info, not stripped
262+
host# file helloworld
263+
helloworld: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, BuildID[sha1]=bb96180ad71bd44e07fc148015a55c844134f30d, for GNU/Linux 3.14.0, with debug_info, not stripped
234264
235265
|
236266
@@ -299,4 +329,5 @@ commands of the Foundational Components in this document.
299329
host# export CROSS_COMPILE_64=$COMPILER_PATH/arm-gnu-toolchain-11.3.rel1-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-
300330
host# export CROSS_COMPILE_32=$COMPILER_PATH/arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-linux-gnueabihf/bin/arm-none-linux-gnueabihf-
301331
host# export CC_64="${CROSS_COMPILE_64}gcc"
332+
host# export CC_32="${CROSS_COMPILE_32}gcc"
302333

0 commit comments

Comments
 (0)