Hi guys,
I've recently adopted the Arm Compiler version 6. I'm using the RTX OS and I need to write some SVC functions as described in the following link:
https://www.keil.com/pack/doc/CMSIS_Dev/RTOS2/html/theory_of_operation.html#CMSIS_RTOS_svcFunctions
In the Arm Compiler v5 it was easier to write a SVC function wrapper as compared to the 6 version.
I'm very little experience in assembler language, is there an application note to understand how to write a SVC function wrapper starting from a SVC Handler (c function) ?
Thanks for your help,
Flavio
Hi Flavio,
Does the below help?
https://developer.arm.com/documentation/ka004541
Thanks Ronan for your answer.
I've already read the documentation that you reported me, but I'd like to better understand the syntax meaning.
For example, in the example reported in the previous link (CMSIS_Dev):
// SVC Wrapper __STATIC_FORCEINLINE uint32_t atomic_inc32 (uint32_t *mem) { register uint32_t val; __ASM volatile ( "svc 1" : "=l" (val) : "l" (mem) : "cc", "memory" ); return (val); } // SVC Handler uint32_t svc_atomic_inc32 (uint32_t *mem) { // A protected function to increment a counter. uint32_t val; __disable_irq(); val = *mem; (*mem) = val + 1U; __enable_irq(); return (val); }
There is a SVC function handler with a pointer and a return value, so in the assambler wrapper include "l" and "cc" symbols, where can I find a documentation that will help me to understand the meaning of this sintax?
Thanks a lot,
https://developer.arm.com/documentation/100748/0622/Using-Assembly-and-Intrinsics-in-C-or-C---Code/Writing-inline-assembly-code
Thanks Ronan for sharing.
Are you saying that you need to write new routines for the SVC 0 entry point, i.e. ADD 'system calls' to the RTX kernel itself? Or do you just want to add new C routines to fire on e.g. SVC 1, SVC 2 calls? I have done both, and can share appropriate code as necessary. I do use GCC though, not the ARM compiler.
Stuart
Hi Stuart,
The answer is the second one: "or do you just want to add new C routines to fire on e.g. SVC 1, SVC 2 calls".
I wanted to know the right syntax to write a SVC assembler wrapper starting from a C function. The page reported to me by Ronan is a good reference to understand better.