📄 core_cm3.lst
字号:
\ __get_PSP:
\ 00000000 EFF30980 mrs r0, psp
269 __ASM("bx lr");
\ 00000004 7047 bx lr
270 }
\ 00000006 7047 BX LR ;; return
271
272 /**
273 * @brief Set the Process Stack Pointer
274 *
275 * @param topOfProcStack Process Stack Pointer
276 *
277 * Assign the value ProcessStackPointer to the MSP
278 * (process stack pointer) Cortex processor register
279 */
\ In section .text, align 4, keep-with-next
280 void __set_PSP(uint32_t topOfProcStack)
281 {
282 __ASM("msr psp, r0");
\ __set_PSP:
\ 00000000 80F30988 msr psp, r0
283 __ASM("bx lr");
\ 00000004 7047 bx lr
284 }
\ 00000006 7047 BX LR ;; return
285
286 /**
287 * @brief Return the Main Stack Pointer
288 *
289 * @return Main Stack Pointer
290 *
291 * Return the current value of the MSP (main stack pointer)
292 * Cortex processor register
293 */
\ In section .text, align 4, keep-with-next
294 uint32_t __get_MSP(void)
295 {
296 __ASM("mrs r0, msp");
\ __get_MSP:
\ 00000000 EFF30880 mrs r0, msp
297 __ASM("bx lr");
\ 00000004 7047 bx lr
298 }
\ 00000006 7047 BX LR ;; return
299
300 /**
301 * @brief Set the Main Stack Pointer
302 *
303 * @param topOfMainStack Main Stack Pointer
304 *
305 * Assign the value mainStackPointer to the MSP
306 * (main stack pointer) Cortex processor register
307 */
\ In section .text, align 4, keep-with-next
308 void __set_MSP(uint32_t topOfMainStack)
309 {
310 __ASM("msr msp, r0");
\ __set_MSP:
\ 00000000 80F30888 msr msp, r0
311 __ASM("bx lr");
\ 00000004 7047 bx lr
312 }
\ 00000006 7047 BX LR ;; return
313
314 /**
315 * @brief Reverse byte order in unsigned short value
316 *
317 * @param value value to reverse
318 * @return reversed value
319 *
320 * Reverse byte order in unsigned short value
321 */
\ In section .text, align 4, keep-with-next
322 uint32_t __REV16(uint16_t value)
323 {
324 __ASM("rev16 r0, r0");
\ __REV16:
\ 00000000 40BA rev16 r0, r0
325 __ASM("bx lr");
\ 00000002 7047 bx lr
326 }
\ 00000004 7047 BX LR ;; return
327
328 /**
329 * @brief Reverse bit order of value
330 *
331 * @param value value to reverse
332 * @return reversed value
333 *
334 * Reverse bit order of value
335 */
\ In section .text, align 4, keep-with-next
336 uint32_t __RBIT(uint32_t value)
337 {
338 __ASM("rbit r0, r0");
\ __RBIT:
\ 00000000 90FAA0F0 rbit r0, r0
339 __ASM("bx lr");
\ 00000004 7047 bx lr
340 }
\ 00000006 7047 BX LR ;; return
341
342 /**
343 * @brief LDR Exclusive (8 bit)
344 *
345 * @param *addr address pointer
346 * @return value of (*address)
347 *
348 * Exclusive LDR command for 8 bit values)
349 */
\ In section .text, align 4, keep-with-next
350 uint8_t __LDREXB(uint8_t *addr)
351 {
352 __ASM("ldrexb r0, [r0]");
\ __LDREXB:
\ 00000000 D0E84F0F ldrexb r0, [r0]
353 __ASM("bx lr");
\ 00000004 7047 bx lr
354 }
\ 00000006 7047 BX LR ;; return
355
356 /**
357 * @brief LDR Exclusive (16 bit)
358 *
359 * @param *addr address pointer
360 * @return value of (*address)
361 *
362 * Exclusive LDR command for 16 bit values
363 */
\ In section .text, align 4, keep-with-next
364 uint16_t __LDREXH(uint16_t *addr)
365 {
366 __ASM("ldrexh r0, [r0]");
\ __LDREXH:
\ 00000000 D0E85F0F ldrexh r0, [r0]
367 __ASM("bx lr");
\ 00000004 7047 bx lr
368 }
\ 00000006 7047 BX LR ;; return
369
370 /**
371 * @brief LDR Exclusive (32 bit)
372 *
373 * @param *addr address pointer
374 * @return value of (*address)
375 *
376 * Exclusive LDR command for 32 bit values
377 */
\ In section .text, align 4, keep-with-next
378 uint32_t __LDREXW(uint32_t *addr)
379 {
380 __ASM("ldrex r0, [r0]");
\ __LDREXW:
\ 00000000 50E8000F ldrex r0, [r0]
381 __ASM("bx lr");
\ 00000004 7047 bx lr
382 }
\ 00000006 7047 BX LR ;; return
383
384 /**
385 * @brief STR Exclusive (8 bit)
386 *
387 * @param value value to store
388 * @param *addr address pointer
389 * @return successful / failed
390 *
391 * Exclusive STR command for 8 bit values
392 */
\ In section .text, align 4, keep-with-next
393 uint32_t __STREXB(uint8_t value, uint8_t *addr)
394 {
395 __ASM("strexb r0, r0, [r1]");
\ __STREXB:
\ 00000000 C1E8400F strexb r0, r0, [r1]
396 __ASM("bx lr");
\ 00000004 7047 bx lr
397 }
\ 00000006 7047 BX LR ;; return
398
399 /**
400 * @brief STR Exclusive (16 bit)
401 *
402 * @param value value to store
403 * @param *addr address pointer
404 * @return successful / failed
405 *
406 * Exclusive STR command for 16 bit values
407 */
\ In section .text, align 4, keep-with-next
408 uint32_t __STREXH(uint16_t value, uint16_t *addr)
409 {
410 __ASM("strexh r0, r0, [r1]");
\ __STREXH:
\ 00000000 C1E8500F strexh r0, r0, [r1]
411 __ASM("bx lr");
\ 00000004 7047 bx lr
412 }
\ 00000006 7047 BX LR ;; return
413
414 /**
415 * @brief STR Exclusive (32 bit)
416 *
417 * @param value value to store
418 * @param *addr address pointer
419 * @return successful / failed
420 *
421 * Exclusive STR command for 32 bit values
422 */
\ In section .text, align 4, keep-with-next
423 uint32_t __STREXW(uint32_t value, uint32_t *addr)
424 {
425 __ASM("strex r0, r0, [r1]");
\ __STREXW:
\ 00000000 41E80000 strex r0, r0, [r1]
426 __ASM("bx lr");
\ 00000004 7047 bx lr
427 }
\ 00000006 7047 BX LR ;; return
428
429 #pragma diag_default=Pe940
430
431
432 #elif (defined (__GNUC__)) /*------------------ GNU Compiler ---------------------*/
433 /* GNU gcc specific functions */
434
435 /**
436 * @brief Return the Process Stack Pointer
437 *
438 * @return ProcessStackPointer
439 *
440 * Return the actual process stack pointer
441 */
442 uint32_t __get_PSP(void) __attribute__( ( naked ) );
443 uint32_t __get_PSP(void)
444 {
445 uint32_t result=0;
446
447 __ASM volatile ("MRS %0, psp\n\t"
448 "MOV r0, %0 \n\t"
449 "BX lr \n\t" : "=r" (result) );
450 return(result);
451 }
452
453 /**
454 * @brief Set the Process Stack Pointer
455 *
456 * @param topOfProcStack Process Stack Pointer
457 *
458 * Assign the value ProcessStackPointer to the MSP
459 * (process stack pointer) Cortex processor register
460 */
461 void __set_PSP(uint32_t topOfProcStack) __attribute__( ( naked ) );
462 void __set_PSP(uint32_t topOfProcStack)
463 {
464 __ASM volatile ("MSR psp, %0\n\t"
465 "BX lr \n\t" : : "r" (topOfProcStack) );
466 }
467
468 /**
469 * @brief Return the Main Stack Pointer
470 *
471 * @return Main Stack Pointer
472 *
473 * Return the current value of the MSP (main stack pointer)
474 * Cortex processor register
475 */
476 uint32_t __get_MSP(void) __attribute__( ( naked ) );
477 uint32_t __get_MSP(void)
478 {
479 uint32_t result=0;
480
481 __ASM volatile ("MRS %0, msp\n\t"
482 "MOV r0, %0 \n\t"
483 "BX lr \n\t" : "=r" (result) );
484 return(result);
485 }
486
487 /**
488 * @brief Set the Main Stack Pointer
489 *
490 * @param topOfMainStack Main Stack Pointer
491 *
492 * Assign the value mainStackPointer to the MSP
493 * (main stack pointer) Cortex processor register
494 */
495 void __set_MSP(uint32_t topOfMainStack) __attribute__( ( naked ) );
496 void __set_MSP(uint32_t topOfMainStack)
497 {
498 __ASM volatile ("MSR msp, %0\n\t"
499 "BX lr \n\t" : : "r" (topOfMainStack) );
500 }
501
502 /**
503 * @brief Return the Base Priority value
504 *
505 * @return BasePriority
506 *
507 * Return the content of the base priority register
508 */
509 uint32_t __get_BASEPRI(void)
510 {
511 uint32_t result=0;
512
513 __ASM volatile ("MRS %0, basepri_max" : "=r" (result) );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -