Forum Discussion

sittinhawk's avatar
sittinhawk
Icon for New Contributor rankNew Contributor
1 month ago

JTAG_UART stuck in printf

I'm trying to setup a NiosV and have printf appear over the JTAG_UART. I've used only the default settings when generating the bsp (just the generate command, no set_settings). I notice when I debug, anytime I step over a printf statement, it never returns (also, no print statements appear in the juart-terminal).

However, if I just do a direct pointer access to the JTAG_UART base address, I successfully see characters printed in the juart-terminal.

Looking in the bsp's summary.html, it appears that it has linked the jtag_uart. Ex: hal.stdout Value = jtag_uart_0.

I also have a fair chunk of CPU block ram memory (262 KB total, only using about 16 KB right now for hello world).

Any ideas what the issue here is?

6 Replies

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

    If you can programmatically print characters out the JTAG UART by directing your program to write to the JTAG UART interface, that would tend to indicate that your hardware is probably configured alright. At least you do know what the base address is of the JTAG UART peripheral, but this doesn't prove that you have the IRQ from the JTAG UART connected to the Nios V processor.

    I think you are correct to focus on the BSP configuration and see if there's anything out of order in that area that could explain what's going on when you printf. Fundamentally you need to have the JTAG UART configured as the peripheral that should connect to the stdin, stdout and stderr streams from the HAL library. And then depending on whether you selected reduced device drivers or regular drivers, there may be a need to have the IRQ from the JTAG UART connected in your Platform Designer system and properly represented in the BSP, or the system.h header.

    Can you share the sequence that you use to create your BSP? It sounds like you may just be running niosv-bsp from the command line. If you could share some details about that, and also share your system.h and alt_sys_init.c that gets generated from the BSP generation flow, that may help shed some light on what's going on. If you can share the settings.bsp file that may be useful as well.

     

  • sittinhawk's avatar
    sittinhawk
    Icon for New Contributor rankNew Contributor

    This is how I created the BSP: In Quartus, Platform Designer, File -> New BSP, this generated the file "settings.bsp", and then I ran the command "niosv-bsp.exe -g settings.bsp"

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

      With this flow, you're getting the default BSP configuration, which depending on the complexity of your system it may not be making the choices that you expect.  Can you share the settings.bsp file that is created by this flow?  The system.h and alt_sys_init.c would be useful as well.

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

        When you create the BSP, look in the "Main" tab to see what is selected for stdout.

        In the screenshot below, I have the lw_uart selected. When jtag_uart is also present, the BSP creator arbitrarily picks one of them and you have to change it to the desired uart before clicking the "Generate BSP" button.

        If the jtag_uart is the only UART present in the hardware, it should be selected automatically.

         

    • BoonBengT_Altera's avatar
      BoonBengT_Altera
      Icon for Moderator rankModerator

      Hi sittinhawk,

       

      I hope you’re doing well. I wanted to follow up and check if there are any remaining questions or concerns regarding this matter. 

      Please let us know if anything still needs clarification — we’re happy to assist further.

      Thank you for your time, and we look forward to your feedback.

       

      Best Wishes

      BB

    • BoonBengT_Altera's avatar
      BoonBengT_Altera
      Icon for Moderator rankModerator

      Hi sittinhawk,

      As we do not receive any further clarification/updates on the matter, hence would assume challenge are overcome. We will continue to monitor this post for the next 5 days. If there are no further inquiries during this period, I will step back and allow the community to assist with any future follow-up questions.

      Thank you for engaging with us!

      Best regards,
      BB