Skip to content

Commit 55a35f9

Browse files
committed
Use attributes from toolchain.h instead of compiler specific declaration.
1 parent e46b659 commit 55a35f9

File tree

1 file changed

+4
-12
lines changed
  • hal/targets/hal/TARGET_NORDIC/TARGET_MCU_NRF51822

1 file changed

+4
-12
lines changed

hal/targets/hal/TARGET_NORDIC/TARGET_MCU_NRF51822/us_ticker.c

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "cmsis.h"
2020
#include "PeripheralNames.h"
2121
#include "nrf_delay.h"
22+
#include "toolchain.h"
2223

2324
/*
2425
* Note: The micro-second timer API on the nRF51 platform is implemented using
@@ -71,18 +72,9 @@ static uint32_t previous_tick_cc_value = 0;
7172
To allow compilation of us_ticker programs without RTOS, those symbols are
7273
exported from this module as weak ones.
7374
*/
74-
#if defined (__CC_ARM) /* ARMCC Compiler */
75-
__attribute__((weak)) uint32_t const os_trv;
76-
__attribute__((weak)) uint32_t const os_clockrate;
77-
__attribute__((weak)) void OS_Tick_Handler() { }
78-
#elif defined (__GNUC__) /* GNU Compiler */
79-
__attribute__((weak)) uint32_t const os_trv = 31;
80-
__attribute__((weak)) uint32_t const os_clockrate = 1000;
81-
__attribute__((noreturn, naked, weak)) void OS_Tick_Handler() { }
82-
#else
83-
#error Compiler not supported.
84-
#error Weak definitions of os_trv, os_clockrate and OS_Tick_Handler should be provided.
85-
#endif
75+
MBED_WEAK uint32_t const os_trv;
76+
MBED_WEAK uint32_t const os_clockrate;
77+
MBED_WEAK void OS_Tick_Handler() { }
8678

8779
static inline void rtc1_enableCompareInterrupt(void)
8880
{

0 commit comments

Comments
 (0)