This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

SIMPLELINK-OPENOCD: Wrong carriage return character makes build impossible on *nix

Part Number: SIMPLELINK-OPENOCD

I've dowloaded SIMPLELINK-OPENOCD and tried to build it. Launching ./configure results in an error.

  • With Zsh
% cd ./openocd/openocd 
% ./configure 
zsh: ./configure: bad interpreter: /bin/sh^M: no such file or directory
%
  • With bash
$ cd ./openocd/openocd 
$ ./configure 
bash: ./configure: bad interpreter: /bin/sh^M: no such file or directory
$

According to Not able to execute a .sh file: /bin/bash^M: bad interpreter

This isn't a permission issue, you aren't getting a message about permissions
/bin/bash^M: bad interpreter: No such file or directory

The script indicates that it must be executed by a shell located at /bin/bash^M. There is no such file: it's called /bin/bash.

The ^M is a carriage return character. Linux uses the line feed character to mark the end of a line, whereas Windows uses the two-character sequence CR LF. Your file has Windows line endings, which is confusing Linux.

Remove the spurious CR characters. You can do it with the following command:

sed -i -e 's/\r$//' create_mgw_3shelf_6xIPNI1P.sh

So I tried the recommended solution and dos2unix as well, to no avail.

Could you please release a clean package of SIMPLELINK-OPENOCD so it can be built on *nix? 

Thank you!

  • The source code for openocd-0.10.0.zip provided at the OpenOCD - Open On-Chip Debugger repository builds with no issue.

  • Olivier,

    I ran into the same issue as you and coudl not yet get a formal release that builds fine. 

    Using a linux host, I cloned the project from TI's GIT repository at: 

    https://git.ti.com/cgit/sdo-emu/openocd/

    Then I could move forward with the build, but only to a certain point. It spawns an error at a specific source file that I couldn't get past.

    I am using Ubuntu 18.04.3 with the following dependencies and options installed: 

    dependencies said:

    sudo apt install libusb-1.0-0
    sudo apt install libhdiapi-dev
    sudo apt install libftdi-dev
    sudo apt install pkg-config
    sudo apt install dos2unix
    sudo apt install vim
    sudo apt install automake

    openocd_options said:
     

    ./configure --enable-xds110 --enable-ti-icdi --enable-cmsis-dap --enable-jlink --disable-doxygen-html --disable-stlink --disable-ulink --disable-usb-blaster-2 --disable-vsllink --disable-osbdm --disable-opendous --disable-aice --disable-usbprog --disable-rlink --disable-armjtagew --disable-usb-blaster --disable-presto --disable-openjtag --disable-parport --disable-gcc-warnings

    I then had to run aclocal before running make (something about versions used to generate files). 

    I am waiting for the developer's comments. 

    Regards,

    Rafael

  • Rafael,

    Thank for the pointer to the git repository.

    The code seems to be cleaner.

    The first step ./configure completes successfully but make fails and complains about a wrong version of automake.

    ReiVilo@MacBook openocd % make
    Makefile:4283: warning: overriding commands for target `check-recursive'
    Makefile:3696: warning: ignoring old commands for target `check-recursive'
     cd . && /bin/sh /Users/ReiVilo/openocd/openocd/missing automake-1.15 --gnu Makefile
    /Users/ReiVilo/openocd/openocd/missing: line 81: automake-1.15: command not found
    WARNING: 'automake-1.15' is missing on your system.
             You should only need it if you modified 'Makefile.am' or
             'configure.ac' or m4 files included by 'configure.ac'.
             The 'automake' program is part of the GNU Automake package:
             <www.gnu.org/.../automake>
             It also requires GNU Autoconf, GNU m4 and Perl in order to run:
             <www.gnu.org/.../autoconf>
             <www.gnu.org/.../>
             <http://www.perl.org/>
    make: *** [Makefile.in] Error 127
    

    However, automake is installed, albeit with release 1.16.1.

    ReiVilo@MacBook openocd % automake --version                         
    automake (GNU automake) 1.16.1
    Copyright (C) 2018 Free Software Foundation, Inc.
    License GPLv2+: GNU GPL version 2 or later <gnu.org/.../gpl-2.0.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.
    
    Written by Tom Tromey <tromey@redhat.com>
           and Alexandre Duret-Lutz <adl@gnu.org>.
    

    I ran those tests on macOS 10.15 Catalina.

    ReiVilo@MacBook openocd % uname -a
    Darwin MacBook 19.0.0 Darwin Kernel Version 19.0.0: Thu Oct 17 16:17:15 PDT 2019; root:xnu-6153.41.3~29/RELEASE_X86_64 x86_64

    To be continued...

  • You may need to run aclocal in the OpenOCD root directory to reconfigure the automake files to the version of automake you have installed. Once you've done that, the build should be proceed correctly.

    The person who created the SimpleLink page posted an image with the wrong line endings. We're in the process of trying get that fixed, but there are some issues with acquiring all of the permissions to make that update (it's strictly controlled as it is available to the public).

    The git repository is the proper master for the files; the archive on the SimpleLink page was supposed to be just an archive of a clone.

  • Thanks for the tip about aclocal. make completes successfully.

    Apart from the boards, what are the differences between the code source from TI and the code source from openocd.org?

    Providing the binaires ready for download for the main OSes, or available through a packet manager (apt-get, brew to name a few), would be a great option. 

  • I was able to build from the https://git.ti.com/cgit/sdo-emu/openocd/ repository.

    I would recommend to

    • Post the same version of the source code on the official SIMPLELINK-OPENOCD page,
    • Provide binaires ready for download for the main OSes, or available through a packet manager (apt-getbrew to name a few),
    • Enrich the official OpenOCD repository with the boards and drivers specific to Texas Instruments.

    Thank you again for your help!

  • Olivier, 

    Thanks for the suggestions. We are still running into an issue in the backend and will post a working package on the download page soon. 

    Precompiled binaries may require additional licensing issues. I am not privy to all details. 

    That may be already included, but it may simply not have been yet released in an offical OpenOCD release. 

    Regards,

    Rafael

  • Oliver, on that third recommendation, we have submitted the TI specific changes to the official OpenOCD repository, and all but one (an update to MSP432 support) have already been accepted and merged.  Ideally, once the OpenOCD team decide to make a new release, our support will be there.

**Attention** This is a public forum