I'm a maintainer of TinyUSB project, to ensure the code quality we have some strict GCC flags enabled.
Wcast-align and Wcast-qual cause SEGGER_RTT.c failed to compile with following error:
Display All
Please either fix them or suppress the error by adding:
Wcast-align and Wcast-qual cause SEGGER_RTT.c failed to compile with following error:
Source Code
- e:\mcu\tinyusb\lib\segger_rtt\rtt\segger_rtt.c: In function '_DoInit':
- e:\mcu\tinyusb\lib\segger_rtt\rtt\segger_rtt.c:323:10: error: cast discards 'volatile' qualifier from pointer target type [-Werror=cast-qual]
- 323 | memset((SEGGER_RTT_CB*)p, 0, sizeof(_SEGGER_RTT)); // Make sure that the RTT CB is always zero initialized.
- | ^
- compilation terminated due to -Wfatal-errors.
- cc1.exe: all warnings being treated as errors
- make: *** [Makefile.mk:1269: build/release-BIN1/tinyusb__lib__SEGGER_RTT__RTT__SEGGER_RTT.o] Error 1
- e:\mcu\tinyusb\lib\segger_rtt\rtt\segger_rtt.c: In function 'SEGGER_RTT_WriteSkipNoLock':
- e:\mcu\tinyusb\lib\segger_rtt\rtt\segger_rtt.c:954:11: error: cast increases required alignment of target type [-Werror=cast-align]
- 954 | pRing = (SEGGER_RTT_BUFFER_UP*)((char*)&_SEGGER_RTT.aUp[BufferIndex] + SEGGER_RTT_UNCACHED_OFF); // Access uncached to make sure we see changes made by the J-Link side and all of our changes go into HW directly
Please either fix them or suppress the error by adding: