Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

custom device driver in C++

Altera_Forum
Honored Contributor II
1,276 Views

Hi everyone, 

 

I've made a custom device driver named "Button" wich send an interruption to the processor when the button is clicked, or Longclicked, or turned to the right or to the left. 

 

I've written the button.vhd file and then, the button_hw.tcl was generated by the sopc_builder. 

 

I've written the button_sw.tcl like this : 

 

create_driver Button_driver set_sw_property hw_class_name Button# The version of this driver set_sw_property version 7.1# This driver may be incompatible with versions of hardware less# than specified below. Updates to hardware and device drivers# rendering the driver incompatible with older versions of# hardware are noted with this property assignment.# # Multiple-Version compatibility was introduced in version 7.1;# prior versions are therefore excluded. set_sw_property min_compatible_hw_version 7.1# Initialize the driver in alt_sys_init() set_sw_property auto_initialize true# Location in generated BSP that above sources will be copied into set_sw_property bsp_subdirectory drivers# # Source file listings...# # Include files add_sw_property include_source inc/Button_regs.h add_sw_property include_source HAL/inc/Button.h add_sw_property c_source HAL/src/Button.c# This driver supports HAL & UCOSII BSP (OS) types add_sw_property supported_bsp_type HAL add_sw_property supported_bsp_type UCOSII# End of filethis file is working, i-e I can access Button.h and Button.c in my software, but I find out that I use C++ function in Button.c, so the compilation isn't working. 

 

I've changed the extension of button.c to button.cpp and changed the line in button_sw.tcl 

 

# add_sw_property c_source HAL/src/Button.c add_sw_property cpp_source HAL/src/Button.cppand then, the compilation is working. 

 

Now I'd like to change button.h to button.hpp, but I don't know how to do? 

 

when I change in button_sw.tcl 

 

#add_sw_property include_source HAL/inc/Button.h add_sw_property include_source HAL/inc/Button.hppI have an error in alt_sys_init.c because it includes "Button.h". Anyone has an idea? 

 

thanks!
0 Kudos
0 Replies
Reply