[SOLVED] Using JlinkExe on Raspberry Pi 3 (V6.20a)

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] Using JlinkExe on Raspberry Pi 3 (V6.20a)


    Hi!
    I am a beginner in using the JLink/JFlasher tool and I want to run the JLink executable on a raspberry PI 3 device in order to perform automated flashing of a given platform.
    I donwloaded the J-Link Software and Documentation pack for Linux ARM systems V6.20a on my windows PC,
    extracted locally there and copied the file on my Pi3 at the following location:

    /opt/SEGGER/JLink.
    I send the
    sudo cp 99-jlink.rules /etc/udev/rules.d/

    enabled read write execution permission on all the files and run JLinkExe.

    Unfortunately the program exits with the following error:

    root@raspberrypi:/opt/SEGGER/JLink# ./JLinkExe
    SEGGER J-Link Commander V6.20a (Compiled Sep 15 2017 18:07:21)
    Could not open J-Link shared library. Exiting now.


    If I run with strace I get the following output:

    root@raspberrypi:/opt/SEGGER/JLink# strace ./JLinkExe
    execve("./JLinkExe", ["./JLinkExe"], [/* 15 vars */]) = 0
    brk(0) = 0x1f7a000
    uname({sys="Linux", node="raspberrypi", ...}) = 0
    access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
    mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x76fdd000
    access("/etc/ld.so.preload", R_OK) = 0
    open("/etc/ld.so.preload", O_RDONLY|O_CLOEXEC) = 3
    fstat64(3, {st_mode=S_IFREG|0644, st_size=42, ...}) = 0
    mmap2(NULL, 42, PROT_READ|PROT_WRITE, MAP_PRIVATE, 3, 0) = 0x76fdc000
    close(3) = 0
    open("/usr/lib/arm-linux-gnueabihf/libarmmem.so", O_RDONLY|O_CLOEXEC) = 3
    read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0h\5\0\0004\0\0\0"..., 512) = 512
    lseek(3, 17960, SEEK_SET) = 17960
    read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 960) = 960
    lseek(3, 17696, SEEK_SET) = 17696
    read(3, "A.\0\0\0aeabi\0\1$\0\0\0\0056\0\6\6\10\1\t\1\n\3\f\1\22\4\24"..., 47) = 47
    fstat64(3, {st_mode=S_IFREG|0644, st_size=18920, ...}) = 0
    mmap2(NULL, 83236, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x76f9b000
    mprotect(0x76fa0000, 61440, PROT_NONE) = 0
    mmap2(0x76faf000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x4000) = 0x76faf000
    mprotect(0x7e8fd000, 4096, PROT_READ|PROT_WRITE|PROT_EXEC|PROT_GROWSDOWN) = 0
    close(3) = 0
    munmap(0x76fdc000, 42) = 0
    open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
    fstat64(3, {st_mode=S_IFREG|0644, st_size=24841, ...}) = 0
    mmap2(NULL, 24841, PROT_READ, MAP_PRIVATE, 3, 0) = 0x76fd6000
    close(3) = 0
    access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
    open("/lib/arm-linux-gnueabihf/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
    read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0lY\0\0004\0\0\0"..., 512) = 512
    lseek(3, 120788, SEEK_SET) = 120788
    read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1520) = 1520
    lseek(3, 86420, SEEK_SET) = 86420
    read(3, "A0\0\0\0aeabi\0\1&\0\0\0\0056\0\6\6\10\1\t\1\n\2\22\4\23\1\24"..., 49) = 49
    fstat64(3, {st_mode=S_IFREG|0755, st_size=122308, ...}) = 0
    mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x76fd5000
    mmap2(NULL, 160316, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x76f73000
    mprotect(0x76f87000, 65536, PROT_NONE) = 0
    mmap2(0x76f97000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x14000) = 0x76f97000
    mmap2(0x76f99000, 4668, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x76f99000
    close(3) = 0
    access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
    open("/lib/arm-linux-gnueabihf/librt.so.1", O_RDONLY|O_CLOEXEC) = 3
    read(3, "\177ELF\1\1\1\3\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0000\30\0\0004\0\0\0"..., 512) = 512
    lseek(3, 25352, SEEK_SET) = 25352
    read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1320) = 1320
    lseek(3, 24964, SEEK_SET) = 24964
    read(3, "A0\0\0\0aeabi\0\1&\0\0\0\0056\0\6\6\10\1\t\1\n\2\22\4\23\1\24"..., 49) = 49
    fstat64(3, {st_mode=S_IFREG|0644, st_size=26672, ...}) = 0
    mmap2(NULL, 90684, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x76f5c000
    mprotect(0x76f62000, 61440, PROT_NONE) = 0
    mmap2(0x76f71000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x5000) = 0x76f71000
    close(3) = 0
    access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
    open("/lib/arm-linux-gnueabihf/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
    read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\220\t\0\0004\0\0\0"..., 512) = 512
    lseek(3, 8660, SEEK_SET) = 8660
    read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1160) = 1160
    lseek(3, 8328, SEEK_SET) = 8328
    read(3, "A0\0\0\0aeabi\0\1&\0\0\0\0056\0\6\6\10\1\t\1\n\2\22\4\23\1\24"..., 49) = 49
    fstat64(3, {st_mode=S_IFREG|0644, st_size=9820, ...}) = 0
    mmap2(NULL, 73912, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x76f49000
    mprotect(0x76f4b000, 61440, PROT_NONE) = 0
    mmap2(0x76f5a000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1000) = 0x76f5a000
    close(3) = 0
    access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
    open("/lib/arm-linux-gnueabihf/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
    read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0L\204\1\0004\0\0\0"..., 512) = 512
    lseek(3, 1239936, SEEK_SET) = 1239936
    read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 2840) = 2840
    lseek(3, 1236500, SEEK_SET) = 1236500
    read(3, "A.\0\0\0aeabi\0\1$\0\0\0\0056\0\6\6\10\1\t\1\n\2\22\4\23\1\24"..., 47) = 47
    fstat64(3, {st_mode=S_IFREG|0755, st_size=1242776, ...}) = 0
    mmap2(NULL, 1312152, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x76e08000
    mprotect(0x76f33000, 65536, PROT_NONE) = 0
    mmap2(0x76f43000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x12b000) = 0x76f43000
    mmap2(0x76f46000, 9624, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x76f46000
    close(3) = 0
    mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x76fd4000
    set_tls(0x76fd46d0, 0x76fd4db8, 0x76fe0050, 0x76fd46d0, 0x76fe0050) = 0
    mprotect(0x76f43000, 8192, PROT_READ) = 0
    mprotect(0x76f5a000, 4096, PROT_READ) = 0
    mprotect(0x76f97000, 4096, PROT_READ) = 0
    mprotect(0x76f71000, 4096, PROT_READ) = 0
    mprotect(0x76f9b000, 20480, PROT_READ|PROT_WRITE) = 0
    mprotect(0x76f9b000, 20480, PROT_READ|PROT_EXEC) = 0
    cacheflush(0x76f9b000, 0x76fa0000, 0, 0x15, 0x7e8fd900) = 0
    mprotect(0x76fdf000, 4096, PROT_READ) = 0
    munmap(0x76fd6000, 24841) = 0
    set_tid_address(0x76fd4278) = 1764
    set_robust_list(0x76fd4280, 12) = 0
    rt_sigaction(SIGRTMIN, {0x76f78434, [], SA_RESTORER|SA_SIGINFO, 0x76e371a0}, NULL, 8) = 0
    rt_sigaction(SIGRT_1, {0x76f782d8, [], SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x76e371a0}, NULL, 8) = 0
    rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
    getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM_INFINITY}) = 0
    fstat64(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 0), ...}) = 0
    mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x76fdc000
    write(1, "SEGGER J-Link Commander V6.20a ("..., 63SEGGER J-Link Commander V6.20a (Compiled Sep 15 2017 18:07:21)
    ) = 63
    futex(0x76f5b0ac, FUTEX_WAKE_PRIVATE, 2147483647) = 0
    brk(0) = 0x1f7a000
    brk(0x1f9b000) = 0x1f9b000
    open("./libjlinkarm.so", O_RDONLY|O_CLOEXEC) = 3
    read(3, "", 512) = 0
    close(3) = 0
    readlink("/proc/self/exe", "/opt/SEGGER/JLink/JLinkExe", 512) = 26
    open("/opt/SEGGER/JLink/libjlinkarm.so", O_RDONLY|O_CLOEXEC) = 3
    read(3, "", 512) = 0
    close(3) = 0
    open("/opt/SEGGER/JLink/libjlinkarm.so", O_RDONLY|O_CLOEXEC) = 3
    read(3, "", 512) = 0
    close(3) = 0
    open("/opt/SEGGER/JLink/libjlinkarm.so.5", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
    write(1, "Could not open J-Link shared lib"..., 51Could not open J-Link shared library. Exiting now.
    ) = 51

    exit_group(1) = ?
    +++ exited with 1 +++


    So it looks like the program is trying to access the /opt/SEGGER/JLink/libjlinkarm.so.5 library, which is not included in the package.
    Instead I have libjlinkarm.so.6 library. Even if I try to rename it to "libjlinkarm.so.5" the problem still persists (i.e. I open the file but still get the same error message "Could not open J-Link shared lib"..., 51Could not open J-Link shared library. ")


    Do you guys have any suggestion on how I can get unstuck?

    Shall I try to install older versions of the library ?

    Thanks
  • Hi,


    I just gave it a try on a Raspberry 3 and could not reproduce any issue.
    Please find attached the trace of my successful try.

    I donwloaded the J-Link Software and Documentation pack for Linux ARM systems V6.20a on my windows PC,
    extracted locally there and copied the file on my Pi3 at the following location:


    This is most likely the cause of the issue.
    Extracting on windows destroys the symbolic links and the file permissions.

    Could you please give it a try to transfer to archive to the raspberry pi and extract it there?


    Best regards,
    Niklas
    Files
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hi,

    thanks for the feedback and good to hear that you are up and running :)

    Best regards,
    Niklas
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.