Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not compile for arduino zero #80

Open
milesfrankland opened this issue Sep 2, 2019 · 5 comments
Open

Does not compile for arduino zero #80

milesfrankland opened this issue Sep 2, 2019 · 5 comments

Comments

@milesfrankland
Copy link

These are the errors:

OneWireItem.h:4: In file included from
BAE910.h:8: from
BAE910.cpp:1: from
 
OneWireHub.h: In function constexpr timeOW_t operator"" _us(long long unsigned int)
 
OneWireHub.h: 13:1: error: the value of 'SystemCoreClock' is not usable in a constant expression
 
samd21g18a.h:239: In file included from
samd21.h:69: from
samd.h:105: from
sam.h:470: from
Arduino.h:48: from
platform.h:8: from
OneWireHub.h:4: from
OneWireItem.h:4: from
BAE910.h:8: from
BAE910.cpp:1: from
system_samd21.h:53: note  uint32_t SystemCoreClock is not const
   extern uint32_t SystemCoreClock;   \*!< System Clock Frequency (Core Clock)  *
 
OneWireItem.h:4: In file included from
BAE910.h:8: from
BAE910.cpp:1: from
 
OneWireHub.h: In function constexpr timeOW_t timeUsToLoops(uint16_t)
 
OneWireHub.h: 20:1: error: the value of 'SystemCoreClock' is not usable in a constant expression
 
samd21g18a.h:239: In file included from
samd21.h:69: from
samd.h:105: from
sam.h:470: from
Arduino.h:48: from
platform.h:8: from
OneWireHub.h:4: from
OneWireItem.h:4: from
BAE910.h:8: from
BAE910.cpp:1: from
system_samd21.h:53: note  uint32_t SystemCoreClock is not const
   extern uint32_t SystemCoreClock;   \*!< System Clock Frequency (Core Clock)  *
 
OneWireHub.h:22: In file included from
OneWireItem.h:4: from
BAE910.h:8: from
BAE910.cpp:1: from
OneWireHub_config.h: At global scope

Compiles fine for AVR stuff though!

@orgua
Copy link
Owner

orgua commented Dec 29, 2019

yeah, this is fucked up. my current solution is a hack - faster uCs should not need the loop-counting. I hope i find some time in the near future to update this lib.

@kiowadriver
Copy link

The same issue with the Trinket M0 (SAMD21E18A). The onewire lib as well as this OneWireHub lib both indicate compatibility with the SAMD21G18A.

I found this pull request for the OneWire library that seemed to resolve some compatibility issues but unfortunately more errors still persist after implementing the same fix.

Compiling .pio\build\adafruit_trinket_m0\lib9b2\OneWireHub\DS2431.cpp.o In file included from .pio\libdeps\adafruit_trinket_m0\OneWireHub\src\OneWireItem.h:4, from .pio\libdeps\adafruit_trinket_m0\OneWireHub\src\BAE910.h:8, from .pio\libdeps\adafruit_trinket_m0\OneWireHub\src\BAE910.cpp:1: .pio\libdeps\adafruit_trinket_m0\OneWireHub\src\OneWireHub.h: In function 'constexpr timeOW_t operator""_us(long long unsigned int)': .pio\libdeps\adafruit_trinket_m0\OneWireHub\src\OneWireHub.h:13:1: error: the value of 'SystemCoreClock' is not usable in a constant expression 13 | } | ^

I can't seem to find a better library for slave emulation but all seem to be out of date. What am I missing? Has something better than OneWire come along?

@netmilk
Copy link

netmilk commented Jul 31, 2023

Hey 👋,

I have the same issue with the STM32F0 board when trying to emulate the DS2431. Thanks for all the work so far! I'd love to help because this sits on the critical path for my application, but I'm not proficient in C++. Let me know if I can assist in any other way, please.

Cheers!
A

In file included from Documents/Arduino/libraries/OneWireHub/src/OneWireItem.h:4,
                 from Documents/Arduino/libraries/OneWireHub/src/DS2431.h:9,
                 from /private/var/folders/0h/tvr3mlyx0wl3rbpljhckvy_h0000gn/T/.arduinoIDE-unsaved2023631-2135-1t8d9vt.d3dzg/sketch_jul31a/sketch_jul31a.ino:9:
Documents/Arduino/libraries/OneWireHub/src/OneWireHub.h: In function 'constexpr timeOW_t operator""_us(long long unsigned int)':
Documents/Arduino/libraries/OneWireHub/src/OneWireHub.h:13:1: error: the value of 'SystemCoreClock' is not usable in a constant expression
   13 | }
      | ^
In file included from Library/Arduino15/packages/STMicroelectronics/hardware/stm32/2.5.0/system/Drivers/CMSIS/Device/ST/STM32F0xx/Include/stm32f030x6.h:103,
                 from Library/Arduino15/packages/STMicroelectronics/hardware/stm32/2.5.0/system/Drivers/CMSIS/Device/ST/STM32F0xx/Include/stm32f0xx.h:125,
                 from Library/Arduino15/packages/STMicroelectronics/hardware/stm32/2.5.0/cores/arduino/stm32/stm32_def.h:28,
                 from Library/Arduino15/packages/STMicroelectronics/hardware/stm32/2.5.0/cores/arduino/stm32/clock.h:19,
                 from Library/Arduino15/packages/STMicroelectronics/hardware/stm32/2.5.0/cores/arduino/wiring_time.h:23,
                 from Library/Arduino15/packages/STMicroelectronics/hardware/stm32/2.5.0/cores/arduino/wiring.h:38,
                 from Library/Arduino15/packages/STMicroelectronics/hardware/stm32/2.5.0/cores/arduino/Arduino.h:36,
                 from /private/var/folders/0h/tvr3mlyx0wl3rbpljhckvy_h0000gn/T/arduino/sketches/45D704DEBA72B1C0696EBD061C77E0F8/sketch/sketch_jul31a.ino.cpp:1:
Library/Arduino15/packages/STMicroelectronics/hardware/stm32/2.5.0/system/Drivers/CMSIS/Device/ST/STM32F0xx/Include/system_stm32f0xx.h:56:17: note: 'uint32_t SystemCoreClock' is not const
   56 | extern uint32_t SystemCoreClock;          /*!< System Clock Frequency (Core Clock) */
      |                 ^~~~~~~~~~~~~~~
Documents/Arduino/libraries/OneWireHub/src/OneWireHub.h: In function 'constexpr timeOW_t timeUsToLoops(uint16_t)':
Documents/Arduino/libraries/OneWireHub/src/OneWireHub.h:20:1: error: the value of 'SystemCoreClock' is not usable in a constant expression
   20 | }
      | ^
Library/Arduino15/packages/STMicroelectronics/hardware/stm32/2.5.0/system/Drivers/CMSIS/Device/ST/STM32F0xx/Include/system_stm32f0xx.h:56:17: note: 'uint32_t SystemCoreClock' is not const
   56 | extern uint32_t SystemCoreClock;          /*!< System Clock Frequency (Core Clock) */
      |                 ^~~~~~~~~~~~~~~
In file included from Documents/Arduino/libraries/OneWireHub/src/OneWireHub.h:22:
Documents/Arduino/libraries/OneWireHub/src/OneWireHub_config.h: At global scope:
Documents/Arduino/libraries/OneWireHub/src/OneWireHub_config.h:27:59: error: 'constexpr timeOW_t operator""_us(long long unsigned int)' called in a constant expression
   27 | constexpr timeOW_t ONEWIRE_TIME_RESET_TIMEOUT        = {  5000_us };        // for not hanging to long in reset-detection, lower value is better for more responsive applications, but can miss resets
      |                                                           ^~~~~~~
Documents/Arduino/libraries/OneWireHub/src/OneWireHub.h:9:20: note: 'constexpr timeOW_t operator""_us(long long unsigned int)' declared here
    9 | constexpr timeOW_t operator "" _us(const unsigned long long int time_us) // user defined literal used in config
      |                    ^~~~~~~~
Documents/Arduino/libraries/OneWireHub/src/OneWireHub_config.h:28:60: error: 'constexpr timeOW_t operator""_us(long long unsigned int)' called in a constant expression
   28 | constexpr timeOW_t ONEWIRE_TIME_RESET_MIN[2]         = {   430_us, 48_us }; // should be 480
      |                                                            ^~~~~~
Documents/Arduino/libraries/OneWireHub/src/OneWireHub.h:9:20: note: 'constexpr timeOW_t operator""_us(long long unsigned int)' declared here
    9 | constexpr timeOW_t operator "" _us(const unsigned long long int time_us) // user defined literal used in config
      |                    ^~~~~~~~
Documents/Arduino/libraries/OneWireHub/src/OneWireHub_config.h:29:60: error: 'constexpr timeOW_t operator""_us(long long unsigned int)' called in a constant expression
   29 | constexpr timeOW_t ONEWIRE_TIME_RESET_MAX[2]         = {   960_us, 80_us }; // from ds2413
      |                                                            ^~~~~~
Documents/Arduino/libraries/OneWireHub/src/OneWireHub.h:9:20: note: 'constexpr timeOW_t operator""_us(long long unsigned int)' declared here
    9 | constexpr timeOW_t operator "" _us(const unsigned long long int time_us) // user defined literal used in config
      |                    ^~~~~~~~
Documents/Arduino/libraries/OneWireHub/src/OneWireHub_config.h:32:61: error: 'constexpr timeOW_t operator""_us(long long unsigned int)' called in a constant expression
   32 | constexpr timeOW_t ONEWIRE_TIME_PRESENCE_TIMEOUT     = {    20_us };        // probe measures 25us, duration of high state between reset and presence
      |                                                             ^~~~~
Documents/Arduino/libraries/OneWireHub/src/OneWireHub.h:9:20: note: 'constexpr timeOW_t operator""_us(long long unsigned int)' declared here
    9 | constexpr timeOW_t operator "" _us(const unsigned long long int time_us) // user defined literal used in config
      |                    ^~~~~~~~
Documents/Arduino/libraries/OneWireHub/src/OneWireHub_config.h:33:60: error: 'constexpr timeOW_t operator""_us(long long unsigned int)' called in a constant expression
   33 | constexpr timeOW_t ONEWIRE_TIME_PRESENCE_MIN[2]      = {   160_us,  8_us }; // was 125
      |                                                            ^~~~~~
Documents/Arduino/libraries/OneWireHub/src/OneWireHub.h:9:20: note: 'constexpr timeOW_t operator""_us(long long unsigned int)' declared here
    9 | constexpr timeOW_t operator "" _us(const unsigned long long int time_us) // user defined literal used in config
      |                    ^~~~~~~~
Documents/Arduino/libraries/OneWireHub/src/OneWireHub_config.h:34:60: error: 'constexpr timeOW_t operator""_us(long long unsigned int)' called in a constant expression
   34 | constexpr timeOW_t ONEWIRE_TIME_PRESENCE_MAX[2]      = {   480_us, 32_us }; // should be 280, was 480
      |                                                            ^~~~~~
Documents/Arduino/libraries/OneWireHub/src/OneWireHub.h:9:20: note: 'constexpr timeOW_t operator""_us(long long unsigned int)' declared here
    9 | constexpr timeOW_t operator "" _us(const unsigned long long int time_us) // user defined literal used in config
      |                    ^~~~~~~~
Documents/Arduino/libraries/OneWireHub/src/OneWireHub_config.h:37:58: error: 'constexpr timeOW_t operator""_us(long long unsigned int)' called in a constant expression
   37 | constexpr timeOW_t ONEWIRE_TIME_MSG_HIGH_TIMEOUT     = { 15000_us };        // there can be these inactive / high timeperiods after reset / presence, this value defines the timeout for these
      |                                                          ^~~~~~~~
Documents/Arduino/libraries/OneWireHub/src/OneWireHub.h:9:20: note: 'constexpr timeOW_t operator""_us(long long unsigned int)' declared here
    9 | constexpr timeOW_t operator "" _us(const unsigned long long int time_us) // user defined literal used in config
      |                    ^~~~~~~~
Documents/Arduino/libraries/OneWireHub/src/OneWireHub_config.h:38:60: error: 'constexpr timeOW_t operator""_us(long long unsigned int)' called in a constant expression
   38 | constexpr timeOW_t ONEWIRE_TIME_SLOT_MAX[2]          = {   135_us, 30_us }; // should be 120, measured from falling edge to next falling edge
      |                                                            ^~~~~~
Documents/Arduino/libraries/OneWireHub/src/OneWireHub.h:9:20: note: 'constexpr timeOW_t operator""_us(long long unsigned int)' declared here
    9 | constexpr timeOW_t operator "" _us(const unsigned long long int time_us) // user defined literal used in config
      |                    ^~~~~~~~
Documents/Arduino/libraries/OneWireHub/src/OneWireHub_config.h:41:61: error: 'constexpr timeOW_t operator""_us(long long unsigned int)' called in a constant expression
   41 | constexpr timeOW_t ONEWIRE_TIME_READ_MIN[2]          = {    20_us,  4_us }; // should be 15, was 30, says when it is safe to read a valid bit
      |                                                             ^~~~~
Documents/Arduino/libraries/OneWireHub/src/OneWireHub.h:9:20: note: 'constexpr timeOW_t operator""_us(long long unsigned int)' declared here
    9 | constexpr timeOW_t operator "" _us(const unsigned long long int time_us) // user defined literal used in config
      |                    ^~~~~~~~
Documents/Arduino/libraries/OneWireHub/src/OneWireHub_config.h:42:61: error: 'constexpr timeOW_t operator""_us(long long unsigned int)' called in a constant expression
   42 | constexpr timeOW_t ONEWIRE_TIME_READ_MAX[2]          = {    60_us, 10_us }; // low states (zeros) of a master should not exceed this time in a slot
      |                                                             ^~~~~
Documents/Arduino/libraries/OneWireHub/src/OneWireHub.h:9:20: note: 'constexpr timeOW_t operator""_us(long long unsigned int)' declared here
    9 | constexpr timeOW_t operator "" _us(const unsigned long long int time_us) // user defined literal used in config
      |                    ^~~~~~~~
Documents/Arduino/libraries/OneWireHub/src/OneWireHub_config.h:43:61: error: 'constexpr timeOW_t operator""_us(long long unsigned int)' called in a constant expression
   43 | constexpr timeOW_t ONEWIRE_TIME_WRITE_ZERO[2]        = {    30_us,  8_us }; // the hub holds a zero for this long
      |                                                             ^~~~~
Documents/Arduino/libraries/OneWireHub/src/OneWireHub.h:9:20: note: 'constexpr timeOW_t operator""_us(long long unsigned int)' declared here
    9 | constexpr timeOW_t operator "" _us(const unsigned long long int time_us) // user defined literal used in config
      |                    ^~~~~~~~

exit status 1

Compilation error: exit status 1

@netmilk
Copy link

netmilk commented Jul 31, 2023

Digging deeper into this issue, I have questions :)

  • Do I understand correctly this issue is connected to this remark in the docs?

at the moment the lib relies sole on loop-counting for timing, no direct access to interrupt or timers, NOTE: if you use an uncalibrated architecture the compilation-process will fail with an error, look at ./examples/debug/calibrate_by_bus_timing for an explanation

@jenslam
Copy link

jenslam commented Mar 8, 2024

I'm trying to include onewirehub into an existing ESP32 based PlatformIO project.
When adding the lib_deps for OnewireHub I'm getting errors in OneWireHubConfig.h in line 47 and following

constexpr timeOW_t ONEWIREHUB_TIME_RESET_TIMEOUT = {5000_us};

Error Message:
constexpr timeOW_t operator""_us(long long unsigned int)' called in a constant expression
I'm not sure if this is OT, but it atleast seems to be an comparable issue..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants