app.rst 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782
  1. .. _design_app:
  2. Application
  3. ===========
  4. .. _design_app_overview:
  5. Overview
  6. --------
  7. In Nuclei N100 SDK, we just provided applications which can
  8. run in different boards without any changes in code to
  9. demonstrate the baremetal service, freertos service and
  10. ucosii service features.
  11. The provided applications can be divided into three categories:
  12. * Bare-metal applications: Located in ``application/baremetal``
  13. * FreeRTOS applications: Located in ``application/freertos``
  14. * UCOSII applications: Located in ``application/ucosii``
  15. * RTThread applications: Located in ``application/rtthread``
  16. If you want to develop your own application in Nuclei N100 SDK, please click
  17. :ref:`develop_appdev` to learn more about it.
  18. The following applications are running Nuclei Eval SoC.
  19. .. note::
  20. * Only benchmark/helloworld can run on Nuclei Qemu >= 2025.02 now.
  21. * Most of the application demostrated below using ``SOC=evalsoc``,
  22. you can easily change it to other SoC such as evalsoc by change it to
  23. ``SOC=evalsoc``
  24. * Some applications may not be able to be run on your SoC using Nuclei CPU
  25. due to lack of cpu feature required to run on it.
  26. * Almost all the applications required Nuclei CPU configured with
  27. irqc and System Timer hardware feature.
  28. * Almost all the application required UART to print message, so you need to
  29. implement an UART drivers and clib stub functions, if you use
  30. :ref:`develop_buildsystem_var_semihost` to print message, it is not required.
  31. Bare-metal applications
  32. -----------------------
  33. .. _design_app_helloworld:
  34. helloworld
  35. ~~~~~~~~~~
  36. This `helloworld application`_ is used to print hello world, and also
  37. will check this RISC-V CSR **MISA** register value.
  38. **How to run this application:**
  39. .. code-block:: shell
  40. # Assume that you can set up the Tools and Nuclei N100 SDK environment
  41. # cd to the helloworld directory
  42. cd application/baremetal/helloworld
  43. # Clean the application first
  44. make SOC=evalsoc clean
  45. # Build and upload the application
  46. make SOC=evalsoc upload
  47. **Expected output as below:**
  48. .. code-block:: console
  49. N100 Nuclei SDK Build Time: Jun 4 2024, 14:19:03
  50. Download Mode: ILM
  51. CPU Frequency 16001597 Hz
  52. CPU HartID: 0
  53. Hart 0, MISA: 0x40001104
  54. MISA: RV32IMC
  55. Got rand integer 455647 using seed 1933213352.
  56. 0: Hello World From Nuclei RISC-V Processor!
  57. 1: Hello World From Nuclei RISC-V Processor!
  58. 2: Hello World From Nuclei RISC-V Processor!
  59. 3: Hello World From Nuclei RISC-V Processor!
  60. 4: Hello World From Nuclei RISC-V Processor!
  61. 5: Hello World From Nuclei RISC-V Processor!
  62. 6: Hello World From Nuclei RISC-V Processor!
  63. 7: Hello World From Nuclei RISC-V Processor!
  64. 8: Hello World From Nuclei RISC-V Processor!
  65. 9: Hello World From Nuclei RISC-V Processor!
  66. 10: Hello World From Nuclei RISC-V Processor!
  67. 11: Hello World From Nuclei RISC-V Processor!
  68. 12: Hello World From Nuclei RISC-V Processor!
  69. 13: Hello World From Nuclei RISC-V Processor!
  70. 14: Hello World From Nuclei RISC-V Processor!
  71. 15: Hello World From Nuclei RISC-V Processor!
  72. 16: Hello World From Nuclei RISC-V Processor!
  73. 17: Hello World From Nuclei RISC-V Processor!
  74. 18: Hello World From Nuclei RISC-V Processor!
  75. 19: Hello World From Nuclei RISC-V Processor!
  76. .. _design_app_demo_timer:
  77. demo_timer
  78. ~~~~~~~~~~
  79. This `demo_timer application`_ is used to demonstrate how to use
  80. the CORE TIMER API including the Timer Interrupt and Timer Software Interrupt.
  81. * First the timer interrupt will run for 5 times
  82. * Then the software timer interrupt will start to run for 5 times
  83. **How to run this application:**
  84. .. code-block:: shell
  85. # Assume that you can set up the Tools and Nuclei N100 SDK environment
  86. # cd to the demo_timer directory
  87. cd application/baremetal/demo_timer
  88. # Clean the application first
  89. make SOC=evalsoc clean
  90. # Build and upload the application
  91. make SOC=evalsoc upload
  92. **Expected output as below:**
  93. .. code-block:: console
  94. N100 Nuclei SDK Build Time: Jun 4 2024, 14:20:01
  95. Download Mode: ILM
  96. CPU Frequency 16000942 Hz
  97. CPU HartID: 0
  98. init timer and start
  99. MTimer IRQ handler 1
  100. MTimer IRQ handler 2
  101. MTimer IRQ handler 3
  102. MTimer IRQ handler 4
  103. MTimer IRQ handler 5
  104. MTimer SW IRQ handler 1
  105. MTimer SW IRQ handler 2
  106. MTimer SW IRQ handler 3
  107. MTimer SW IRQ handler 4
  108. MTimer SW IRQ handler 5
  109. MTimer msip and mtip interrupt test finish and pass
  110. .. _design_app_demo_irqc:
  111. demo_irqc
  112. ~~~~~~~~~
  113. This `demo_irqc application`_ is used to demonstrate how to use
  114. the irqc API and Interrupt.
  115. * The timer interrupt and timer software interrupt are used
  116. **How to run this application:**
  117. .. code-block:: shell
  118. # Assume that you can set up the Tools and Nuclei N100 SDK environment
  119. # cd to the demo_irqc directory
  120. cd application/baremetal/demo_irqc
  121. # Clean the application first
  122. make SOC=evalsoc clean
  123. # Build and upload the application
  124. make SOC=evalsoc upload
  125. .. code-block:: console
  126. N100 Nuclei SDK Build Time: Jun 4 2024, 14:21:42
  127. Download Mode: ILM
  128. CPU Frequency 16000942 Hz
  129. CPU HartID: 0
  130. Initialize timer and start timer interrupt periodically
  131. -------------------
  132. [IN TIMER INTERRUPT]timer interrupt hit 0 times
  133. [IN TIMER INTERRUPT]trigger software interrupt
  134. [IN TIMER INTERRUPT]software interrupt will run when timer interrupt finished
  135. [IN TIMER INTERRUPT]timer interrupt end
  136. [IN SOFTWARE INTERRUPT]software interrupt hit 0 times
  137. [IN SOFTWARE INTERRUPT]software interrupt end
  138. -------------------
  139. [IN TIMER INTERRUPT]timer interrupt hit 1 times
  140. [IN TIMER INTERRUPT]trigger software interrupt
  141. [IN TIMER INTERRUPT]software interrupt will run when timer interrupt finished
  142. [IN TIMER INTERRUPT]timer interrupt end
  143. [IN SOFTWARE INTERRUPT]software interrupt hit 1 times
  144. [IN SOFTWARE INTERRUPT]software interrupt end
  145. -------------------
  146. [IN TIMER INTERRUPT]timer interrupt hit 2 times
  147. [IN TIMER INTERRUPT]trigger software interrupt
  148. [IN TIMER INTERRUPT]software interrupt will run when timer interrupt finished
  149. [IN TIMER INTERRUPT]timer interrupt end
  150. [IN SOFTWARE INTERRUPT]software interrupt hit 2 times
  151. [IN SOFTWARE INTERRUPT]software interrupt end
  152. -------------------
  153. .. _design_app_demo_extirq:
  154. demo_extirq
  155. ~~~~~~~~~~~
  156. This `demo_extirq application`_ is used to demonstrate how to use external interrupt with irqc controller.
  157. **How to run this application:**
  158. .. code-block:: shell
  159. # Assume that you can set up the Tools and Nuclei N100 SDK environment
  160. cd application/baremetal/demo_extirq
  161. # Clean the application first
  162. make SOC=evalsoc clean
  163. # Build and upload the application
  164. make SOC=evalsoc upload
  165. **Expected output as below:**
  166. .. code-block:: console
  167. N100 Nuclei SDK Build Time: Jun 4 2024, 14:22:37
  168. Download Mode: ILM
  169. CPU Frequency 16000942 Hz
  170. CPU HartID: 0
  171. You can press any key now to trigger uart receive interrupt
  172. Enter uart0 interrupt, you just typed: 1
  173. Enter uart0 interrupt, you just typed: 2
  174. Enter uart0 interrupt, you just typed: 3
  175. .. _design_app_lowpower:
  176. lowpower
  177. ~~~~~~~~
  178. This `lowpower application`_ is used to demonstrate how to use low-power feature of RISC-V
  179. processor.
  180. Timer interrupt is setup before enter to wfi mode, and global interrupt will be disabled,
  181. so interrupt handler will not be entered, and will directly resume to next pc of wfi.
  182. **How to run this application:**
  183. .. code-block:: shell
  184. # Assume that you can set up the Tools and Nuclei N100 SDK environment
  185. # Assume your processor has enabled low-power feature
  186. # cd to the low-power directory
  187. cd application/baremetal/lowpower
  188. # Clean the application first
  189. make SOC=evalsoc clean
  190. # Build and upload the application
  191. make SOC=evalsoc upload
  192. **Expected output as below:**
  193. .. code-block:: console
  194. N100 Nuclei SDK Build Time: Jun 4 2024, 14:24:42
  195. Download Mode: ILM
  196. CPU Frequency 16001597 Hz
  197. CPU HartID: 0
  198. CSV, WFI Start/End, 205728/205743
  199. CSV, WFI Cost, 15
  200. .. _design_app_coremark:
  201. coremark
  202. ~~~~~~~~
  203. This `coremark benchmark application`_ is used to run EEMBC CoreMark Software.
  204. EEMBC CoreMark Software is a product of EEMBC and is provided under the terms of the
  205. CoreMark License that is distributed with the official EEMBC COREMARK Software release.
  206. If you received this EEMBC CoreMark Software without the accompanying CoreMark License,
  207. you must discontinue use and download the official release from www.coremark.org.
  208. In Nuclei N100 SDK, we provided code and Makefile for this ``coremark`` application.
  209. You can also optimize the ``COMMON_FLAGS`` defined in coremark application Makefile
  210. to get different score number.
  211. * By default, this application runs for 15 iterations, you can also change this in Makefile.
  212. e.g. Change this ``-DITERATIONS=15`` to value such as ``-DITERATIONS=20``
  213. * macro **PERFORMANCE_RUN=1** is defined
  214. * **STDCLIB ?= newlib_small** is added in its Makefile to enable float value print
  215. .. note::
  216. N100's time and cycle counter is only 24bit, easy to overflow, so make sure
  217. the iteration is small.
  218. **How to run this application:**
  219. .. code-block:: shell
  220. # Assume that you can set up the Tools and Nuclei N100 SDK environment
  221. # cd to the coremark directory
  222. cd application/baremetal/benchmark/coremark
  223. # Clean the application first
  224. make SOC=evalsoc clean
  225. # Build and upload the application
  226. make SOC=evalsoc upload
  227. **Expected output as below:**
  228. .. code-block:: console
  229. N100 Nuclei SDK Build Time: Jun 4 2024, 14:37:47
  230. Download Mode: ILM
  231. CPU Frequency 16000286 Hz
  232. CPU HartID: 0
  233. Start to run coremark for 15 iterations
  234. 2K performance run parameters for coremark.
  235. CoreMark Size : 666
  236. Total ticks : 5052270
  237. Total time (secs): 0.315755
  238. Iterations/Sec : 47.505194
  239. ERROR! Must execute for at least 10 secs for a valid result!
  240. Iterations : 15
  241. Compiler version : GCC13.1.1 20230713
  242. Compiler flags : -Ofast -fno-code-hoisting -fno-tree-vectorize -fno-common -finline-functions -falign-functions=4 -falign-jumps=4 -falign-loops=4 -finline1
  243. Memory location : STACK
  244. seedcrc : 0xe9f5
  245. [0]crclist : 0xe714
  246. [0]crcmatrix : 0x1fd7
  247. [0]crcstate : 0x8e3a
  248. [0]crcfinal : 0x2d47
  249. Errors detected
  250. Print Personal Added Addtional Info to Easy Visual Analysis
  251. (Iterations is: 15
  252. (total_ticks is: 5052270
  253. (*) Assume the core running at 1 MHz
  254. So the CoreMark/MHz can be calculated by:
  255. (Iterations*1000000/total_ticks) = 2.968962 CoreMark/MHz
  256. CSV, Benchmark, Iterations, Cycles, CoreMark/MHz
  257. CSV, CoreMark, 15, 5052270, 2.968
  258. .. _design_app_dhrystone:
  259. dhrystone
  260. ~~~~~~~~~
  261. This `dhrystone benchmark application`_ is used to run DHRYSTONE Benchmark Software.
  262. The Dhrystone benchmark program has become a popular benchmark for CPU/compiler performance measurement,
  263. in particular in the area of minicomputers, workstations, PC's and microprocesors.
  264. * It apparently satisfies a need for an easy-to-use integer benchmark;
  265. * it gives a first performance indication which is more meaningful than MIPS numbers which,
  266. in their literal meaning (million instructions per second), cannot be used across different
  267. instruction sets (e.g. RISC vs. CISC).
  268. * With the increasing use of the benchmark, it seems necessary to reconsider the benchmark and
  269. to check whether it can still fulfill this function.
  270. In Nuclei N100 SDK, we provided code and Makefile for this ``dhrystone`` application.
  271. You can also optimize the ``COMMON_FLAGS`` defined in dhrystone application Makefile
  272. to get different score number.
  273. * **STDCLIB ?= newlib_small** is added in its Makefile to enable float value print
  274. **How to run this application:**
  275. .. code-block:: shell
  276. # Assume that you can set up the Tools and Nuclei N100 SDK environment
  277. # cd to the dhrystone directory
  278. cd application/baremetal/benchmark/dhrystone
  279. # Clean the application first
  280. make SOC=evalsoc clean
  281. # Build and upload the application
  282. make SOC=evalsoc upload
  283. **Expected output as below:**
  284. .. code-block:: console
  285. N100 Nuclei SDK Build Time: Jun 4 2024, 14:38:59
  286. Download Mode: ILM
  287. CPU Frequency 16000942 Hz
  288. CPU HartID: 0
  289. Dhrystone Benchmark, Version 2.1 (Language: C)
  290. Program compiled without 'register' attribute
  291. Please give the number of runs through the benchmark:
  292. Execution starts, 2000 runs through Dhrystone
  293. Execution ends
  294. Final values of the variables used in the benchmark:
  295. Int_Glob: 5
  296. should be: 5
  297. Bool_Glob: 1
  298. should be: 1
  299. Ch_1_Glob: A
  300. should be: A
  301. Ch_2_Glob: B
  302. should be: B
  303. Arr_1_Glob[8]: 7
  304. should be: 7
  305. Arr_2_Glob[8][7]: 2010
  306. should be: Number_Of_Runs + 10
  307. Ptr_Glob->
  308. Ptr_Comp: -1879032512
  309. should be: (implementation-dependent)
  310. Discr: 0
  311. should be: 0
  312. Enum_Comp: 2
  313. should be: 2
  314. Int_Comp: 17
  315. should be: 17
  316. Str_Comp: DHRYSTONE PROGRAM, SOME STRING
  317. should be: DHRYSTONE PROGRAM, SOME STRING
  318. Next_Ptr_Glob->
  319. Ptr_Comp: -1879032512
  320. should be: (implementation-dependent), same as above
  321. Discr: 0
  322. should be: 0
  323. Enum_Comp: 1
  324. should be: 1
  325. Int_Comp: 18
  326. should be: 18
  327. Str_Comp: DHRYSTONE PROGRAM, SOME STRING
  328. should be: DHRYSTONE PROGRAM, SOME STRING
  329. Int_1_Loc: 5
  330. should be: 5
  331. Int_2_Loc: 13
  332. should be: 13
  333. Int_3_Loc: 7
  334. should be: 7
  335. Enum_Loc: 1
  336. should be: 1
  337. Str_1_Loc: DHRYSTONE PROGRAM, 1'ST STRING
  338. should be: DHRYSTONE PROGRAM, 1'ST STRING
  339. Str_2_Loc: DHRYSTONE PROGRAM, 2'ND STRING
  340. should be: DHRYSTONE PROGRAM, 2'ND STRING
  341. Measured time too small to obtain meaningful results
  342. Please increase number of runs
  343. (*) User_Cycle for total run through Dhrystone with loops 2000:
  344. 1042022
  345. So the DMIPS/MHz can be calculated by:
  346. 1000000/(User_Cycle/Number_Of_Runs)/1757 = 1.092399 DMIPS/MHz
  347. CSV, Benchmark, Iterations, Cycles, DMIPS/MHz
  348. CSV, Dhrystone, 2000, 1042022, 1.092
  349. .. _design_app_whetstone:
  350. whetstone
  351. ~~~~~~~~~
  352. This `whetstone benchmark application`_ is used to run C/C++ Whetstone Benchmark Software
  353. (Single or Double Precision).
  354. The Fortran Whetstone programs were the first general purpose benchmarks that set industry
  355. standards of computer system performance. Whetstone programs also addressed the question
  356. of the efficiency of different programming languages, an important issue not covered by
  357. more contemporary standard benchmarks.
  358. In Nuclei N100 SDK, we provided code and Makefile for this ``whetstone`` application.
  359. You can also optimize the ``COMMON_FLAGS`` defined in whetstone application Makefile
  360. to get different score number.
  361. * **STDCLIB ?= newlib_small** is added in its Makefile to enable float value print
  362. * Extra **LDLIBS := -lm** is added in its Makefile to include the math library
  363. **How to run this application:**
  364. .. code-block:: shell
  365. # Assume that you can set up the Tools and Nuclei N100 SDK environment
  366. # cd to the whetstone directory
  367. cd application/baremetal/benchmark/whetstone
  368. # Clean the application first
  369. make SOC=evalsoc clean
  370. # Build and upload the application
  371. make SOC=evalsoc upload
  372. **Expected output as below:**
  373. .. code-block:: console
  374. N100 Nuclei SDK Build Time: Jun 4 2024, 14:41:32
  375. Download Mode: ILM
  376. CPU Frequency 16000942 Hz
  377. CPU HartID: 0
  378. ##########################################
  379. Single Precision C Whetstone Benchmark Opt 3 32 Bit
  380. Calibrate
  381. 14.54 Seconds 1 Passes (x 100)
  382. Use 1 passes (x 100)
  383. Single Precision C/C++ Whetstone Benchmark
  384. Loop content Result MFLOPS MOPS Seconds
  385. N1 floating point -1.12475013732910156 0.148 0.130
  386. N2 floating point -1.12274742126464844 0.149 0.901
  387. N3 if then else 1.00000000000000000 226.099 0.000
  388. N4 fixed point 12.00000000000000000 0.764 0.412
  389. N5 sin,cos etc. 0.49909299612045288 0.015 5.601
  390. N6 floating point 0.99999982118606567 0.142 3.804
  391. N7 assignments 3.00000000000000000 71.241 0.003
  392. N8 exp,sqrt etc. 0.75110614299774170 0.010 3.693
  393. MWIPS 0.688 14.544
  394. MWIPS/MHz 0.043 14.544
  395. CSV, Benchmark, MWIPS/MHz
  396. CSV, Whetstone, 0.042
  397. FreeRTOS applications
  398. ---------------------
  399. .. _design_app_freertos_demo:
  400. demo
  401. ~~~~
  402. This `freertos demo application`_ is to show basic freertos task functions.
  403. * Two freertos tasks are created
  404. * A software timer is created
  405. In Nuclei N100 SDK, we provided code and Makefile for this ``freertos demo`` application.
  406. * **RTOS = FreeRTOS** is added in its Makefile to include FreeRTOS service
  407. * The **configTICK_RATE_HZ** in ``FreeRTOSConfig.h`` is set to 100, you can change it
  408. to other number according to your requirement.
  409. **How to run this application:**
  410. .. code-block:: shell
  411. # Assume that you can set up the Tools and Nuclei N100 SDK environment
  412. # cd to the freertos demo directory
  413. cd application/freertos/demo
  414. # Clean the application first
  415. make SOC=evalsoc clean
  416. # Build and upload the application
  417. make SOC=evalsoc upload
  418. **Expected output as below:**
  419. .. code-block:: console
  420. N100 Nuclei SDK Build Time: Jun 4 2024, 14:44:39
  421. Download Mode: ILM
  422. CPU Frequency 16000942 Hz
  423. CPU HartID: 0
  424. Before StartScheduler
  425. Enter to task_1
  426. task1 is running 0.....
  427. Enter to task_2
  428. task2 is running 0.....
  429. task1 is running 1.....
  430. task2 is running 1.....
  431. task1 is running 2.....
  432. task2 is running 2.....
  433. task1 is running 3.....
  434. task2 is running 3.....
  435. task1 is running 4.....
  436. task2 is running 4.....
  437. timers Callback 0
  438. task1 is running 5.....
  439. task2 is running 5.....
  440. task1 is running 6.....
  441. task2 is running 6.....
  442. task1 is running 7.....
  443. UCOSII applications
  444. -------------------
  445. .. _design_app_ucosii_demo:
  446. demo
  447. ~~~~
  448. This `ucosii demo application`_ is show basic ucosii task functions.
  449. * 4 tasks are created
  450. * 1 task is created first, and then create 3 other tasks and then suspend itself
  451. In Nuclei N100 SDK, we provided code and Makefile for this ``ucosii demo`` application.
  452. * **RTOS = UCOSII** is added in its Makefile to include UCOSII service
  453. * The **OS_TICKS_PER_SEC** in ``os_cfg.h`` is by default set to 50, you can change it
  454. to other number according to your requirement.
  455. **How to run this application:**
  456. .. code-block:: shell
  457. # Assume that you can set up the Tools and Nuclei N100 SDK environment
  458. # cd to the ucosii demo directory
  459. cd application/ucosii/demo
  460. # Clean the application first
  461. make SOC=evalsoc clean
  462. # Build and upload the application
  463. make SOC=evalsoc upload
  464. **Expected output as below:**
  465. .. code-block:: console
  466. N100 Nuclei SDK Build Time: Jun 4 2024, 14:45:42
  467. Download Mode: ILM
  468. CPU Frequency 16000286 Hz
  469. CPU HartID: 0
  470. Start ucosii...
  471. create start task success
  472. start all task...
  473. task3 is running... 1
  474. task2 is running... 1
  475. task1 is running... 1
  476. task3 is running... 2
  477. task2 is running... 2
  478. task1 is running... 2
  479. task3 is running... 3
  480. task2 is running... 3
  481. task3 is running... 4
  482. task2 is running... 4
  483. task1 is running... 3
  484. task3 is running... 5
  485. task2 is running... 5
  486. task3 is running... 6
  487. task2 is running... 6
  488. RT-Thread applications
  489. ----------------------
  490. .. _design_app_rtthread_demo:
  491. demo
  492. ~~~~
  493. This `rt-thread demo application`_ is show basic rt-thread thread functions.
  494. * main function is a pre-created thread by RT-Thread
  495. * main thread will create 5 test threads using the same function ``thread_entry``
  496. In Nuclei N100 SDK, we provided code and Makefile for this ``rtthread demo`` application.
  497. * **RTOS = RTThread** is added in its Makefile to include RT-Thread service
  498. * The **RT_TICK_PER_SECOND** in ``rtconfig.h`` is by default set to `100`, you can change it
  499. to other number according to your requirement.
  500. **How to run this application:**
  501. .. code-block:: shell
  502. # Assume that you can set up the Tools and Nuclei N100 SDK environment
  503. # cd to the rtthread demo directory
  504. cd application/rtthread/demo
  505. # Clean the application first
  506. make SOC=evalsoc clean
  507. # Build and upload the application
  508. make SOC=evalsoc upload
  509. **Expected output as below:**
  510. .. code-block:: console
  511. N100 Nuclei SDK Build Time: Jun 4 2024, 14:47:24
  512. Download Mode: ILM
  513. CPU Frequency 15999303 Hz
  514. CPU HartID: 0
  515. \ | /
  516. - RT - Thread Operating System
  517. / | \ 3.1.3 build Jun 4 2024
  518. 2006 - 2019 Copyright by rt-thread team
  519. Main thread count: 0
  520. thread 0 count: 0
  521. thread 1 count: 0
  522. thread 2 count: 0
  523. thread 3 count: 0
  524. thread 4 count: 0
  525. thread 0 count: 1
  526. thread 1 count: 1
  527. thread 2 count: 1
  528. thread 3 count: 1
  529. thread 4 count: 1
  530. Main thread count: 1
  531. thread 0 count: 2
  532. thread 1 count: 2
  533. thread 2 count: 2
  534. thread 3 count: 2
  535. .. _design_app_rtthread_msh:
  536. msh
  537. ~~~
  538. This `rt-thread msh application`_ demonstrates msh shell in serial console which is a component of rt-thread.
  539. * ``MSH_CMD_EXPORT(nsdk, msh nuclei sdk demo)`` exports a command ``nsdk`` to msh shell
  540. In Nuclei N100 SDK, we provided code and Makefile for this ``rtthread msh`` application.
  541. * **RTOS = RTThread** is added in its Makefile to include RT-Thread service
  542. * **RTTHREAD_MSH := 1** is added in its Makefile to include RT-Thread msh component
  543. * The **RT_TICK_PER_SECOND** in ``rtconfig.h`` is by default set to `100`, you can change it
  544. to other number according to your requirement.
  545. **How to run this application:**
  546. .. code-block:: shell
  547. # Assume that you can set up the Tools and Nuclei N100 SDK environment
  548. # cd to the rtthread msh directory
  549. cd application/rtthread/msh
  550. # Clean the application first
  551. make SOC=evalsoc clean
  552. # Build and upload the application
  553. make SOC=evalsoc upload
  554. **Expected output as below:**
  555. .. code-block:: console
  556. N100 Nuclei SDK Build Time: Jun 4 2024, 14:48:20
  557. Download Mode: ILM
  558. CPU Frequency 16000286 Hz
  559. CPU HartID: 0
  560. \ | /
  561. - RT - Thread Operating System
  562. / | \ 3.1.3 build Jun 4 2024
  563. 2006 - 2019 Copyright by rt-thread team
  564. Hello RT-Thread!
  565. msh >help
  566. RT-Thread shell commands:
  567. list_timer - list timer in system
  568. list_mailbox - list mail box in system
  569. list_sem - list semaphore in system
  570. list_thread - list thread
  571. version - show RT-Thread version information
  572. ps - List threads in the system.
  573. help - RT-Thread shell help.
  574. nsdk - msh nuclei sdk demo
  575. msh >ps
  576. thread pri status sp stack size max used left tick error
  577. -------- --- ------- ---------- ---------- ------ ---------- ---
  578. tshell 6 ready 0x000000d8 0x00001000 10% 0x00000005 000
  579. tidle 7 ready 0x00000078 0x00000200 23% 0x00000020 000
  580. main 2 suspend 0x000000b8 0x00000400 17% 0x00000013 000
  581. msh >nsdk
  582. Hello Nuclei SDK!
  583. msh >
  584. .. _helloworld application: https://github.com/Nuclei-Software/nuclei-sdk/tree/develop_n100/application/baremetal/helloworld
  585. .. _demo_timer application: https://github.com/Nuclei-Software/nuclei-sdk/tree/develop_n100/application/baremetal/demo_timer
  586. .. _demo_irqc application: https://github.com/Nuclei-Software/nuclei-sdk/tree/develop_n100/application/baremetal/demo_irqc
  587. .. _demo_extirq application: https://github.com/Nuclei-Software/nuclei-sdk/tree/develop_n100/application/baremetal/demo_extirq
  588. .. _lowpower application: https://github.com/Nuclei-Software/nuclei-sdk/tree/develop_n100/application/baremetal/lowpower
  589. .. _coremark benchmark application: https://github.com/Nuclei-Software/nuclei-sdk/tree/develop_n100/application/baremetal/benchmark/coremark
  590. .. _dhrystone benchmark application: https://github.com/Nuclei-Software/nuclei-sdk/tree/develop_n100/application/baremetal/benchmark/dhrystone
  591. .. _whetstone benchmark application: https://github.com/Nuclei-Software/nuclei-sdk/tree/develop_n100/application/baremetal/benchmark/whetstone
  592. .. _freertos demo application: https://github.com/Nuclei-Software/nuclei-sdk/tree/develop_n100/application/freertos/demo
  593. .. _ucosii demo application: https://github.com/Nuclei-Software/nuclei-sdk/tree/develop_n100/application/ucosii/demo
  594. .. _rt-thread demo application: https://github.com/Nuclei-Software/nuclei-sdk/tree/develop_n100/application/rtthread/demo
  595. .. _rt-thread msh application: https://github.com/Nuclei-Software/nuclei-sdk/tree/develop_n100/application/rtthread/msh