faq.rst 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. .. _faq:
  2. FAQ
  3. ===
  4. Why I can't download application?
  5. ---------------------------------
  6. * **Case 1: Remote communication error. Target disconnected.: Success.**
  7. .. code-block:: console
  8. Nuclei OpenOCD, 64-bit Open On-Chip Debugger 0.10.0+dev-00014-g0eae03214 (2019-12-12-07:43)
  9. Licensed under GNU GPL v2
  10. For bug reports, read
  11. http://openocd.org/doc/doxygen/bugs.html
  12. Remote communication error. Target disconnected.: Success.
  13. "monitor" command not supported by this target.
  14. "monitor" command not supported by this target.
  15. "monitor" command not supported by this target.
  16. You can't do that when your target is ``exec'
  17. "monitor" command not supported by this target.
  18. "monitor" command not supported by this target.
  19. Please check whether your driver is installed successfully via replace target ``upload`` to ``run_openocd``
  20. as the board user manual described, especially, for **RV-STAR** and **Nuclei Demo SoC Evaluation** boards,
  21. For windows, you need to download the **HummingBird Debugger Windows Driver** from
  22. https://nucleisys.com/developboard.php, and install it.
  23. If still not working, please check whether your JTAG connection is good or your CPU core is OK.
  24. .. note::
  25. The USB driver might lost when you re-plug the USB port, you might need to reinstall the driver.
  26. * **Case 2: bfd requires flen 4, but target has flen 0**
  27. .. code-block:: console
  28. bfd requires flen 4, but target has flen 0
  29. "monitor" command not supported by this target.
  30. "monitor" command not supported by this target.
  31. "monitor" command not supported by this target.
  32. You can't do that when your target is `exec'
  33. "monitor" command not supported by this target.
  34. "monitor" command not supported by this target.
  35. *bfd* is abbreviation for **Binary File Descriptor**.
  36. This is caused by the target core flen is 0, which means it didn't have float point
  37. unit in it, but your program is compiled using flen = 4, single point float unit used,
  38. which is incompatible, similar cases such as ``bfd requires flen 8, but target has flen 4``
  39. Just change your CORE to proper core settings and will solve this issue.
  40. For example, if you compile your core with ``CORE=n300f``,
  41. just change it to ``CORE=n300``.
  42. * **Case 3: bfd requires xlen 8, but target has xlen 4**
  43. .. code-block:: console
  44. bfd requires xlen 8, but target has xlen 4
  45. "monitor" command not supported by this target.
  46. "monitor" command not supported by this target.
  47. "monitor" command not supported by this target.
  48. You can't do that when your target is ``exec'
  49. "monitor" command not supported by this target.
  50. "monitor" command not supported by this target.
  51. This issue is caused by the program is a riscv 64 program,
  52. but the core is a riscv 32 core, so just change your program
  53. to be compiled using a riscv 32 compile option.
  54. For example, if you compile your core with ``CORE=ux600``,
  55. just change it to ``CORE=n300``.
  56. How to select correct FDTI debugger?
  57. ------------------------------------
  58. From Nuclei SDK release 0.2.9, the openocd configuration file doesn't
  59. contain `ftdi_device_desc`_ line by default, so if there are more than
  60. one FTDI debuggers which has the same VID/PID(0x0403/0x6010) as Nuclei
  61. Debugger Kit use, then you might need to add extra ``ftdi device_desc``
  62. line in the openocd configuration file to describe the FTDI device description.
  63. Or you can add extra ``adapter serial your_serial_no`` for your debugger, you can check
  64. its serial number via windows FT_PROG tool.
  65. **NOTE**: for windows, you need to add an extra ``A`` to the serial number, eg. your serial number is
  66. ``FT6S9RD6``, then this extra openocd config line should be ``adapter serial "FT6S9RD6A"`` for windows.
  67. * For **Nuclei FPGA Evaluation Board**, you can check the openocd configuration
  68. file in *SoC/evalsoc/Board/nuclei_fpga_eval/openocd_evalsoc.cfg*.
  69. * For **Nuclei RVSTAR Board**, you can check the openocd configuration file
  70. in *SoC/gd32vf103/Board/gd32vf103v_rvstar/openocd_gd32vf103.cfg*.
  71. Why I can't download application in Linux?
  72. ------------------------------------------
  73. Please check that whether you have followed the `debugger kit manual`_
  74. to setup the USB JTAG drivers correctly.
  75. The windows steps and linux steps are different, please take care.
  76. Why the provided application is not running correctly in my Nuclei FPGA Evaluation Board?
  77. -----------------------------------------------------------------------------------------
  78. Please check the following items:
  79. 1. Did you program the correct Nuclei Evaluation FPGA bitstream?
  80. 2. Did you re-power the board, when you just programmed the board with FPGA bitstream?
  81. 3. Did you choose the right **CORE** as the Nuclei Evaluation FPGA bitstream present?
  82. 4. If your application is RTOS demos, did you run in ``flashxip`` mode, if yes, it is expected
  83. due to flash speed is really slow, you'd better try ``ilm`` or ``flash`` mode.
  84. 5. If still not working, you might need to check whether the FPGA bitstream is correct or not?
  85. Why ECLIC handler can't be installed using ECLIC_SetVector?
  86. -----------------------------------------------------------
  87. If you are running in ``FlashXIP`` download mode, it is expected,
  88. since the vector table is placed in Flash area which can't be changed
  89. during running time.
  90. You can only use this ``ECLIC_SetVector`` API when your vector table
  91. is placed in RAM which can be changed during running time, so if you want to
  92. write portable application, we recommended you to use exactly the eclic handler
  93. names defined in **startup_<device>.S**.
  94. Access to github.com is slow, any workaround?
  95. ---------------------------------------------
  96. Access speed to github.com sometimes is slow and not stable, but if you want to clone source code,
  97. you can also switch to use our mirror site maintained in gitee.com.
  98. This mirror will sync changes from github to gitee every 6 hours, that is 4 times a day.
  99. You just need to replace the github to gitee when you clone any repo in **Nuclei-Software** or **riscv-mcu**.
  100. For example, if you want to clone **nuclei-sdk** using command
  101. ``git clone https://github.com/Nuclei-Software/nuclei-sdk``, then
  102. you can achieve it by command ``git clone https://gitee.com/Nuclei-Software/nuclei-sdk``
  103. \`.text' will not fit in region \`ilm' or \`.bss' will not fit in region \`ram'
  104. -------------------------------------------------------------------------------
  105. If you met similar message as below when build an application:
  106. .. code-block:: console
  107. xxx/bin/ld: cifar10.elf section `.text' will not fit in region `ilm'
  108. xxx/bin/ld: cifar10.elf section `.bss' will not fit in region `ram'
  109. xxx/bin/ld: section .stack VMA [000000009000f800,000000009000ffff] overlaps section .bss VMA [00000000900097c0,00000000900144eb]
  110. xxx/bin/ld: region `ilm' overflowed by 43832 bytes
  111. xxx/bin/ld: region `ram' overflowed by 0 bytes
  112. It is caused by the program is too big, our default link script is 64K ILM, 64K DLM, 4M SPIFlash for Nuclei Demo/Eval SoC.
  113. If your core has bigger ILM or DLM, you can change related linker script file according to your choice.
  114. For example, if you want to change linker script for evalsoc on nuclei_fpga_eval ilm download mode:
  115. ``ILM to 512K, DLM to 256K``, then you can change link script file
  116. ``SoC/evalsoc/Board/nuclei_fpga_eval/Source/GCC/gcc_evalsoc_ilm.ld`` as below:
  117. .. code-block:: diff
  118. diff --git a/SoC/evalsoc/Board/nuclei_fpga_eval/Source/GCC/gcc_evalsoc_ilm.ld b/SoC/evalsoc/Board/nuclei_fpga_eval/Source/GCC/gcc_evalsoc_ilm.ld
  119. index 1ac5b90..08451b3 100644
  120. --- a/SoC/evalsoc/Board/nuclei_fpga_eval/Source/GCC/gcc_evalsoc_ilm.ld
  121. +++ b/SoC/evalsoc/Board/nuclei_fpga_eval/Source/GCC/gcc_evalsoc_ilm.ld
  122. @@ -28,8 +28,8 @@ ENTRY( _start )
  123. MEMORY
  124. {
  125. - ilm (rxa!w) : ORIGIN = 0x80000000, LENGTH = 64K
  126. - ram (wxa!r) : ORIGIN = 0x90000000, LENGTH = 64K
  127. + ilm (rxa!w) : ORIGIN = 0x80000000, LENGTH = 512K
  128. + ram (wxa!r) : ORIGIN = 0x90000000, LENGTH = 256K
  129. }
  130. cc1: error: unknown cpu 'nuclei-300-series' for '-mtune'
  131. ---------------------------------------------------------
  132. This `mtune` option is introduced in Nuclei SDK 0.3.5, used to select optimized gcc pipeline model
  133. for Nuclei RISC-V Core series such as 200/300/600/900 series, and this feature required Nuclei GNU
  134. Toolchain 2022.01, please upgrade to this version or later ones.
  135. undefined reference to __errno when using libncrt library
  136. ---------------------------------------------------------
  137. When you are using libncrt library, and linked with ``-lm``, you may face below issues
  138. .. code-block:: console
  139. /home/share/devtools/toolchain/nuclei_gnu/linux64/newlibc/2023.10.14/gcc/bin/../lib/gcc/riscv64-unknown-elf/13.1.1/../../../../riscv64-unknown-elf/bin/ld: /home/share/devtools/toolchain/nuclei_gnu/linux64/newlibc/2023.10.14/gcc/bin/../lib/gcc/riscv64-unknown-elf/13.1.1/../../../../riscv64-unknown-elf/lib/rv32imafdc/ilp32d/libm.a(libm_a-w_exp.o): in function `.L1':
  140. w_exp.c:(.text.exp+0x4a): undefined reference to `__errno'
  141. /home/share/devtools/toolchain/nuclei_gnu/linux64/newlibc/2023.10.14/gcc/bin/../lib/gcc/riscv64-unknown-elf/13.1.1/../../../../riscv64-unknown-elf/bin/ld: /home/share/devtools/toolchain/nuclei_gnu/linux64/newlibc/2023.10.14/gcc/bin/../lib/gcc/riscv64-unknown-elf/13.1.1/../../../../riscv64-unknown-elf/lib/rv32imafdc/ilp32d/libm.a(libm_a-w_exp.o): in function `.L0 ':
  142. w_exp.c:(.text.exp+0x6e): undefined reference to `__errno'
  143. /home/share/devtools/toolchain/nuclei_gnu/linux64/newlibc/2023.10.14/gcc/bin/../lib/gcc/riscv64-unknown-elf/13.1.1/../../../../riscv64-unknown-elf/bin/ld: /home/share/devtools/toolchain/nuclei_gnu/linux64/newlibc/2023.10.14/gcc/bin/../lib/gcc/riscv64-unknown-elf/13.1.1/../../../../riscv64-unknown-elf/lib/rv32imafdc/ilp32d/libm.a(libm_a-w_log.o): in function `log':
  144. w_log.c:(.text.log+0x28): undefined reference to `__errno'
  145. /home/share/devtools/toolchain/nuclei_gnu/linux64/newlibc/2023.10.14/gcc/bin/../lib/gcc/riscv64-unknown-elf/13.1.1/../../../../riscv64-unknown-elf/bin/ld: w_log.c:(.text.log+0x46): undefined reference to `__errno'
  146. /home/share/devtools/toolchain/nuclei_gnu/linux64/newlibc/2023.10.14/gcc/bin/../lib/gcc/riscv64-unknown-elf/13.1.1/../../../../riscv64-unknown-elf/bin/ld: /home/share/devtools/toolchain/nuclei_gnu/linux64/newlibc/2023.10.14/gcc/bin/../lib/gcc/riscv64-unknown-elf/13.1.1/../../../../riscv64-unknown-elf/lib/rv32imafdc/ilp32d/libm.a(libm_a-math_err.o): in function `with_errno':
  147. math_err.c:(.text.with_errno+0x12): undefined reference to `__errno'
  148. collect2: error: ld returned 1 exit status
  149. You can fix it by not link ``-lm`` library, since libncrt library already provided math library feature, so
  150. no need to link this math library.
  151. undefined reference to fclose/sprintf similar API provided in system libraries
  152. ------------------------------------------------------------------------------
  153. From 0.5.0 release, we no longer use ``--specs=`` option to select library we want to use, and we also passed
  154. ``-nodefaultlibs`` options to not use standard system libraries, this changes are made to support both gcc and clang
  155. toolchain, so in Nuclei SDK build system, we control the needed system libraries to be linked as required by ``STDCLIB`` make variable, for details, please check ``Build/toolchain/*.mk`` makefiles, and also we use linker's group
  156. libraries feature ``--start-group archives --end-group`` to repeatly search undefined reference in the group libraries,
  157. but this feature is not enabled in Eclipse CDT based IDE like Nuclei Studio, which undefined reference is searched in the order of library specified on the command line, so you may meet issue like undefined fclose reference even you linked newlib nano c library ``-lc_nano`` if the library order is not good, so to fix this issue, you may need to place
  158. the library in a good order and need to repeatly link it, such as ``-lgcc -lc_nano -lm -lsemihost -lgcov -lgcc -lc_nano``, and also we have opened an issue to track it, see https://github.com/eclipse-embed-cdt/eclipse-plugins/issues/592
  159. fatal error: rvintrin.h: No such file or directory
  160. --------------------------------------------------
  161. If you are using Nuclei Toolchain 2023.10, ``rvintrin.h`` no longer exist for B extension, please
  162. don't include this header file. If you want to use an intrinsic API for B extension, you need to write
  163. using c asm intrinsic.
  164. riscv-nuclei-elf-gcc: not found when using Nuclei Studio 2023.10
  165. ----------------------------------------------------------------
  166. ``riscv-nuclei-elf-gcc``(gcc10) has changed to ``riscv64-unknown-elf-gcc``(gcc13) since Nuclei Studio 2023.10 or
  167. Nuclei RISC-V Toolchain 2023.10, so if you are using older toolchain created npk package or ide project, you
  168. may face this build fail issue, you can follow the user guide of Nuclei Studio 2023.10 to fix this issue, see chapter 8.
  169. .. _debugger kit manual: https://nucleisys.com/developboard.php#ddr200t
  170. .. _ftdi_device_desc: http://openocd.org/doc/html/Debug-Adapter-Configuration.html