-
Notifications
You must be signed in to change notification settings - Fork 370
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
Memfault-SDK integration with MyNewt (Alternate) #2686
Conversation
kernel/os/syscfg.yml
Outdated
@@ -190,6 +195,9 @@ syscfg.defs: | |||
If set, run time is measured in cpu time ticks rather than OS time | |||
ticks. | |||
value: 0 | |||
MEMFAULT_ENABLE: | |||
description: 'Enables Memfault SDK features' |
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 be moved to util/memfault_sdk/syscfg.yml
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.
util/memfault_sdk is currently only included inside kernel/os/pkg.yml
if MEMFAULT_ENABLE
is set. Putting MEMFAULT_ENABLE
inside util/memfault_sdk/syscfg.yml
would create a catch-22 circular dependency
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.
We do not need the dependency there
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.
Right, os no longer needs to pull in the package, I can move it to the app side. Changed
I have already reviewed most of it. Please consider this approach based on our discussion on slack. @wes3 @mkiiskila @andrzej-kaczmarek @utzig |
7c25e96
to
cdc263c
Compare
Registering callback via API is useless for any crash that happens before registration. This should be done in the same way as Also we do not really need any code related to Memfault in mynewt-core for this to work - the package implementing |
I can see how replacing the registration process with a compile time function pointer to the callback is beneficial but I don't see the benefit of keeping the package itself out of mynewt. Isn't it easier for a mynewt user to utilize |
I don't really see good reason why we should include support for paid-for proprietary product in Mynewt tree given that it can be easily done out-of-tree. Also I don't like that proposed solution pulls Memfault repo via some other 3rd party repo, so the benefit is that in your own repo you can do integration in whatever way you like and no one cares. And the clean and simple solution to have full official integration would be to add callback on our side and then let Memfault make use of it in their repository. |
@andrzej-kaczmarek
I do understand your point but it is a very narrow thought process and I do not agree with it. Either ways @t3zeng has gone ahead and done his part and opened up a new PR with what you want. |
I do like this approach:
|
@vrahane Once we add |
There are some misconceptions here. First off, the purpose of the wrapper repo is to house the necessary mynewt repo yaml files. This is there because mynewt only allows for the repo files to be at the top level and it provides the power to choose when to update the commit hash in case things break. Second, it currently includes some fork of the actual memfault-sdk right now because that fork contains changes that I am currently working on merging into the official memfault-sdk repo. Once that merge is complete, the wrapper repo will host the official memfault-sdk repo and not some fork. Taking out the memfault package from mynewt tree does not eliminate the need for the wrapper repo because you still need to pull in the memfault repo to mynewt to use it. The only difference is in your proposed solution the coredump callback is defined in the memfault sdk, users need to use the internet to search for what callback functions are available for them to use, and any changes to the mechanism on mynewt side will break all packages that leverage the new coredump callback since they will all live outside of mynewt. What removing the memfault package from mynewt-core doesn't change is the need to have a repo that has the yaml files needed for mynewt to recognize it as a repo that can be pulled in for use. |
util/memfault_sdk/src/memfault_sdk.c
Outdated
#if MYNEWT_VAL(MEMFAULT_ENABLE) | ||
#if MYNEWT_VAL(MEMFAULT_COREDUMP_CB) | ||
void os_coredump_cb(void *tf) { | ||
memfault_fault_handler((sMfltRegState *)tf, kMfltRebootReason_HardFault); |
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?
No, I know exactly why you "need" all those hacks to make it work. What I propose instead is doing this properly and add everything to Memfault repo and get rid of all those intermediate repos/packages/whatever. And that also includes |
Getting rid of the intermediate repo has no bearing to the changes in mynewt. All that changes is the path of the package that's included which is a very minor difference not worth fixating on in the context of this review. Not including the package or any reference to this support on mynewt side simply seems strange since a user would not be able to easily know what is available to them if they want to use the feature. They would need to search on the internet which makes using mynewt less attractive to both hobbyists and companies alike in comparison to some other RTOS that does include support. Also, this os_coredump_cb functionality can't change in the future without breaking all of the different individual packages that live all across the internet because nobody can easily know what packages were supporting it and even if they did, they would need to make a PR to all of them or else they would just stop working forever. I already made a PR that removes the memfault package so you're free to approve it if you support that strategy |
Why would I want to pull in |
Okay I can get rid of |
Please link in the discussion. |
|
The official memfault-firmware-sdk now has repository.yml at the top level for mynewt. I have adjusted paths to point directly to it |
So just add remaining code from this PR to memfault repo and close this PR, we'll merge os_coredump_cb from the other PR. |
hi @andrzej-kaczmarek, catching up on this thread, thanks for the feedback! We can definitely go ahead and pull the However, I do see benefit in having a memfault porting layer directly in mynewt (similar to how tinyusb looks like it's integrated today). It would make it easier for an end user to get started, follow mynewt core API changes, and integrate directly into tools like mcumgr (there was an early prototype for that here). Let me know if you see a path forward for including the port directly to make things easier for end users in the future. thanks! |
There's no need to add I checked few other ports available in Memfault repository and they seem to require some kind of patching in target OS (e.g. FreeRTOS, Zephyr, Dialog SDK) since there's no support provided by those OSes, so I do not understand why you guys push on adding code to Mynewt so much and claim that Mynewt will be "less attractive (...) in comparison to some other RTOS that does include support". In fact, in case of Mynewt all you have to do is to tweak app/target configuration, no need to apply any patches. |
Thanks for the feedback @andrzej-kaczmarek ... you are right that some of our ports do work this way. For newer ports such as the one with the nRF Connect SDK we've included a memfault module within the SDK for easier inclusion of SDK specific metric collection and build system addition. Both approaches work though so we have added a |
@t3zeng We can close this one now. |
In this alternate PR I have utilized a slightly different strategy.
A new OS_COREDUMP_CB syscfg flag in conjunction with a new os feature to register a custom callback allow the memfault integration to register its own fault handling API.