SuperHouse / esp-open-rtos

Open source FreeRTOS-based ESP8266 software framework
BSD 3-Clause "New" or "Revised" License
1.53k stars 491 forks source link

reset stdout redirection for exception dumps #596

Closed phkehl closed 6 years ago

phkehl commented 6 years ago

Reset stdout to the default direct-to-UART handler on exceptions and abort()s. Users may have used set_write_stdout() to redirect output elsewhere, which likely isn't going to work in the exception handler.

ourairquality commented 6 years ago

Not sure if this is a great default. People might have redirected to an alternative output that does have some chance of working in the context of an exception. The output is likely lost anyway in a deployed device unless some method to save this output is added, a method that allows this output to be recovered on re-boot. e.g. Perhaps some extension of the 'reset reasons' state. This might be stored in the limited RTC memory where it would be inefficient to store the text output. So perhaps some hooks are need to allow these exception functions to be re-defined, or to allow alternatives to be linked, and that would address the use case that this patch addresses.

phkehl commented 6 years ago

Thanks for you comments! That makes sense. I've studied the code a bit more. I found that set_user_exception_handler() lets me do what I want already. I'll close this.