0% found this document useful (0 votes)
34 views24 pages

System Segger View - 1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views24 pages

System Segger View - 1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 24

Usage of Segger :

SEGGER SystemView is a real-time analysis tool that visualizes embedded system


events, helping developers monitor performance and optimize RTOS behavior.
Steps to Integrate the System Segger View

Step1:
 Downloading The Necessary Software
o System Segger View
o System Segger View Target Source
o J-Link Drivers

Step2:
 Including System View in The Application
Step3:
 Adding Include Path and Apply Path to FreeRTOS
Step4:
 Sending System Information/Target Configuration
Step5:
 Continuous Recording

Step1 Explanation:
First we have to install the required software,
1.Installation of System segger view:
In google search put system segger view  Click first link
Click  List of downloads
Inside list of downloads,
[Hint: Based on software operating system download it ]
System Segger View Version – 3.56a
Windows  64-bit Installer
Once downloaded double click it  give next the agree the license  Install.

Now installation is Done.


2.Download of System segger view Target source:
Scroll down  In system view, Target source download and unzip it .

Scroll down  In manuals  download latest version system view user manual pdf.
Create one folder in C or D drive copy all segger related documents in it.
3.Installation of J-link Drivers:
For continuous recording we need to download J-link driver.
Open new tab  search J-link drivers  click first link  scroll down  go to J-link
software and documentation pack  click for downloads

Install the j-link driver.


Step2 Explanation:
Open user manual  in 4.1 including system view in the application  we must add
all this files in our project.

Open your project  in S32DS  Right click on your project create new folder
name as segger.
After creating Segger folder  same like under segger you have to create  config,
os, patch, segger.

Open the systemview_src_v356a  config  copy all files and paste into your
project already created segger inside  config
One more file we must add in to config,
Systemview_src_v356v  sample  FreeRTOSV10  config  Cortex-M add
this file in your project  segger  config.

In config folder we should add 4 necessary files.


In your project segger folder  OS  paste this below mentioned files.

Check in your project properly added or not.


Next patch file we should add.

check in your project  patch folder.


Next segger folder add below mentioned files.

Exclude these files like syscalls folder, SEGGER_RTT_printf.


Remaining files we must add in segger folder.
Step2 is now completed.
Step3 Explanation:
We should have to set path for segger.
Project settings  c/c++ build  settings standard s32ds c compiler  include 
at top by add symbol we can add path of segger .
Check the segger paths added properly or not.
One more path we have to add.
Project settings  c/c++ general  paths and symbols  at top by add option we can
add path of segger.

Step3 is completed now.


Step4 Explanation:
Open project  segger folder  config
SEGGER_SYSVIEW_Config_FreeRTOS.c
We have to change this things,
 #define SYSVIEW_APP_NAME "FreeRTOS Blinky Application"
 #define SYSVIEW_DEVICE_NAME "S32DS.3.4"
 #define SYSVIEW_RAM_BASE (0x20000000)

In your project main.c file  you have to add SEGGER_SYSVIEW.h file


After that in your main.c file under main we have to call the segger functions.

In your project open FreeRTOSConfig.h file.


You have to add,
#include “SEGGER_SYSVIEW_FreeRTOS.h”
In your project  FreeRTOS folder have to open portmacro.h file.

In portmacro.h file  we have to add this (237 to 240)


//Add function below in file portmacro.h
#ifdef configASSERT
void vSetVarulMaxPRIGROUPValue( void );
#endif

In port.c file have to add this,


#if( configASSERT_DEFINED == 1 )
void vSetVarulMaxPRIGROUPValue( void )
{
#if( configASSERT_DEFINED == 1 )
{
volatile uint32_t ulOriginalPriority;
volatile uint8_t * const pucFirstUserPriorityRegister = ( volatile uint8_t
* const ) ( portNVIC_IP_REGISTERS_OFFSET_16 +
portFIRST_USER_INTERRUPT_NUMBER );
volatile uint8_t ucMaxPriorityValue;

/* Determine the maximum priority from which ISR safe FreeRTOS API
functions can be called. ISR safe functions are those that end in "FromISR".
FreeRTOS maintains separate thread and ISR API functions to ensure interrupt entry
is as fast and simple as possible.
Save the interrupt priority value that is about to be clobbered. */
ulOriginalPriority = *pucFirstUserPriorityRegister;

/* Determine the number of priority bits available. First write to all


possible bits. */
*pucFirstUserPriorityRegister = portMAX_8_BIT_VALUE;

/* Read the value back to see how many bits stuck. */


ucMaxPriorityValue = *pucFirstUserPriorityRegister;

/* Use the same mask on the maximum system call priority. */


ucMaxSysCallPriority =
configMAX_SYSCALL_INTERRUPT_PRIORITY & ucMaxPriorityValue;

/* Calculate the maximum acceptable priority group value for the


number
of bits read back. */
ulMaxPRIGROUPValue = portMAX_PRIGROUP_BITS;
while( ( ucMaxPriorityValue & portTOP_BIT_OF_BYTE ) ==
portTOP_BIT_OF_BYTE )
{
ulMaxPRIGROUPValue--;
ucMaxPriorityValue <<= ( uint8_t ) 0x01;
}

#ifdef __NVIC_PRIO_BITS
{
/* Check the CMSIS configuration that defines the number of
priority bits matches the number of priority bits actually queried from the hardware. */
configASSERT( ( portMAX_PRIGROUP_BITS -
ulMaxPRIGROUPValue ) == __NVIC_PRIO_BITS );
}
#endif
#ifdef configPRIO_BITS
{
/* Check the FreeRTOS configuration that defines the number of
priority bits matches the number of priority bits actually queried from the hardware. */
configASSERT( ( portMAX_PRIGROUP_BITS -
ulMaxPRIGROUPValue ) == configPRIO_BITS );
}
#endif

/* Shift the priority group value back to its position within the AIRCR
register. */
ulMaxPRIGROUPValue <<= portPRIGROUP_SHIFT;
ulMaxPRIGROUPValue &= portPRIORITY_GROUP_MASK;

/* Restore the clobbered interrupt priority register to its original


value. */
*pucFirstUserPriorityRegister = ulOriginalPriority;
}
#endif /* conifgASSERT_DEFINED */
}
Line number 773 to 837 add this content in your port.c file

Step5 Explanation:
Open system segger view  at top click target  recorder configuration  click J-
link.
After ok  J-link connection.

After this Start Recording continuously.


After this you can monitor your task in system segger view.
Steps To Enable Stack Size In S32DS
Step1:
Open your project in s32ds environment.
Step2:
Click project settings  c/c++ build  settings  stabdard s32ds c compiler 
miscellaneous  other flags :
-c -fmessage-length=0 -fstack-usage
Add this .
Step3:
After that .su file will create. In that you can check stack size .
Example:
#include <stdio.h>
void functionA() {
int a[10]; // Local array of 10 integers
printf("In Function A\n");
}
void functionB() {
int b[5]; // Local array of 5 integers
printf("In Function B\n");
}

int main() {
functionA();
functionB();
return 0;
}
Add this function build your project and check how much bytes occupied this
function.

Explanation of the .su File Contents


 Function A: 40 indicates that function A requires 40 bytes of stack space. This
includes the space needed for the local array and any other function call
overhead.
 Function B: 20 indicates that function B requires 20 bytes of stack space.

Analyze Stack Usage


Using the information from the .su file, you can:
 Assess whether your functions are using an acceptable amount of stack space.
 Make changes to optimize memory usage, such as reducing local variable sizes
or allocating larger arrays dynamically if necessary.
Function Performance Monitoring:
Main task with function

Main task without function

You might also like