This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

what is (void)dummy? nRF52840 SDK 14.0

Hi there,

I came across the function call "(void)dummy;" which I am trying to locate. Where can I find this?

__STATIC_INLINE void nrf_rtc_event_clear(NRF_RTC_Type * p_rtc, nrf_rtc_event_t event)
{
    *((volatile uint32_t *)((uint8_t *)p_rtc + (uint32_t)event)) = 0;
#if __CORTEX_M == 0x04
    volatile uint32_t dummy = *((volatile uint32_t *)((uint8_t *)p_rtc + (uint32_t)event));
    (void)dummy; //puru: what is this? Is it calling some special function?
#endif
}

I think this will execute as it is a CortexM4 processor. And if yes then what function will it call? where is it located? Also what I observe is the first line is assigning the value as "0".

Am I interpreting it correctly?

Thanks!

Parents
  • The important part is the line before that. The volatile uint32_t dummy = ... line exists to force a read-back of the register, which is specifically needed on the Cortex M4 chips because otherwise the M4's write buffer may delay the write, which is undesirable when clearing interrupt flags. Like endnode mentioned, the void cast does literally nothing and is just to suppress possible compiler warnings about dummy being unused after assignment.

Reply
  • The important part is the line before that. The volatile uint32_t dummy = ... line exists to force a read-back of the register, which is specifically needed on the Cortex M4 chips because otherwise the M4's write buffer may delay the write, which is undesirable when clearing interrupt flags. Like endnode mentioned, the void cast does literally nothing and is just to suppress possible compiler warnings about dummy being unused after assignment.

Children
Related