-
Notifications
You must be signed in to change notification settings - Fork 80
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
feat(CMSIS): Adding mallinfo function and reworking Cordio memory management. #1179
base: main
Are you sure you want to change the base?
Conversation
Need to call this multiple times to allow us to calculate the size requirements before requesting the heap memory.
This is a significant API change. We need to call WsfHeapAlloc with the required size before calling WsfHeapGetFreeStartAddress. This will allow us to do dynamic memory allocation, instead of allocating a large block of memory on initialization.
void LlInitRunTimeCfg(const LlRtCfg_t *pCfg) | ||
{ | ||
WSF_ASSERT(pLctrRtCfg == NULL); | ||
// WSF_ASSERT(pLctrRtCfg == NULL); | ||
WSF_ASSERT(pCfg); |
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.
Is the intention to entirely remove this commented line?
It makes sense to me that pLctrRtCfg
may possibly be empty in this context -- given that it is not read and later assigned to pCfg
.
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.
Yes we need to remove this check. The problem is that we will get an assertion if this function is called twice. We need to call this twice to calculate the length of dynamic memory needed.
void BbInitRunTimeCfg(const BbRtCfg_t *pCfg) | ||
{ | ||
WSF_ASSERT(pBbRtCfg == NULL); | ||
// WSF_ASSERT(pBbRtCfg == NULL); |
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.
Ditto. Similar observation for pBbRtCfg
in BbInitRunTimeCfg()
.
@crsz20 I was just thinking, it would be good to add a LL function for the size calculation. We're copying a lot of code that could be consolidated. |
Which part do you think could be consolidated? In the |
…solved hard-fault error.
Lines 127 - 133 in the file below. We could add a function with the same parameters as LlInit() that returns the memory requirement. |
/clang-format-run |
Description
Adding mallinfo function to give us information on how much heap space is being used and how much is available. Reworking the Cordio memory management so we don't have to request an arbitrarily large block of memory on initialization.
Checklist Before Requesting Review