LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices



Reply
 
Search this Thread
Old 05-27-2013, 01:57 PM   #16
business_kid
Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 6,628

Rep: Reputation: 586Reputation: 586Reputation: 586Reputation: 586Reputation: 586Reputation: 586

$CC is the actual compiler, not a subdir

Code:
export CC=/root/sat/bin/arm-none-eabi-gcc
 
Old 05-27-2013, 02:14 PM   #17
PeterUK
Member
 
Registered: May 2009
Posts: 277

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by business_kid View Post
$CC is the actual compiler, not a subdir

Code:
export CC=/root/sat/bin/arm-none-eabi-gcc
nop :-( did that and I get:

Code:
./configure --enable-maintainer-mode --enable-stlink --enable-ft2232_libftdi --enable-ftdi --enable-usbprog --host=arm-none-eabi
checking for a BSD-compatible install... /usr/bin/ginstall -c
checking whether build environment is sane... yes
checking for arm-none-eabi-strip... no
checking for strip... strip
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... yes
checking for arm-none-eabi-gcc... /root/sat/bin/arm-none-eabi-gcc
checking whether the C compiler works... no
configure: error: in `/tmp/Install/stlink_from0/openocd/openocd-codepress':
configure: error: C compiler cannot create executables
See `config.log' for more details
UPDATE:

I looked at the config file, and I think its here where it fails:

Code:
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu

ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test -n "$ac_tool_prefix"; then
  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
set dummy ${ac_tool_prefix}gcc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_CC+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test -n "$CC"; then
  ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
    for ac_exec_ext in '' $ac_executable_extensions; do
  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_prog_CC="${ac_tool_prefix}gcc"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
$as_echo "$CC" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
I think $CC need to be a combination from GCC and ARM-GCC, how do you set multi path to $CC, is that possible?

Also if I do echo $CC nothing come up its set somewhere is the script?

UPDATE2:

I thought it was that only use one compiler but no, I copy that arm...gcc to may folder where is gcc and it fails the same Its failing the Compiler test into the config.

UPDATE3:

I tried all the gcc something into that folder and none pass that test.

The test is "# Try to create an executable without -o first, disregard a.out."

This is the test for the config file:

Code:
# Try to create an executable without -o first, disregard a.out.
# It will help us diagnose broken compilers, and finding out an intuition
# of exeext.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
$as_echo_n "checking whether the C compiler works... " >&6; }
ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`

# The possible output files:
ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"

ac_rmfiles=
for ac_file in $ac_files
do
  case $ac_file in
    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
    * ) ac_rmfiles="$ac_rmfiles $ac_file";;
  esac
done
rm -f $ac_rmfiles

if { { ac_try="$ac_link_default"
case "(($ac_try" in
  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
  *) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
  (eval "$ac_link_default") 2>&5
  ac_status=$?
  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
  test $ac_status = 0; }; then :

Last edited by PeterUK; 05-27-2013 at 03:45 PM.
 
Old 05-27-2013, 05:00 PM   #18
ppencho
LQ Newbie
 
Registered: Jan 2004
Location: Bulgaria
Distribution: Slackware64-current
Posts: 27

Rep: Reputation: 3
Quote:
Originally Posted by PeterUK View Post
But it just hang there! :-( What is it wrong?
What do you mean by "But it just hang there!"? Does arm-none-eabi-gdb freeze or it refuse to connect? I have troubles to connect (target remote localhost:3333) when the arm board is not halted. You can halt it by passing a command to openocd:
Code:
./openocd --file /tcl/board/stm32f4discovery.cfg -c init -c "reset halt"
I think that your toolchain works fine but you could check this link:
http://www.arklyffe.com/main/2010/08...olchain-build/

Following it I created a script to build my own toolchain (see the attached file)
Attached Files
File Type: txt build-arm-toolchain.sh.txt (10.2 KB, 6 views)
 
Old 05-27-2013, 07:38 PM   #19
PeterUK
Member
 
Registered: May 2009
Posts: 277

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by ppencho View Post
What do you mean by "But it just hang there!"? Does arm-none-eabi-gdb freeze or it refuse to connect? I have troubles to connect (target remote localhost:3333) when the arm board is not halted. You can halt it by passing a command to openocd:
Code:
./openocd --file /tcl/board/stm32f4discovery.cfg -c init -c "reset halt"
I think that your toolchain works fine but you could check this link:
http://www.arklyffe.com/main/2010/08...olchain-build/

Following it I created a script to build my own toolchain (see the attached file)
I have one question ppencho, Do you actually has been able to download xxx.elf file and all working in the ARM?

Also why do I need to download and compile gdb its already in the system and I think I did installed.

On that strip you will update gdb and the other (GMP_VER=5.1.1,MPFR_VER=3.1.2,MPC_VER=1.0.1,BINUTILS_VER=2.23.2
GCC_VER=4.8.0,GDB_VER=7.6,NEWLIB_VER=2.0.0 in the system, this will not mess up anything, right?

Thanks
 
Old 05-28-2013, 05:07 AM   #20
business_kid
Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 6,628

Rep: Reputation: 586Reputation: 586Reputation: 586Reputation: 586Reputation: 586Reputation: 586
I noticed a couple of problems. I am presuming all your tools are in /root/sat/bin. If not, put symlinks to them there. The quick way out is this (In the shell, just before you start building)

Code:
export PATH=/root/sat/bin:$PATH
Then use no $CC stuff. The first place it will check for everything is /root/sat/bin.Be sure not to compile any x86 stuff without logging out of that shell
 
Old 05-28-2013, 12:28 PM   #21
ppencho
LQ Newbie
 
Registered: Jan 2004
Location: Bulgaria
Distribution: Slackware64-current
Posts: 27

Rep: Reputation: 3
Quote:
Originally Posted by PeterUK View Post
I have one question ppencho, Do you actually has been able to download xxx.elf file and all working in the ARM?
I have homemade AT91SAM7S64 and I can connect, flash, erase, run, debug, everything works.

Quote:
Also why do I need to download and compile gdb its already in the system and I think I did installed.
If you mean gdb that comes with Slackware, I think that it does not have ARM support. So in x86 OS you need to compile your own dev tools with target=arm-none-eabi. But as I see you already installed prebuilt versions of arm-none-eabi-(gcc, as, ld, ...) so you don't have to do anything else for the toolchain.

Quote:
On that strip you will update gdb and the other (GMP_VER=5.1.1,MPFR_VER=3.1.2,MPC_VER=1.0.1,BINUTILS_VER=2.23.2
GCC_VER=4.8.0,GDB_VER=7.6,NEWLIB_VER=2.0.0 in the system, this will not mess up anything, right?
My script will build and install the toolchain in the directory from where it is run (see the short description in the script). None of the existing Slackware files will be affected, even the binary file names (gcc, as, ld) will be different (with prefix arm-none-eabi-). After its finish you just have to add the toolchain directory to your path (<script dir>/arm-none-eabi/bin) and you're ready to build your arm applications

But you didn't say what is the meaning of "But it just hang there!"
 
Old 05-29-2013, 04:05 AM   #22
PeterUK
Member
 
Registered: May 2009
Posts: 277

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by ppencho View Post

But you didn't say what is the meaning of "But it just hang there!"
It stay on the step permanently on:

Quote:
Reading symbols from /home/bla bla bla/stm32f4-discovery/main.elf...done.
(gdb)
I have to kill the the process manually.

I have one question because that tool chain is also not working.

What is the process you have download code into the ARM? Thanks
 
Old 05-29-2013, 12:06 PM   #23
ppencho
LQ Newbie
 
Registered: Jan 2004
Location: Bulgaria
Distribution: Slackware64-current
Posts: 27

Rep: Reputation: 3
STEP 1: run OpenOCD:
Code:
/usr/bin/openocd -f interface/jlink.cfg -c "gdb_memory_map enable" -c "gdb_flash_program enable" -f board/atmel_at91sam7s-ek.cfg -c "adapter_khz 6000"
Code:
Open On-Chip Debugger 0.7.0 (2013-05-27-23:26)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.sourceforge.net/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'jtag'
srst_only srst_pulls_trst srst_gates_jtag srst_open_drain connect_deassert_srst
Warn : use 'at91sam7s256.cpu' as target identifier, not '0'
adapter speed: 6000 kHz
Info : J-Link initialization started / target CPU reset initiated
Info : J-Link compiled Jul 30 2008 11:24:37 ARM Rev.5
Info : J-Link caps 0x80d7bbf
Info : J-Link hw version 50000
Info : J-Link hw type J-Link
Info : J-Link max mem block 9992
Info : J-Link configuration
Info : USB-Address: 0x0
Info : Kickstart power on JTAG-pin 19: 0x0
Info : Vref = 3.313 TCK = 1 TDI = 0 TDO = 1 TMS = 0 SRST = 0 TRST = 0
Info : J-Link JTAG Interface ready
Info : clock speed 6000 kHz
Info : JTAG tap: at91sam7s256.cpu tap/device found: 0x3f0f0f0f (mfg: 0x787, part: 0xf0f0, ver: 0x3)
Info : Embedded ICE version 1
Info : at91sam7s256.cpu: hardware has 2 breakpoint/watchpoint units
STEP2: from another console connect to OpenOCD server (this step is not mandatory but I use it to halt the target, to see registers, read/write memory, so on - try the commands halt, reg, mdw, mww):
Code:
telnet localhost 4444
Code:
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Open On-Chip Debugger
> halt
target state: halted
target halted in ARM state due to debug-request, current mode: Supervisor
cpsr: 0xf00000d3 pc: 0x001eae60
> mdw 0x200000
0x00200000: df26d7ed 
> mww 0x200000 0x1234
> mdw 0x200000       
0x00200000: 00001234 
> reg 
===== ARM registers
(0) r0 (/32): 0xF00000D3 (dirty)
(1) r1 (/32): 0x80800000 (dirty)
(2) r2 (/32): 0x001000A0
(3) r3 (/32): 0x84211001
(4) r4 (/32): 0x00180008
(5) r5 (/32): 0x00204000
(6) r6 (/32): 0x10000000
(7) r7 (/32): 0x00000400
...
STEP 3: from another console run gdb:
Code:
arm-none-eabi-gdb blink.elf
Code:
GNU gdb (GDB) 7.6
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-unknown-linux-gnu --target=arm-none-eabi".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /install/packages/arm_build/work/blink.elf...done.
(gdb)
STEP4: arm-none-eabi-gdb is waiting for your commands, from inside it run 'target [options]', 'load', 'continue':
Code:
GNU gdb (GDB) 7.6
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-unknown-linux-gnu --target=arm-none-eabi".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /install/packages/arm_build/work/blink.elf...done.
(gdb) target remote localhost:3333
Remote debugging using localhost:3333
0x001eae60 in ?? ()
(gdb) load
Loading section .text, size 0x164 lma 0x200000
Loading section .data, size 0x1d lma 0x200164
Start address 0x200000, load size 385
Transfer rate: 8 KB/sec, 192 bytes/write.
(gdb) continue
Continuing.
And here we have a blinking LED saying "Hello World!"
 
Old 05-29-2013, 07:16 PM   #24
PeterUK
Member
 
Registered: May 2009
Posts: 277

Original Poster
Rep: Reputation: 16
[QUOTE=ppencho;4961437]

STEP 1:
I did:
Code:
openocd -f /opt/openocd-codepress/tcl/board/stm32f4discovery.cfg -c "gdb_memory_map enable" -c "gdb_flash_program enable" -c "adapter_khz 8000"
A quick look at the board and it look a 8M clock at the adapter (8000H2L) so update that command there.

I get:
Code:
bash-4.2# openocd -f /tcl/board/stm32f4discovery.cfg -c "gdb_memory_map enable" -c "gdb_flash_program enable" -c "adapter_khz 8000"
Open On-Chip Debugger 0.7.0-rc1-dev-00002-ge12989a (2013-04-27-17:22)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.sourceforge.net/doc/doxygen/bugs.html
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
adapter speed: 8000 kHz
Info : This adapter doesn't support configurable speed
Info : STLINK v2 JTAG v14 API v2 SWIM v0 VID 0x0483 PID 0x3748
Info : Target voltage: 2.898996
Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : accepting 'telnet' connection from 4444
wrong # args: should be "load libaryFile"
Info : accepting 'gdb' connection from 3333
Info : device id = 0x10016413
Info : flash size = 1024kbytes
Warn : acknowledgment received, but no packet pending
undefined debug reason 6 - target needs reset
Error: Target not halted
Error: failed erasing sectors 0 to 0
Error: flash_erase returned -304
Error: Target not halted
Error: failed erasing sectors 0 to 0
Error: flash_erase returned -304
Warn : The target is not in the halted nor running stated, stepi/continue ignored.
^Z
[1]+  Stopped
On the telnet terminal I get (The load that was me try a error thing)

Code:
bash-4.2# telnet localhost 4444
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Open On-Chip Debugger
> load
wrong # args: should be "load libaryFile"
accepting 'gdb' connection from 3333
device id = 0x10016413
flash size = 1024kbytes
acknowledgment received, but no packet pending
undefined debug reason 6 - target needs reset
Target not halted
failed erasing sectors 0 to 0
flash_erase returned -304
Target not halted
failed erasing sectors 0 to 0
flash_erase returned -304
The target is not in the halted nor running stated, stepi/continue ignored.
And it the project folder I did:
Code:
bash-4.2# arm-none-eabi-gdb main.elfGNU gdb (GDB) 7.6
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu --target=arm-none-eabi".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /stm32f4-discovery_blinky/main.elf...done.
(gdb) target remote localhost:3333
Remote debugging using localhost:3333
0x00000000 in ?? ()
(gdb) load
Error erasing flash with vFlashErase packet
(gdb) load
Error erasing flash with vFlashErase packet
(gdb) continue
Continuing.
The target is not in the halted nor running stated, stepi/continue ignored.

Program received signal SIGINT, Interrupt.
0x00000000 in ?? ()
(gdb) ^Z
[1]+  Stopped
I've put the command good to know I did need to type "load" them manually :-/.

If I had -c "reset halt"

say:

Code:
invalid command name "reset"
I have done in another way too (without Openocd). I open one terminal I use the stlink utility (st-util -p 4242) and then use the same commands and terminal on another terminal (arm-none-eabi-gdb main.elf)

But I need to reboot power for it to start working.

------ this is a note for business_kid ---------------
business_kid, you dont need to change "--host=i686-pc-linux-gnu --target=arm-none-eabi" in order to work.

Also I try to build gdb (with ppencho suggested package) in order to create arm-none-eabi-gdb with the option in config --host==arm-none-eabi and it fail. (I added the path to arm-none-eabi-gcc before run the config script)

----------------------------------------------------------------------
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cmake, linking libraries yfaye Programming 1 04-08-2009 07:13 PM
Linking libraries. Gamma_User Linux - Newbie 1 01-19-2009 06:24 PM
linking static libraries??? birjodh Linux - General 1 06-08-2007 12:02 AM
Linking old libraries to new one? winterhunter Linux - Software 7 10-24-2005 05:37 AM
Linking program with .a libraries rudy2 Programming 2 04-22-2005 06:36 AM


All times are GMT -5. The time now is 01:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration