README.nios2 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. Nios II is a 32-bit embedded-processor architecture designed
  2. specifically for the Altera family of FPGAs.
  3. Please refer to the link for more information on Nios II,
  4. https://www.altera.com/products/processors/overview.html
  5. Please refer to the link for Linux port and toolchains,
  6. http://rocketboards.org/foswiki/view/Documentation/NiosIILinuxUserManual
  7. The Nios II port of u-boot is controlled by device tree. Please check
  8. out doc/README.fdt-control.
  9. To add a new board/configuration (eg, mysystem) to u-boot, you will need
  10. three files.
  11. 1. The device tree source which describes the hardware, dts file.
  12. arch/nios2/dts/mysystem.dts
  13. 2. Default configuration of Kconfig, defconfig file.
  14. configs/mysystem_defconfig
  15. 3. The legacy board header file.
  16. include/configs/mysystem.h
  17. The device tree source must be generated from your qsys/sopc design
  18. using the sopc2dts tool. Then modified to fit your configuration. Please
  19. find the sopc2dts download and usage at the wiki,
  20. http://www.alterawiki.com/wiki/Sopc2dts
  21. $ java -jar sopc2dts.jar --force-altr -i mysystem.sopcinfo -o mysystem.dts
  22. You will need to add additional properties to the dts. Please find an
  23. example at, arch/nios2/dts/10m50_devboard.dts.
  24. 1. Add "stdout-path=..." property with your serial path to the chosen
  25. node, like this,
  26. chosen {
  27. stdout-path = &uart_0;
  28. };
  29. 2. If you use SPI/EPCS or I2C, you will need to add aliases to number
  30. the sequence of these devices, like this,
  31. aliases {
  32. spi0 = &epcs_controller;
  33. };
  34. Next, you will need a default config file. You may start with
  35. 10m50_defconfig, modify the options and save it.
  36. $ make 10m50_defconfig
  37. $ make menuconfig
  38. $ make savedefconfig
  39. $ cp defconfig configs/mysystem_defconfig
  40. You will need to change the names of board header file and device tree,
  41. and select the drivers with menuconfig.
  42. Nios II architecture --->
  43. (mysystem) Board header file
  44. Device Tree Control --->
  45. (mysystem) Default Device Tree for DT control
  46. There is a selection of "Provider of DTB for DT control" in the Device
  47. Tree Control menu.
  48. ( ) Separate DTB for DT control, will cat the dtb to end of u-boot
  49. binary, output u-boot-dtb.bin. This should be used for production.
  50. If you use boot copier, like EPCS boot copier, make sure the copier
  51. copies all the u-boot-dtb.bin, not just u-boot.bin.
  52. ( ) Embedded DTB for DT control, will include the dtb inside the u-boot
  53. binary. This is handy for development, eg, using gdb or nios2-download.
  54. The last thing, legacy board header file describes those config options
  55. not covered in Kconfig yet. You may copy it from 10m50_devboard.h.
  56. $ cp include/configs/10m50_devboard.h include/configs/mysystem.h
  57. Please change the SDRAM base and size to match your board. The base
  58. should be cached virtual address, for Nios II with MMU it is 0xCxxx_xxxx
  59. to 0xDxxx_xxxx.
  60. #define CONFIG_SYS_SDRAM_BASE 0xc8000000
  61. #define CONFIG_SYS_SDRAM_SIZE 0x08000000
  62. You will need to change the environment variables location and setting,
  63. too. You may change other configs to fit your board.
  64. After all these changes, you may build and test.
  65. $ export CROSS_COMPILE=nios2-elf- (or nios2-linux-gnu-)
  66. $ make mysystem_defconfig
  67. $ make
  68. Enjoy!