-
Notifications
You must be signed in to change notification settings - Fork 381
Memfault-SDK integration with MyNewt (Alternate) #2686
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
e41f0e9
Memfault MyNewt Integration
t3zeng 97b8dfd
Replace callback registration with compile time function pointer
t3zeng 01281f4
Point util package depedency directly to official memfault sdk
t3zeng 35269fb
Define different reboot reason for asserts
t3zeng File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,79 @@ | ||
| <!-- | ||
| # | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
| # | ||
| --> | ||
| To use mynewt-memfault-sdk add following lines to **project.yml**. | ||
|
|
||
| ```yaml | ||
| repository.mynewt-memfault-sdk: | ||
| type: github | ||
| vers: 0.0.0 | ||
| user: proxyco | ||
| repo: mynewt-memfault-sdk | ||
| ``` | ||
|
|
||
| This dependency will allow you to pull in memfault features | ||
| ```yaml | ||
| pkg.deps: | ||
| - "@mynewt-memfault-sdk/memfault-firmware-sdk/ports/mynewt" | ||
| ``` | ||
|
|
||
| To use mynewt-memfault-sdk, set this values in **syscfg.vals:** section | ||
| ```yaml | ||
| MEMFAULT_ENABLE: 1 | ||
| ``` | ||
|
|
||
| Other syscfgs you can configure are: | ||
| ```yaml | ||
| MEMFAULT_DEVICE_INFO_SOFTWARE_TYPE: | ||
| description: A name to represent the firmware running on the MCU. | ||
| value: '"app-fw"' | ||
|
|
||
| MEMFAULT_DEVICE_INFO_SOFTWARE_VERS: | ||
| description: The version of the "software_type" currently running. | ||
| value: '"1.0.0"' | ||
|
|
||
| MEMFAULT_DEVICE_INFO_HARDWARE_VERS: | ||
| description: The revision of hardware for the device. This value must remain the same for a unique device. | ||
| value: '"dvt1"' | ||
|
|
||
| MEMFAULT_EVENT_STORAGE_SIZE: | ||
| description: Storage size for Memfault events | ||
| value: 1024 | ||
|
|
||
| MEMFAULT_SANITIZE_START: | ||
| description: Start address of address sanitization range | ||
| value: 0x00000000 | ||
| restrictions: | ||
| - $notnull | ||
|
|
||
| MEMFAULT_SANITIZE_SIZE: | ||
| description: Size of address sanitization range | ||
| value: 0xFFFFFFFF | ||
| restrictions: | ||
| - $notnull | ||
|
|
||
| MEMFAULT_DEBUG_LOG_BUFFER_SIZE: | ||
| description: Size of debug log buffer in bytes | ||
| value: 128 | ||
|
|
||
| MEMFAULT_MEM_NZ_AREA: | ||
| description: Memory area that does not get zeroed out at init time | ||
| value: '".mflt.core.nz"' | ||
| ``` |
This file contains hidden or 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,22 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| #pragma once | ||
|
|
||
| #include "os/mynewt.h" |
This file contains hidden or 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,28 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| pkg.name: util/memfault_sdk | ||
| pkg.description: "Memfault SDK package" | ||
| pkg.author: "Apache Mynewt <dev@mynewt.apache.org>" | ||
| pkg.homepage: "http://mynewt.apache.org/" | ||
| pkg.keywords: | ||
|
|
||
| pkg.deps: | ||
| - "@apache-mynewt-core/kernel/os" | ||
|
|
||
| pkg.deps.MEMFAULT_ENABLE: | ||
| - "@mynewt-memfault-sdk/memfault-firmware-sdk/ports/mynewt" |
This file contains hidden or 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,34 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| #include "memfault_sdk/memfault_sdk.h" | ||
|
|
||
| #if MYNEWT_VAL(MEMFAULT_ENABLE) | ||
| #include "memfault/panics/coredump.h" | ||
| #include "memfault/panics/arch/arm/cortex_m.h" | ||
| #include "memfault/panics/platform/coredump.h" | ||
| #endif | ||
|
|
||
| #if MYNEWT_VAL(MEMFAULT_ENABLE) | ||
| #if MYNEWT_VAL(MEMFAULT_COREDUMP_CB) | ||
| void os_coredump_cb(void *tf) { | ||
| memfault_fault_handler((sMfltRegState *)tf, kMfltRebootReason_HardFault); | ||
| } | ||
| #endif | ||
| #endif | ||
This file contains hidden or 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,28 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
| # | ||
|
|
||
| syscfg.defs: | ||
| MEMFAULT_ENABLE: | ||
| description: 'Enables Memfault SDK features' | ||
| value: 0 | ||
|
|
||
| MEMFAULT_COREDUMP_CB: | ||
| description: 'Enable custom memfault coredump handling cb' | ||
| value: 0 | ||
| restriction: | ||
| - 'OS_COREDUMP_CB if 1' |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should also handle assertions, not just hardfaults I would think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assertions also call the fault handler so we will be able to capture core dumps in those scenarios
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reset reason set here will be wrong though?