Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
17 years ago

jtag interface from user aplication

Hi,

I'm trying to access the jtag port inside the fpga with the alt_jtag_atlantic block (also used in the jtag_uart for the niosII processor).

I need access to the jtag port from a custom C/C++ program. I tried an approach like in this link :

http://nioswiki.jot.com/wikihome/highspeedimagedownloaddemo

but then in Visual studio (not g++).

I have a problem about the "int jtagatlantic_get_error(const char * * other_info);" function from inside the jtag_atlantic dll.

The error is an undefined reference :

error LNK2019: unresolved external symbol "int __cdecl jtagatlantic_get_error(char const * *)" (?jtagatlantic_get_error@@YAHPAPBD@Z) referenced in function _main

Does anyone has experience with this, or knows where I can find more information?

Stefaan

17 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    I rembered your post, when I stumbled upon the same enum issue with MSVC. I can supply now a small example application, including the MSVC import library and modified include file.

    Best regards,

    Frank

    P.S.: As another comment, jtag_atlantic.dll is only seeing JTAG UART (NODE_ID 0x80) virtual JTAG functions. To interface any other virtual JTAG node type, you have to go through jtag_client.dll. According to the exported functions, sld_hapi.dll is providing an interface similar to virtual JTAG tcl commands provided by quartus_stp, as documented in TclScriptRefMnl.pdf. Unfortunately there's no interface documentation for both DLLs.

    Another option is using generic JTAG interfaces and implementing the virtual JTAG protocol, as discussed in other threads.

    --- Quote End ---

    ==================

    Dear Frank,

    I tried the example MSVC application you've provided with Quartus 9.1 installed. Got strange issue:

    1) jtagatlantic_open (NULL, 0x0, -1, NULL) - OK

    2) jtagatlantic_flush - OK

    3) jtagatlantic_write(link, "Hello", 5) returns 5. Should be OK, but nothing is sent to NIOS target

    - When using nios2-terminal (command line or NIOS IDE) - works fine - NIOS target receives "Hello".

    - I sniffed JTAGserver on TCP/IP socket 1309 - can see activity at steps 1 and 2 (open, flush), but no activity at step 3.

    Also tried other JTAG_Atlantic examples (attached) - they work in Cygwin environment, but behave exactly as described above when compiled in MSVC.

    Did you try this sample application with recent releases of Quartus (9/10). May be something changed in JTAG_Atlantic.DLL in recent Quartus releases ?

    Would very appreciate your help.

    Sincerely,

    Juri Cizas

    Infineon Technologies
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    Did you try this sample application with recent releases of Quartus (9/10)

    --- Quote End ---

    No, I'm not working with JTAG UART at present. It has been my starting point for virtual JTAG interface from PC applications. I have a number of test tools interfacing In-System Source&Probe and Memory Content Editor virtual JTAG function through sld_hapi.dll. Apparently, there are no changes from Quartus version 8 to version 9 related to this usage.

    Unfortunately, I have no idea what's going wrong. I'll try to look into it within the next days.

    Best regards,

    Frank
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Dear Frank,

    Happy New Year!

    Very appreciate your help!

    By any chance, do you have any short description or example C/C++ code of sld_hapi.dll ? May be I can use it instead of Atlantic ?

    Sincerely,

    Juri Cizas
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    The jtag_atlantic_terminal returned some errors when compiling it in MSVC: :confused:

    1>JTAG.obj : error LNK2019: unresolved external symbol "void __cdecl jtagatlantic_close(struct JTAGATLANTIC *)" (?jtagatlantic_close@@YAXPAUJTAGATLANTIC@@@Z) referenced in function _main
    1>JTAG.obj : error LNK2019: unresolved external symbol "int __cdecl jtagatlantic_flush(struct JTAGATLANTIC *)" (?jtagatlantic_flush@@YAHPAUJTAGATLANTIC@@@Z) referenced in function _main
    1>JTAG.obj : error LNK2019: unresolved external symbol "int __cdecl jtagatlantic_write(struct JTAGATLANTIC *,char const *,unsigned int)" (?jtagatlantic_write@@YAHPAUJTAGATLANTIC@@PBDI@Z) referenced in function _main
    1>JTAG.obj : error LNK2019: unresolved external symbol "int __cdecl jtagatlantic_get_error(char const * *)" (?jtagatlantic_get_error@@YAHPAPBD@Z) referenced in function _main
    1>JTAG.obj : error LNK2019: unresolved external symbol "int __cdecl jtagatlantic_read(struct JTAGATLANTIC *,char *,unsigned int)" (?jtagatlantic_read@@YAHPAUJTAGATLANTIC@@PADI@Z) referenced in function _main
    1>JTAG.obj : error LNK2019: unresolved external symbol "struct JTAGATLANTIC * __cdecl jtagatlantic_open(char const *,int,int,char const *)" (?jtagatlantic_open@@YAPAUJTAGATLANTIC@@PBDHH0@Z) referenced in function _main
    
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    You get unresolved external when not adding jtag_atlantic.lib to the project.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    I have a number of test tools interfacing In-System Source&Probe and Memory Content Editor virtual JTAG function through sld_hapi.dll.

    --- Quote End ---

    Hi,

    Could you tell me how did you find the function prototypes from the sld_hapi.dll ?

    I managed to get a dynamic lib usable in cygwin (following this : http://www.emmestech.com/moron_guides/moron1.html (http://www.emmestech.com/moron_guides/moron1.html) ) but now I can't find prototypes.

    I tried to use Dependency Walker but exported function seems to be not "decorated".

    Thanks in adavance for your help.

    Franck.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi

    I'm trying to use the jtagatlantic library, but I have a problem when I call the function jtagatlantic_open(). I want to build a program with Dev-C++ to send data to the Nios II processor in my FPGA board.

    If I load the Nios II system in the board and I run the software in the Nios II processor since the Nios II SBT for Eclipse, when I run my C++ program the function jtagAtlantic_open() don't open the link. The function jtagatlantic_get_error() returns the value -6 (Target or port in use, see other_info) and the parameter other_info contains "Nios2 on 127.0.0.1".

    In the other hand, If I load the Nios II system but I don´t run any software in the Nios II processor, then the function jtagatlantic_open() run well.

    So, I think the problem is that the jtag uart can't be used at the same time by jtag atlantic and the Nios II program.

    What can I do about it?

    Thanks,

    David