Skip to content

Commit

Permalink
[K32W0] Add Software Diagnosis Cluster (#11190)
Browse files Browse the repository at this point in the history
Signed-off-by: Doru Gucea <[email protected]>

* Restyled by clang-format

Co-authored-by: Restyled.io <[email protected]>
Signed-off-by: Doru Gucea <[email protected]>
  • Loading branch information
2 people authored and andreilitvin committed Nov 12, 2021
1 parent 03143f6 commit f8f47a7
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
2 changes: 1 addition & 1 deletion examples/lighting-app/k32w/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ extern InitFunc __init_array_start;
extern InitFunc __init_array_end;

/* needed for FreeRtos Heap 4 */
uint8_t __attribute__((section(".heap"))) ucHeap[0xF000];
uint8_t __attribute__((section(".heap"))) ucHeap[HEAP_SIZE];

extern "C" void main_task(void const * argument)
{
Expand Down
30 changes: 30 additions & 0 deletions src/platform/K32W/PlatformManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,35 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack(void)
return err;
}

CHIP_ERROR PlatformManagerImpl::_GetCurrentHeapFree(uint64_t & currentHeapFree)
{
size_t freeHeapSize;

freeHeapSize = xPortGetFreeHeapSize();
currentHeapFree = static_cast<uint64_t>(freeHeapSize);
return CHIP_NO_ERROR;
}

CHIP_ERROR PlatformManagerImpl::_GetCurrentHeapUsed(uint64_t & currentHeapUsed)
{
size_t freeHeapSize;
size_t usedHeapSize;

freeHeapSize = xPortGetFreeHeapSize();
usedHeapSize = HEAP_SIZE - freeHeapSize;

currentHeapUsed = static_cast<uint64_t>(usedHeapSize);
return CHIP_NO_ERROR;
}

CHIP_ERROR PlatformManagerImpl::_GetCurrentHeapHighWatermark(uint64_t & currentHeapHighWatermark)
{
size_t highWatermarkHeapSize;

highWatermarkHeapSize = HEAP_SIZE - xPortGetMinimumEverFreeHeapSize();
currentHeapHighWatermark = static_cast<uint64_t>(highWatermarkHeapSize);
return CHIP_NO_ERROR;
}

} // namespace DeviceLayer
} // namespace chip
3 changes: 3 additions & 0 deletions src/platform/K32W/PlatformManagerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ class PlatformManagerImpl final : public PlatformManager, public Internal::Gener
// ===== Methods that implement the PlatformManager abstract interface.

CHIP_ERROR _InitChipStack(void);
CHIP_ERROR _GetCurrentHeapFree(uint64_t & currentHeapFree);
CHIP_ERROR _GetCurrentHeapUsed(uint64_t & currentHeapUsed);
CHIP_ERROR _GetCurrentHeapHighWatermark(uint64_t & currentHeapHighWatermark);

// ===== Members for internal use by the following friends.

Expand Down

0 comments on commit f8f47a7

Please sign in to comment.