qub1750ul / Arduino_SoftwareReset

Arduino library that allows to reset an arduino board from the sketch
MIT License
7 stars 6 forks source link

Can´t compile the code with the latest version #8

Closed StriMek closed 3 years ago

StriMek commented 6 years ago

Hi, I get this error when compiling in Arduino 1.8.7:

Arduino:1.8.7 (Windows 10), Kort:"Optiboot on 28-pin cpus, 16MHz, ATmega328p"

Build options changed, rebuilding all avr-gcc: error: libraries\SoftwareReset\SoftwareReset.a: No such file or directory

exit status 1 Error compiling for board Optiboot on 28-pin cpus.

This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.

I call the function like in the example: softwareReset::standard() ;

What can be the fault?

Best regards Mikael

per1234 commented 6 years ago

The problem seems to be caused by setting dot_a_linkage=true in library.properties with a header-only library. If I remove that line from library.properties or add a dummy .cpp file to the library the error goes away.

This is not specific to the "Optiboot on 28-pin cpus, 16MHz, ATmega328p" board @StriMek is using, the error occurs when compiling for one of the official Arduino boards like Arduino/Genuino Uno. The minimal sketch to reproduce this issue is:

#include <SoftwareReset.h>
void setup() {}
void loop() {}
StriMek commented 5 years ago

Hi, Many thanks. I removed the line dot_a_linkage=true and then it worked like a charm. Have a nice weekend Best regards Mikael

chakthy commented 5 years ago

I'm unable to use the library with Arduino uno wifi rev2 Not sure if I'm using it properly. I added the line: softwareReset::standard(); on my code in case the if function does not get the desired result. This is the error I'm getting:

SoftwareReset.h:26:5: error: 'MCUSR' was not declared in this scope MCUSR = 0 ;

per1234 commented 5 years ago

@chakthy that is off-topic for this issue. The equivalent register to MCUSR on the Arduino Uno WiFi Rev2's ATmega4809 is RSTCTRL.RSTFR.

See section 11.3.1 of the megaAVR 0-Series manual: http://ww1.microchip.com/downloads/en/DeviceDoc/40002015A.pdf