koendv / SerialWireOutput

Serial Wire Output (SWO) library for STM32duino arm Arduinos
21 stars 3 forks source link

compilation error #4

Closed lejibxl closed 1 year ago

lejibxl commented 2 years ago

Drear Koendv, When compiling with STM32duino (nucleo-g031k8) I got the following error :

C:\Users\448076342\Documents\Arduino\libraries\SerialWireOutput\SWOStream.cpp: In constructor 'SWOStream::SWOStream(uint32_t, swoProtocolType, uint32_t, bool, uint32_t)': C:\Users\448076342\Documents\Arduino\libraries\SerialWireOutput\SWOStream.cpp:64:3: error: 'CoreDebug' was not declared in this scope 64 | CoreDebug->DEMCR = CoreDebug_DEMCR_TRCENA_Msk; /* trace enable */ | ^~~~~~~~~ C:\Users\448076342\Documents\Arduino\libraries\SerialWireOutput\SWOStream.cpp:64:22: error: 'CoreDebug_DEMCR_TRCENA_Msk' was not declared in this scope 64 | CoreDebug->DEMCR = CoreDebug_DEMCR_TRCENA_Msk; /* trace enable */ | ^~~~~~~~~~~~~~~~~~~~~~~~~~ C:\Users\448076342\Documents\Arduino\libraries\SerialWireOutput\SWOStream.cpp:65:3: error: 'TPI' was not declared in this scope 65 | TPI->CSPSR = 1; /* protocol width = 1 bit */ | ^~~ C:\Users\448076342\Documents\Arduino\libraries\SerialWireOutput\SWOStream.cpp:69:3: error: 'ITM' was not declared in this scope 69 | ITM->LAR = 0xC5ACCE55; /* unlock access to ITM registers */ | ^~~ C:\Users\448076342\Documents\Arduino\libraries\SerialWireOutput\SWOStream.cpp:71:7: error: 'ITM_TCR_SWOENA_Msk' was not declared in this scope 71 | ITM_TCR_SWOENA_Msk | ITM_TCR_ITMENA_Msk; /* trace control register */ | ^~~~~~~~~~~~~~~~~~ C:\Users\448076342\Documents\Arduino\libraries\SerialWireOutput\SWOStream.cpp:71:28: error: 'ITM_TCR_ITMENA_Msk' was not declared in this scope; did you mean 'RTC_CR_ITSE_Msk'? 71 | ITM_TCR_SWOENA_Msk | ITM_TCR_ITMENA_Msk; /* trace control register */ | ^~~~~~~~~~~~~~~~~~ | RTC_CR_ITSE_Msk C:\Users\448076342\Documents\Arduino\libraries\SerialWireOutput\SWOStream.cpp: In member function 'void SWOStream::enable(bool)': C:\Users\448076342\Documents\Arduino\libraries\SerialWireOutput\SWOStream.cpp:93:5: error: 'ITM' was not declared in this scope 93 | ITM->TER = 0xFFFFFFFF; /* enable all stimulus channels */ | ^~~ C:\Users\448076342\Documents\Arduino\libraries\SerialWireOutput\SWOStream.cpp:95:5: error: 'ITM' was not declared in this scope 95 | ITM->TER = 0x0; /* disable all stimulus channels */ | ^~~ C:\Users\448076342\Documents\Arduino\libraries\SerialWireOutput\SWOStream.cpp: In member function 'virtual size_t SWOStream::write(uint8_t)': C:\Users\448076342\Documents\Arduino\libraries\SerialWireOutput\SWOStream.cpp:101:9: error: 'ITM' was not declared in this scope 101 | if (((ITM->TCR & ITM_TCR_ITMENA_Msk) != 0UL) && | ^~~ C:\Users\448076342\Documents\Arduino\libraries\SerialWireOutput\SWOStream.cpp:101:20: error: 'ITM_TCR_ITMENA_Msk' was not declared in this scope; did you mean 'RTC_CR_ITSE_Msk'? 101 | if (((ITM->TCR & ITM_TCR_ITMENA_Msk) != 0UL) && | ^~~~~~~~~~~~~~~~~~ | RTC_CR_ITSE_Msk C:\Users\448076342\Documents\Arduino\libraries\SerialWireOutput\SWOStream.cpp: In member function 'virtual size_t SWOStream::write(const uint8_t*, size_t)': C:\Users\448076342\Documents\Arduino\libraries\SerialWireOutput\SWOStream.cpp:111:9: error: 'ITM' was not declared in this scope 111 | if (((ITM->TCR & ITM_TCR_ITMENA_Msk) != 0UL) && | ^~~ C:\Users\448076342\Documents\Arduino\libraries\SerialWireOutput\SWOStream.cpp:111:20: error: 'ITM_TCR_ITMENA_Msk' was not declared in this scope; did you mean 'RTC_CR_ITSE_Msk'? 111 | if (((ITM->TCR & ITM_TCR_ITMENA_Msk) != 0UL) && | ^~~~~~~~~~~~~~~~~~ | RTC_CR_ITSE_Msk exit status 1 Error compiling for board Nucleo-32.

koendv commented 2 years ago

Thank you. This is an interesting question.

So I am not certain SWO will work on stm32g031k8.

This still leaves semihosting and rtt.

regards,

koen