Forum Discussion

Balerion's avatar
Balerion
Icon for Occasional Contributor rankOccasional Contributor
5 months ago
Solved

Nios-V .elf download failure

Hi all,
I am trying to download two simple Nios-V apps using RiscFree IDE to my target boards. One of my board has Cyclone-V and the other has Arria-10. My main.cpp files are same but their BSPs are different since boards are different. My app is so simple such that it has a printf printing hello world from jtag uart. However, I am not able to download it to the target. It gives me error as written below, when I try to download it to the board that has Arria-10

--------------------------------
Initializing connection...
Cannot set the JTAG Frequency, continuing with auto adjust mode.
Error occured during enumeration of RISC-V harts(no hart found).

--------------------------------
When I try to download the other app to Cyclone-V it also gives me error the

---------------------------------
Initializing Connection ...

Unable to setup adaptive clock.

Internal error. Couldn't halt the target timeout occured.

Error occured attempting to halt the target during discovery.

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

I don't know what the problem are. Could you please help me about that.

Sincerely,

Balerion

  • Hi Balerion,

    When you are able to download the elf using the --go command, it is likely that your setup on the board is correct already

    There is an update by the way. I tried the command

    *****************************************************************
    "niosv-download.exe app.elf --go"

    -> Hello Nios V World!

    *****************************************************************

    And you saw this error when trying to connect with RiscFree

    Initializing connection ...
    Cannot set the JTAG frequency, continuing with auto adjust mode
    Connected to target device with IDCODE 0x2e240dd using USB-Blaster-2 (1) via JTAG at 24.00MHz.
    Info : Active Harts Detected : 1
    Info : Core[0] Hart[0] is in halted state
    Info : [0] System architecture : RV32
    Info : [0] Number of hardware breakpoints available : 1
    Info : [0] Number of program buffers: 8
    Info : [0] Number of data registers: 2
    Info : [0] Memory access -> Program buffer
    Info : [0] Memory access -> Abstract access memory
    Info : [0] CSR & FP Register access -> Abstract commands

    Waiting for debugger connection on port 56767.
    Press 'Q' to Quit.

    This could be your RiscFree's setting or your host system's setting not set correctly.

    Likely Root Causes
    GDB Server launched by risc free failes to connect IDE cannot detect the prompt (gdb) migh due to the following

    a) Firewall/antivrus is blocking the local host port access

    b) IDE times out before connection is established

    c) There is a mismatch in how the debug config launches

    Possible Fix

    a) Temporarily disable antivirus / firewall

    b) Try launch RiscFree as administrator

    c) Increase debugger timeout (if IDE allows)

    Please let me know the result after you try the step and provide screenshot if possible.

    Regards,

    Boon Khai

28 Replies

  • BoonkhaiN_Altera's avatar
    BoonkhaiN_Altera
    Icon for Occasional Contributor rankOccasional Contributor

    Hi Balerion,

    When you are able to download the elf using the --go command, it is likely that your setup on the board is correct already

    There is an update by the way. I tried the command

    *****************************************************************
    "niosv-download.exe app.elf --go"

    -> Hello Nios V World!

    *****************************************************************

    And you saw this error when trying to connect with RiscFree

    Initializing connection ...
    Cannot set the JTAG frequency, continuing with auto adjust mode
    Connected to target device with IDCODE 0x2e240dd using USB-Blaster-2 (1) via JTAG at 24.00MHz.
    Info : Active Harts Detected : 1
    Info : Core[0] Hart[0] is in halted state
    Info : [0] System architecture : RV32
    Info : [0] Number of hardware breakpoints available : 1
    Info : [0] Number of program buffers: 8
    Info : [0] Number of data registers: 2
    Info : [0] Memory access -> Program buffer
    Info : [0] Memory access -> Abstract access memory
    Info : [0] CSR & FP Register access -> Abstract commands

    Waiting for debugger connection on port 56767.
    Press 'Q' to Quit.

    This could be your RiscFree's setting or your host system's setting not set correctly.

    Likely Root Causes
    GDB Server launched by risc free failes to connect IDE cannot detect the prompt (gdb) migh due to the following

    a) Firewall/antivrus is blocking the local host port access

    b) IDE times out before connection is established

    c) There is a mismatch in how the debug config launches

    Possible Fix

    a) Temporarily disable antivirus / firewall

    b) Try launch RiscFree as administrator

    c) Increase debugger timeout (if IDE allows)

    Please let me know the result after you try the step and provide screenshot if possible.

    Regards,

    Boon Khai

    • Balerion's avatar
      Balerion
      Icon for Occasional Contributor rankOccasional Contributor

      Hi,

      I have started IDE as administrator, I also disable the firewall/antivirus. Then I tried to debug again at the same time I opened Wireshark to observe the localhost:port that IDE uses at loopback adapter. And I didn't see any packets. I don't know why but at the same computer I can successfully debug Nios-2 design and while debugging Nios-2 design through Nios2 Eclipse I observed TCP packets that IDE sends and receives at localhost:port. What do you think about that?

      Thanks,

      Balerion

  • BoonkhaiN_Altera's avatar
    BoonkhaiN_Altera
    Icon for Occasional Contributor rankOccasional Contributor

    Hi Balerion,

    When you say you can debug through nios2 eclipse, meaning that you can load the elf, step through the code without issue using the nios2 eclipse? However at the same computer, when debug using RiscFree it dosent work?

    Regards,

    Boon Khai.

    • Balerion's avatar
      Balerion
      Icon for Occasional Contributor rankOccasional Contributor

      Hi,

      Yes exactly, that happens. I mean I can download, debug go step by step over the code with nios2 eclipse. But when I try to use Riscfree, I can't. Not even a packet comes in or goes out through localhost:port.

      Thanks,

      Balerion

  • BoonkhaiN_Altera's avatar
    BoonkhaiN_Altera
    Icon for Occasional Contributor rankOccasional Contributor

    Hi,

    What version that you use for the RiscFree? When you debug using RiscFree, did you configure the debug configuration first to connect to the board JTAG?


    Regards,

    Boon Khai.

    • Balerion's avatar
      Balerion
      Icon for Occasional Contributor rankOccasional Contributor

      Hi,

      I am using RiscFree IDE v24.3.1, 9th Aug 2024. For debugging I first configure debug configuration then click apply then click debug. That is what I'm doing. By the way, I observed something which is when I run "niosv-download.exe app.elf --go" I see TCP packet traffic in localhost:port(at which gdb server waits for client to connect). However, when I try to do same over RiscFree IDE. I don't see any packets. This may be sign of what the problem is?

      Thanks,

      Balerion

      • BoonkhaiN_Altera's avatar
        BoonkhaiN_Altera
        Icon for Occasional Contributor rankOccasional Contributor

        Hi Balerion,

        The RiscFree version looks fine, can you help to screen shot your RiscFree IDE's debug configuration? Wonder if you selected the correct board at the debug configuration setting?

        Regards,

        Boon Khai

  • Jeet14's avatar
    Jeet14
    Icon for Frequent Contributor rankFrequent Contributor

    Hi Balerion,


    Any update on the previous comment?


    Regards

    Tiwari


  • Balerion's avatar
    Balerion
    Icon for Occasional Contributor rankOccasional Contributor

    Hi,

    I have tried the same process on another laptop whose network policies are not restricted and It worked. Thank you guys for the help and support. This topic can be closed.

    Thanks,

    Balerion

  • Hi @Balerion,


    Great! Good to know that it is working now, with no further clarification on this thread, it will be transitioned to community support for further help on doubts in this thread.


    Please login to ‘ https://supporttickets.intel.com/s/?language=en_US’, view details of the desire request, and post a feed/response within the next 15 days to allow me to continue to support you. After 15 days, this thread will be transitioned to community support. The community users will be able to help you on your follow-up questions.

    Thank you for the questions and as always pleasure having you here.


    Best Wishes

    BB