Visible to Intel only — GUID: mwh1416946623826
Ixiasoft
Product Discontinuance Notification
1. Nios® II Software Developer's Handbook Revision History
2. Overview of Nios® II Embedded Development
3. Getting Started with the Graphical User Interface
4. Getting Started from the Command Line
5. Nios® II Software Build Tools
6. Overview of the Hardware Abstraction Layer
7. Developing Programs Using the Hardware Abstraction Layer
8. Developing Device Drivers for the Hardware Abstraction Layer
9. Exception Handling
10. Cache and Tightly-Coupled Memory
11. MicroC/OS-II Real-Time Operating System
12. Ethernet and the NicheStack TCP/IP Stack
13. Read-Only Zip File System
14. Publishing Component Information to Embedded Software
15. HAL API Reference
16. Nios® II Software Build Tools Reference
17. Nios® II Software Developer's Handbook Archives
1.1. Overview of Nios® II Embedded Development Revision History
1.2. Getting Started with the Graphical User Interface Revision History
1.3. Getting Started from the Command Line Revision History
1.4. Nios® II Software Build Tools Revision History
1.5. Overview of the Hardware Abstraction Layer Revision History
1.6. Developing Programs Using the Hardware Abstraction Layer Revision History
1.7. Developing Device Drivers for the Hardware Abstraction Layer Revision History
1.8. Exception Handling Revision History
1.9. Cache and Tightly-Coupled Memory Revision History
1.10. MicroC/OS-II Real-Time Operating System Revision History
1.11. Ethernet and the NicheStack TCP/IP Stack - Nios® II Edition Revision History
1.12. Read-Only Zip File System Revision History
1.13. Publishing Component Information to Embedded Software Revision History
1.14. HAL API Reference Revision History
1.15. Nios® II Software Build Tools Reference Revision History
2.1. Windows* Subsystem for Linux* (WSL 1) on Windows Requirements for Nios® II EDS
2.2. Prerequisites for Understanding the Nios® II Embedded Design Suite
2.3. Finding Nios II EDS Files
2.4. Nios® II Software Development Environment
2.5. Nios® II EDS Development Flows
2.6. Nios® II Programs
2.7. Intel FPGA Software Packages for Embedded Systems
2.8. Nios® II Embedded Design Examples
2.9. Third-Party Embedded Tools Support
2.10. Additional Nios® II Information
3.1. Installing Eclipse IDE into Nios® II EDS
3.2. Getting Started with Nios II Software in Eclipse
3.3. Makefiles and the Nios® II SBT for Eclipse
3.4. Using the BSP Editor
3.5. Run Configurations in the SBT for Eclipse
3.6. Optimizing Project Build Time
3.7. Importing a Command-Line Project
3.8. Packaging a Library for Reuse
3.9. Creating a Software Package
3.10. Programming Flash in Intel FPGA Embedded Systems
3.11. Creating Memory Initialization Files
3.12. Running a Nios® II System with ModelSim
3.13. Eclipse Usage Notes
3.13.1. Configuring Application and Library Properties
3.13.2. Configuring BSP Properties
3.13.3. Exclude from Build Not Supported
3.13.4. Selecting the Correct Launch Configuration Type
3.13.5. Target Connection Options
3.13.6. Renaming Nios® II Projects
3.13.7. Running Shell Scripts from the SBT for Eclipse
3.13.8. Must Use Nios® II Build Configuration
3.13.9. CDT Limitations
3.13.10. Enhancements for Build Configurations in SBT and SBT for Eclipse
5.1. Road Map for the SBT
5.2. Makefiles
5.3. Nios® II Embedded Software Projects
5.4. Common BSP Tasks
5.5. Details of BSP Creation
5.6. Tcl Scripts for BSP Settings
5.7. Revising Your BSP
5.8. Specifying BSP Defaults
5.9. Device Drivers and Software Packages
5.10. Boot Configurations for Intel FPGA Embedded Software
5.11. Intel FPGA-Provided Embedded Development Tools
5.12. Restrictions
7.1. HAL BSP Settings
7.2. The Nios® II Embedded Project Structure
7.3. The system.h System Description File
7.4. Data Widths and the HAL Type Definitions
7.5. UNIX-Style Interface
7.6. File System
7.7. Using Character-Mode Devices
7.8. Using File Subsystems
7.9. Using Timer Devices
7.10. Using Flash Devices
7.11. Using DMA Devices
7.12. Using Interrupt Controllers
7.13. Reducing Code Footprint in Embedded Systems
7.14. Boot Sequence and Entry Point
7.15. Memory Usage
7.16. Working with HAL Source Files
7.13.1. Enable Compiler Optimizations
7.13.2. Use Reduced Device Drivers
7.13.3. Reduce the File Descriptor Pool
7.13.4. Use /dev/null
7.13.5. Use a Smaller File I/O Library
7.13.6. Use the Lightweight Device Driver API
7.13.7. Use the Minimal Character-Mode API
7.13.8. Eliminate Unused Device Drivers
7.13.9. Eliminate Unneeded Exit Code
7.13.10. Turn off C++ Support
8.1. Driver Integration in the HAL API
8.2. The HAL Peripheral-Specific API
8.3. Preparing for HAL Driver Development
8.4. Development Flow for Creating Device Drivers
8.5. Nios® II Hardware Design Concepts
8.6. Accessing Hardware
8.7. Creating Embedded Drivers for HAL Device Classes
8.8. Integrating a Device Driver in the HAL
8.9. Creating a Custom Device Driver for the HAL
8.10. Reducing Code Footprint in HAL Embedded Drivers
8.11. HAL Namespace Allocation
8.12. Overriding the HAL Default Device Drivers
8.8.5.2.1. Creating and Naming the Driver or Package
8.8.5.2.2. Identifying the Hardware Component Class
8.8.5.2.3. Setting the BSP Type
8.8.5.2.4. Specifying an Operating System
8.8.5.2.5. Specifying Source Files
8.8.5.2.6. Specifying a Subdirectory
8.8.5.2.7. Enabling Software Initialization
8.8.5.2.8. Adding Include Paths
8.8.5.2.9. Version Compatibility
9.2.1. HAL APIs for Hardware Interrupts
9.2.2. HAL ISR Restrictions
9.2.3. Writing an ISR
9.2.4. Registering an ISR with the Enhanced Interrupt API
9.2.5. Enabling and Disabling Interrupts
9.2.6. Configuring an External Interrupt Controller
9.2.7. C Example
9.2.8. Upgrading to the Enhanced HAL Interrupt API
9.3.1.1. Execute Time-Intensive Algorithms in the Application Context
9.3.1.2. Implement Time-Intensive Algorithms in Hardware
9.3.1.3. Increase Buffer Size
9.3.1.4. Use Double Buffering
9.3.1.5. Keep Interrupts Enabled
9.3.1.6. Use Fast Memory
9.3.1.7. Use a Separate Exception Stack
9.3.1.8. Use Nested Hardware Interrupts
9.3.1.9. Locate ISR Body in Vector Table
9.3.1.10. Use Compiler Optimization
10.1. Nios® II Cache Implementation
10.2. HAL API Functions for Managing Cache
10.3. Initializing the Nios® II Cache after Reset
10.4. Nios® II Device Driver Cache Considerations
10.5. Cache Considerations for Writing Program Loaders
10.6. Managing Cache in Multi-Master and Multi-Processor Systems
10.7. Nios® II Tightly-Coupled Memory
15.1.1. _exit()
15.1.2. _rename()
15.1.3. alt_dcache_flush()
15.1.4. alt_dcache_flush_all()
15.1.5. alt_dcache_flush_no_writeback()
15.1.6. alt_uncached_malloc()
15.1.7. alt_uncached_free()
15.1.8. alt_remap_uncached()
15.1.9. alt_remap_cached()
15.1.10. alt_icache_flush_all()
15.1.11. alt_icache_flush()
15.1.12. alt_alarm_start()
15.1.13. alt_alarm_stop()
15.1.14. alt_dma_rxchan_depth()
15.1.15. alt_dma_rxchan_close()
15.1.16. alt_dev_reg()
15.1.17. alt_dma_rxchan_open()
15.1.18. alt_dma_rxchan_prepare()
15.1.19. alt_dma_rxchan_reg()
15.1.20. alt_dma_txchan_close()
15.1.21. alt_dma_txchan_ioctl()
15.1.22. alt_dma_txchan_open()
15.1.23. alt_dma_txchan_reg()
15.1.24. alt_flash_close_dev()
15.1.25. alt_exception_cause_generated_bad_addr()
15.1.26. alt_erase_flash_block()
15.1.27. alt_dma_rxchan_ioctl()
15.1.28. alt_dma_txchan_space()
15.1.29. alt_dma_txchan_send()
15.1.30. alt_flash_open_dev()
15.1.31. alt_fs_reg()
15.1.32. alt_get_flash_info()
15.1.33. alt_ic_irq_disable()
15.1.34. alt_ic_irq_enabled()
15.1.35. alt_ic_isr_register()
15.1.36. alt_ic_irq_enable()
15.1.37. alt_instruction_exception_register()
15.1.38. alt_irq_disable()
15.1.39. alt_irq_cpu_enable_interrupts ()
15.1.40. alt_irq_disable_all()
15.1.41. alt_irq_enable()
15.1.42. alt_irq_enable_all()
15.1.43. alt_irq_enabled()
15.1.44. alt_irq_init()
15.1.45. alt_irq_pending ()
15.1.46. alt_irq_register()
15.1.47. alt_llist_insert()
15.1.48. alt_llist_remove()
15.1.49. alt_load_section()
15.1.50. alt_nticks()
15.1.51. alt_read_flash()
15.1.52. alt_tick()
15.1.53. alt_ticks_per_second()
15.1.54. alt_timestamp()
15.1.55. alt_timestamp_freq()
15.1.56. alt_timestamp_start()
15.1.57. alt_write_flash()
15.1.58. alt_write_flash_block()
15.1.59. close()
15.1.60. fstat()
15.1.61. fork()
15.1.62. fcntl()
15.1.63. execve()
15.1.64. getpid()
15.1.65. kill()
15.1.66. stat()
15.1.67. settimeofday()
15.1.68. wait()
15.1.69. unlink()
15.1.70. sbrk()
15.1.71. link()
15.1.72. lseek()
15.1.73. alt_sysclk_init()
15.1.74. open()
15.1.75. times()
15.1.76. read()
15.1.77. write()
15.1.78. usleep()
15.1.79. alt_lock_flash()
15.1.80. gettimeofday()
15.1.81. ioctl()
15.1.82. isatty()
15.3.1. adc_stop
15.3.2. adc_start
15.3.3. adc_set_mode_run_once
15.3.4. adc_set_mode_run_continuously
15.3.5. adc_recalibrate
15.3.6. adc_interrupt_enable
15.3.7. adc_interrupt_disable
15.3.8. adc_clear_interrupt_status
15.3.9. adc_wait_for_interrupt - ADC Sample Storage Status Register
15.3.10. adc_interrupt_asserted
15.3.11. adc_wait_for interrupt - IRQ Status Register
15.3.12. alt_adc_word_read
16.1.1. Logging Levels
16.1.2. Setting Values
16.1.3. Utility and Script Summary
16.1.4. nios2-app-generate-makefile
16.1.5. nios2-bsp-create-settings
16.1.6. nios2-bsp-generate-files
16.1.7. nios2-bsp-query-settings
16.1.8. nios2-bsp-update-settings
16.1.9. nios2-lib-generate-makefile
16.1.10. nios2-bsp-editor
16.1.11. nios2-app-update-makefile
16.1.12. nios2-lib-update-makefile
16.1.13. nios2-swexample-create
16.1.14. nios2-elf-insert
16.1.15. nios2-elf-query
16.1.16. nios2-flash-programmer-generate
16.1.17. nios2-bsp
16.1.18. nios2-bsp-console
16.1.19. alt-file-convert (BETA)
16.5.2.1. add_memory_device
16.5.2.2. add_memory_region
16.5.2.3. add_section_mapping
16.5.2.4. are_same_resource
16.5.2.5. delete_memory_region
16.5.2.6. delete_section_mapping
16.5.2.7. disable_sw_package
16.5.2.8. enable_sw_package
16.5.2.9. get_addr_span
16.5.2.10. get_assignment
16.5.2.11. get_available_drivers
16.5.2.12. get_available_sw_packages
16.5.2.13. get_base_addr
16.5.2.14. get_break_offset
16.5.2.15. get_break_slave_desc
16.5.2.16. get_cpu_name
16.5.2.17. get_current_memory_regions
16.5.2.18. get_current_section_mappings
16.5.2.19. get_default_memory_regions
16.5.2.20. get_driver
16.5.2.21. get_enabled_sw_packages
16.5.2.22. get_exception_offset
16.5.2.23. get_exception_slave_desc
16.5.2.24. get_fast_tlb_miss_exception_offset
16.5.2.25. get_fast_tlb_miss_exception_slave_desc
16.5.2.26. get_interrupt_controller_id
16.5.2.27. get_irq_interrupt_controller_id
16.5.2.28. get_irq_number
16.5.2.29. get_memory_region
16.5.2.30. get_module_class_name
16.5.2.31. get_module_name
16.5.2.32. get_reset_offset
16.5.2.33. get_reset_slave_desc
16.5.2.34. get_section_mapping
16.5.2.35. get_setting
16.5.2.36. get_setting_desc
16.5.2.37. get_slave_descs
16.5.2.38. is_char_device
16.5.2.39. is_connected_interrupt_controller_device
16.5.2.40. is_connected_to_data_master
16.5.2.41. is_connected_to_instruction_master
16.5.2.42. is_ethernet_mac_device
16.5.2.43. is_flash
16.5.2.44. is_memory_device
16.5.2.45. is_non_volatile_storage
16.5.2.46. is_timer_device
16.5.2.47. log_debug
16.5.2.48. log_default
16.5.2.49. log_error
16.5.2.50. log_verbose
16.5.2.51. set_driver
16.5.2.52. set_ignore_file
16.5.2.53. set_setting
16.5.2.54. update_memory_region
16.5.2.55. update_section_mapping
16.5.2.56. add_default_memory_regions
16.5.2.57. create_bsp
16.5.2.58. generate_bsp
16.5.2.59. get_available_bsp_type_versions
16.5.2.60. get_available_bsp_types
16.5.2.61. get_available_cpu_architectures
16.5.2.62. get_available_cpu_names
16.5.2.63. get_available_software
16.5.2.64. get_available_software_setting_properties
16.5.2.65. get_available_software_settings
16.5.2.66. get_bsp_version
16.5.2.67. get_cpu_architecture
16.5.2.68. get_nios2_dpx_thread_num
16.5.2.69. get_sopcinfo_file
16.5.2.70. get_supported_bsp_types
16.5.2.71. is_bsp_hal_extension
16.5.2.72. is_bsp_lwhal_extension
16.5.2.73. open_bsp
16.5.2.74. save_bsp
16.5.2.75. set_bsp_version
16.5.2.76. set_logging_mode
16.5.3.1. add_class_sw_setting
16.5.3.2. add_class_systemh_line
16.5.3.3. add_module_sw_property
16.5.3.4. add_module_sw_setting
16.5.3.5. add_module_systemh_line
16.5.3.6. add_systemh_line
16.5.3.7. get_class_peripheral
16.5.3.8. get_module_assignment
16.5.3.9. get_module_name
16.5.3.10. get_module_peripheral
16.5.3.11. get_module_sw_setting_value
16.5.3.12. get_peripheral_property
16.5.3.13. remove_class_systemh_line
16.5.3.14. remove_module_systemh_line
16.5.3.15. set_class_sw_setting_property
16.5.3.16. set_module_sw_setting_property
Visible to Intel only — GUID: mwh1416946623826
Ixiasoft
3.9. Creating a Software Package
This section shows how you can build a custom library into a BSP as a software package. The software package can be linked to any BSP through the BSP Editor.
This section contains an example illustrating the steps necessary to include any software package into a Nios II BSP.
To create and exercise the example software package, perform the following steps:
- Locate the ip directory in your Intel FPGA Complete Design Suite installation. For example, if the Intel FPGA Complete Design Suite version 14.1 is installed on the Windows operating system, the directory might be c:\altera\14.1\ip. Under the ip directory, create a directory for the software package. For simplicity, this section refers to this directory as <example package>.
- In <example package>, create a subdirectory named EXAMPLE_SW_PACKAGE. In <example package>/EXAMPLE_SW_PACKAGE, create two subdirectories named inc and lib.
- In <example package>/EXAMPLE_SW_PACKAGE/inc, create a new header file named example_sw_package.h containing the following code:
/* Example Software Package */ void example_sw_package(void);
- In <example package>/EXAMPLE_SW_PACKAGE/lib, create a new C source file named example_sw_package.c containing the following code:
/* Example Software Package */ #include <stdio.h> #include "..\inc\example_sw_package.h" void example_sw_package(void) { printf ("Example Software Package. \n"); }
- In <example package>, create a new Tcl script file named example_sw_package_sw.tcl containing the following code:
# # example_sw_package_sw.tcl # # Create a software package known as "example_sw_package" create_sw_package example_sw_package # The version of this software set_sw_property version 14.1 # Location in generated BSP that sources should be copied into set_sw_property bsp_subdirectory Example_SW_Package # # Source file listings... # # C/C++ source files #add_sw_property c_source EXAMPLE_SW_PACKAGE/src/my_source.c # Include files add_sw_property include_source EXAMPLE_SW_PACKAGE/inc/example_sw_package.h # Lib files add_sw_property lib_source EXAMPLE_SW_PACKAGE/lib/libexample_sw_package_library.a # Include paths for headers which define the APIs for this package # to share w/ app & bsp # Include paths are relative to the location of this software # package tcl file add_sw_property include_directory EXAMPLE_SW_PACKAGE/inc # This driver supports HAL & UCOSII BSP (OS) types add_sw_property supported_bsp_type HAL add_sw_property supported_bsp_type UCOSII # Add example software package system.h setting to the BSP: add_sw_setting quoted_string system_h_define \ example_sw_package_system_value EXAMPLE_SW_PACKAGE_SYSTEM_VALUE 1 \ "Example software package system value" # End of file
- In the SBT for Eclipse, create a Nios II application and BSP project based on the Hello World template. Set the application project name to hello_example_sw_package.
- Create a new C file named hello_example_sw_package.c in the new application project containing the following code:
/* * "Hello World" example. * * This example prints 'Hello from Nios II' to the STDOUT stream. It also * tests inclusion of a user software package. */ #include <stdio.h> #include "example_sw_package.h" int main() { printf("Hello from Nios II!\n"); example_sw_package(); return 0; }
- Delete hello_world.c from the hello_example_sw_package application project.
- In the File menu, point to New and click Nios II Library
- Set the project name to example_sw_package_library.
- For Location, browse to <example package>\EXAMPLE_SW_PACKAGE\lib
Note: Building the library here is required, because the resulting .a is referenced here by example_sw_package_sw.tcl.
- Click Finish.
- Build the example_sw_package_library project to create the libexample_sw_package_library.a library archive file.
- Right-click the BSP project, point to Nios II, and click BSP Editor to open the BSP Editor.
- In the BSP Software Packages tab, find example_sw_package in the software package table, and enable it.
If there are any errors in a software package's *_sw.tcl file, such as an incorrect path that causes a file to not be found, the software package does not appear in the BSP Editor.
- Click the Generate button to regenerate the BSP. On the File menu, click Save to save your changes to settings.bsp.
- In the File menu, click Exit to exit the BSP Editor.
- Build the hello_example_sw_package_bsp BSP project.
- Build the hello_example_sw_package application project.
hello_example_sw_package.elf is ready to download and execute.