1. This forum section is a read-only archive which contains old newsgroup posts. If you wish to post a query, please do so in one of our main forum sections (here). This way you will get a faster, better response from the members on Motherboard Point.

Prob. with msp-gdb

Discussion in 'Embedded' started by Martin, May 18, 2006.

  1. Martin

    Martin Guest

    Hi,

    I've just started playing with the gcc port for msp430.

    I've compiled and linked my program with:

    msp430-gcc test.c -o test -I /cygdrive/c/mspgcc/msp430/include
    -mmcu=msp430x449 -g

    But when I run msp430-gdb, I get, when I run "file test" :

    "test": not in executable format: File format not recognized

    The file "test" has the keyword ELF in it, so I would guess it's the
    correct format. I don't understand why msp430-gdb would have a problem
    with it. msp430-gdb -v gives me:

    GNU gdb 6.0 ...

    This GDB was configured as "--host=i686-pc-cygwin --target=msp430".

    And msp-gcc is the latest version from Sourceforge.

    Anybody have an idea what the problem might be here?

    Thanks,
    Martin.
     
    Martin, May 18, 2006
    #1
    1. Advertisements

  2. [...]

    You didn't like the response I posted when you asked this on
    the msp430-gcc mailing list yesterday?
     
    Grant Edwards, May 18, 2006
    #2
    1. Advertisements

  3. Martin

    Martin Guest

    Hi,

    hadn't seen your reply! My messages have to be vetted for the mailing
    list and so take a little longer. As you can see I tried "file test"
    and msp430-gdb replies that it doesn't recognise the format. This
    doesn't make any sense since msp_gcc created the executable.

    Cheers,
    Martin.
     
    Martin, May 18, 2006
    #3
  4. Is the name of the object file created by msp430-gcc "test" or
    "test.elf"? The command line you showed in your posting on the
    mailing list was creating "test.elf", but then you were trying
    to do things with a file named "test".

    Where did the file "test" come from?
    That depends on which command line you really used -- the one
    you posted on the mailing list, or the one you posted here.

    What do the following commands display?

    msp430-objdump --section-headers test

    msp430-objdump --section-headers test.elf
     
    Grant Edwards, May 18, 2006
    #4
  5. Martin

    Coos Haak Guest

    Op 18 May 2006 10:54:45 -0700 schreef Martin:
    In a *NIX environment test is a reserved word: man test
    So you might have use another name after -o
    or use './test' at the prompt.
    HTH, I don't suscribet do a msp430 mailing list.
     
    Coos Haak, May 18, 2006
    #5
  6. That only matters if you're trying to run a program named
    "test" from the shell without specifying a path. Some shells
    have a built-in named "test". Other shells will find the "test"
    executable in /usr/bin.

    However that has absolutely no impact on creating or using a
    file named "test" in other contexts.
    Using a file named "test" is perfectly fine.

    For non-native ELF files, I generally use a ".elf" suffix, but
    that's purely a matter of personal taste: Unix doesn't care
    least if I want to name a file "test" or "test.elf".
    It doesn't matter. It's not a program he's trying to execute
    from a shell prompt, so there's no difference between using
    "test" and using "./test":

    $ echo "hi there" >test

    $ cat test
    hi there

    $ file test
    test: ASCII text

    $ wc test
    1 2 9 test

    $ tr '[a-z]' '[A-Z]' <test
    HI THERE
     
    Grant Edwards, May 18, 2006
    #6
  7. After thinking about it more, I do remember that many years
    ago, the Cygwin-hosted Gnu linker had a bug where if you
    specified a filename without a "suffix", it would create an
    output file with ".exe" tacked onto the name of the file even
    though the file definitely wasn't a ".exe" file. That fun
    little bit of brain-damage caused a lot of Makefiles to break.
    But, I thought that was fixed a long time ago.

    In any case, I don't see how that problem would have caused the
    symptoms the OP is reporting.
     
    Grant Edwards, May 18, 2006
    #7
  8. Martin

    Martin Guest

    Hi,

    yeah I tried naming the binary test.elf, test and test_1 just in case.
    I simply renamed the same file each time.

    I ran "msp430-objdump --section-headers test_1":

    test_1: file format elf32-msp430

    Sections:
    Idx Name Size VMA LMA File off Algn
    0 .text 00000780 00001100 00001100 00000094 2**1
    CONTENTS, ALLOC, LOAD, READONLY, CODE
    1 .data 00000002 00000200 00001880 00000814 2**1
    CONTENTS, ALLOC, LOAD, DATA
    2 .vectors 00000020 0000ffe0 0000ffe0 00000816 2**0
    CONTENTS, ALLOC, LOAD, READONLY, CODE
    3 .stab 00001bcc 00000000 00000000 00000838 2**2
    CONTENTS, READONLY, DEBUGGING
    4 .stabstr 00002879 00000000 00000000 00002404 2**0
    CONTENTS, READONLY, DEBUGGING

    That certainly indicates that the binary file is ok.

    Cheers,
    Martin.
     
    Martin, May 19, 2006
    #8
  9. That looks right. If msp430-objdump recognizes the file as an
    MSP430 ELF file and msp430-gdb doesn't, then msp430-gdb must be
    broken.

    Can cut/paste a sample gdb session into a posting?
     
    Grant Edwards, May 19, 2006
    #9
  10. Martin

    Martin Guest

    Hi,

    here's a copy of what happens:

    $ msp430-gdb --se=test_1
    GNU gdb 6.0
    Copyright 2003 Free Software Foundation, Inc.
    GDB is free software, covered by the GNU General Public License, and
    you are
    welcome to change it and/or distribute copies of it under certain
    conditions.
    Type "show copying" to see the conditions.
    There is absolutely no warranty for GDB. Type "show warranty" for
    details.
    This GDB was configured as "--host=i686-pc-cygwin
    --target=msp430"..."/home/tst/
    LCD/test_1": not in executable format: File format not recognized
    (gdb) file test_1
    "/home/tst/LCD/test_1": not in executable format: File format not
    recognized
    (gdb)



    Is it possible that the new version of msp-gcc isn't compatible with
    msp-gdb?
    I downloaded it all from Sourceforge 3 days ago.

    Cheers,
    Martin.
     
    Martin, May 19, 2006
    #10
  11. Since gcc doesn't actually produce object files, it would
    probably be binutils/gdb that are out of sync.
    If you want to send me your ELF file (or put it somewhere I can
    download it), I could try loading it with gdb 5.1.1.
     
    Grant Edwards, May 19, 2006
    #11
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.