Skip to content

Commit

Permalink
Updated for CLANG builds
Browse files Browse the repository at this point in the history
  • Loading branch information
StrahinjaJacimovic committed Jun 18, 2024
1 parent 2616857 commit 5667ba0
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions ARM/gcc_clang/delays/m0+/delays.c
Original file line number Diff line number Diff line change
@@ -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 )
Expand Down

0 comments on commit 5667ba0

Please sign in to comment.