You are not logged in.

#1 2014-10-27 02:04:24

leonardo
Member
Registered: 2014-10-27
Posts: 5

[SOLVED] Need help with Compiling to TM4C123glx with arm-none-eabi-gcc

Hello !

I was using the 'arm-none-eabi-gcc' package from 'comunity' on Arch Linux in order to compile some projects to my TI TM4C123gxl.

In order to test the compiler, I rebuild a pre-build example sent with the 'Tivaware' software package (qs-rgb). The compilation was smooth, but the final binary didn't run on the board. (about 14KB)

After that, I downloaded a toolchain from this website:
https://launchpad.net/gcc-arm-embedded
Which also ships an 'arm-none-eabi-gcc'.

The compilation with the toolchain above could generate a binary that could run on my board. (about 10KB)

At first, I thought it was a bug, and I was on my way to file a bug report.  But then I remember that this toolchain can be build with several different options, so I need to ask:

Do your package have support to this target? (TI TM4C123glx)
Is there a difference between the two toolchains that I should have noticed?

Sorry if my questions are some obvious things. I have no much information about toolchain building.


If you need any more informations about this, I will be happy to send you.
If you prefer I open a bug report, I will be happy to do so.

Thank you!

Last edited by leonardo (2014-11-07 00:24:38)

Offline

#2 2014-10-27 03:38:24

anatolik
Developer
Registered: 2012-09-27
Posts: 428

Re: [SOLVED] Need help with Compiling to TM4C123glx with arm-none-eabi-gcc

Unlike Arch package the toolchain you mentioned includes a number offtree patches and custom libraries. See relese notes for library description https://launchpadlibrarian.net/186124315/release.txt newlib-nano is one of such libraries. Maybe it affects your project? Provide compile log and any additional information that might shed line to the problem.

Does TI TM4C123glx uses Cortex F4? My stm32 discoveryf4 has the same CPU and Arch toolchain works fine.

Offline

#3 2014-10-27 03:39:04

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 16,275

Re: [SOLVED] Need help with Compiling to TM4C123glx with arm-none-eabi-gcc

Welcome to Arch Linux.  This question is a bit off the beaten path, I would not expect an immediate answer.  I checked the PKGBUILD, and the build options are:

  export CFLAGS_FOR_TARGET='-O2 -g -pipe'
  export CXXFLAGS_FOR_TARGET='-O2 -g -pipe'

  ../configure --target=$_target \
               --prefix=/usr \
               --libexecdir=/usr/lib \
               --with-pkgversion='Arch Repository' \
               --with-bugurl='https://bugs.archlinux.org/' \
               --enable-multilib \
               --enable-interwork \
               --enable-languages=c,c++ \
               --with-newlib \
               --with-gnu-as \
               --with-gnu-ld \
               --disable-nls \
               --disable-shared \
               --disable-threads \
               --with-headers=newlib/libc/include \
               --disable-libssp \
               --disable-libstdcxx-pch \
               --disable-libmudflap \
               --disable-libgomp \
               --with-system-zlib \
               --disable-newlib-supplied-syscalls

That does not tell me much about which processors are supported.  You might contact the developer who supports it via the mail lists, or leave a bug report for the package.

Edit:  A little slow on the posting.  I see a developer beat me here smile

Last edited by ewaller (2014-10-27 03:40:02)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#4 2014-10-27 23:15:24

anatolik
Developer
Registered: 2012-09-27
Posts: 428

Re: [SOLVED] Need help with Compiling to TM4C123glx with arm-none-eabi-gcc

leonardo, here is completely untested patch that makes arm-none-eabi-gcc use newlib-nano instead of newlib. Get the PKGBUILD from ABS, apply the patch and rebuild the *-gcc. Let me know if it makes any difference.

The -nano project goal is provide smaller footprint in probably the reason of smaller binary with linaro toolchain.

Index: PKGBUILD
===================================================================
--- PKGBUILD	(revision 121494)
+++ PKGBUILD	(working copy)
@@ -8,6 +8,7 @@
 pkgrel=1
 #_snapshot=4.9-20140604
 _newlibver=2.1.0
+_newlibnanover=2.1
 pkgdesc='The GNU Compiler Collection - cross compiler for ARM EABI (bare-metal) target'
 arch=(i686 x86_64)
 url='http://gcc.gnu.org/'
@@ -18,12 +19,12 @@
 options=(!emptydirs !strip staticlibs)
 source=(ftp://gcc.gnu.org/pub/gcc/releases/gcc-$pkgver/gcc-$pkgver.tar.bz2
         #ftp://gcc.gnu.org/pub/gcc/snapshots/$_snapshot/gcc-$_snapshot.tar.bz2
-        ftp://sourceware.org/pub/newlib/newlib-$_newlibver.tar.gz
+        https://github.com/32bitmicro/newlib-nano-2/archive/newlib-nano-$_newlibnanover.zip
         gcc-multilib.patch
         gcc-no-exceptions.patch
         libgloss-configure-fix.patch)
 sha256sums=('d334781a124ada6f38e63b545e2a3b8c2183049515a1abab6d513f109f1d717e'
-            '3e4d5ab9f0508942b6231b8ade4f8e5048cf92c96ed574c2bd6bd3320a599a48'
+            '51cdc44ff7821837701316e4145d48b2dc27e43713f88194f6f147c6f09651a9'
             '998d1face674cc8d1af5bf28ded15caaaa18936a28f278123448f29555a07775'
             '7f59b28475aa2018a7edfb81ea81444a6eb098fd3847d8e605809ae6fbeabde5'
             'eac96c034d3d7d16080d9aef4749e4eda493563a3348e6a06f08e8a330b027ba')
@@ -36,7 +37,7 @@
 
 prepare() {
   # Apply configure fix from newlib CVS
-  cd "$srcdir/newlib-$_newlibver/libgloss/arm"
+  cd "$srcdir/newlib-nano-2-newlib-nano-$_newlibnanover/libgloss/arm"
   patch -Np0 -i "$srcdir/libgloss-configure-fix.patch"
   autoreconf
 
@@ -47,8 +48,8 @@
   patch -Np0 -i "$srcdir"/gcc-no-exceptions.patch
 
   # Move newlib and libgloss to gcc source directory
-  mv "$srcdir"/newlib-$_newlibver/newlib "$srcdir/$_basedir"
-  mv "$srcdir"/newlib-$_newlibver/libgloss "$srcdir/$_basedir"
+  mv "$srcdir"/newlib-nano-2-newlib-nano-$_newlibnanover/newlib "$srcdir/$_basedir"
+  mv "$srcdir"/newlib-nano-2-newlib-nano-$_newlibnanover/libgloss "$srcdir/$_basedir"
 
   # hack! - some configure tests for header files using "$CPP $CPPFLAGS"
   sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" "$srcdir"/$_basedir/{libiberty,gcc}/configure

Offline

#5 2014-10-29 01:20:46

leonardo
Member
Registered: 2014-10-27
Posts: 5

Re: [SOLVED] Need help with Compiling to TM4C123glx with arm-none-eabi-gcc

Hello,
Thank you all for the answers. Sorry I am a little late to reply, but I got unexpectedly busy the last days, sad


>>Does TI TM4C123glx uses Cortex F4? My stm32 discoveryf4 has the same CPU and Arch toolchain works fine.
Sorry, I am not familiar with the meaning of Cortex F4. If I guess right, and the F is about a FPU, this processor have one  (Cortex-M4F).

>> Get the PKGBUILD from ABS, apply the patch and rebuild the *-gcc. Let me know if it makes any difference.
I am a little unfamiliar with ABS, so I will say what I have done:

# abs community/arm-none-eabi-gcc
cp -r /var/abs/community/arm-none-eabi-gcc/ .
cd arm-none-eabi-gcc/
(pasted the patch on anatolik.patch)
patch PKGBUILD anatolik.patch
makepkg
# pacman -U arm-none-eabi-gcc-4.9.1-1-x86_64.pkg.tar.xz

cd <source_folder>/examples/boards/ek-tm4c123gxl/qs-rgb
make clean all

##Output##########################
  CC    ../drivers/buttons.c
  CC    ../../../../utils/cmdline.c
In file included from /usr/arm-none-eabi/include/string.h:10:0,
                 from ../../../../utils/cmdline.c:34:
/usr/arm-none-eabi/include/_ansi.h:16:24: fatal error: sys/config.h: No such file or directory
#include <sys/config.h>
                        ^
compilation terminated.
../../../../makedefs:174: recipe for target 'gcc/cmdline.o' failed
make: *** [gcc/cmdline.o] Error 1
#################################

$ whereis arm-none-eabi-gcc
> arm-none-eabi-gcc: /usr/bin/arm-none-eabi-gcc /usr/share/man/man1/arm-none-eabi-gcc.1.gz


When I change the PATH to include the other toolchain:

make clean all

##Output##########################
  CC    ../drivers/buttons.c
  CC    ../../../../utils/cmdline.c
  CC    qs-rgb.c
  CC    ../drivers/rgb.c
  CC    rgb_commands.c
  CC    startup_gcc.c
  CC    ../../../../utils/uartstdio.c
  CC    ../../../../utils/ustdlib.c
  LD    gcc/qs-rgb.axf
################################

Did I miss something?

Offline

#6 2014-10-29 01:48:28

leonardo
Member
Registered: 2014-10-27
Posts: 5

Re: [SOLVED] Need help with Compiling to TM4C123glx with arm-none-eabi-gcc

I tried to find the ./configure options for the other toolchain, but I had no luck.

About the processor support, i found a document on this launchpad site that says what architectures they support. It may help somehow:
https://launchpadlibrarian.net/186123405/readme.txt

Thanks for the help!

Offline

#7 2014-10-30 07:47:58

anatolik
Developer
Registered: 2012-09-27
Posts: 428

Re: [SOLVED] Need help with Compiling to TM4C123glx with arm-none-eabi-gcc

I think I need to bite a bullet and provide proper newlib/newlib-nano packages in Arch. There are several people asked about it.

I plan to look at the Linaro toolchain and make something similar with Arch packages.

Offline

#8 2014-10-30 20:29:49

anatolik
Developer
Registered: 2012-09-27
Posts: 428

Re: [SOLVED] Need help with Compiling to TM4C123glx with arm-none-eabi-gcc

Could you please test the packages I created? Now newlib and newlib-nano are separate libraries. Try building your package first with newlib and then newlib-nano. newlib-nano should produce smaller output binaries.

http://pkgbuild.com/~anatolik/arm-embedded/

Let me know if you see any issues.

Offline

#9 2014-11-04 05:05:13

leonardo
Member
Registered: 2014-10-27
Posts: 5

Re: [SOLVED] Need help with Compiling to TM4C123glx with arm-none-eabi-gcc

Hello!

I installed the following packages:

- arm-none-eabi-binutils-2.24-2-x86_64.pkg.tar.xz
- arm-none-eabi-gcc-4.9.2-1-x86_64.pkg.tar.xz
- arm-none-eabi-newlib-2.1.0-1-any.pkg.tar.xz

Binary: 11048 bytes

Then I removed :
- arm-none-eabi-newlib-2.1.0-1-any.pkg.tar.xz
and installed:
- arm-none-eabi-newlib-nano-2.1-1-any.pkg.tar.xz

Binary: 11048 bytes

Both binaries work pretty well on the target. smile

In order to compare, I saved both binaries on another folder, and then compared:
cmp nano.bin norm.bin
- nano.bin norm.bin differ: byte 1157, line 6

Going further, I 'hexdumped' them, and found 2 different lines:

00000480  b0 0d 00 20 00 01 00 20
00000480  b0 0d 00 20 80 00 00 20

00000830  80 00 00 20 00 25 00 00
00000830  84 00 00 20 00 25 00 00

So, they are 3 bits different each other. But different.

Build with 'Lauchpad' toolchain:
Binary: 10864 bytes (1,6% smaller)

So, the important stuff:
1) Both Arch versions worked fine now.
2) The two Arch binaries are slightly different, but different.

Thank you for fixing this!

Offline

#10 2014-11-04 05:37:36

anatolik
Developer
Registered: 2012-09-27
Posts: 428

Re: [SOLVED] Need help with Compiling to TM4C123glx with arm-none-eabi-gcc

Good to know that it works. I discussed the newlib packaging with debian developers and try to find the best way to make arm embedded toolchain. I'll push new binaries to testing repository this week.

fyi: you can use arm-none-eabi-objdump to disassemble the binaries. It is easier to compare assembler than hex dumps.

Offline

#11 2014-11-04 23:01:35

anatolik
Developer
Registered: 2012-09-27
Posts: 428

Re: [SOLVED] Need help with Compiling to TM4C123glx with arm-none-eabi-gcc

I just pushed a lot of arm embedded toolchain updates to [community-testing] repo. Please pull following packages arm-none-eabi-{binutils,gcc,newlib,gdb} and give it a try.

Offline

#12 2014-11-07 00:22:31

leonardo
Member
Registered: 2014-10-27
Posts: 5

Re: [SOLVED] Need help with Compiling to TM4C123glx with arm-none-eabi-gcc

Hello!

I downloaded and installed these 4 packages using pacman.

I compiled the same example project, and it seems to be working fine!
Just as a detail, the final binary have 11252bytes.

Thank you.

Offline

Board footer

Powered by FluxBB