STM32CubeIde HardFault その5 error: expected expression before ')' token
compile error
../Src/main.c: In function 'main': ../Src/main.c:40:26: error: expected expression before ')' token printf(fmt, __VA_ARGS__); \ ^ ../Src/main.c:141:4: note: in expansion of macro 'safe_printf' safe_printf("Main:Hello World\n"); ^~~~~~~~~~~ ../Src/main.c: In function 'StartDefaultTask': ../Src/main.c:40:26: error: expected expression before ')' token printf(fmt, __VA_ARGS__); \ ^ ../Src/main.c:205:4: note: in expansion of macro 'safe_printf' safe_printf("Main:Hello World\n"); ^~~~~~~~~~~ make: *** [Src/subdir.mk:35: Src/main.o] Error 1 "make -j4 all" terminated with exit code 2. Build might be incomplete. 04:29:29 Build Failed. 3 errors, 0 warnings. (took 1s.441ms)
##をつけると、コンパイルできるようになった。
/* Private define ------------------------------------------------------------*/ /* USER CODE BEGIN PD */ #define safe_printf(fmt,...) \ portDISABLE_INTERRUPTS(); \ printf(fmt, ##__VA_ARGS__); \ portENABLE_INTERRUPTS(); /* USER CODE END PD */
hard faultは、治らなかった。