Nios® II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
12437 Discussions

Memory address problem related to create a custom instruction

Honored Contributor II



I'm working to compile the application sample from Nios II Custom Instruction User Guide. 


I made the hardware setup and configuration with QSys without problem and I've programmed the BeMicro SDK board but I've a problem with the software application on Nios II EDS. 


After create the BSP project and application project I need to customize this defines for MEMORY_DEVICE_SIZE on crc_main.c but I don't know what values I need to use: 

/* Change the name of memory device according to what you are using * e.g.: DDR_SDRAM_0# #_SPAN * SSRAM_0# #_SPAN */ # define MEMORY_DEVICE_SIZE DDR_SDRAM# #_SPAN  


Here I put the system.h section with the mobile_ddr_sdram's configuration and custom instruction's configuration made automatically by Nios II EDS using the sopcfile that I made using QSys. This file include the Custom Instruction CRC from the guide: 

/* * mobile_ddr_sdram configuration * */ # define ALT_MODULE_CLASS_mobile_ddr_sdram mtx_avalon_sdram_mddr # define MOBILE_DDR_SDRAM_BASE 0x4000000 # define MOBILE_DDR_SDRAM_IRQ -1 # define MOBILE_DDR_SDRAM_IRQ_INTERRUPT_CONTROLLER_ID -1 # define MOBILE_DDR_SDRAM_NAME "/dev/mobile_ddr_sdram" # define MOBILE_DDR_SDRAM_SPAN 67108864 # define MOBILE_DDR_SDRAM_TYPE "mtx_avalon_sdram_mddr" /* * Custom instruction macros * */ # define ALT_CI_CRC_0(n,A) __builtin_custom_ini(ALT_CI_CRC_0_N+(n&ALT_CI_CRC_0_N_MASK),(A)) # define ALT_CI_CRC_0_N 0x0 # define ALT_CI_CRC_0_N_MASK ((1<<3)-1)  


I need that someone help me to know what value I need to use in the MEMORY_DEVICE_SIZE defines on crc_main.c. 




0 Kudos
1 Reply
Honored Contributor II

If I correctly understand your question, you only need to add MOBILE_ to the template define in order to match the name of your ddr device: