-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[slc] add
ot_crash_handler
to platform projects (#806)
- Loading branch information
Showing
13 changed files
with
1,651 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
id: ot_core_vendor_extension | ||
label: Silicon Labs OpenThread Core Vendor Extension | ||
package: OpenThread | ||
category: OpenThread | ||
quality: production | ||
description: |- | ||
This component implements ot::Extension::ExtensionBase for EFR32. | ||
When used with the OT Crash Handler component, crash info will be printed after the OpenThread instance is initialized. | ||
provides: | ||
- name: ot_core_vendor_extension | ||
include: | ||
- path: openthread/src/ | ||
file_list: | ||
- path: ncp/ncp_base.hpp | ||
source: | ||
- path: src/openthread/core/vendor_extension.cpp | ||
define: | ||
- name: OPENTHREAD_ENABLE_VENDOR_EXTENSION | ||
value: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
id: ot_crash_handler | ||
label: Crash Handler | ||
package: OpenThread | ||
category: OpenThread | ||
quality: production | ||
description: |- | ||
This component provides a set of APIs for printing crash info. | ||
In the case of a crash, this component captures the details. | ||
The provided `efr32PrintResetInfo()` API prints the crash details. | ||
provides: | ||
- name: ot_crash_handler | ||
conflicts: | ||
- name: legacy_hal_soc | ||
requires: | ||
- name: component_catalog | ||
- name: device | ||
- name: emlib_rmu | ||
- name: event_handler | ||
include: | ||
- path: third_party/silabs/gecko_sdk/protocol/openthread/src/legacy_hal/include | ||
file_list: | ||
- path: crash_handler.h | ||
- path: third_party/silabs/gecko_sdk/platform/service/legacy_hal/inc | ||
file_list: | ||
- path: asm.h | ||
- path: efm32_micro.h | ||
condition: | ||
- device_cortexm | ||
- path: micro-common.h | ||
- path: micro-types.h | ||
- path: micro.h | ||
- path: reset-def.h | ||
- path: platform-header.h | ||
- path: cortexm3/diagnostic.h | ||
condition: | ||
- device_cortexm | ||
source: | ||
- path: third_party/silabs/gecko_sdk/platform/service/legacy_hal/src/faults.s | ||
- path: third_party/silabs/gecko_sdk/protocol/openthread/src/legacy_hal/crash_handler.c | ||
- path: third_party/silabs/src/legacy_hal/diagnostic.c | ||
define: | ||
- name: "PLATFORM_HEADER" | ||
value: "\"platform-header.h\"" | ||
- name: CORTEXM3_EFM32_MICRO | ||
condition: | ||
- device_cortexm | ||
- name: CORTEXM3 | ||
condition: | ||
- device_cortexm | ||
- name: CORTEXM3_EFR32 | ||
condition: | ||
- device_cortexm | ||
- name: PHY_RAIL | ||
condition: | ||
- device_cortexm | ||
template_contribution: | ||
- name: component_catalog | ||
value: ot_crash_handler | ||
- name: event_handler | ||
value: | ||
event: platform_init | ||
include: crash_handler.h | ||
handler: sl_ot_crash_handler_init |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
/* | ||
* Copyright (c) 2024, The OpenThread Authors. | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* 1. Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* 2. Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in the | ||
* documentation and/or other materials provided with the distribution. | ||
* 3. Neither the name of the copyright holder nor the | ||
* names of its contributors may be used to endorse or promote products | ||
* derived from this software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | ||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
* POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
/** | ||
* @file | ||
* This file implements a OpenThread vendor extension for EFR32 | ||
*/ | ||
|
||
#include "openthread-core-config.h" | ||
|
||
#include <stdbool.h> | ||
#include <stdint.h> | ||
|
||
#include "common/code_utils.hpp" | ||
#include "common/new.hpp" | ||
|
||
#include "instance/extension.hpp" | ||
|
||
#if defined(SL_COMPONENT_CATALOG_PRESENT) | ||
#include "sl_component_catalog.h" | ||
#endif | ||
|
||
#include "platform-efr32.h" | ||
|
||
namespace ot { | ||
namespace Extension { | ||
|
||
/** | ||
* Defines the vendor extension object. | ||
* | ||
*/ | ||
class Extension : public ExtensionBase | ||
{ | ||
public: | ||
explicit Extension(Instance &aInstance) | ||
: ExtensionBase(aInstance) | ||
{ | ||
} | ||
}; | ||
|
||
// ---------------------------------------------------------------------------- | ||
// `ExtensionBase` API | ||
// ---------------------------------------------------------------------------- | ||
|
||
static OT_DEFINE_ALIGNED_VAR(sExtensionRaw, sizeof(Extension), uint64_t); | ||
|
||
ExtensionBase &ExtensionBase::Init(Instance &aInstance) | ||
{ | ||
ExtensionBase *ext = reinterpret_cast<ExtensionBase *>(&sExtensionRaw); | ||
|
||
VerifyOrExit(!ext->mIsInitialized); | ||
|
||
ext = new (&sExtensionRaw) Extension(aInstance); | ||
|
||
exit: | ||
return *ext; | ||
} | ||
|
||
void ExtensionBase::SignalInstanceInit(void) | ||
{ | ||
// OpenThread instance is initialized and ready. | ||
|
||
#if defined(SL_CATALOG_OT_CRASH_HANDLER_PRESENT) | ||
efr32PrintResetInfo(); | ||
#endif | ||
} | ||
|
||
void ExtensionBase::SignalNcpInit(Ncp::NcpBase &aNcpBase) | ||
{ | ||
// NCP instance is initialized and ready. | ||
OT_UNUSED_VARIABLE(aNcpBase); | ||
|
||
#if defined(SL_CATALOG_OT_CRASH_HANDLER_PRESENT) | ||
efr32PrintResetInfo(); | ||
#endif | ||
} | ||
|
||
void ExtensionBase::HandleNotifierEvents(Events aEvents) | ||
{ | ||
OT_UNUSED_VARIABLE(aEvents); | ||
} | ||
|
||
} // namespace Extension | ||
} // namespace ot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.