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

Arduino Crypto library: compilation problem with MegaTinyCore 2.6.8 (IDE 1.8.19, Win10) #998

Closed
XFer012 opened this issue Aug 23, 2023 · 1 comment
Labels
duplicate This issue or pull request already exists Not our bug This is a bug in a third party tool and should be raised with the maintainers of that tool, if any.

Comments

@XFer012
Copy link

XFer012 commented Aug 23, 2023

Hi,
I'm trying to build an Arduino Crypto Library example ("TestEd25519") for ATTiny 3224, latest MegaTinyCore 2.6.8 and Arduino IDE 1.8.19.

I get the following errors (mostly about RNG.cpp):

Arduino: 1.8.19 (Windows 10), TD: 1.57, Board: "ATtiny3224/1624/1614/1604/824/814/804/424/414/404/214/204, ATtiny3224, 10 MHz internal, 1.8V (5 MHz or less), Disabled/Disabled, EEPROM retained, Enabled (default timer), 8ms, Master or Slave (saves flash and RAM), Default (doesn't print floats, 1.4k flash use), PB0-2, PA3-5 (default), On all pins, with new implementation., Disabled (recommended), No delay before window "opens""

In file included from C:\Users\Fernando\AppData\Local\Arduino15\packages\megaTinyCore\hardware\megaavr\2.6.8\cores\megatinycore/Arduino.h:37:0,

                 from L:\Progetti\Arduino\libraries\Crypto\src\RNG.cpp:27:

L:\Progetti\Arduino\libraries\Crypto\src\RNG.cpp: In function 'void WDT_vect()':

L:\Progetti\Arduino\libraries\Crypto\src\RNG.cpp:228:5: warning: 'WDT_vect' appears to be a misspelled 'signal' handler, missing '__vector' prefix [-Wmisspelled-isr]

 ISR(WDT_vect)

     ^

L:\Progetti\Arduino\libraries\Crypto\src\RNG.cpp:239:27: error: 'TCNT0' was not declared in this scope

     unsigned char value = TCNT0;

                           ^~~~~

L:\Progetti\Arduino\libraries\Crypto\src\RNG.cpp:239:27: note: suggested alternative: 'TCA0'

     unsigned char value = TCNT0;

                           ^~~~~

                           TCA0

L:\Progetti\Arduino\libraries\Crypto\src\RNG.cpp: In destructor 'RNGClass::~RNGClass()':

L:\Progetti\Arduino\libraries\Crypto\src\RNG.cpp:288:5: error: 'MCUSR' was not declared in this scope

     MCUSR &= ~(1 << WDRF);

     ^~~~~

L:\Progetti\Arduino\libraries\Crypto\src\RNG.cpp:288:21: error: 'WDRF' was not declared in this scope

     MCUSR &= ~(1 << WDRF);

                     ^~~~

L:\Progetti\Arduino\libraries\Crypto\src\RNG.cpp:288:21: note: suggested alternative: 'WDT'

     MCUSR &= ~(1 << WDRF);

                     ^~~~

                     WDT

In file included from L:\Progetti\Arduino\libraries\Crypto\src\RNG.cpp:37:0:

L:\Progetti\Arduino\libraries\Crypto\src\RNG.cpp:291:30: error: 'WDCE' was not declared in this scope

     _WD_CONTROL_REG |= (1 << _WD_CHANGE_BIT) | (1 << WDE);

                              ^

L:\Progetti\Arduino\libraries\Crypto\src\RNG.cpp:291:30: note: suggested alternative: 'ADC0'

L:\Progetti\Arduino\libraries\Crypto\src\RNG.cpp:291:54: error: 'WDE' was not declared in this scope

     _WD_CONTROL_REG |= (1 << _WD_CHANGE_BIT) | (1 << WDE);

                                                      ^~~

L:\Progetti\Arduino\libraries\Crypto\src\RNG.cpp:291:54: note: suggested alternative: 'WDT'

     _WD_CONTROL_REG |= (1 << _WD_CHANGE_BIT) | (1 << WDE);

                                                      ^~~

                                                      WDT

L:\Progetti\Arduino\libraries\Crypto\src\RNG.cpp:292:23: error: no match for 'operator=' (operand types are 'WDT_t {aka WDT_struct}' and 'int')

     _WD_CONTROL_REG = 0;

                       ^

In file included from c:\users\fernando\appdata\local\arduino15\packages\dxcore\tools\avr-gcc\7.3.0-atmel3.6.1-azduino6\avr\include\avr\io.h:733:0,

                 from c:\users\fernando\appdata\local\arduino15\packages\dxcore\tools\avr-gcc\7.3.0-atmel3.6.1-azduino6\avr\include\avr\pgmspace.h:90,

                 from C:\Users\Fernando\AppData\Local\Arduino15\packages\megaTinyCore\hardware\megaavr\2.6.8\cores\megatinycore/api/String.h:30,

                 from C:\Users\Fernando\AppData\Local\Arduino15\packages\megaTinyCore\hardware\megaavr\2.6.8\cores\megatinycore/api/Print.h:24,

                 from C:\Users\Fernando\AppData\Local\Arduino15\packages\megaTinyCore\hardware\megaavr\2.6.8\cores\megatinycore/api/Stream.h:25,

                 from C:\Users\Fernando\AppData\Local\Arduino15\packages\megaTinyCore\hardware\megaavr\2.6.8\cores\megatinycore/api/Client.h:22,

                 from C:\Users\Fernando\AppData\Local\Arduino15\packages\megaTinyCore\hardware\megaavr\2.6.8\cores\megatinycore/api/ArduinoAPI.h:29,

                 from C:\Users\Fernando\AppData\Local\Arduino15\packages\megaTinyCore\hardware\megaavr\2.6.8\cores\megatinycore/Arduino.h:26,

                 from L:\Progetti\Arduino\libraries\Crypto\src\RNG.cpp:27:

c:\users\fernando\appdata\local\arduino15\packages\dxcore\tools\avr-gcc\7.3.0-atmel3.6.1-azduino6\avr\include\avr\iotn3224.h:2040:16: note: candidate: constexpr WDT_struct& WDT_struct::operator=(const WDT_struct&)

 typedef struct WDT_struct

                ^~~~~~~~~~

c:\users\fernando\appdata\local\arduino15\packages\dxcore\tools\avr-gcc\7.3.0-atmel3.6.1-azduino6\avr\include\avr\iotn3224.h:2040:16: note:   no known conversion for argument 1 from 'int' to 'const WDT_struct&'

c:\users\fernando\appdata\local\arduino15\packages\dxcore\tools\avr-gcc\7.3.0-atmel3.6.1-azduino6\avr\include\avr\iotn3224.h:2040:16: note: candidate: constexpr WDT_struct& WDT_struct::operator=(WDT_struct&&)

c:\users\fernando\appdata\local\arduino15\packages\dxcore\tools\avr-gcc\7.3.0-atmel3.6.1-azduino6\avr\include\avr\iotn3224.h:2040:16: note:   no known conversion for argument 1 from 'int' to 'WDT_struct&&'

L:\Progetti\Arduino\libraries\Crypto\src\RNG.cpp: In member function 'void RNGClass::begin(const char*)':

L:\Progetti\Arduino\libraries\Crypto\src\RNG.cpp:485:5: error: 'MCUSR' was not declared in this scope

     MCUSR &= ~(1 << WDRF);

     ^~~~~

L:\Progetti\Arduino\libraries\Crypto\src\RNG.cpp:485:21: error: 'WDRF' was not declared in this scope

     MCUSR &= ~(1 << WDRF);

                     ^~~~

L:\Progetti\Arduino\libraries\Crypto\src\RNG.cpp:485:21: note: suggested alternative: 'WDT'

     MCUSR &= ~(1 << WDRF);

                     ^~~~

                     WDT

In file included from L:\Progetti\Arduino\libraries\Crypto\src\RNG.cpp:37:0:

L:\Progetti\Arduino\libraries\Crypto\src\RNG.cpp:489:30: error: 'WDCE' was not declared in this scope

     _WD_CONTROL_REG |= (1 << _WD_CHANGE_BIT) | (1 << WDE);

                              ^

L:\Progetti\Arduino\libraries\Crypto\src\RNG.cpp:489:30: note: suggested alternative: 'ADC0'

L:\Progetti\Arduino\libraries\Crypto\src\RNG.cpp:489:54: error: 'WDE' was not declared in this scope

     _WD_CONTROL_REG |= (1 << _WD_CHANGE_BIT) | (1 << WDE);

                                                      ^~~

L:\Progetti\Arduino\libraries\Crypto\src\RNG.cpp:489:54: note: suggested alternative: 'WDT'

     _WD_CONTROL_REG |= (1 << _WD_CHANGE_BIT) | (1 << WDE);

                                                      ^~~

                                                      WDT

L:\Progetti\Arduino\libraries\Crypto\src\RNG.cpp:490:29: error: 'WDIE' was not declared in this scope

     _WD_CONTROL_REG = (1 << WDIE);

                             ^~~~

L:\Progetti\Arduino\libraries\Crypto\src\RNG.cpp:490:29: note: suggested alternative: 'WDT'

     _WD_CONTROL_REG = (1 << WDIE);

                             ^~~~

                             WDT

exit status 1

Error compiling for board ATtiny3224/1624/1614/1604/824/814/804/424/414/404/214/204.

I had to disable Verbose Compilation because the message body was too large (> 65535 chars).

I reckon is more a problem with Crypto library assuming things than with MegaTinyCore; still, in case there's a reasonably simple fix it would be nice to have Crypto compatible with the newer ATTinys. :)

Update: same problem with current DxCore 1.5.8 (tested with AVR64DD14).

@SpenceKonde SpenceKonde added duplicate This issue or pull request already exists Not our bug This is a bug in a third party tool and should be raised with the maintainers of that tool, if any. labels Sep 1, 2023
@SpenceKonde
Copy link
Owner

SpenceKonde commented Sep 1, 2023

#924

This guy fixed it - it can only be dealt with at the library level as the library needs to use a different means to gather entropy (on classic they used the beat of the poorly controlled, asynchronous WDT oscillator against the system clock to generate entropy; on the new parts, there turns out to be a better way that generates more entropy faster (though an analogous method using the RTC is also possible, but in that thread, I got the impression that my CCL hack was faster and - besides that I suspect it's a better source of randomness, since Microchip isn't even trying control the timing of a CCL inverting itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists Not our bug This is a bug in a third party tool and should be raised with the maintainers of that tool, if any.
Projects
None yet
Development

No branches or pull requests

2 participants