reg_test.asm 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484
  1. ;/*
  2. ; FreeRTOS V7.4.2 - Copyright (C) 2013 Real Time Engineers Ltd.
  3. ;
  4. ;
  5. ; ***************************************************************************
  6. ; * *
  7. ; * FreeRTOS tutorial books are available in pdf and paperback. *
  8. ; * Complete, revised, and edited pdf reference manuals are also *
  9. ; * available. *
  10. ; * *
  11. ; * Purchasing FreeRTOS documentation will not only help you, by *
  12. ; * ensuring you get running as quickly as possible and with an *
  13. ; * in-depth knowledge of how to use FreeRTOS, it will also help *
  14. ; * the FreeRTOS project to continue with its mission of providing *
  15. ; * professional grade, cross platform, de facto standard solutions *
  16. ; * for microcontrollers - completely free of charge! *
  17. ; * *
  18. ; * >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
  19. ; * *
  20. ; * Thank you for using FreeRTOS, and thank you for your support! *
  21. ; * *
  22. ; ***************************************************************************
  23. ;
  24. ;
  25. ; This file is part of the FreeRTOS distribution.
  26. ;
  27. ; FreeRTOS is free software; you can redistribute it and/or modify it under
  28. ; the terms of the GNU General Public License (version 2) as published by the
  29. ; Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
  30. ; >>>NOTE<<< The modification to the GPL is included to allow you to
  31. ; distribute a combined work that includes FreeRTOS without being obliged to
  32. ; provide the source code for proprietary components outside of the FreeRTOS
  33. ; kernel. FreeRTOS is distributed in the hope that it will be useful, but
  34. ; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  35. ; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  36. ; more details. You should have received a copy of the GNU General Public
  37. ; License and the FreeRTOS license exception along with FreeRTOS; if not it
  38. ; can be viewed here: http://www.freertos.org/a00114.html and also obtained
  39. ; by writing to Richard Barry, contact details for whom are available on the
  40. ; FreeRTOS WEB site.
  41. ;
  42. ; 1 tab == 4 spaces!
  43. ;
  44. ; ***************************************************************************
  45. ; * *
  46. ; * Having a problem? Start by reading the FAQ "My application does *
  47. ; * not run, what could be wrong? *
  48. ; * *
  49. ; * http://www.FreeRTOS.org/FAQHelp.html *
  50. ; * *
  51. ; ***************************************************************************
  52. ;
  53. ;
  54. ; http://www.FreeRTOS.org - Documentation, training, latest information,
  55. ; license and contact details.
  56. ;
  57. ; http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
  58. ; including FreeRTOS+Trace - an indispensable productivity tool.
  59. ;
  60. ; Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell
  61. ; the code with commercial support, indemnification, and middleware, under
  62. ; the OpenRTOS brand: http://www.OpenRTOS.com. High Integrity Systems also
  63. ; provide a safety engineered and independently SIL3 certified version under
  64. ; the SafeRTOS brand: http://www.SafeRTOS.com.
  65. ;*/
  66. ;-------------------------------------------------
  67. ; port to RT-Thread by Grissiom
  68. ;
  69. .def vRegTestTask1
  70. .ref ulRegTest1Counter
  71. .ref rt_thread_yield
  72. .if (__TI_VFP_SUPPORT__)
  73. .ref vPortTaskUsesFPU
  74. .endif ;__TI_VFP_SUPPORT__
  75. .text
  76. .arm
  77. vRegTestTask1:
  78. .if (__TI_VFP_SUPPORT__)
  79. ; Let the port layer know that this task needs its FPU context saving.
  80. BL vPortTaskUsesFPU
  81. .endif
  82. ; Fill each general purpose register with a known value.
  83. mov r0, #0xFF
  84. mov r1, #0x11
  85. mov r2, #0x22
  86. mov r3, #0x33
  87. mov r4, #0x44
  88. mov r5, #0x55
  89. mov r6, #0x66
  90. mov r7, #0x77
  91. mov r8, #0x88
  92. mov r9, #0x99
  93. mov r10, #0xAA
  94. mov r11, #0xBB
  95. mov r12, #0xCC
  96. mov r14, #0xEE
  97. .if (__TI_VFP_SUPPORT__)
  98. ; Fill each FPU register with a known value.
  99. vmov d0, r0, r1
  100. vmov d1, r2, r3
  101. vmov d2, r4, r5
  102. vmov d3, r6, r7
  103. vmov d4, r8, r9
  104. vmov d5, r10, r11
  105. vmov d6, r0, r1
  106. vmov d7, r2, r3
  107. vmov d8, r4, r5
  108. vmov d9, r6, r7
  109. vmov d10, r8, r9
  110. vmov d11, r10, r11
  111. vmov d12, r0, r1
  112. vmov d13, r2, r3
  113. vmov d14, r4, r5
  114. vmov d15, r6, r7
  115. .endif
  116. vRegTestLoop1:
  117. STMFD sp!, {r0-r3, r12}
  118. ; Force yeild
  119. BL rt_thread_yield
  120. LDMFD sp!, {r0-r3, r12}
  121. .if (__TI_VFP_SUPPORT__)
  122. ; Check all the VFP registers still contain the values set above.
  123. ; First save registers that are clobbered by the test.
  124. STMFD sp!, { r0-r1 }
  125. vmov r0, r1, d0
  126. cmp r0, #0xFF
  127. bne reg1_error_loopf
  128. cmp r1, #0x11
  129. bne reg1_error_loopf
  130. vmov r0, r1, d1
  131. cmp r0, #0x22
  132. bne reg1_error_loopf
  133. cmp r1, #0x33
  134. bne reg1_error_loopf
  135. vmov r0, r1, d2
  136. cmp r0, #0x44
  137. bne reg1_error_loopf
  138. cmp r1, #0x55
  139. bne reg1_error_loopf
  140. vmov r0, r1, d3
  141. cmp r0, #0x66
  142. bne reg1_error_loopf
  143. cmp r1, #0x77
  144. bne reg1_error_loopf
  145. vmov r0, r1, d4
  146. cmp r0, #0x88
  147. bne reg1_error_loopf
  148. cmp r1, #0x99
  149. bne reg1_error_loopf
  150. vmov r0, r1, d5
  151. cmp r0, #0xAA
  152. bne reg1_error_loopf
  153. cmp r1, #0xBB
  154. bne reg1_error_loopf
  155. vmov r0, r1, d6
  156. cmp r0, #0xFF
  157. bne reg1_error_loopf
  158. cmp r1, #0x11
  159. bne reg1_error_loopf
  160. vmov r0, r1, d7
  161. cmp r0, #0x22
  162. bne reg1_error_loopf
  163. cmp r1, #0x33
  164. bne reg1_error_loopf
  165. vmov r0, r1, d8
  166. cmp r0, #0x44
  167. bne reg1_error_loopf
  168. cmp r1, #0x55
  169. bne reg1_error_loopf
  170. vmov r0, r1, d9
  171. cmp r0, #0x66
  172. bne reg1_error_loopf
  173. cmp r1, #0x77
  174. bne reg1_error_loopf
  175. vmov r0, r1, d10
  176. cmp r0, #0x88
  177. bne reg1_error_loopf
  178. cmp r1, #0x99
  179. bne reg1_error_loopf
  180. vmov r0, r1, d11
  181. cmp r0, #0xAA
  182. bne reg1_error_loopf
  183. cmp r1, #0xBB
  184. bne reg1_error_loopf
  185. vmov r0, r1, d12
  186. cmp r0, #0xFF
  187. bne reg1_error_loopf
  188. cmp r1, #0x11
  189. bne reg1_error_loopf
  190. vmov r0, r1, d13
  191. cmp r0, #0x22
  192. bne reg1_error_loopf
  193. cmp r1, #0x33
  194. bne reg1_error_loopf
  195. vmov r0, r1, d14
  196. cmp r0, #0x44
  197. bne reg1_error_loopf
  198. cmp r1, #0x55
  199. bne reg1_error_loopf
  200. vmov r0, r1, d15
  201. cmp r0, #0x66
  202. bne reg1_error_loopf
  203. cmp r1, #0x77
  204. bne reg1_error_loopf
  205. ; Restore the registers that were clobbered by the test.
  206. LDMFD sp!, {r0-r1}
  207. ; VFP register test passed. Jump to the core register test.
  208. b reg1_loopf_pass
  209. reg1_error_loopf:
  210. ; If this line is hit then a VFP register value was found to be
  211. ; incorrect.
  212. b reg1_error_loopf
  213. reg1_loopf_pass:
  214. .endif ;__TI_VFP_SUPPORT__
  215. ; Test each general purpose register to check that it still contains the
  216. ; expected known value, jumping to vRegTestError1 if any register contains
  217. ; an unexpected value.
  218. cmp r0, #0xFF
  219. bne vRegTestError1
  220. cmp r1, #0x11
  221. bne vRegTestError1
  222. cmp r2, #0x22
  223. bne vRegTestError1
  224. cmp r3, #0x33
  225. bne vRegTestError1
  226. cmp r4, #0x44
  227. bne vRegTestError1
  228. cmp r5, #0x55
  229. bne vRegTestError1
  230. cmp r6, #0x66
  231. bne vRegTestError1
  232. cmp r7, #0x77
  233. bne vRegTestError1
  234. cmp r8, #0x88
  235. bne vRegTestError1
  236. cmp r9, #0x99
  237. bne vRegTestError1
  238. cmp r10, #0xAA
  239. bne vRegTestError1
  240. cmp r11, #0xBB
  241. bne vRegTestError1
  242. cmp r12, #0xCC
  243. bne vRegTestError1
  244. ; This task is still running without jumping to vRegTestError1, so increment
  245. ; the loop counter so the check task knows the task is running error free.
  246. stmfd sp!, { r0-r1 }
  247. ldr r0, Count1Const
  248. ldr r1, [r0]
  249. add r1, r1, #1
  250. str r1, [r0]
  251. ldmfd sp!, { r0-r1 }
  252. ; Loop again, performing the same tests.
  253. b vRegTestLoop1
  254. Count1Const .word ulRegTest1Counter
  255. vRegTestError1:
  256. b vRegTestError1
  257. ;-------------------------------------------------
  258. ;
  259. .def vRegTestTask2
  260. .ref ulRegTest2Counter
  261. .text
  262. .arm
  263. ;
  264. vRegTestTask2:
  265. .if (__TI_VFP_SUPPORT__)
  266. ; Let the port layer know that this task needs its FPU context saving.
  267. BL vPortTaskUsesFPU
  268. .endif
  269. ; Fill each general purpose register with a known value.
  270. mov r0, #0xFF000000
  271. mov r1, #0x11000000
  272. mov r2, #0x22000000
  273. mov r3, #0x33000000
  274. mov r4, #0x44000000
  275. mov r5, #0x55000000
  276. mov r6, #0x66000000
  277. mov r7, #0x77000000
  278. mov r8, #0x88000000
  279. mov r9, #0x99000000
  280. mov r10, #0xAA000000
  281. mov r11, #0xBB000000
  282. mov r12, #0xCC000000
  283. mov r14, #0xEE000000
  284. .if (__TI_VFP_SUPPORT__)
  285. ; Fill each FPU register with a known value.
  286. vmov d0, r0, r1
  287. vmov d1, r2, r3
  288. vmov d2, r4, r5
  289. vmov d3, r6, r7
  290. vmov d4, r8, r9
  291. vmov d5, r10, r11
  292. vmov d6, r0, r1
  293. vmov d7, r2, r3
  294. vmov d8, r4, r5
  295. vmov d9, r6, r7
  296. vmov d10, r8, r9
  297. vmov d11, r10, r11
  298. vmov d12, r0, r1
  299. vmov d13, r2, r3
  300. vmov d14, r4, r5
  301. vmov d15, r6, r7
  302. .endif
  303. vRegTestLoop2:
  304. .if (__TI_VFP_SUPPORT__)
  305. ; Check all the VFP registers still contain the values set above.
  306. ; First save registers that are clobbered by the test.
  307. STMFD sp!, { r0-r1 }
  308. vmov r0, r1, d0
  309. cmp r0, #0xFF000000
  310. bne reg2_error_loopf
  311. cmp r1, #0x11000000
  312. bne reg2_error_loopf
  313. vmov r0, r1, d1
  314. cmp r0, #0x22000000
  315. bne reg2_error_loopf
  316. cmp r1, #0x33000000
  317. bne reg2_error_loopf
  318. vmov r0, r1, d2
  319. cmp r0, #0x44000000
  320. bne reg2_error_loopf
  321. cmp r1, #0x55000000
  322. bne reg2_error_loopf
  323. vmov r0, r1, d3
  324. cmp r0, #0x66000000
  325. bne reg2_error_loopf
  326. cmp r1, #0x77000000
  327. bne reg2_error_loopf
  328. vmov r0, r1, d4
  329. cmp r0, #0x88000000
  330. bne reg2_error_loopf
  331. cmp r1, #0x99000000
  332. bne reg2_error_loopf
  333. vmov r0, r1, d5
  334. cmp r0, #0xAA000000
  335. bne reg2_error_loopf
  336. cmp r1, #0xBB000000
  337. bne reg2_error_loopf
  338. vmov r0, r1, d6
  339. cmp r0, #0xFF000000
  340. bne reg2_error_loopf
  341. cmp r1, #0x11000000
  342. bne reg2_error_loopf
  343. vmov r0, r1, d7
  344. cmp r0, #0x22000000
  345. bne reg2_error_loopf
  346. cmp r1, #0x33000000
  347. bne reg2_error_loopf
  348. vmov r0, r1, d8
  349. cmp r0, #0x44000000
  350. bne reg2_error_loopf
  351. cmp r1, #0x55000000
  352. bne reg2_error_loopf
  353. vmov r0, r1, d9
  354. cmp r0, #0x66000000
  355. bne reg2_error_loopf
  356. cmp r1, #0x77000000
  357. bne reg2_error_loopf
  358. vmov r0, r1, d10
  359. cmp r0, #0x88000000
  360. bne reg2_error_loopf
  361. cmp r1, #0x99000000
  362. bne reg2_error_loopf
  363. vmov r0, r1, d11
  364. cmp r0, #0xAA000000
  365. bne reg2_error_loopf
  366. cmp r1, #0xBB000000
  367. bne reg2_error_loopf
  368. vmov r0, r1, d12
  369. cmp r0, #0xFF000000
  370. bne reg2_error_loopf
  371. cmp r1, #0x11000000
  372. bne reg2_error_loopf
  373. vmov r0, r1, d13
  374. cmp r0, #0x22000000
  375. bne reg2_error_loopf
  376. cmp r1, #0x33000000
  377. bne reg2_error_loopf
  378. vmov r0, r1, d14
  379. cmp r0, #0x44000000
  380. bne reg2_error_loopf
  381. cmp r1, #0x55000000
  382. bne reg2_error_loopf
  383. vmov r0, r1, d15
  384. cmp r0, #0x66000000
  385. bne reg2_error_loopf
  386. cmp r1, #0x77000000
  387. bne reg2_error_loopf
  388. ; Restore the registers that were clobbered by the test.
  389. LDMFD sp!, {r0-r1}
  390. ; VFP register test passed. Jump to the core register test.
  391. b reg2_loopf_pass
  392. reg2_error_loopf:
  393. ; If this line is hit then a VFP register value was found to be
  394. ; incorrect.
  395. b reg2_error_loopf
  396. reg2_loopf_pass:
  397. .endif ;__TI_VFP_SUPPORT__
  398. ; Test each general purpose register to check that it still contains the
  399. ; expected known value, jumping to vRegTestError2 if any register contains
  400. ; an unexpected value.
  401. cmp r0, #0xFF000000
  402. bne vRegTestError2
  403. cmp r1, #0x11000000
  404. bne vRegTestError2
  405. cmp r2, #0x22000000
  406. bne vRegTestError2
  407. cmp r3, #0x33000000
  408. bne vRegTestError2
  409. cmp r4, #0x44000000
  410. bne vRegTestError2
  411. cmp r5, #0x55000000
  412. bne vRegTestError2
  413. cmp r6, #0x66000000
  414. bne vRegTestError2
  415. cmp r7, #0x77000000
  416. bne vRegTestError2
  417. cmp r8, #0x88000000
  418. bne vRegTestError2
  419. cmp r9, #0x99000000
  420. bne vRegTestError2
  421. cmp r10, #0xAA000000
  422. bne vRegTestError2
  423. cmp r11, #0xBB000000
  424. bne vRegTestError2
  425. cmp r12, #0xCC000000
  426. bne vRegTestError2
  427. cmp r14, #0xEE000000
  428. bne vRegTestError2
  429. ; This task is still running without jumping to vRegTestError2, so increment
  430. ; the loop counter so the check task knows the task is running error free.
  431. stmfd sp!, { r0-r1 }
  432. ldr r0, Count2Const
  433. ldr r1, [r0]
  434. add r1, r1, #1
  435. str r1, [r0]
  436. ldmfd sp!, { r0-r1 }
  437. ; Loop again, performing the same tests.
  438. b vRegTestLoop2
  439. Count2Const .word ulRegTest2Counter
  440. vRegTestError2:
  441. b vRegTestError2
  442. ;-------------------------------------------------