adafruit / Adafruit_Mynewt

Apache Mynewt documentation and test project for the nRF5x family of BLE SoCs
MIT License
8 stars 3 forks source link

Add custom SYSINIT_PANIC_ASSERT handler #32

Open microbuilder opened 7 years ago

microbuilder commented 7 years ago

At present, any SYSINIT_PANIC_ASSERT that fails in sysinit will cause the system to halt since it asserts, which might be confusing even when developing.

A custom sysinit panic assert handler should be added at the app level. I think this is the prototype, but check the Master branch which just had a bug fix for this: typedef void sysinit_panic_fn(const char *file, int line)

We can override the syscfg setting in the target or app and have it log something or send something to the console or do whatever.

See the TSL2561 driver for an example. If the driver isn't present or fails init, the system will halt.