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