Coder Social home page Coder Social logo

openslab-osu / featherfault Goto Github PK

View Code? Open in Web Editor NEW
4.0 4.0 1.0 3.53 MB

🔬FeatherFault tells you why your Arduino program is crashing

License: GNU General Public License v3.0

C++ 63.09% Python 36.91%
arduino-library crash failure fault-diagnosis feather-m0 hardfault samd21

featherfault's Issues

Integrate Register Saving from FeatherTrace

FeatherTrace saves registers pushed onto the stack to a register dump and takes a stacktrace, printing this information on reboot. While a full stacktrace as found in FeatherTrace requires changing compiler flags, saving the pushed registers would only require an inline assembly interrupt handler similar to the one found here. As a result, integrating this feature into FeatherFault would be a useful way to get around being unable to MARK some areas of code while still allowing FeatherFault to be Arduino IDE compatible (unlike FeatherTrace). An external program and the elf from the current build (hopefully compiled with -g3?) would be required to translate the saved address into a line number, but this would be useful information if the line was not MARKed.

The implementation of this ISR would be based on the link above, and would rely on the exception handling behavior in the Cortex-M0+.

Using FeatherFault with SleepyDog fails to compile

FeatherFault fails to compile when being used with the Adafruit SleepyDog Library. This issue is caused by both FeatherFault and SleepyDog defining WDT_Handler function, causing a multiple definition error during link time:

C:\Users\User\AppData\Local\Temp\arduino_build_638914\libraries\Adafruit_SleepyDog_Library\utility\WatchdogSAMD.cpp.o: In function `WDT_Handler':

C:\Users\User\Documents\Arduino\libraries\Adafruit_SleepyDog_Library\utility/WatchdogSAMD.cpp:167: multiple definition of `WDT_Handler'

C:\Users\User\AppData\Local\Temp\arduino_build_638914\libraries\FeatherFault\FeatherFault.cpp.o:C:\Users\zackp\OneDrive\Documents\Arduino\libraries\FeatherFault\src/FeatherFault.cpp:148: first defined here

collect2.exe: error: ld returned 1 exit status

FeatherFault needs to be able to respond to the watchdog timer, so removing WDT_Handler is out of the question. The only idea I have to resolve this issue is to implement the FeatherFault watchdog code in terms of the SleepyDog library--resulting in less-than-ideal reliability and another dependency.

For the moment I will mark this as wontfix, though I am open to other solutions.

WDT reset synchronization causes MARK to run slowly

Currently the the MARK macro takes nearly 5 milliseconds, which can add up quickly if used 20 times in a loop. I think most of this is in the string processing - extracting the filename from the FILE constant. If we move this step into the interrupt handler, we could reduce the time to copying and int and a pointer, plus the time to actually feed the watchdog. I expect this to take around 2 microseconds if the peripheral clock runs at 1MHz.

Here's my test code:

#include "FeatherFault.h"

void setup() {
  digitalWrite(13, LOW);
  delay(100);
  digitalWrite(13, HIGH);
  Serial.begin(115200);
  while(!Serial);
  FeatherFault::StartWDT(FeatherFault::WDTTimeout::WDT_8S); MARK;
  FeatherFault::PrintFault(Serial); MARK;
  Serial.flush(); MARK;
}

void loop() {
  long tic = micros();
  MARK;
  long toc = micros();
  Serial.println(toc-tic);
}

And a graph of the result
featherfault_MARK_time

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.