Jump to content
43oh

Toolchain setup under GNU/Linux (including Eclipse)


Recommended Posts

Hi doragasu, really a great link. I tried that and it is working fine for the release with lm4flash. But the debugging is not working for me.

In commandline it is working after adding the xml file in the project folder and adding an additional line in the gdb prompt. But the same thing is not working in eclipse. This is the result when I am trying to debug.

 

Error in final launch sequence

Failed to execute MI command:

-exec-run

Error message from debugger back end:

Don't know how to run. Try "help target".

Don't know how to run. Try "help target".

Link to post
Share on other sites

Did you copy the XML file to the root of your project (it should be at ~/src/stellaris/projects/template/target.xml)?

 

Do you have the following lines for Initialization commands, and in the same order? (step 7):

set tdesc filename target.xml

target extended-remote :3333

monitor reset halt

 

Did you uncheck "Reset and delay" and "Halt" (step 7)?

Did you uncheck "Use remote target" (step 6)?

Link to post
Share on other sites
  • 5 months later...
  • 3 months later...
  • 1 month later...

I followed the instructions in your first and second links (haven't gotten to the third yet), and can compile and debug using gcc.

 

I started working with the example programs from TI (stellarisware), and found that blinky and interrupts work fine, but when I loaded freertos_demo, it only runs partway through the code before halting ( or crashing?) (specifically, it doesn't return from the xTaskCreate call).

I loaded the compiled binary I downloaded from TI, and it works fine.

 

I ran a quick diff on the sources (source .zip vs. compiled .zip), and found no differences.  The executables are different sizes, but considering they were produced with different compilers, that's not necessarily a problem.

 

Has anyone else tried to compile and run freertos_demo with the gcc tool chain?  I'm wondering if there's a problem with the setup, or if I just did something wrong.

 

Thanks!

Link to post
Share on other sites
  • 3 months later...

Hello Guys! 

 

This is my first post on this forum :) So, I got a stellaris board to explore the power of arm. I'm using arch linux. I want to setup a toolchain based on eclipse, but if I donwload the SW-LM3S-9453.exe, unzip it, and try to make it I got the following errors:

 

 

[root@vaio stellaris]# make
make[1]: Entering directory '/home/erbal/src/stellaris/driverlib'
make[2]: Entering directory '/home/erbal/src/stellaris/driverlib'
  CC    adc.c
as: unrecognized option '-mcpu=cortex-m3'
../makedefs:186: recipe for target 'gcc-cm3/adc.o' failed
make[2]: *** [gcc-cm3/adc.o] Error 1
make[2]: Leaving directory '/home/erbal/src/stellaris/driverlib'
Makefile:41: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/home/erbal/src/stellaris/driverlib'
Makefile:46: recipe for target 'all' failed
make: *** [all] Error 2

What am I missing? 

Link to post
Share on other sites

Hi,

I do not know about arch linux - recommend this instead: https://launchpad.net/gcc-arm-embedded since it is made/maintained by ARM peoples and for Cortex-M4 contains hardware floating point libraries.

About the Eclipse setup: check the following settings:

1) In Project | Properties | C/C++ General | Path and Symbols: you have two sub-menus: Assembly and GNU C; The settings in Assembly should be the same as for GNU C.

2) In Projects | Properties | C/C++ Settings also two sub-menus: Assembler and Compiler - should be the same settings in both. Note this depends somewhat by the Eclipse version and how you configured it.

Also recommend this plug-in to be installed: http://gnuarmeclipse.livius.net/blog/install/

 

L

Link to post
Share on other sites

Hi,

I do not know about arch linux - recommend this instead: https://launchpad.net/gcc-arm-embedded since it is made/maintained by ARM peoples and for Cortex-M4 contains hardware floating point libraries.

About the Eclipse setup: check the following settings:

1) In Project | Properties | C/C++ General | Path and Symbols: you have two sub-menus: Assembly and GNU C; The settings in Assembly should be the same as for GNU C.

2) In Projects | Properties | C/C++ Settings also two sub-menus: Assembler and Compiler - should be the same settings in both. Note this depends somewhat by the Eclipse version and how you configured it.

Also recommend this plug-in to be installed: http://gnuarmeclipse.livius.net/blog/install/

 

L

I've downloaded it, but where should I copy the unpacked files to use it globally? I mean like with eclipse. :)

 

edit: I still got these errors in eclipse:

screenshot

 

 

If I try to compile it in the terminal with this command:

arm-none-eabi-gcc main.c startup_gcc.c -g -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -Os -ffunction-sections -fdata-sections -MD -std=c99 -Wall -pedantic -DPART_LM4F120H5QR -c -I/home/erbal/src/stellaris/  -DTARGET_IS_BLIZZARD_RA1

It says:

as: unrecognized option '-mcpu=cortex-m4'as: unrecognized option '-mcpu=cortex-m4'
 
Link to post
Share on other sites

Hi,

It is not clear what you downloaded - if you mean the launchpad's gcc, then it should be installed in /usr/local/gcc-arm-none-eabi-4_7-2012q4 if you use linux and must have /usr/local/gcc-arm-none-eabi-4_7-2012q4/bin in your path. (there is my gcc version and path)

 

Also, not clear if you downloaded also gnuarmeclipse plug-in. The link provided is useful also since has installing instructions. But some more words about this a little bit later.

 

Now, you must know some things about how TI made Stellaris/Tiva package: (I hope you use the latest TIVA package - you do not specify your micro, it is also important) - it is made for "bach" processing - i.e. you must open a terminal, change to the TIVA folder and from that one, you can launch the command "make", which will build all examples/boards inside. This is because there is also the makedefs file which prepare the environment for that (check also this file since it may require some modifications). Doing from Eclipse console is not the right thing to do - could be some missing paths.

 

But, working directly from Eclipse you must make a project (you made it, but not happy with the picture, the Console tab should be posted instead) and, if you have a Cortex-M4 micro, the things can be easier to do - you are not forced to build the libraries, but to use instead ROM_ prefixed functions since these are already embedded into flash.

Also, using the suggested plug-in, you do not need to use/write your own makefiles - that's the job of the plug-in (it is a "managed make").

 

In the case of a Cortex-M4 micro, the option -mfloat-abi=softfp is wrong, should be -mfloat-abi=hard, the other one is not compatible with the specified  gcc library.

 

I know it will take some time until you will have a good working tool chain (also happened to me, nobody is born savant), keep trying and for sure you will succeed. 

 

L

Link to post
Share on other sites

Thank you @@Lyon! Thank you very much! Now, I feel I'm moving forward :D

Well, I guess I experienced too much with a lot of packages. So I reinstalled my OS (no worries, it was fresh install :D ). I've downloaded this https://launchpad.net/gcc-arm-embedded , unpacked and copied to /usr/local, I've also added this path my paths. 
I make the tiva package successfully. So, I've downloaded the eclipse cdt version. 
I set up the eclipse, based on this tutorial: http://kernelhacks.blogspot.hu/2012/11/the-complete-tutorial-for-stellaris_25.html

 

Now, I'm trying to build the blinky example, from tiva package.

Here's what eclipse says: 

make all 
Building file: ../blinky.c
Invoking: Cross GCC Compiler
arm-none-eabi-gcc -DPART_LM4F120H5QR -DARM_MATH_CM4 -DTARGET_IS_BLIZZARD_RA1 -I/home/erbal/scr -O0 -g3 -Wall -c -fmessage-length=0 -mthumb -mtune=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -MMD -MP -MF"blinky.d" -MT"blinky.d" -o "blinky.o" "../blinky.c"
/bin/sh: arm-none-eabi-gcc: command not found
subdir.mk:21: recipe for target 'blinky.o' failed
make: *** [blinky.o] Error 127

Edit.: I've installed arm-none-eabi-gcc 4.8.2-3, now I got the following:

make all 
Building file: ../blinky.c
Invoking: Cross GCC Compiler
arm-none-eabi-gcc -DPART_LM4F120H5QR -DARM_MATH_CM4 -DTARGET_IS_BLIZZARD_RA1 -I/home/erbal/scr -O0 -g3 -Wall -c -fmessage-length=0 -mthumb -mtune=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -MMD -MP -MF"blinky.d" -MT"blinky.d" -o "blinky.o" "../blinky.c"
../blinky.c: In function 'main':
subdir.mk:21: recipe for target 'blinky.o' failed
../blinky.c:45:1: sorry, unimplemented: Thumb-1 hard-float VFP ABI
 {
 ^
make: *** [blinky.o] Error 1
Link to post
Share on other sites

Hi,

Seems the problems you have are still related to Eclipse settings and path. Use only the suggested compiler, others may not have the floating point libraries. Strongly suggest to install gnuarm plug-in (not obvious if yes or not, from your post). Eclipse CDT is good, but not enough, seems like untuned car for the ARM purposes. Below are my settings, with the plug-in installed. One more thing: do not use blinky project, it is weak, does not force the environment and compiler to use all needed settings and paths. Use instead qs_xxx program in your distribution.

 

 

 

All settings described below are from Project | Properties and the corresponding menus/submenus from the left pane.

C/C++ Build:

   Discovery Options:

     GCC C Compiler: Compiler invocation command: /usr/local/gcc-arm-none-eabi-4_7-2012q4/bin/arm-none-eabi-gcc

     GCC Assembler:  Compiler invocation command: /usr/local/gcc-arm-none-eabi-4_7-2012q4/bin/arm-none-eabi-gcc

   Environment: add here a path, mine is this: /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/gcc-arm-none-eabi-4_7-2012q4/bin:${PATH}

   Settings: Tool Settings:

             Target processor: Processor cortex-m4

                                             Thumb (-mthumb)

                                             Float ABI: FP instructions (-mfloat-abi=hard)

                                             FPU Type: FPv4-SP-D16 (-mfpu=fpv4-sp-d16)

             Debugging:           Debug level: -g3

                                             Debug format: dwarf-2

             Additional tools:   check all

            ARM GCC Assembler: Command: arm-none-eabi-gcc

                      All Options: -x assembler-with-cpp -DDEBUG -DPART_LM4F232H5QD - DTARGET_IS_BLIZZARD_RA1 -Dgcc -I/usr/local/gcc-arm-none-eabi-4_7-            2012q4/lib/gcc/arm- none-eabi/4.7.3/include -I/usr/local/gcc-arm-none-eabi-4_7-2012q4/lib/gcc/arm-none-eabi/4.7.3/ include-fixed -I/usr/local/gcc-arm-none-eabi-4_7-2012q4/arm-none-eabi/include -I"/Users/L/ Proj/WSEJ-GNU-ICDI/Sine-dem" -Wall -Wa,-adhlns="$@.lst" -c -fmessage-length=0 - mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -g3 -gdwarf-2

             ARM GCC C Compiler: Command: arm-none-eabi-gcc

    All options: -DDEBUG -DPART_LM4F232H5QD -DTARGET_IS_BLIZZARD_RA1 -Dgcc -I/usr/local/gcc-arm-none-eabi-4_7-2012q4/arm-none-eabi/include -   I/usr/local/gcc-arm-none- eabi-4_7-2012q4/lib/gcc/arm-none-eabi/4.7.3/include-fixed -I/usr/local/gcc-arm-none- eabi-4_7-2012q4/lib/gcc/arm-none-eabi/4.7.3/include -I"/Users/L/Proj/WSEJ-GNU-ICDI/Sine- dem" -Os -ffunction-sections -fdata-sections -Wall -Wextra -Wa,-adhlns="$@.lst" -c -fmessage- length=0 -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -g3 -gdwarf-2

            ARM GCC Linker: 

                              General:  Script file(-T): /Users/L/Proj/WSEJ-GNU-ICDI/Sine-dem/lm4f120h5qr.ld

                                               -nostartfiles, -Xlinker --gc-sections

                              Libraries:   Libraries(-l) and in the pane add letters m and c, one letter per row

                              Library search path (-L): /usr/local/gcc-arm-none-eabi-4_7-2012q4/arm-none-eabi/lib/armv7e-m/fpu/

            ARM GNU Create Flash Image: Command: arm-none-eabi-objcopy

                                                                     All options: -O ihex Sine-dem.elf

            ARM GNU Create listing:   Command: arm-none-eabi-objdump

                                                            All options: -h -S Sine-dem.elf

            ARM GNU Print Size:        Command: arm-none-eabi-size

                                                           All Options: --format=berkeley Sine-dem.elf

Settings: Build Steps: Post Build Command: arm-none-eabi-objcopy -S -O binary "Sine-dem.elf" "Sine-dem.bin"

C/C++ General

Path and Symbols:

the settings should be the same for Assembly and GNU C, write one and copy to other:

            /usr/local/gcc-arm-none-eabi-4_7-2012q4/arm-none-eabi/include

            /usr/local/gcc-arm-none-eabi-4_7-2012q4/lib/gcc/arm-none-eabi/4.7.3/include-fixed

            /usr/local/gcc-arm-none-eabi-4_7-2012q4/lib/gcc/arm-none-eabi/4.7.3/include

            /Sine-dem (This is set as workspace path)

Preprocessor Include Path: verify here the existance of all previous path settings

 

L

Link to post
Share on other sites

Great thread! I took the opportunity to play along at home and build an Ubuntu VM dedicated to ARM development.

 

Any ideas what could cause the linker to complain about an "undefined reference to `_exit"? (yep, including that apostrophe)

 

The project only consists of blinky.c and startup_gcc.c from the TivaWare examples folder.

 

 

make all
Building file: ../blinky.c
Invoking: Cross ARM C Compiler
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wall  -g3 -gdwarf-2 -DPART_TM4C123GH6PM -DARM_MATH_CM4 -DTARGET_IS_BLIZZARD_RA1 -I/home/chicken/src/TivaWare-2.0.1.11577 -MMD -MP -MF"blinky.d" -MT"blinky.d" -c -o "blinky.o" "../blinky.c"
Finished building: ../blinky.c
 
Building file: ../startup_gcc.c
Invoking: Cross ARM C Compiler
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wall  -g3 -gdwarf-2 -DPART_TM4C123GH6PM -DARM_MATH_CM4 -DTARGET_IS_BLIZZARD_RA1 -I/home/chicken/src/TivaWare-2.0.1.11577 -MMD -MP -MF"startup_gcc.d" -MT"startup_gcc.d" -c -o "startup_gcc.o" "../startup_gcc.c"
Finished building: ../startup_gcc.c
 
Building target: template.elf
Invoking: Cross ARM C Linker
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wall  -g3 -gdwarf-2 -Xlinker --gc-sections -L/home/chicken/src/TivaWare-2.0.1.11577/driverlib/gcc -Wl,-Map,"template.map" -Wl,--static,--gc-sections -o "template.elf"  ./blinky.o ./startup_gcc.o   -lm -lc
/usr/local/gcc-arm-none-eabi-4_8-2013q4/bin/../lib/gcc/arm-none-eabi/4.8.3/../../../../arm-none-eabi/lib/armv7e-m/fpu/libc.a(lib_a-exit.o): In function `exit':
exit.c:(.text.exit+0x16): undefined reference to `_exit'
collect2: error: ld returned 1 exit status
make: *** [template.elf] Error 1
PS: starting with blinky to get the basics right
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...