README.nios 6.6 KB

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