テスト用

Fork of nRF51822 by Nordic Semiconductor

Committer:
yihui
Date:
Sun Aug 31 00:58:52 2014 +0000
Revision:
63:708b23889028
Parent:
37:c29c330d942c
fix 'impossible constraint in asm' error for gcc toolchain

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 0:eff01767de02 1 #ifndef NRF_SVC__
bogdanm 0:eff01767de02 2 #define NRF_SVC__
bogdanm 0:eff01767de02 3
bogdanm 0:eff01767de02 4 #ifdef SVCALL_AS_NORMAL_FUNCTION
bogdanm 0:eff01767de02 5 #define SVCALL(number, return_type, signature) return_type signature
bogdanm 0:eff01767de02 6 #else
bogdanm 0:eff01767de02 7
bogdanm 0:eff01767de02 8 #ifndef SVCALL
bogdanm 0:eff01767de02 9 #if defined (__CC_ARM)
bogdanm 0:eff01767de02 10 #define SVCALL(number, return_type, signature) return_type __svc(number) signature
bogdanm 0:eff01767de02 11 #elif defined (__GNUC__)
bogdanm 0:eff01767de02 12 #define SVCALL(number, return_type, signature) \
bogdanm 0:eff01767de02 13 _Pragma("GCC diagnostic ignored \"-Wreturn-type\"") \
bogdanm 0:eff01767de02 14 _Pragma("GCC diagnostic ignored \"-Wunused-function\"") \
bogdanm 0:eff01767de02 15 __attribute__((naked)) static return_type signature \
bogdanm 0:eff01767de02 16 { \
bogdanm 0:eff01767de02 17 __asm( \
bogdanm 0:eff01767de02 18 "svc %0\n" \
yihui 63:708b23889028 19 "bx r14" : : "I" ((uint32_t)number) : "r0" \
bogdanm 0:eff01767de02 20 ); \
bogdanm 0:eff01767de02 21 }
bogdanm 0:eff01767de02 22 #elif defined (__ICCARM__)
bogdanm 0:eff01767de02 23 #define PRAGMA(x) _Pragma(#x)
bogdanm 0:eff01767de02 24 #define SVCALL(number, return_type, signature) \
bogdanm 0:eff01767de02 25 PRAGMA(swi_number = number) \
bogdanm 0:eff01767de02 26 __swi return_type signature;
bogdanm 0:eff01767de02 27 #else
bogdanm 0:eff01767de02 28 #define SVCALL(number, return_type, signature) return_type signature
bogdanm 0:eff01767de02 29 #endif
bogdanm 0:eff01767de02 30 #endif // SVCALL
bogdanm 0:eff01767de02 31
bogdanm 0:eff01767de02 32 #endif // SVCALL_AS_NORMAL_FUNCTION
bogdanm 0:eff01767de02 33 #endif // NRF_SVC__