Skip to content
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

[silabs] Add systemView for 917 #32701

Merged
merged 2 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions examples/platform/silabs/sl_systemview_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/**
* @file
* @brief Segger System View configuration file.
*******************************************************************************
* # License
* <b>Copyright 2020 Silicon Laboratories Inc.
*www.silabs.com</b>
*******************************************************************************
*
* SPDX-License-Identifier: Zlib
*
* The licensor of this software is Silicon
*Laboratories Inc.
*
* This software is provided 'as-is', without any
*express or implied warranty. In no event will the
*authors be held liable for any damages arising from
*the use of this software.
*
* Permission is granted to anyone to use this
*software for any purpose, including commercial
*applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be
*misrepresented; you must not claim that you wrote
*the original software. If you use this software in a
*product, an acknowledgment in the product
*documentation would be appreciated but is not
*required.
* 2. Altered source versions must be plainly marked
*as such, and must not be misrepresented as being the
*original software.
* 3. This notice may not be removed or altered from
*any source distribution.
*
******************************************************************************/

// Overwirte SystemView config for GN build, SHOULD NOT BE USED WITH SLC!!!

#pragma once

#define SEGGER_SYSVIEW_TIMESTAMP_SOURCE_DWT 0
#define SEGGER_SYSVIEW_TIMESTAMP_SOURCE_SLEEPTIMER 1

// <o SEGGER_SYSVIEW_TIMESTAMP_SOURCE> Source for the time stamps
// <SEGGER_SYSVIEW_TIMESTAMP_SOURCE_DWT=> DWT Cycle Counter
// <SEGGER_SYSVIEW_TIMESTAMP_SOURCE_SLEEPTIMER=> Sleep Timer
// <i> Source for time stamps. Only meaningful when no OS is present. When an OS is present, time stamp is provided by the OS.
// <i> SEGGER_SYSVIEW_TIMESTAMP_SOURCE_DWT is not available on Cortex-M0+ and cannot be selected.
// <i> Default: SEGGER_SYSVIEW_TIMESTAMP_SOURCE_SLEEPTIMER
#define SEGGER_SYSVIEW_TIMESTAMP_SOURCE SEGGER_SYSVIEW_TIMESTAMP_SOURCE_SLEEPTIMER

// <o SEGGER_SYSVIEW_RTT_BUFFER_SIZE> RTT buffer size (in bytes)
// <i> Default: 1024
#define SEGGER_SYSVIEW_RTT_BUFFER_SIZE 8192

// <o SEGGER_SYSVIEW_RTT_CHANNEL> RTT channel for SystemView
// <i> Default: 1
#define SEGGER_SYSVIEW_RTT_CHANNEL 1

// <q SEGGER_SYSVIEW_USE_STATIC_BUFFER> Use static buffer to generate events
// <i> Determines if a single static buffer is used to generate the events. If disabled, the buffer is allocated on the stack.
// <i> Default: 1
#define SEGGER_SYSVIEW_USE_STATIC_BUFFER 1

// <q SEGGER_SYSVIEW_POST_MORTEM_MODE> Enable post mortem mode
// <i> Default: 0
#define SEGGER_SYSVIEW_POST_MORTEM_MODE 0

// <q SEGGER_SYSVIEW_CAN_RESTART> Enable SystemView restart
// <i> If enabled, start sequence is sent on every startup. It is not recommended to disabled this feature.
// <i> Default: 1
#define SEGGER_SYSVIEW_CAN_RESTART 1

// <q SEGGER_SYSVIEW_ID_SHIFT> Number of bits to shift the Id to save bandwidth. (i.e. 2 when Ids are 4 byte aligned)
// <i> Default: 0
#define SEGGER_SYSVIEW_ID_SHIFT 0

// <<< end of configuration section >>>
1 change: 0 additions & 1 deletion src/platform/silabs/platformAbstraction/GsdkSpam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ CHIP_ERROR SilabsPlatform::Init(void)

#ifdef SL_CATALOG_SYSTEMVIEW_TRACE_PRESENT
SEGGER_SYSVIEW_Conf();
SEGGER_SYSVIEW_Start();
#endif

#if SILABS_LOG_OUT_UART || ENABLE_CHIP_SHELL || CHIP_DEVICE_CONFIG_THREAD_ENABLE_CLI
Expand Down
9 changes: 9 additions & 0 deletions src/platform/silabs/platformAbstraction/WiseMcuSpam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ void soc_pll_config(void);
#include "silabs_utils.h"
#endif

#ifdef SL_CATALOG_SYSTEMVIEW_TRACE_PRESENT
#include "SEGGER_SYSVIEW.h"
#endif

namespace chip {
namespace DeviceLayer {
namespace Silabs {
Expand All @@ -63,6 +67,11 @@ CHIP_ERROR SilabsPlatform::Init(void)
#if SILABS_LOG_ENABLED
silabsInitLog();
#endif

#ifdef SL_CATALOG_SYSTEMVIEW_TRACE_PRESENT
SEGGER_SYSVIEW_Conf();
#endif

return CHIP_NO_ERROR;
}

Expand Down
27 changes: 26 additions & 1 deletion third_party/silabs/SiWx917_sdk.gni
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ template("siwx917_sdk") {
config("${sdk_target_name}_config") {
include_dirs = []
libs = []
defines = []
if (defined(invoker.include_dirs)) {
include_dirs += invoker.include_dirs
}
Expand Down Expand Up @@ -143,12 +144,25 @@ template("siwx917_sdk") {
"${wifi_sdk_root}/components/device/silabs/si91x/mcu/drivers/systemlevel/inc",
]

if (use_system_view) {
_include_dirs += [
"${efr32_sdk_root}/util/third_party/segger/systemview/SEGGER",
"${efr32_sdk_root}/util/third_party/segger/systemview/init/",
"${efr32_sdk_root}/util/third_party/segger/systemview/profiles/freertos_v10/",
]

defines += [
"SL_CATALOG_SYSTEMVIEW_TRACE_PRESENT",
"SEGGER_SYSVIEW_RTT_BUFFER_SIZE=8192",
]
}

# Note that we're setting the mbedTLS and PSA configuration files through a
# define. This means the build system by default does not pick up changes in
# the content of these, only when changing the filename itself.
# To fix this, these files are also manually depended upon in the source set
# declared in siwx917_mbedtls_config further down this file.
defines = [
defines += [
"MBEDTLS_CONFIG_FILE=\"siwx917-chip-mbedtls-config.h\"",
"__STARTUP_CLEAR_BSS",
"HARD_FAULT_LOG_ENABLE",
Expand Down Expand Up @@ -475,6 +489,17 @@ template("siwx917_sdk") {
"${wifi_sdk_root}/components/device/silabs/si91x/wireless/firmware_upgrade/firmware_upgradation.c",
]

if (use_system_view) {
sources += [
"${chip_root}/examples/platform/silabs/sl_systemview_config.h",
"${efr32_sdk_root}/util/third_party/segger/systemview/Config/Global.h",
"${efr32_sdk_root}/util/third_party/segger/systemview/Config/SEGGER_RTT_Conf.h",
"${efr32_sdk_root}/util/third_party/segger/systemview/SEGGER/SEGGER_SYSVIEW.c",
"${efr32_sdk_root}/util/third_party/segger/systemview/init/SEGGER_SYSVIEW_Init.c",
"${efr32_sdk_root}/util/third_party/segger/systemview/profiles/freertos_v10/SEGGER_SYSVIEW_FreeRTOS.c",
]
}

if (!disable_lcd) {
sources += [
"${efr32_sdk_root}/platform/middleware/glib/dmd/display/dmd_memlcd.c",
Expand Down
9 changes: 7 additions & 2 deletions third_party/silabs/efr32_sdk.gni
Original file line number Diff line number Diff line change
Expand Up @@ -403,12 +403,14 @@ template("efr32_sdk") {
if (use_system_view) {
_include_dirs += [
"${efr32_sdk_root}/util/third_party/segger/systemview/SEGGER",
"${efr32_sdk_root}/util/third_party/segger/systemview/Config/",
"${efr32_sdk_root}/util/third_party/segger/systemview/init/",
"${efr32_sdk_root}/util/third_party/segger/systemview/profiles/freertos_v10/",
]

defines += [ "SL_CATALOG_SYSTEMVIEW_TRACE_PRESENT" ]
defines += [
"SL_CATALOG_SYSTEMVIEW_TRACE_PRESENT",
"SEGGER_SYSVIEW_RTT_BUFFER_SIZE=8192",
]
}

defines += board_defines
Expand Down Expand Up @@ -831,6 +833,9 @@ template("efr32_sdk") {

if (use_system_view) {
sources += [
"${chip_root}/examples/platform/silabs/sl_systemview_config.h",
"${efr32_sdk_root}/util/third_party/segger/systemview/Config/Global.h",
"${efr32_sdk_root}/util/third_party/segger/systemview/Config/SEGGER_RTT_Conf.h",
"${efr32_sdk_root}/util/third_party/segger/systemview/SEGGER/SEGGER_SYSVIEW.c",
"${efr32_sdk_root}/util/third_party/segger/systemview/init/SEGGER_SYSVIEW_Init.c",
"${efr32_sdk_root}/util/third_party/segger/systemview/profiles/freertos_v10/SEGGER_SYSVIEW_FreeRTOS.c",
Expand Down
Loading