Type: Answers

Area: Embedded



How can I use the Nios II Simple Socket Server and Web Server Software examples if the TSE example design is a Qsys Sub System?

Description

If the Nios® II Triple Speed Ethernet (TSE) example design is instanced as a subsystem using hierarchical Qsys, manual modifications are required to the Example Software to define the correct path to peripherals.


The example software uses the instance name of components in the TSE example design,   but these are pre-pended with a hierarchical name if the TSE design is instantiated as a sub system in Qsys.    This will cause errors similar to the below to be seen on compilation in Nios II Software Build Tools (SBT):

error: 'EXT_FLASH_NAME' undeclared here (not in a function)
error: 'TSE_MAC_BASE' undeclared here (not in a function)
error: 'TSE_MAC_BASE' undeclared here (not in a function)
error: 'TSE_MAC_TRANSMIT_FIFO_DEPTH' undeclared here (not in a function)
error: 'TSE_MAC_RECEIVE_FIFO_DEPTH' undeclared here (not in a function)
error: 'TSE_MAC_USE_MDIO' undeclared here (not in a function)
error: 'TSE_MAC_ENABLE_MACLITE' undeclared here (not in a function)
error: 'TSE_MAC_MACLITE_GIGE' undeclared here (not in a function)
error: 'TSE_MAC_IS_MULTICHANNEL_MAC' undeclared here (not in a function)
error: 'TSE_MAC_NUMBER_OF_CHANNEL' undeclared here (not in a function)

Workaround/Fix

To resolve the errors follow the steps below within your Application Project in the Nios II SBT for Eclipse:

  1. Open network_utilities.c and perform a find and replace for “EXT_FLASH” -> “_ EXT_FLASH”
    • For example: If your top level .qsys system is s called “QSYS_TOP” in your top level .qsys project search for “EXT_FLASH”, and replace with “QSYS_TOP_EXT_FLASH”
    • Before:
      #define EXT_FLASH_NAME "/dev/ext_flash"
    • After:
      #define QSYS_TOP_EXT_FLASH "/dev/ext_flash"
  2. Edit tse_my_system.c: line 10 to update the #defines macros used when the TSE info structure is created:
    • Before:
      alt_tse_system_info tse_mac_device[MAXNETS] = { TSE_SYSTEM_EXT_MEM_NO_SHARED_FIFO(TSE_MAC, 0, SGDMA_TX, SGDMA_RX, TSE_PHY_AUTO_ADDRESS, 0, DESCRIPTOR_MEMORY) };
    • After:
      alt_tse_system_info tse_mac_device[MAXNETS] = { TSE_SYSTEM_EXT_MEM_NO_SHARED_FIFO(QSYS_TOP_TSE_MAC, 0, QSYS_TOP_SGDMA_TX, QSYS_TOP_SGDMA_RX, TSE_PHY_AUTO_ADDRESS, 0, QSYS_TOP_DESCRIPTOR_MEMORY) };
  3. Rebuild the Software Application Project

This information is scheduled to be included in a future version of the Nios II and TSE example design
documentation.