Results 1 to 3 of 3

Thread: How to know what files to include in Nios II main file?

  1. #1
    Join Date
    Apr 2013
    Posts
    76
    Rep Power
    1

    Default How to know what files to include in Nios II main file?

    When I initially created a system with just a JTAG UART as peripheral and then chose "Nios II application and BSP from template" and then selected small hello world, the .c file with the main routine contained only 1 header file:

    #include "sys/alt_stdio.h"

    I assume that this contains the printf function used for hello world application. However, I do not find a folder named sys anywhere in the things generated by the Nios II Eclipse IDE.

    Anyway, when I later add more peripherals like PIO to my design and regenerate the SOPC file, how do I know what header files to include so I can use the new peripherals? Also, where are the HAL version of IORD and IORW declared for the new peripherals like the PIO?

  2. #2
    Join Date
    Dec 2015
    Location
    Belgium
    Posts
    132
    Rep Power
    1

    Default Re: How to know what files to include in Nios II main file?

    Hello XAUI

    You have to look into the board support package project (BSP project)

    Example:
    C:\FpgaQsysProjects\Q16\tse_tutorial\software\tse_ hello_world == your files
    C:\FpgaQsysProjects\Q16\tse_tutorial\software\tse_ hello_world_bsp\drivers\inc == supporting routines for the hardware selected.

    These files are not generated by Eclipse but by Qsys based on the configuration you built in Qsys.

    Best Regards,
    Johi.
    Last edited by Johi; January 29th, 2017 at 09:44 AM.

  3. #3
    Join Date
    Apr 2013
    Posts
    76
    Rep Power
    1

    Default Re: How to know what files to include in Nios II main file?

    Yes after experimentation I found what files are needed, depends on what we are doing.

    alt_stdio for stdin and stdout
    system.h always needed as it has constants needed for HAL functions
    io.h if we are using the iord and iowr functions
    peripheral headers e.g alt_timer_regs.h if we are using the timer as it contains timer specific HAL functions that are easier to use then IORD and IOWR
    if we use usleep then we need unistd.h
    if we are using interrupts that need to be registerd then we must include alt_irq.h
    then if we are using HAL types like alt_uint16 then we need alt_types.h too

    yes it keeps going

Similar Threads

  1. include nios software files to rbf
    By domtheron in forum General Discussion Forum
    Replies: 0
    Last Post: November 16th, 2011, 04:48 AM
  2. Replies: 3
    Last Post: July 22nd, 2011, 06:28 AM
  3. AN517 source files (ie main.c and header files)
    By MAX232 in forum General Altera Discussion
    Replies: 2
    Last Post: November 1st, 2009, 06:31 AM
  4. How to include header files in Nios IDE?
    By maoguohua2002 in forum General Discussion Forum
    Replies: 1
    Last Post: January 12th, 2005, 01:01 AM
  5. How to include header files in Nios IDE
    By neo in forum General Discussion Forum
    Replies: 0
    Last Post: December 20th, 2004, 06:15 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •