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

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

    Hi Balerion,


    Any update on the Boonkhai previous comment?


    Regards

    Tiwari


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

    Hi Balerion,

    We are not sure yet at the moment, if you don't mind, could you please share the FPGA design? so I can consult the subject matter expert in our team.

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

    I see, so you are connecting to the board through jtagserver.

    Is your device consist of HPS? or it is just FPGA.

    And also you were saying that you able to

    1) download .sof through Quartus Programmer.
    2) can see the fpga in Jtag Chain.(the jtagconfig command)
    3) can also open juart-teminal from console.
    4) can see the target device and Nios-v core through RiscFree IDE Debug Configuration.

    Wonder if you can share your design? would like to cross check if the debug component is loaded, I will take the file to consult with the subject matter expert in our team.

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

      Hi,

      Both of my device are just FPGA. I want to ask that where do you expect the problem to occur in this situation? I mean, does it seem to be at software side or fpga side?

      Thanks,

      Balerion

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

    Hi please share the jtagconfig for Cyclone-V as well

    run with the "jtagconfig -d" for both devices.

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

      Hi
      I run the command "jtagconfig -d" for both devices. Here is the result.

      For Arria-10 board:


      1) USB-BlasterII [USB-1]
      (JTAG Server Version 18.1.0 Build 625 09/12/2018 SJ Standard Edition)
      02E240DD 10AX048E(1|2|3|3ES|4|4ES)/.. (IR=10)
      Design hash 659832DA50C1CCAFD154
      + Node 30006E00 Signal Tap #0
      + Node 30006E01 Signal Tap #1
      + Node 30006E02 Signal Tap #2
      + Node 30006E03 Signal Tap #3
      + Node 30006E04 Signal Tap #4
      + Node 30006E05 Signal Tap #5
      + Node 30006E06 Signal Tap #6
      + Node 30006E07 Signal Tap #7
      + Node 30006E08 Signal Tap #8
      + Node 08986E00 Nios V #0
      + Node 0C006E00 JTAG UART #0
      + Node 0C206E00 JTAG PHY #0
      + Node 0C206E01 JTAG PHY #1

      Captured DR after reset = (02E240DD) [32]
      Captured IR after reset = (155) [10]
      Captured Bypass after reset = (0) [1]
      Captured Bypass chain = (0) [1]
      JTAG clock speed 24 MHz


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

      For Cyclone-V board:

      1) USB-BlasterII [USB-1]
      (JTAG Server Version 18.1.0 Build 625 09/12/2018 SJ Standard Edition)
      02B130DD 5CE(BA7|FA7|FA7ES) (IR=10)
      Design hash BCF7B2F2148F6CA555BF
      + Node 00486E00 Source/Probe #0
      + Node 08986E00 Nios V #0
      + Node 0C006E00 JTAG UART #0
      + Node 0C206E00 JTAG PHY #0
      + Node 00486E01 Source/Probe #1
      + Node 0C206E01 JTAG PHY #1
      + Node 30006E2A Signal Tap #42
      + Node 30006E3C Signal Tap #60
      + Node 30006E29 Signal Tap #41

      Captured DR after reset = (02B130DD) [32]
      Captured IR after reset = (155) [10]
      Captured Bypass after reset = (0) [1]
      Captured Bypass chain = (0) [1]
      JTAG clock speed 24 MHz

      Thanks,

      Balerion

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

      Hi,


      I run "jtagconfig" in niosv shell and the output is below the output is for Arria-10 device. I didn't do it for Cyclone-V. If you want I can also share that.

      Thanks,
      *************
      > jtagconfig


      1) USB-BlasterII [USB-1]
      02E240DD 10AX048E(1|2|3|3ES|4|4ES)/..
      **************

      Balerion

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

    Hi Balerion,

    You have two board, Cyclone-V and Arria-10, and you were saying with the same main.cpp and the same steps, loading into Cyclone-V works but not Arria-10?

    You can try check with

    1) Quartus programmer jtag chain by running

    jtagconfig

    2) check that the nios-v processor is actually present and makesure your sof file includes a nios v processor, if the bitstream doest not instantiate a nios-v core the debugger wont find any risc-v harts (hence "no hart found" error), please make sure the bitstream is programmed first

    3) verify BSP and platform configuration and make sure your BSP is generated from a platform designer system that includes required peripheral eg: JTAG UART, clock and reset, memory map etc.

    Regards,

    Boon Khai

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

      Hi BoonkhaiN,

      Actually I couldn't download .elf to the both device.

      For Cyclone-V board,

      I used Quartus Prime 24.1 Standard version. My design is synthesized with it. Then I generated my BSP using niosv shell of Quartus 24.1 std. I used the command "niosv-bsp -c -t=hal --sopcinfo=system.sopcinfo bsp/settings.bsp" to generate the BSP then for the app, I used the command "niosv-app -a=app -b=bsp -s=app/hello.cpp". Then I import the Nios-V CmakeList project into RiscFree IDE then compiled it. However, When I try to download it to the target it gave me error as I said in the previous post. Which is,

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

      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 can download .sof through Quartus Programmer. I can see the fpga in Jtag Chain. I can also open juart-teminal from console. I can see the target device and Nios-v core through RiscFree IDE Debug Configuration. However I couldn't download my .elf to the target.

      For Arria-10 Board,

      I used Quartus Prime 24.3 Pro version. My design is synthesized with it. Then I generated my BSP using niosv shell of Quartus 24.3 pro. I was thinking of using .sopcinfo file to generate bsp however, I read that it is discarded from currnet CLI interface commands. So that, I used the command "niosv-bsp -c -p=system.qpf -s=system.qsys -t=hal bsp/settings.bsp" to generate the BSP then for the app, I used the command "niosv-app -b=bsp -a=app -s=app/hello.cpp". Then I import the Nios-V CmakeList project into RiscFree IDE then compiled it. However, When I try to download it to the target it gave me error as I said in the previous post. Which is,

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

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

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

      I can download .sof through Quartus Programmer. I can see the fpga in Jtag Chain. I can also open juart-teminal from console. I can see the target device and Nios-v core through RiscFree IDE Debug Configuration. However I couldn't download my .elf to the target.

      I couldn't get the problem in both case, Is there anything you suggest me to do?

      Thanks,

      Balerion