https://github.com/romanalexandroff/esp32_hard_fault_tests
This project consists of functions which sole purpose is to crash or hard-fail an ESP32 in as many ways as possible. The project is created as an educational material to learn potential threats for an embedded software execution, so they can be avoided during the future development.
https://github.com/romanalexandroff/esp32_hard_fault_tests
esp32 testing
Last synced: 28 days ago
JSON representation
This project consists of functions which sole purpose is to crash or hard-fail an ESP32 in as many ways as possible. The project is created as an educational material to learn potential threats for an embedded software execution, so they can be avoided during the future development.
- Host: GitHub
- URL: https://github.com/romanalexandroff/esp32_hard_fault_tests
- Owner: RomanAlexandroff
- License: mit
- Created: 2025-01-14T21:45:51.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-14T09:28:04.000Z (over 1 year ago)
- Last Synced: 2025-03-22T04:12:46.655Z (about 1 year ago)
- Topics: esp32, testing
- Language: C++
- Homepage:
- Size: 34.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ESP32-Hard-Fault-Tests
Hard faults and crashes are the bogeymen of novice embedded software developers. This project serves as an educational resource designed to confront these fears head-on by exploring a comprehensive range of scenarios that can lead to crashes on the ESP32.
The primary objective of this project is to identify, document and experience all possible causes of program execution crashes firsthand. The project aims to let unexperienced developers meet a variety of program crashes in a controlled enviroment and get used to them, making encountering a crash an ordinary day-to-day experience, thereby reducing the associated stress.
By allowing inexperienced developers to encounter various program crashes in a controlled environment, the project aims to normalize these issues, making them a routine part of development. This approach seeks to reduce the stress associated with encountering crashes, empowering developers to handle them with confidence.
## Features
The project includes the following tests:
- Dividing by zero
- Writing to a memory address pointed to by an uninitialized global pointer
- Writing to a memory address pointed to by a null pointer
- Calling an invalid function pointer
- Trying to access memory outside the valid range
- Causing a stack overflow with a recursive function
- Returning a pointer to the stack-allocated memory
- Returning a pointer to the heap-allocated and freed memory
- Freeing the same memory twice
- Assigning a 32-bit value to an 8-bit variable
- Unaligned memory access
- Trying to delete a watchdog task that does not exist or is already deleted
## File Structure
- `ESP32_Hard_Fault_Tests.ino`: Main Arduino sketch file that sets up and runs the tests.
- `ESP32_Hard_Fault_Tests.h`: Header file containing function declarations necessary includes and a compiler optimisation level macro.
- `functions.cpp`: Implementation of the various fault-inducing functions and their descriptions.
- `LICENSE`: MIT License for the project.
- `README.md`: This file.
- `.gitignore`: Git ignore file to exclude certain files from version control.
## Usage
**Disclaimer**. The usage of this sketch might harm or even break an ESP32. Use this sketch at your own risk. I will not undertake any accountability for any damages caused by the use of this sketch.
If you are not willing to risk testing the sketch on your own development board, I suggest you to try a free online ESP32 simulator such as [Wokwi](https://wokwi.com).
1. Clone the repository to your local machine.
2. Open the project in the Arduino IDE.
3. Upload the `ESP32_Hard_Fault_Tests.ino` sketch to your ESP32 board.
4. Open the Serial Monitor to observe the results of the tests.
## Contributions
Contributions are welcome! If you have new cases of ESP32 crashing or hard-failing, please feel free to submit a pull request or open an issue. Your contributions will help make this project more comprehensive and useful for the community.
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## Author
Roman Alexandrov - [r.aleksandroff@gmail.com](mailto:r.aleksandroff@gmail.com)