From 5667ba0a37bdc53e23e546fb7eb2ca15949d1f68 Mon Sep 17 00:00:00 2001 From: strahi-linux Date: Tue, 18 Jun 2024 14:41:12 +0200 Subject: [PATCH] Updated for CLANG builds --- ARM/gcc_clang/delays/m0+/delays.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/ARM/gcc_clang/delays/m0+/delays.c b/ARM/gcc_clang/delays/m0+/delays.c index b816bfdb6..df4f31cb9 100644 --- a/ARM/gcc_clang/delays/m0+/delays.c +++ b/ARM/gcc_clang/delays/m0+/delays.c @@ -1,14 +1,22 @@ -#include "core_header.h" #include "stdint.h" +#include "core_header.h" + +/* Added because of compiler specific commands */ +#ifdef _CLANG_LLVM_ + #define SUBS_MACRO "subs" +#else + #define SUBS_MACRO "sub" +#endif void __attribute__( ( noinline, section( ".RamFunc" ) ) ) Delay_Cyc( uint32_t cycle_num ) { asm volatile( "loopCycles%=: \n" - " sub %[cycle_num], %[cycle_num], #1 \n" + " " SUBS_MACRO " %[cycle_num], %[cycle_num], #1 \n" " nop \n" " bne loopCycles%= \n" - : [cycle_num] "+l"( cycle_num ) ); + : [cycle_num] "+l"(cycle_num) + ); } void __attribute__( ( noinline ) ) Delay_us( uint32_t time_us )