Setting Up - adwinying/FreeLwIP-Nios-II GitHub Wiki

Setting up Projects

Table of Contents

Pre-requisites

Required Software

  • Git client/shell
  • Cygwin 32-bit (NOT 64-bit) with at least telnet installed
  • Quartus 13.1 (setup below)

Setting up Quartus 13.1

  1. Run QuartusSetup-13.1.0.162.exe
  2. To activate Quartus, add system environment variable in Windows: Variable: LM_LICENSE_FILE Value: [email protected]
  3. Done.

Configuring FPGA Hardware

  1. Clone project to a local directory (Cygwin /home/ recommended)
  2. Navigate to /[Project Name]/FPGA/ and open the file that ends with *.qpf extension
  3. Connect your FPGA to your computer via USB Blaster
  4. Click on the Programmer button (circled in red) Programmer button
  5. Click OK on the dialog. The Programmer window may disappear but please check your minimized windows. Programmer window
  6. Ensure device is listed in the window. If not, reconnect/troubleshoot in Device Manager
  7. Press Start to write to FPGA.
  8. Wait for progress bar to show 100% (Successful)
  9. Done.

[IMPORTANT] Do not close [OpenCore Plus Status] window!! (shown below) OpenCore Plus Status

atk2-uIP

  1. Configure hardware using the files from /atk2-uip/FPGA/ using instructions from Configuring FPGA Hardware
  2. Assuming you've cloned the files from GitHub, navigate to atk-uip/atk2-sc1/OBJ/test_histogram in a Cygwin window
  3. If there are no C files in the directory (*.c or *.o extension), then type ./run.sh and hit Enter Careful, this could overwrite existing files in /OBJ/test_histogram
  4. Once completed, type make run and hit Enter
  5. Once you see TOPPERS/ATK2-SC1 Release 1.3.2 for NIOS2_DEV_DE2_115(NIOS2), compilation has complete and UIP is up and running. uIP
  6. Done.

atk2-TINET

  1. Configure hardware using the files from /atk2-tinet/FPGA/ using instructions from Configuring FPGA Hardware
  2. Assuming you've cloned the files from GitHub, navigate to atk-tinet/atk2-sc1/OBJ/test_histogram in a Cygwin window
  3. If there are no C files in the directory (*.c or *.o extension), then type ./run.sh and hit Enter Careful, this could overwrite existing files in /OBJ/test_histogram
  4. Once completed, type make run and hit Enter
  5. Once you see TOPPERS/ATK2-SC1 Release 1.3.2 for NIOS2_DEV_DE2_115(NIOS2), compilation has complete and program is loaded. TINET1
  6. As with the screenshot above, you may see multiple lines of Error:E_OS_STATE=SetEvent(2, 0x1). This is normal and wait for a few seconds until you see TINET 1.5.3 (Jan 30 2017, 05:47:21) appears then TINET is up and running. TINET2
  7. Done.

lwIP (no OS)

  1. Configure hardware using the files from /FreeLwIP-Nios-II/FPGA/ using instructions from Configuring FPGA Hardware
  2. In Windows Start Menu, look for a program named NIOS 13.1 Software Built Tools for Eclipse (SBT) and launch program.
  3. If prompted for default workspace location, select any local directory.
  4. Go to File > Import.. and select General > Existing Projects into Workspace then click Next.
  5. Under Select root directory, click Browse.. and locate the /FreeLwIP-Nios-II/FPGA/software/ directory then click OK.
  6. Check the checkboxes for lwIP_NIOS_II_Example and lwIP_NIOS_II_Example_bsp then click Finish.
  7. Editing MAC address: in main.c look for alteraTseNetif.hwaddr[0] to [5] and edit the MAC address
  8. Enable/Disable DHCP: in main.c look for #define USE_DHCP and change to 0 or 1 to Disable/Enable it. If DHCP is disabled, #define STATIC_IP must be defined
  9. Right click lwIP_NIOS_II_Example project directory in Project Explorer and click Build Project
  10. Build is completed when lwIP_NIOS_II_Example.elf exists in project directory
  11. Right click the project directory again then click Run As > 3 Nios II Hardware
  12. When running the program for the first time, ensure Project ELF file name is point to the right *.elf file. Alternatively, you can manually select ELF file by checking Enable browse for file system ELF file and browse for the ELF file SBT1
  13. If system timestamp error appears, check Ignore mistmatched system timestamp under the Target Connection tab
  14. Press Run
  15. The Nios II Console should appear and something similar should be visible:
Running...
INFO    : TSE MAC 0 found at address 0x04001c00
INFO    : PHY Marvell 88E1119 found at PHY address 0x01 of MAC Group[0]
INFO    : PHY[0.0] - Automatically mapped to tse_mac_device[0]
INFO    : PHY[0.0] - Restart Auto-Negotiation, checking PHY link...
INFO    : PHY[0.0] - Auto-Negotiation PASSED
INFO    : PHY[0.0] - Checking link...
INFO    : PHY[0.0] - Link established
INFO    : PHY[0.0] - Speed = 1000, Duplex = Full
Waiting for link...OK
Waiting for DHCP IP address...IP address: 192.168.123.136
  1. Done.

FreeRTOS-lwIP

Refer to lwIP (no OS), and replace lwIP_NIOS_II_Example with FreeLwIP