blob: 2cee7233472a7b6772e8daeb96db9182a2b3a9e6 [file] [log] [blame]
wdenk4a551702003-10-08 23:26:14 +00001
2 U-Boot for Nios-32
3
4 Last Update: October 4, 2003
5====================================================================
6
7This file contains information regarding U-Boot and the Altera
8Nios CPU. For information regarding U-Boot and the Nios Development
9Kit, Cyclone Edition (DK-1C20), see doc/README.dk1c20.
10
11For those interested in contributing ... see HELP WANTED below.
12
13
141. OVERVIEW
15------------
16
17U-Boot has been successfully tested on the Nios Cyclone development
18board using both the 'safe' and 'standard 32' configurations with
19Nios CPU revision 3.08 (CPU_ID = 0x3008). U-Boot can be used with
20or without the GERMS monitor. The initial version of U-Boot for the
21Cyclone development kit is about 60 Kbyte and will fit in a single
22sector of on-board FLASH. Only the Nios 32-bit CPU is supported.
23
241.1 GERMS Monitor
25------------------
26If GERMS is just not enough, then U-Boot is a great antibiotic.
27You will be very pleased with its high degree of configurability
28and its rich feature set.
29
30A few of the most obvious limitations of GERMS are overcome by
31using U-Boot (See 'Brain Damage'). Most notably, you can use
32minicom or Hyperterminal (duh).
33
341.2 Altera Source Code
35-----------------------
36The Nios port does NOT include ANY sources that Altera has the
37copyright. This was a conscious decision ... not an accident.
38The Altera license is not clear in terms of distributing Altera
39sources (when altera silicon is not involved). This isn't really
40a problem as little, if any, of the Altera source contains
41features that are not already available in U-Boot.
42
43The Nios port also does not use the long-winded peripheral
44structure definitions from the Nios SDK.
45
46
47
482. CONFIGURATION OPTIONS/SETTINGS
49----------------------------------
50
512.1 Nios-specific Options/Settings
52-----------------------------------
53All configuration options/settings that are specific to Nios begin
54with "CONFIG_NIOS_" or "CFG_NIOS_". The following is a list of
55currently defined Nios-specific options/parameters. If any options
56are related to Standard-32 Nios SDK excalibur.h definitions, the
57related definition follows the description).
58
59
60CONFIG_NIOS -- defined for all Nios-32 boards.
61
62CFG_NIOS_CONSOLE -- the base address of the console UART.
63 (standard-32: na_uart1_base).
64
65CFG_NIOS_FIXEDBAUD -- defined if the console UART PTF fixed_baud
66 parameter is set to '1'.
67
68CFG_NIOS_MULT_HW -- use full hardware multiply (not yet implemented).
69
70CFG_NIOS_MULT_MSTEP -- use hardware assisted multiply using the
71 MSTEP instruction (not yet implemented).
72
73CFG_NIOS_TMRBASE -- the base address of the timer used to support
74 xxx_timer routines (e.g. set_timer(), get_timer(), etc.).
75 (standard-32: na_lo_priority_timer2_base).
76
77CFG_NIOS_TMRIRQ -- the interrupt request (vector number) assigned to
78 the timer. (standard-32: na_low_priority_timer2_irq).
79
80CFG_NIOS_TMRMS -- the period of the timer in milliseconds.
81
822.2 Differences in U-Boot Options/Settings
83-------------------------------------------
84Some 'standard' U-Boot options/settings are treated differently in
85the Nios port. These are described below.
86
87CFG_GBL_DATA_OFFSET -- in the Nios port, this is the offset of the
88 global data structure in the Nios memory space. More simply,
89 the address of global data.
90
91
923. ASSEMBLY CODING
93-------------------
94
95In browsing the assembly source files, you may notice the absence
96of the 'magic macros' (e.g. MOVIA, MOVIP, ADDIP etc.). This is
97deliberate. The documentation for the magic macros is scant and
98it is hard to find ... it does not appear in the Nios programmer's
99manual, nor does it appear in the assembler manual. Regardless,
100the macros actually do very little to improve readability anyway.
101
102With this in mind, all assembler modules use only instructions that
103appear in the Nios programmer's manual OR are directly supported
104by the nios-elf toolchain. For example, the 'dec %rB' instruction
105is an alias for 'subi %rB,1' that is supported by the assembler
106but does not appear in the programmer's manual.
107
108
1094. BRAIN DAMAGE
110----------------
111
112This section describes some of the unfortunate and avoidable aspects
113of working with the Nios CPU ... and some things you can do to
114reduce your pain.
115
1164.1 GERMS doesn't work with Hyperterminal
117------------------------------------------
118GERMS doesn't do CR/LF mapping that is compatible with Hyperterminal
119(or minicom) -- geez. Regardless of you opion of Hyperterminal, this
120sad design decision is remedied by using U-Boot.
121
1224.2 cygwin Incompatibility
123---------------------------
124The version of cygwin distributed with the nios GNUPro toolchain is
125out-of-date and incompatible with the latest cygwin distributions.
126In addition, many of the standard utilities are very dated as well.
127If you try to download and build the lastest version of grep for
128example, you'll quickly realize that a native gcc is not available
129(the next topic) which leads to U-Boot build problems (following
130topic).
131
132The solution ... well, you can wait for Altera ... or build as
133set of tools for linux.
134
1354.3 No native gcc
136------------------
137I'm not sure how this one slipped through the cracks ... but it is
138a real pain. Basically, if you want to build anything for the native
139environment -- forget it! A native (cygwin) gcc is not distributed,
140and the old version of cygwin makes locating one challenging.
141
142The solution ... same as above. Just download the gcc source from
143Altera and build up a set of cross tools for your favorite linux
144distro.
145
1464.4 Can't build default U-Boot
147-------------------------------
148By default, when you build U-Boot you will be building some native
149tools along with the target elf, bin, and srec files. Without a
150native gcc, this (obviously) causes problems.
151
152For developers using the Altera cygwin tools you can remove the
153'tools' directory from SUBDIRS in the top-level Makefile. You will
154also have to edit common/Makefile:
155
156Replace:
157environment.o: environment.c ../tools/envcrc
158 $(CC) $(AFLAGS) -Wa,--no-warn \
159 -DENV_CRC=$(shell ../tools/envcrc) \
160 -c -o $@ environment.c
161
162With:
163environment.o: environment.c ../tools/envcrc
164 $(CC) $(AFLAGS) -Wa,--no-warn \
165 -DENV_CRC=0 \
166 -c -o $@ environment.c
167
168BTW, thats a 'zero' ... not the letter 'O'.
169
170
1715. HELP WANTED
172---------------
173
174There are plenty of areas where help is needed. Here's are some ideas
175for those interested in contributing:
176
177-SMC 91C111 support. E.g. add in tftpboot, etc.
178
179-CompactFlash. Port & test CF/FAT.
180
181-ASMI support. Use ASMI for environment, etc.
182
183-Bedbug. Develop bedbug for Nios ... or at least provide a disassemble
184 command.
185
186-Add boot support for ucLinux (niosnommu).
187
188-Implement (don't copy Altera code) the __mulxx routines using the
189 MSTEP and MUL instructions (e.g. CFG_NIOS_MULT_HW and CFG_NIOS_MULT_MSTEP).
190
191
192
193Regards,
194
195--Scott
196<smcnutt@psyent.com>