ucglib
ucglib copied to clipboard
'__NOP' was not declared in this scope
Hello, I'm using Bluepill STM32F103C8, with stm32duino (arduino framework) and platformio. I try to compile a simple Hello world program, but I have following error:
.pio\libdeps\genericSTM32F103C8\Ucglib\src\Ucglib.cpp: In function 'void ucg_com_arduino_send_8bit(ucg_t*, uint8_t)':
.pio\libdeps\genericSTM32F103C8\Ucglib\src\Ucglib.cpp:834:3: error: '__NOP' was not declared in this scope
I use:
Ucglib_ST7735_18x128x160_HWSPI ucg(/*cd=*/ PA8, /*cs=*/ PB12, /*reset=*/ PA15);
Is this library still up to date? I think this library looks good and could be useful (lightweight) for controller with limited flash (64kB).
Thank you
This is because the __NOP
intrinsic is missing in the toolchain pulled for the STM32 in this case. I don't remember exactly when and why that was changed (If memory serves me well, the toolchain needs an update of the compiler, I think it was moved from library to compiler level some time ago, but I can be wrong here...)
As s quick fix, add
#if defined(__arm__)
#define __NOP __asm volatile ("nop")
#endif
at the beginning of Ucglib.cpp
. I don't know if this is the best solution, maybe something like #if defined (__NOP)
is better, but depending on the project, the above might be sufficient.
Update: there's already a pull request for his from someone else, I didn't notice: #149