nios2.rst 3.3 KB

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