faq.rst 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  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 Eval 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 FTDI 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. For more details, please check `Debug with multiple FTDI devices <https://doc.nucleisys.com/nuclei_studio_supply/27-debug_with_multiple_ftdi_devices/>`_
  72. Why I can't download application in Linux?
  73. ------------------------------------------
  74. Please check that whether you have followed the `debugger kit manual`_
  75. to setup the USB JTAG drivers correctly.
  76. The windows steps and linux steps are different, please take care.
  77. Why the provided application is not running correctly in my Nuclei FPGA Evaluation Board?
  78. -----------------------------------------------------------------------------------------
  79. Please check the following items:
  80. 1. Did you program the correct Nuclei Evaluation FPGA bitstream?
  81. 2. Did you re-power the board, when you just programmed the board with FPGA bitstream?
  82. 3. Did you choose the right **CORE** as the Nuclei Evaluation FPGA bitstream present?
  83. 4. If your application is RTOS demos, did you run in ``flashxip`` mode, if yes, it is expected
  84. due to flash speed is really slow, you'd better try ``ilm`` or ``flash`` mode.
  85. 5. If still not working, you might need to check whether the FPGA bitstream is correct or not?
  86. Why ECLIC handler can't be installed using ECLIC_SetVector?
  87. -----------------------------------------------------------
  88. If you are running in ``FlashXIP`` download mode, it is expected,
  89. since the vector table is placed in Flash area which can't be changed
  90. during running time.
  91. You can only use this ``ECLIC_SetVector`` API when your vector table
  92. is placed in RAM which can be changed during running time, so if you want to
  93. write portable application, we recommended you to use exactly the eclic handler
  94. names defined in **startup_<device>.S**.
  95. Access to github.com is slow, any workaround?
  96. ---------------------------------------------
  97. Access speed to github.com sometimes is slow and not stable, but if you want to clone source code,
  98. you can also switch to use our mirror site maintained in gitee.com.
  99. This mirror will sync changes from github to gitee every 6 hours, that is 4 times a day.
  100. You just need to replace the github to gitee when you clone any repo in **Nuclei-Software** or **riscv-mcu**.
  101. For example, if you want to clone **nuclei-sdk** using command
  102. ``git clone https://github.com/Nuclei-Software/nuclei-sdk``, then
  103. you can achieve it by command ``git clone https://gitee.com/Nuclei-Software/nuclei-sdk``
  104. \`.text' will not fit in region \`ilm' or \`.bss' will not fit in region \`ram'
  105. -------------------------------------------------------------------------------
  106. If you met similar message as below when build an application:
  107. .. code-block:: console
  108. xxx/bin/ld: cifar10.elf section `.text' will not fit in region `ilm'
  109. xxx/bin/ld: cifar10.elf section `.bss' will not fit in region `ram'
  110. xxx/bin/ld: section .stack VMA [000000009000f800,000000009000ffff] overlaps section .bss VMA [00000000900097c0,00000000900144eb]
  111. xxx/bin/ld: region `ilm' overflowed by 43832 bytes
  112. xxx/bin/ld: region `ram' overflowed by 0 bytes
  113. 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.
  114. If your core has bigger ILM or DLM, you can change related linker script file according to your choice.
  115. For example, if you want to change linker script for evalsoc on nuclei_fpga_eval ilm download mode:
  116. ``ILM to 512K, DLM to 256K``, then you can change link script file
  117. ``SoC/evalsoc/Board/nuclei_fpga_eval/Source/GCC/gcc_evalsoc_ilm.ld`` as below:
  118. .. code-block:: diff
  119. 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
  120. index 1ac5b90..08451b3 100644
  121. --- a/SoC/evalsoc/Board/nuclei_fpga_eval/Source/GCC/gcc_evalsoc_ilm.ld
  122. +++ b/SoC/evalsoc/Board/nuclei_fpga_eval/Source/GCC/gcc_evalsoc_ilm.ld
  123. @@ -28,8 +28,8 @@ ENTRY( _start )
  124. MEMORY
  125. {
  126. - ilm (rxa!w) : ORIGIN = 0x80000000, LENGTH = 64K
  127. - ram (wxa!r) : ORIGIN = 0x90000000, LENGTH = 64K
  128. + ilm (rxa!w) : ORIGIN = 0x80000000, LENGTH = 512K
  129. + ram (wxa!r) : ORIGIN = 0x90000000, LENGTH = 256K
  130. }
  131. cc1: error: unknown cpu 'nuclei-300-series' for '-mtune'
  132. ---------------------------------------------------------
  133. This `mtune` option is introduced in Nuclei SDK 0.3.5, used to select optimized gcc pipeline model
  134. for Nuclei RISC-V Core series such as 200/300/600/900 series, and this feature required Nuclei GNU
  135. Toolchain 2022.01, please upgrade to this version or later ones.
  136. undefined reference to __errno when using libncrt library
  137. ---------------------------------------------------------
  138. When you are using libncrt library, and linked with ``-lm``, you may face below issues
  139. .. code-block:: console
  140. /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':
  141. w_exp.c:(.text.exp+0x4a): undefined reference to `__errno'
  142. /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 ':
  143. w_exp.c:(.text.exp+0x6e): undefined reference to `__errno'
  144. /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':
  145. w_log.c:(.text.log+0x28): 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: w_log.c:(.text.log+0x46): undefined reference to `__errno'
  147. /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':
  148. math_err.c:(.text.with_errno+0x12): undefined reference to `__errno'
  149. collect2: error: ld returned 1 exit status
  150. You can fix it by not link ``-lm`` library, since libncrt library already provided math library feature, so
  151. no need to link this math library.
  152. undefined reference to fclose/sprintf similar API provided in system libraries
  153. ------------------------------------------------------------------------------
  154. From 0.5.0 release, we no longer use ``--specs=`` option to select library we want to use, and we also passed
  155. ``-nodefaultlibs`` options to not use standard system libraries, this changes are made to support both gcc and clang
  156. 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
  157. libraries feature ``--start-group archives --end-group`` to repeatly search undefined reference in the group libraries,
  158. 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
  159. 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
  160. fatal error: rvintrin.h: No such file or directory
  161. --------------------------------------------------
  162. If you are using Nuclei Toolchain 2023.10, ``rvintrin.h`` no longer exist for B extension, please
  163. don't include this header file. If you want to use an intrinsic API for B extension, you need to write
  164. using c asm intrinsic.
  165. riscv-nuclei-elf-gcc: not found when using Nuclei Studio 2023.10
  166. ----------------------------------------------------------------
  167. ``riscv-nuclei-elf-gcc`` (gcc10) has changed to ``riscv64-unknown-elf-gcc`` (gcc13) since Nuclei Studio 2023.10 or
  168. Nuclei RISC-V Toolchain 2023.10, so if you are using older toolchain created npk package or ide project, you
  169. may face this build fail issue, you can follow the user guide of Nuclei Studio 2023.10 to fix this issue, see chapter 8.
  170. .. _debugger kit manual: https://nucleisys.com/developboard.php#ddr200t
  171. .. _ftdi_device_desc: http://openocd.org/doc/html/Debug-Adapter-Configuration.html