Hello,
Since few hours I'm struggling with compilation error of C++ project based on RT1051 uC. During my investigation I found that those two defines from fsl_clock.h are causing problems:
CCM_TUPLE and CCM_ANALOG_TUPLE
I'm using GNU Arm Embedded Toolchain Version 8-2018-q4-major and CMake, compilator spits those errors:
../bsp/drivers/fsl_clock.h:90:110: error: dereferencing a null pointer in '*0'
#define CCM_ANALOG_TUPLE(reg, shift) ((((uint32_t)(&((CCM_ANALOG_Type *)0U)->reg) & 0xFFFU) << 16U) | (shift))
../bsp/drivers/fsl_clock.h:90:110: error: enumerator value for 'kCLOCK_PllUsb2' is not an integer constant
#define CCM_ANALOG_TUPLE(reg, shift) ((((uint32_t)(&((CCM_ANALOG_Type *)0U)->reg) & 0xFFFU) << 16U) | (shift))
../bsp/drivers/fsl_clock.h:594:34: error: expression '0->CCM_Type::CCSR' has side-effects
((((uint32_t)(&((CCM_Type *)0U)->reg)) & 0xFFU) | ((shift) << 8U) | ((((mask) >> (shift)) & 0x1FFFU) << 13U) | \
((busyShift) << 26U))
It looks like g++ compiler is having some difficulties with compiling those macros.
If I won't include "fsl_clock.h" compilation is working. There is no such problem when using gcc compiler.
Any ideas how to fix this issue ? I would be very grateful.
Best Regards
Mateusz Piesta