Added DMA memory, added SystemView tracing.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
imi415 2021-03-06 01:55:08 +08:00
parent a4b05a759b
commit 707908c8ad
Signed by: imi415
GPG Key ID: 17F01E106F9F5E0A
95 changed files with 22248 additions and 10 deletions

View File

@ -29,6 +29,8 @@ set(C_SOURCES
"Core/Src/user_printf_impl.c" "Core/Src/user_printf_impl.c"
"Core/Src/tasks/user_hello_task.c" "Core/Src/tasks/user_hello_task.c"
"Core/Src/tasks/user_lvgl_task.c" "Core/Src/tasks/user_lvgl_task.c"
"Core/Src/tasks/user_sysview_task.c"
"Core/Src/SEGGER_SYSVIEW_Config_FreeRTOS.c"
"Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_cortex.c" "Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_cortex.c"
"Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_rcc.c" "Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_rcc.c"
"Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_rcc_ex.c" "Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_rcc_ex.c"
@ -66,6 +68,11 @@ set(C_SOURCES
"Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os2.c" "Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os2.c"
"Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_4.c" "Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_4.c"
"Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c" "Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c"
"Middlewares/Third_Party/SystemView/SEGGER/SEGGER_RTT.c"
"Middlewares/Third_Party/SystemView/SEGGER/SEGGER_RTT_printf.c"
"Middlewares/Third_Party/SystemView/SEGGER/SEGGER_SYSVIEW.c"
"Middlewares/Third_Party/SystemView/SEGGER/Syscalls/SEGGER_RTT_Syscalls_GCC.c"
"Middlewares/Third_Party/SystemView/Sample/FreeRTOSV10/SEGGER_SYSVIEW_FreeRTOS.c"
"Middlewares/Third_Party/printf/printf.c" "Middlewares/Third_Party/printf/printf.c"
"Middlewares/Third_Party/LittleVGL/src/lv_font/lv_font_montserrat_14.c" "Middlewares/Third_Party/LittleVGL/src/lv_font/lv_font_montserrat_14.c"
"Middlewares/Third_Party/LittleVGL/src/lv_font/lv_font_montserrat_12_subpx.c" "Middlewares/Third_Party/LittleVGL/src/lv_font/lv_font_montserrat_12_subpx.c"
@ -182,6 +189,7 @@ set(C_SOURCES
# Copy them from Makefile # Copy them from Makefile
set(ASM_SOURCES set(ASM_SOURCES
"Middlewares/Third_Party/SystemView/SEGGER/SEGGER_RTT_ASM_ARMv7M.S"
"startup_stm32h750xx.s" "startup_stm32h750xx.s"
) )
@ -203,12 +211,16 @@ include_directories(
"Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2" "Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2"
"Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F" "Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F"
"Middlewares/Third_Party/printf" "Middlewares/Third_Party/printf"
"Middlewares/Third_Party/SystemView/SEGGER"
"Middlewares/Third_Party/SystemView/Config"
"Middlewares/Third_Party/SystemView/Sample/FreeRTOSV10"
"Middlewares/Third_Party/LittleVGL" "Middlewares/Third_Party/LittleVGL"
) )
# Final compiler flags # Final compiler flags
set(CMAKE_C_FLAGS "${CFLAGS_HARDWARE} ${CFLAGS_EXTRA} -Wall -fdata-sections -ffunction-sections") set(CMAKE_C_FLAGS "${CFLAGS_HARDWARE} ${CFLAGS_EXTRA} -Wall -fdata-sections -ffunction-sections")
set(CMAKE_CXX_FLAGS "${CFLAGS_HARDWARE} ${CFLAGS_EXTRA} -Wall -fdata-sections -ffunction-sections") set(CMAKE_CXX_FLAGS "${CFLAGS_HARDWARE} ${CFLAGS_EXTRA} -Wall -fdata-sections -ffunction-sections")
set(CMAKE_ASM_FLAGS "${CMAKE_C_FLAGS} -x assembler-with-cpp")
set(CMAKE_EXE_LINKER_FLAGS "${CFLAGS_HARDWARE} -specs=nano.specs -Wl,--gc-sections -lc -lm -lnosys ${LDFLAGS_EXTRA}") set(CMAKE_EXE_LINKER_FLAGS "${CFLAGS_HARDWARE} -specs=nano.specs -Wl,--gc-sections -lc -lm -lnosys ${LDFLAGS_EXTRA}")
# Main targets are added here # Main targets are added here

View File

@ -165,6 +165,10 @@ standard names. */
/* USER CODE BEGIN Defines */ /* USER CODE BEGIN Defines */
/* Section where parameter definitions can be added (for instance, to override default ones in FreeRTOS.h) */ /* Section where parameter definitions can be added (for instance, to override default ones in FreeRTOS.h) */
#define INCLUDE_xTaskGetIdleTaskHandle 1
#include "SEGGER_SYSVIEW_FreeRTOS.h"
/* USER CODE END Defines */ /* USER CODE END Defines */
#endif /* FREERTOS_CONFIG_H */ #endif /* FREERTOS_CONFIG_H */

View File

@ -214,7 +214,7 @@
#define USE_HAL_SPI_REGISTER_CALLBACKS 0U /* SPI register callback disabled */ #define USE_HAL_SPI_REGISTER_CALLBACKS 0U /* SPI register callback disabled */
#define USE_HAL_SWPMI_REGISTER_CALLBACKS 0U /* SWPMI register callback disabled */ #define USE_HAL_SWPMI_REGISTER_CALLBACKS 0U /* SWPMI register callback disabled */
#define USE_HAL_TIM_REGISTER_CALLBACKS 0U /* TIM register callback disabled */ #define USE_HAL_TIM_REGISTER_CALLBACKS 0U /* TIM register callback disabled */
#define USE_HAL_UART_REGISTER_CALLBACKS 0U /* UART register callback disabled */ #define USE_HAL_UART_REGISTER_CALLBACKS 1U /* UART register callback enabled */
#define USE_HAL_USART_REGISTER_CALLBACKS 0U /* USART register callback disabled */ #define USE_HAL_USART_REGISTER_CALLBACKS 0U /* USART register callback disabled */
#define USE_HAL_WWDG_REGISTER_CALLBACKS 0U /* WWDG register callback disabled */ #define USE_HAL_WWDG_REGISTER_CALLBACKS 0U /* WWDG register callback disabled */

View File

@ -57,6 +57,7 @@ void PVD_AVD_IRQHandler(void);
void FLASH_IRQHandler(void); void FLASH_IRQHandler(void);
void RCC_IRQHandler(void); void RCC_IRQHandler(void);
void DMA1_Stream0_IRQHandler(void); void DMA1_Stream0_IRQHandler(void);
void DMA1_Stream1_IRQHandler(void);
void TIM2_IRQHandler(void); void TIM2_IRQHandler(void);
void TIM3_IRQHandler(void); void TIM3_IRQHandler(void);
void USART1_IRQHandler(void); void USART1_IRQHandler(void);

View File

@ -23,4 +23,11 @@ extern osEventFlagsId_t g_user_lvgl_event_handle;
void user_lvgl_task(void *argument); void user_lvgl_task(void *argument);
extern osThreadId_t g_user_sysview_task_handle;
extern osThreadAttr_t g_user_sysview_task_attributes;
extern osSemaphoreId_t g_user_sysview_uart_rx_semphr;
extern osSemaphoreId_t g_user_sysview_uart_tx_semphr;
void user_sysview_task(void *argument);
#endif #endif

View File

@ -0,0 +1,104 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_Config_FreeRTOS.c
Purpose : Sample setup configuration of SystemView with FreeRTOS.
Revision: $Rev: 7745 $
*/
#include "FreeRTOS.h"
#include "SEGGER_SYSVIEW.h"
extern const SEGGER_SYSVIEW_OS_API SYSVIEW_X_OS_TraceAPI;
/*********************************************************************
*
* Defines, configurable
*
**********************************************************************
*/
// The application name to be displayed in SystemViewer
#define SYSVIEW_APP_NAME "STM32H750XB Hello Application"
// The target device name
#define SYSVIEW_DEVICE_NAME "Cortex-M7F"
// Frequency of the timestamp. Must match SEGGER_SYSVIEW_GET_TIMESTAMP in SEGGER_SYSVIEW_Conf.h
#define SYSVIEW_TIMESTAMP_FREQ (configCPU_CLOCK_HZ)
// System Frequency. SystemcoreClock is used in most CMSIS compatible projects.
#define SYSVIEW_CPU_FREQ configCPU_CLOCK_HZ
// The lowest RAM address used for IDs (pointers)
#define SYSVIEW_RAM_BASE (0x10000000)
/*********************************************************************
*
* _cbSendSystemDesc()
*
* Function description
* Sends SystemView description strings.
*/
static void _cbSendSystemDesc(void) {
SEGGER_SYSVIEW_SendSysDesc("N="SYSVIEW_APP_NAME",D="SYSVIEW_DEVICE_NAME",O=FreeRTOS");
SEGGER_SYSVIEW_SendSysDesc("I#15=SysTick");
}
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
void SEGGER_SYSVIEW_Conf(void) {
SEGGER_SYSVIEW_Init(SYSVIEW_TIMESTAMP_FREQ, SYSVIEW_CPU_FREQ,
&SYSVIEW_X_OS_TraceAPI, _cbSendSystemDesc);
SEGGER_SYSVIEW_SetRAMBase(SYSVIEW_RAM_BASE);
}
/*************************** End of file ****************************/

View File

@ -54,6 +54,7 @@ TIM_HandleTypeDef htim2;
TIM_HandleTypeDef htim3; TIM_HandleTypeDef htim3;
UART_HandleTypeDef huart1; UART_HandleTypeDef huart1;
DMA_HandleTypeDef hdma_usart1_tx;
DMA_HandleTypeDef hdma_memtomem_dma1_stream0; DMA_HandleTypeDef hdma_memtomem_dma1_stream0;
SDRAM_HandleTypeDef hsdram1; SDRAM_HandleTypeDef hsdram1;
@ -174,6 +175,13 @@ int main(void)
/* USER CODE BEGIN RTOS_EVENTS */ /* USER CODE BEGIN RTOS_EVENTS */
/* add events, ... */ /* add events, ... */
CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;
DWT->CYCCNT = 0;
DWT->CTRL |= DWT_CTRL_CYCCNTENA_Msk;
SEGGER_SYSVIEW_Conf();
/* USER CODE END RTOS_EVENTS */ /* USER CODE END RTOS_EVENTS */
/* Start scheduler */ /* Start scheduler */
@ -659,6 +667,9 @@ static void MX_DMA_Init(void)
/* DMA1_Stream0_IRQn interrupt configuration */ /* DMA1_Stream0_IRQn interrupt configuration */
HAL_NVIC_SetPriority(DMA1_Stream0_IRQn, 5, 0); HAL_NVIC_SetPriority(DMA1_Stream0_IRQn, 5, 0);
HAL_NVIC_EnableIRQ(DMA1_Stream0_IRQn); HAL_NVIC_EnableIRQ(DMA1_Stream0_IRQn);
/* DMA1_Stream1_IRQn interrupt configuration */
HAL_NVIC_SetPriority(DMA1_Stream1_IRQn, 5, 0);
HAL_NVIC_EnableIRQ(DMA1_Stream1_IRQn);
} }

View File

@ -24,6 +24,7 @@
/* USER CODE BEGIN Includes */ /* USER CODE BEGIN Includes */
/* USER CODE END Includes */ /* USER CODE END Includes */
extern DMA_HandleTypeDef hdma_usart1_tx;
/* Private typedef -----------------------------------------------------------*/ /* Private typedef -----------------------------------------------------------*/
/* USER CODE BEGIN TD */ /* USER CODE BEGIN TD */
@ -508,6 +509,25 @@ void HAL_UART_MspInit(UART_HandleTypeDef* huart)
GPIO_InitStruct.Alternate = GPIO_AF7_USART1; GPIO_InitStruct.Alternate = GPIO_AF7_USART1;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
/* USART1 DMA Init */
/* USART1_TX Init */
hdma_usart1_tx.Instance = DMA1_Stream1;
hdma_usart1_tx.Init.Request = DMA_REQUEST_USART1_TX;
hdma_usart1_tx.Init.Direction = DMA_MEMORY_TO_PERIPH;
hdma_usart1_tx.Init.PeriphInc = DMA_PINC_DISABLE;
hdma_usart1_tx.Init.MemInc = DMA_MINC_ENABLE;
hdma_usart1_tx.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
hdma_usart1_tx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
hdma_usart1_tx.Init.Mode = DMA_NORMAL;
hdma_usart1_tx.Init.Priority = DMA_PRIORITY_LOW;
hdma_usart1_tx.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
if (HAL_DMA_Init(&hdma_usart1_tx) != HAL_OK)
{
Error_Handler();
}
__HAL_LINKDMA(huart,hdmatx,hdma_usart1_tx);
/* USART1 interrupt Init */ /* USART1 interrupt Init */
HAL_NVIC_SetPriority(USART1_IRQn, 5, 0); HAL_NVIC_SetPriority(USART1_IRQn, 5, 0);
HAL_NVIC_EnableIRQ(USART1_IRQn); HAL_NVIC_EnableIRQ(USART1_IRQn);
@ -540,6 +560,9 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* huart)
*/ */
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_10|GPIO_PIN_9); HAL_GPIO_DeInit(GPIOA, GPIO_PIN_10|GPIO_PIN_9);
/* USART1 DMA DeInit */
HAL_DMA_DeInit(huart->hdmatx);
/* USART1 interrupt DeInit */ /* USART1 interrupt DeInit */
HAL_NVIC_DisableIRQ(USART1_IRQn); HAL_NVIC_DisableIRQ(USART1_IRQn);
/* USER CODE BEGIN USART1_MspDeInit 1 */ /* USER CODE BEGIN USART1_MspDeInit 1 */

View File

@ -62,6 +62,7 @@ extern SDRAM_HandleTypeDef hsdram1;
extern LTDC_HandleTypeDef hltdc; extern LTDC_HandleTypeDef hltdc;
extern TIM_HandleTypeDef htim2; extern TIM_HandleTypeDef htim2;
extern TIM_HandleTypeDef htim3; extern TIM_HandleTypeDef htim3;
extern DMA_HandleTypeDef hdma_usart1_tx;
extern UART_HandleTypeDef huart1; extern UART_HandleTypeDef huart1;
extern TIM_HandleTypeDef htim7; extern TIM_HandleTypeDef htim7;
@ -223,6 +224,20 @@ void DMA1_Stream0_IRQHandler(void)
/* USER CODE END DMA1_Stream0_IRQn 1 */ /* USER CODE END DMA1_Stream0_IRQn 1 */
} }
/**
* @brief This function handles DMA1 stream1 global interrupt.
*/
void DMA1_Stream1_IRQHandler(void)
{
/* USER CODE BEGIN DMA1_Stream1_IRQn 0 */
/* USER CODE END DMA1_Stream1_IRQn 0 */
HAL_DMA_IRQHandler(&hdma_usart1_tx);
/* USER CODE BEGIN DMA1_Stream1_IRQn 1 */
/* USER CODE END DMA1_Stream1_IRQn 1 */
}
/** /**
* @brief This function handles TIM2 global interrupt. * @brief This function handles TIM2 global interrupt.
*/ */

View File

@ -0,0 +1,110 @@
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "stm32h7xx_hal.h"
#include "SEGGER_RTT.h"
#include "SEGGER_SYSVIEW.h"
#include "SEGGER_SYSVIEW_Conf.h"
#include "user_tasks.h"
#define SYSVIEW_TX_SIZE 1024
extern UART_HandleTypeDef huart1;
osThreadId_t g_user_sysview_task_handle;
osThreadAttr_t g_user_sysview_task_attributes = {
.name = "SV_TASK",
.stack_size = 256 * 4,
.priority = (osPriority_t)osPriorityNormal,
};
osSemaphoreId_t g_user_sysview_uart_rx_semphr;
osSemaphoreId_t g_user_sysview_uart_tx_semphr;
uint8_t g_sysview_tx_buf[SYSVIEW_TX_SIZE] __attribute__((section(".dma_ram")));
static const U8 sysview_hello_message[] = {
'S',
'E',
'G',
'G',
'E',
'R',
' ',
'S',
'y',
's',
't',
'e',
'm',
'V',
'i',
'e',
'w',
' ',
'V',
'0' + SEGGER_SYSVIEW_MAJOR,
'.',
'0' + (SEGGER_SYSVIEW_MINOR / 10),
'0' + (SEGGER_SYSVIEW_MINOR % 10),
'.',
'0' + (SEGGER_SYSVIEW_REV / 10),
'0' + (SEGGER_SYSVIEW_REV % 10),
'\0',
0,
0,
0,
0,
0,
};
void _user_uart_recv_callback(UART_HandleTypeDef *huart) {
osSemaphoreRelease(g_user_sysview_uart_rx_semphr);
}
void _user_uart_send_callback(UART_HandleTypeDef *huart) {
osSemaphoreRelease(g_user_sysview_uart_tx_semphr);
}
void user_sysview_task(void *argument) {
uint8_t rx_buf[1];
int channel_id = SEGGER_SYSVIEW_GetChannelID();
g_user_sysview_uart_rx_semphr = osSemaphoreNew(1U, 0U, NULL);
if(g_user_sysview_uart_rx_semphr == NULL) osThreadExit();
g_user_sysview_uart_tx_semphr = osSemaphoreNew(1U, 0U, NULL);
if(g_user_sysview_uart_tx_semphr == NULL) osThreadExit();
HAL_UART_RegisterCallback(&huart1, HAL_UART_RX_COMPLETE_CB_ID,
_user_uart_recv_callback);
HAL_UART_RegisterCallback(&huart1, HAL_UART_TX_COMPLETE_CB_ID,
_user_uart_send_callback);
HAL_UART_Transmit_DMA(&huart1, (uint8_t *)sysview_hello_message,
sizeof(sysview_hello_message));
SEGGER_SYSVIEW_Start();
HAL_UART_Receive_IT(&huart1, rx_buf, 1);
for(;;) {
if(osSemaphoreGetCount(g_user_sysview_uart_rx_semphr) > 0) {
SEGGER_RTT_WriteDownBufferNoLock(channel_id, rx_buf, 1);
osSemaphoreAcquire(g_user_sysview_uart_rx_semphr, osWaitForever);
HAL_UART_Receive_IT(&huart1, rx_buf, 1);
};
if(osSemaphoreAcquire(g_user_sysview_uart_tx_semphr, 100) == osOK) {
unsigned int tx_len = SEGGER_RTT_GetBytesInBuffer(channel_id);
unsigned int real_len = SEGGER_RTT_ReadUpBufferNoLock(
channel_id, g_sysview_tx_buf, ((tx_len > SYSVIEW_TX_SIZE) ? SYSVIEW_TX_SIZE : tx_len));
if(real_len > 0) HAL_UART_Transmit_DMA(&huart1, g_sysview_tx_buf, real_len);
}
osDelay(50);
}
}

View File

@ -5,5 +5,5 @@
extern UART_HandleTypeDef huart1; extern UART_HandleTypeDef huart1;
void _putchar(char character) { void _putchar(char character) {
HAL_UART_Transmit(&huart1, (uint8_t *)&character, 0x01, 1000); //HAL_UART_Transmit(&huart1, (uint8_t *)&character, 0x01, 1000);
} }

View File

@ -5,6 +5,10 @@
#include "user_tasks.h" #include "user_tasks.h"
void user_tasks_init(void) { void user_tasks_init(void) {
g_user_sysview_task_handle = osThreadNew(user_sysview_task, NULL, &g_user_sysview_task_attributes);
if(g_user_sysview_task_handle == NULL) Error_Handler();
// Create LVGL event flag. // Create LVGL event flag.
g_user_lvgl_event_handle = osEventFlagsNew(NULL); g_user_lvgl_event_handle = osEventFlagsNew(NULL);
if(g_user_lvgl_event_handle == NULL) { if(g_user_lvgl_event_handle == NULL) {

View File

@ -1,5 +1,5 @@
########################################################################################################################## ##########################################################################################################################
# File automatically-generated by tool: [projectgenerator] version: [3.13.0-B3] date: [Thu Mar 04 22:59:26 CST 2021] # File automatically-generated by tool: [projectgenerator] version: [3.13.0-B3] date: [Fri Mar 05 23:04:25 CST 2021]
########################################################################################################################## ##########################################################################################################################
# ------------------------------------------------ # ------------------------------------------------

View File

@ -160,6 +160,10 @@ extern "C" {
#define INCLUDE_uxTaskGetStackHighWaterMark2 0 #define INCLUDE_uxTaskGetStackHighWaterMark2 0
#endif #endif
#ifndef INCLUDE_pxTaskGetStackStart
#define INCLUDE_pxTaskGetStackStart 0
#endif
#ifndef INCLUDE_eTaskGetState #ifndef INCLUDE_eTaskGetState
#define INCLUDE_eTaskGetState 0 #define INCLUDE_eTaskGetState 0
#endif #endif
@ -416,6 +420,23 @@ hold explicit before calling the code. */
#define tracePOST_MOVED_TASK_TO_READY_STATE( pxTCB ) #define tracePOST_MOVED_TASK_TO_READY_STATE( pxTCB )
#endif #endif
#ifndef traceREADDED_TASK_TO_READY_STATE
#define traceREADDED_TASK_TO_READY_STATE( pxTCB ) traceMOVED_TASK_TO_READY_STATE( pxTCB )
#endif
#ifndef traceMOVED_TASK_TO_DELAYED_LIST
#define traceMOVED_TASK_TO_DELAYED_LIST()
#endif
#ifndef traceMOVED_TASK_TO_OVERFLOW_DELAYED_LIST
#define traceMOVED_TASK_TO_OVERFLOW_DELAYED_LIST()
#endif
#ifndef traceMOVED_TASK_TO_SUSPENDED_LIST
#define traceMOVED_TASK_TO_SUSPENDED_LIST( pxTCB )
#endif
#ifndef traceQUEUE_CREATE #ifndef traceQUEUE_CREATE
#define traceQUEUE_CREATE( pxNewQueue ) #define traceQUEUE_CREATE( pxNewQueue )
#endif #endif
@ -660,6 +681,18 @@ hold explicit before calling the code. */
#define traceTASK_NOTIFY_GIVE_FROM_ISR() #define traceTASK_NOTIFY_GIVE_FROM_ISR()
#endif #endif
#ifndef traceISR_EXIT_TO_SCHEDULER
#define traceISR_EXIT_TO_SCHEDULER()
#endif
#ifndef traceISR_EXIT
#define traceISR_EXIT()
#endif
#ifndef traceISR_ENTER
#define traceISR_ENTER()
#endif
#ifndef traceSTREAM_BUFFER_CREATE_FAILED #ifndef traceSTREAM_BUFFER_CREATE_FAILED
#define traceSTREAM_BUFFER_CREATE_FAILED( xIsMessageBuffer ) #define traceSTREAM_BUFFER_CREATE_FAILED( xIsMessageBuffer )
#endif #endif

View File

@ -1468,6 +1468,25 @@ UBaseType_t uxTaskGetStackHighWaterMark( TaskHandle_t xTask ) PRIVILEGED_FUNCTIO
*/ */
configSTACK_DEPTH_TYPE uxTaskGetStackHighWaterMark2( TaskHandle_t xTask ) PRIVILEGED_FUNCTION; configSTACK_DEPTH_TYPE uxTaskGetStackHighWaterMark2( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
/**
* task.h
* <PRE>uint8_t* pxTaskGetStackStart( TaskHandle_t xTask);</PRE>
*
* INCLUDE_pxTaskGetStackStart must be set to 1 in FreeRTOSConfig.h for
* this function to be available.
*
* Returns the start of the stack associated with xTask. That is,
* the highest stack memory address on architectures where the stack grows down
* from high memory, and the lowest memory address on architectures where the
* stack grows up from low memory.
*
* @param xTask Handle of the task associated with the stack returned.
* Set xTask to NULL to return the stack of the calling task.
*
* @return A pointer to the start of the stack.
*/
uint8_t* pxTaskGetStackStart( TaskHandle_t xTask) PRIVILEGED_FUNCTION;
/* When using trace macros it is sometimes necessary to include task.h before /* When using trace macros it is sometimes necessary to include task.h before
FreeRTOS.h. When this is done TaskHookFunction_t will not yet have been defined, FreeRTOS.h. When this is done TaskHookFunction_t will not yet have been defined,
so the following two prototypes will cause a compilation error. This can be so the following two prototypes will cause a compilation error. This can be

View File

@ -492,14 +492,20 @@ void xPortSysTickHandler( void )
save and then restore the interrupt mask value as its value is already save and then restore the interrupt mask value as its value is already
known. */ known. */
portDISABLE_INTERRUPTS(); portDISABLE_INTERRUPTS();
traceISR_ENTER();
{ {
/* Increment the RTOS tick. */ /* Increment the RTOS tick. */
if( xTaskIncrementTick() != pdFALSE ) if( xTaskIncrementTick() != pdFALSE )
{ {
traceISR_EXIT_TO_SCHEDULER();
/* A context switch is required. Context switching is performed in /* A context switch is required. Context switching is performed in
the PendSV interrupt. Pend the PendSV interrupt. */ the PendSV interrupt. Pend the PendSV interrupt. */
portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT; portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT;
} }
else
{
traceISR_EXIT();
}
} }
portENABLE_INTERRUPTS(); portENABLE_INTERRUPTS();
} }

View File

@ -89,7 +89,7 @@ typedef unsigned long UBaseType_t;
#define portNVIC_INT_CTRL_REG ( * ( ( volatile uint32_t * ) 0xe000ed04 ) ) #define portNVIC_INT_CTRL_REG ( * ( ( volatile uint32_t * ) 0xe000ed04 ) )
#define portNVIC_PENDSVSET_BIT ( 1UL << 28UL ) #define portNVIC_PENDSVSET_BIT ( 1UL << 28UL )
#define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired != pdFALSE ) portYIELD() #define portEND_SWITCHING_ISR( xSwitchRequired ) { if( xSwitchRequired != pdFALSE ) { traceISR_EXIT_TO_SCHEDULER(); portYIELD(); } else { traceISR_EXIT(); } }
#define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x ) #define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/

View File

@ -220,6 +220,17 @@ count overflows. */
taskRECORD_READY_PRIORITY( ( pxTCB )->uxPriority ); \ taskRECORD_READY_PRIORITY( ( pxTCB )->uxPriority ); \
vListInsertEnd( &( pxReadyTasksLists[ ( pxTCB )->uxPriority ] ), &( ( pxTCB )->xStateListItem ) ); \ vListInsertEnd( &( pxReadyTasksLists[ ( pxTCB )->uxPriority ] ), &( ( pxTCB )->xStateListItem ) ); \
tracePOST_MOVED_TASK_TO_READY_STATE( pxTCB ) tracePOST_MOVED_TASK_TO_READY_STATE( pxTCB )
/*
* Place the task represented by pxTCB which has been in a ready list before
* into the appropriate ready list for the task.
* It is inserted at the end of the list.
*/
#define prvReaddTaskToReadyList( pxTCB ) \
traceREADDED_TASK_TO_READY_STATE( pxTCB ); \
taskRECORD_READY_PRIORITY( ( pxTCB )->uxPriority ); \
vListInsertEnd( &( pxReadyTasksLists[ ( pxTCB )->uxPriority ] ), &( ( pxTCB )->xStateListItem ) ); \
tracePOST_MOVED_TASK_TO_READY_STATE( pxTCB )
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
/* /*
@ -1672,7 +1683,7 @@ static void prvAddNewTaskToReadyList( TCB_t *pxNewTCB )
{ {
mtCOVERAGE_TEST_MARKER(); mtCOVERAGE_TEST_MARKER();
} }
prvAddTaskToReadyList( pxTCB ); prvReaddTaskToReadyList( pxTCB );
} }
else else
{ {
@ -1733,7 +1744,7 @@ static void prvAddNewTaskToReadyList( TCB_t *pxNewTCB )
{ {
mtCOVERAGE_TEST_MARKER(); mtCOVERAGE_TEST_MARKER();
} }
traceMOVED_TASK_TO_SUSPENDED_LIST(pxTCB);
vListInsertEnd( &xSuspendedTaskList, &( pxTCB->xStateListItem ) ); vListInsertEnd( &xSuspendedTaskList, &( pxTCB->xStateListItem ) );
#if( configUSE_TASK_NOTIFICATIONS == 1 ) #if( configUSE_TASK_NOTIFICATIONS == 1 )
@ -3882,6 +3893,20 @@ static void prvCheckTasksWaitingTermination( void )
#endif /* INCLUDE_uxTaskGetStackHighWaterMark */ #endif /* INCLUDE_uxTaskGetStackHighWaterMark */
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
#if (INCLUDE_pxTaskGetStackStart == 1)
uint8_t* pxTaskGetStackStart( TaskHandle_t xTask)
{
TCB_t *pxTCB;
UBaseType_t uxReturn;
(void)uxReturn;
pxTCB = prvGetTCBFromHandle( xTask );
return ( uint8_t * ) pxTCB->pxStack;
}
#endif /* INCLUDE_pxTaskGetStackStart */
/*-----------------------------------------------------------*/
#if ( INCLUDE_vTaskDelete == 1 ) #if ( INCLUDE_vTaskDelete == 1 )
static void prvDeleteTCB( TCB_t *pxTCB ) static void prvDeleteTCB( TCB_t *pxTCB )
@ -4056,7 +4081,7 @@ TCB_t *pxTCB;
/* Inherit the priority before being moved into the new list. */ /* Inherit the priority before being moved into the new list. */
pxMutexHolderTCB->uxPriority = pxCurrentTCB->uxPriority; pxMutexHolderTCB->uxPriority = pxCurrentTCB->uxPriority;
prvAddTaskToReadyList( pxMutexHolderTCB ); prvReaddTaskToReadyList( pxMutexHolderTCB );
} }
else else
{ {
@ -4146,7 +4171,7 @@ TCB_t *pxTCB;
any other purpose if this task is running, and it must be any other purpose if this task is running, and it must be
running to give back the mutex. */ running to give back the mutex. */
listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), ( TickType_t ) configMAX_PRIORITIES - ( TickType_t ) pxTCB->uxPriority ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */ listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), ( TickType_t ) configMAX_PRIORITIES - ( TickType_t ) pxTCB->uxPriority ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */
prvAddTaskToReadyList( pxTCB ); prvReaddTaskToReadyList( pxTCB );
/* Return true to indicate that a context switch is required. /* Return true to indicate that a context switch is required.
This is only actually required in the corner case whereby This is only actually required in the corner case whereby
@ -5208,6 +5233,7 @@ const TickType_t xConstTickCount = xTickCount;
/* Add the task to the suspended task list instead of a delayed task /* Add the task to the suspended task list instead of a delayed task
list to ensure it is not woken by a timing event. It will block list to ensure it is not woken by a timing event. It will block
indefinitely. */ indefinitely. */
traceMOVED_TASK_TO_SUSPENDED_LIST(pxCurrentTCB);
vListInsertEnd( &xSuspendedTaskList, &( pxCurrentTCB->xStateListItem ) ); vListInsertEnd( &xSuspendedTaskList, &( pxCurrentTCB->xStateListItem ) );
} }
else else
@ -5224,12 +5250,14 @@ const TickType_t xConstTickCount = xTickCount;
{ {
/* Wake time has overflowed. Place this item in the overflow /* Wake time has overflowed. Place this item in the overflow
list. */ list. */
traceMOVED_TASK_TO_OVERFLOW_DELAYED_LIST();
vListInsert( pxOverflowDelayedTaskList, &( pxCurrentTCB->xStateListItem ) ); vListInsert( pxOverflowDelayedTaskList, &( pxCurrentTCB->xStateListItem ) );
} }
else else
{ {
/* The wake time has not overflowed, so the current block list /* The wake time has not overflowed, so the current block list
is used. */ is used. */
traceMOVED_TASK_TO_DELAYED_LIST();
vListInsert( pxDelayedTaskList, &( pxCurrentTCB->xStateListItem ) ); vListInsert( pxDelayedTaskList, &( pxCurrentTCB->xStateListItem ) );
/* If the task entering the blocked state was placed at the /* If the task entering the blocked state was placed at the
@ -5259,11 +5287,13 @@ const TickType_t xConstTickCount = xTickCount;
if( xTimeToWake < xConstTickCount ) if( xTimeToWake < xConstTickCount )
{ {
/* Wake time has overflowed. Place this item in the overflow list. */ /* Wake time has overflowed. Place this item in the overflow list. */
traceMOVED_TASK_TO_OVERFLOW_DELAYED_LIST();
vListInsert( pxOverflowDelayedTaskList, &( pxCurrentTCB->xStateListItem ) ); vListInsert( pxOverflowDelayedTaskList, &( pxCurrentTCB->xStateListItem ) );
} }
else else
{ {
/* The wake time has not overflowed, so the current block list is used. */ /* The wake time has not overflowed, so the current block list is used. */
traceMOVED_TASK_TO_DELAYED_LIST();
vListInsert( pxDelayedTaskList, &( pxCurrentTCB->xStateListItem ) ); vListInsert( pxDelayedTaskList, &( pxCurrentTCB->xStateListItem ) );
/* If the task entering the blocked state was placed at the head of the /* If the task entering the blocked state was placed at the head of the

View File

@ -0,0 +1,113 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
----------------------------------------------------------------------
File : Global.h
Purpose : Global types
In case your application already has a Global.h, you should
merge the files. In order to use Segger code, the types
U8, U16, U32, I8, I16, I32 need to be defined in Global.h;
additional definitions do not hurt.
Revision: $Rev: 12501 $
---------------------------END-OF-HEADER------------------------------
*/
#ifndef GLOBAL_H // Guard against multiple inclusion
#define GLOBAL_H
#define U8 unsigned char
#define I8 signed char
#define U16 unsigned short
#define I16 signed short
#ifdef __x86_64__
#define U32 unsigned
#define I32 int
#else
#define U32 unsigned long
#define I32 signed long
#endif
//
// CC_NO_LONG_SUPPORT can be defined to compile test
// without long support for compilers that do not
// support C99 and its long type.
//
#ifdef CC_NO_LONG_SUPPORT
#define PTR_ADDR U32
#else // Supports long type.
#if defined(_WIN32) && !defined(__clang__) && !defined(__MINGW32__)
//
// Microsoft VC6 compiler related
//
#define U64 unsigned __int64
#define U128 unsigned __int128
#define I64 __int64
#define I128 __int128
#if _MSC_VER <= 1200
#define U64_C(x) x##UI64
#else
#define U64_C(x) x##ULL
#endif
#else
//
// C99 compliant compiler
//
#define U64 unsigned long long
#define I64 signed long long
#define U64_C(x) x##ULL
#endif
#if (defined(_WIN64) || defined(__LP64__)) // 64-bit symbols used by Visual Studio and GCC, maybe others as well.
#define PTR_ADDR U64
#else
#define PTR_ADDR U32
#endif
#endif // Supports long type.
#endif // Avoid multiple inclusion
/*************************** End of file ****************************/

View File

@ -0,0 +1,428 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
---------------------------END-OF-HEADER------------------------------
File : SEGGER_RTT_Conf.h
Purpose : Implementation of SEGGER real-time transfer (RTT) which
allows real-time communication on targets which support
debugger memory accesses while the CPU is running.
Revision: $Rev: 21386 $
*/
#ifndef SEGGER_RTT_CONF_H
#define SEGGER_RTT_CONF_H
#ifdef __IAR_SYSTEMS_ICC__
#include <intrinsics.h>
#endif
/*********************************************************************
*
* Defines, configurable
*
**********************************************************************
*/
//
// Take in and set to correct values for Cortex-A systems with CPU cache
//
//#define SEGGER_RTT_CPU_CACHE_LINE_SIZE (32) // Largest cache line size (in bytes) in the current system
//#define SEGGER_RTT_UNCACHED_OFF (0xFB000000) // Address alias where RTT CB and buffers can be accessed uncached
//
// Most common case:
// Up-channel 0: RTT
// Up-channel 1: SystemView
//
#ifndef SEGGER_RTT_MAX_NUM_UP_BUFFERS
#define SEGGER_RTT_MAX_NUM_UP_BUFFERS (3) // Max. number of up-buffers (T->H) available on this target (Default: 3)
#endif
//
// Most common case:
// Down-channel 0: RTT
// Down-channel 1: SystemView
//
#ifndef SEGGER_RTT_MAX_NUM_DOWN_BUFFERS
#define SEGGER_RTT_MAX_NUM_DOWN_BUFFERS (3) // Max. number of down-buffers (H->T) available on this target (Default: 3)
#endif
#ifndef BUFFER_SIZE_UP
#define BUFFER_SIZE_UP (1024) // Size of the buffer for terminal output of target, up to host (Default: 1k)
#endif
#ifndef BUFFER_SIZE_DOWN
#define BUFFER_SIZE_DOWN (16) // Size of the buffer for terminal input to target from host (Usually keyboard input) (Default: 16)
#endif
#ifndef SEGGER_RTT_PRINTF_BUFFER_SIZE
#define SEGGER_RTT_PRINTF_BUFFER_SIZE (64u) // Size of buffer for RTT printf to bulk-send chars via RTT (Default: 64)
#endif
#ifndef SEGGER_RTT_MODE_DEFAULT
#define SEGGER_RTT_MODE_DEFAULT SEGGER_RTT_MODE_NO_BLOCK_SKIP // Mode for pre-initialized terminal channel (buffer 0)
#endif
/*********************************************************************
*
* RTT memcpy configuration
*
* memcpy() is good for large amounts of data,
* but the overhead is big for small amounts, which are usually stored via RTT.
* With SEGGER_RTT_MEMCPY_USE_BYTELOOP a simple byte loop can be used instead.
*
* SEGGER_RTT_MEMCPY() can be used to replace standard memcpy() in RTT functions.
* This is may be required with memory access restrictions,
* such as on Cortex-A devices with MMU.
*/
#ifndef SEGGER_RTT_MEMCPY_USE_BYTELOOP
#define SEGGER_RTT_MEMCPY_USE_BYTELOOP 0 // 0: Use memcpy/SEGGER_RTT_MEMCPY, 1: Use a simple byte-loop
#endif
//
// Example definition of SEGGER_RTT_MEMCPY to external memcpy with GCC toolchains and Cortex-A targets
//
//#if ((defined __SES_ARM) || (defined __CROSSWORKS_ARM) || (defined __GNUC__)) && (defined (__ARM_ARCH_7A__))
// #define SEGGER_RTT_MEMCPY(pDest, pSrc, NumBytes) SEGGER_memcpy((pDest), (pSrc), (NumBytes))
//#endif
//
// Target is not allowed to perform other RTT operations while string still has not been stored completely.
// Otherwise we would probably end up with a mixed string in the buffer.
// If using RTT from within interrupts, multiple tasks or multi processors, define the SEGGER_RTT_LOCK() and SEGGER_RTT_UNLOCK() function here.
//
// SEGGER_RTT_MAX_INTERRUPT_PRIORITY can be used in the sample lock routines on Cortex-M3/4.
// Make sure to mask all interrupts which can send RTT data, i.e. generate SystemView events, or cause task switches.
// When high-priority interrupts must not be masked while sending RTT data, SEGGER_RTT_MAX_INTERRUPT_PRIORITY needs to be adjusted accordingly.
// (Higher priority = lower priority number)
// Default value for embOS: 128u
// Default configuration in FreeRTOS: configMAX_SYSCALL_INTERRUPT_PRIORITY: ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
// In case of doubt mask all interrupts: 1 << (8 - BASEPRI_PRIO_BITS) i.e. 1 << 5 when 3 bits are implemented in NVIC
// or define SEGGER_RTT_LOCK() to completely disable interrupts.
//
#ifndef SEGGER_RTT_MAX_INTERRUPT_PRIORITY
#define SEGGER_RTT_MAX_INTERRUPT_PRIORITY (0x20) // Interrupt priority to lock on SEGGER_RTT_LOCK on Cortex-M3/4 (Default: 0x20)
#endif
/*********************************************************************
*
* RTT lock configuration for SEGGER Embedded Studio,
* Rowley CrossStudio and GCC
*/
#if ((defined(__SES_ARM) || defined(__SES_RISCV) || defined(__CROSSWORKS_ARM) || defined(__GNUC__) || defined(__clang__)) && !defined (__CC_ARM) && !defined(WIN32))
#if (defined(__ARM_ARCH_6M__) || defined(__ARM_ARCH_8M_BASE__))
#define SEGGER_RTT_LOCK() { \
unsigned int _SEGGER_RTT__LockState; \
__asm volatile ("mrs %0, primask \n\t" \
"movs r1, #1 \n\t" \
"msr primask, r1 \n\t" \
: "=r" (_SEGGER_RTT__LockState) \
: \
: "r1", "cc" \
);
#define SEGGER_RTT_UNLOCK() __asm volatile ("msr primask, %0 \n\t" \
: \
: "r" (_SEGGER_RTT__LockState) \
: \
); \
}
#elif (defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_8M_MAIN__))
#ifndef SEGGER_RTT_MAX_INTERRUPT_PRIORITY
#define SEGGER_RTT_MAX_INTERRUPT_PRIORITY (0x20)
#endif
#define SEGGER_RTT_LOCK() { \
unsigned int _SEGGER_RTT__LockState; \
__asm volatile ("mrs %0, basepri \n\t" \
"mov r1, %1 \n\t" \
"msr basepri, r1 \n\t" \
: "=r" (_SEGGER_RTT__LockState) \
: "i"(SEGGER_RTT_MAX_INTERRUPT_PRIORITY) \
: "r1", "cc" \
);
#define SEGGER_RTT_UNLOCK() __asm volatile ("msr basepri, %0 \n\t" \
: \
: "r" (_SEGGER_RTT__LockState) \
: \
); \
}
#elif defined(__ARM_ARCH_7A__)
#define SEGGER_RTT_LOCK() { \
unsigned int _SEGGER_RTT__LockState; \
__asm volatile ("mrs r1, CPSR \n\t" \
"mov %0, r1 \n\t" \
"orr r1, r1, #0xC0 \n\t" \
"msr CPSR_c, r1 \n\t" \
: "=r" (_SEGGER_RTT__LockState) \
: \
: "r1", "cc" \
);
#define SEGGER_RTT_UNLOCK() __asm volatile ("mov r0, %0 \n\t" \
"mrs r1, CPSR \n\t" \
"bic r1, r1, #0xC0 \n\t" \
"and r0, r0, #0xC0 \n\t" \
"orr r1, r1, r0 \n\t" \
"msr CPSR_c, r1 \n\t" \
: \
: "r" (_SEGGER_RTT__LockState) \
: "r0", "r1", "cc" \
); \
}
#elif defined(__riscv) || defined(__riscv_xlen)
#define SEGGER_RTT_LOCK() { \
unsigned int _SEGGER_RTT__LockState; \
__asm volatile ("csrr %0, mstatus \n\t" \
"csrci mstatus, 8 \n\t" \
"andi %0, %0, 8 \n\t" \
: "=r" (_SEGGER_RTT__LockState) \
: \
: \
);
#define SEGGER_RTT_UNLOCK() __asm volatile ("csrr a1, mstatus \n\t" \
"or %0, %0, a1 \n\t" \
"csrs mstatus, %0 \n\t" \
: \
: "r" (_SEGGER_RTT__LockState) \
: "a1" \
); \
}
#else
#define SEGGER_RTT_LOCK()
#define SEGGER_RTT_UNLOCK()
#endif
#endif
/*********************************************************************
*
* RTT lock configuration for IAR EWARM
*/
#ifdef __ICCARM__
#if (defined (__ARM6M__) && (__CORE__ == __ARM6M__)) || \
(defined (__ARM8M_BASELINE__) && (__CORE__ == __ARM8M_BASELINE__))
#define SEGGER_RTT_LOCK() { \
unsigned int _SEGGER_RTT__LockState; \
_SEGGER_RTT__LockState = __get_PRIMASK(); \
__set_PRIMASK(1);
#define SEGGER_RTT_UNLOCK() __set_PRIMASK(_SEGGER_RTT__LockState); \
}
#elif (defined (__ARM7EM__) && (__CORE__ == __ARM7EM__)) || \
(defined (__ARM7M__) && (__CORE__ == __ARM7M__)) || \
(defined (__ARM8M_MAINLINE__) && (__CORE__ == __ARM8M_MAINLINE__)) || \
(defined (__ARM8M_MAINLINE__) && (__CORE__ == __ARM8M_MAINLINE__))
#ifndef SEGGER_RTT_MAX_INTERRUPT_PRIORITY
#define SEGGER_RTT_MAX_INTERRUPT_PRIORITY (0x20)
#endif
#define SEGGER_RTT_LOCK() { \
unsigned int _SEGGER_RTT__LockState; \
_SEGGER_RTT__LockState = __get_BASEPRI(); \
__set_BASEPRI(SEGGER_RTT_MAX_INTERRUPT_PRIORITY);
#define SEGGER_RTT_UNLOCK() __set_BASEPRI(_SEGGER_RTT__LockState); \
}
#elif (defined (__ARM7A__) && (__CORE__ == __ARM7A__)) || \
(defined (__ARM7R__) && (__CORE__ == __ARM7R__))
#define SEGGER_RTT_LOCK() { \
unsigned int _SEGGER_RTT__LockState; \
__asm volatile ("mrs r1, CPSR \n\t" \
"mov %0, r1 \n\t" \
"orr r1, r1, #0xC0 \n\t" \
"msr CPSR_c, r1 \n\t" \
: "=r" (_SEGGER_RTT__LockState) \
: \
: "r1", "cc" \
);
#define SEGGER_RTT_UNLOCK() __asm volatile ("mov r0, %0 \n\t" \
"mrs r1, CPSR \n\t" \
"bic r1, r1, #0xC0 \n\t" \
"and r0, r0, #0xC0 \n\t" \
"orr r1, r1, r0 \n\t" \
"msr CPSR_c, r1 \n\t" \
: \
: "r" (_SEGGER_RTT__LockState) \
: "r0", "r1", "cc" \
); \
}
#endif
#endif
/*********************************************************************
*
* RTT lock configuration for IAR RX
*/
#ifdef __ICCRX__
#define SEGGER_RTT_LOCK() { \
unsigned long _SEGGER_RTT__LockState; \
_SEGGER_RTT__LockState = __get_interrupt_state(); \
__disable_interrupt();
#define SEGGER_RTT_UNLOCK() __set_interrupt_state(_SEGGER_RTT__LockState); \
}
#endif
/*********************************************************************
*
* RTT lock configuration for IAR RL78
*/
#ifdef __ICCRL78__
#define SEGGER_RTT_LOCK() { \
__istate_t _SEGGER_RTT__LockState; \
_SEGGER_RTT__LockState = __get_interrupt_state(); \
__disable_interrupt();
#define SEGGER_RTT_UNLOCK() __set_interrupt_state(_SEGGER_RTT__LockState); \
}
#endif
/*********************************************************************
*
* RTT lock configuration for KEIL ARM
*/
#ifdef __CC_ARM
#if (defined __TARGET_ARCH_6S_M)
#define SEGGER_RTT_LOCK() { \
unsigned int _SEGGER_RTT__LockState; \
register unsigned char _SEGGER_RTT__PRIMASK __asm( "primask"); \
_SEGGER_RTT__LockState = _SEGGER_RTT__PRIMASK; \
_SEGGER_RTT__PRIMASK = 1u; \
__schedule_barrier();
#define SEGGER_RTT_UNLOCK() _SEGGER_RTT__PRIMASK = _SEGGER_RTT__LockState; \
__schedule_barrier(); \
}
#elif (defined(__TARGET_ARCH_7_M) || defined(__TARGET_ARCH_7E_M))
#ifndef SEGGER_RTT_MAX_INTERRUPT_PRIORITY
#define SEGGER_RTT_MAX_INTERRUPT_PRIORITY (0x20)
#endif
#define SEGGER_RTT_LOCK() { \
unsigned int _SEGGER_RTT__LockState; \
register unsigned char BASEPRI __asm( "basepri"); \
_SEGGER_RTT__LockState = BASEPRI; \
BASEPRI = SEGGER_RTT_MAX_INTERRUPT_PRIORITY; \
__schedule_barrier();
#define SEGGER_RTT_UNLOCK() BASEPRI = _SEGGER_RTT__LockState; \
__schedule_barrier(); \
}
#endif
#endif
/*********************************************************************
*
* RTT lock configuration for TI ARM
*/
#ifdef __TI_ARM__
#if defined (__TI_ARM_V6M0__)
#define SEGGER_RTT_LOCK() { \
unsigned int _SEGGER_RTT__LockState; \
_SEGGER_RTT__LockState = __get_PRIMASK(); \
__set_PRIMASK(1);
#define SEGGER_RTT_UNLOCK() __set_PRIMASK(_SEGGER_RTT__LockState); \
}
#elif (defined (__TI_ARM_V7M3__) || defined (__TI_ARM_V7M4__))
#ifndef SEGGER_RTT_MAX_INTERRUPT_PRIORITY
#define SEGGER_RTT_MAX_INTERRUPT_PRIORITY (0x20)
#endif
#define SEGGER_RTT_LOCK() { \
unsigned int _SEGGER_RTT__LockState; \
_SEGGER_RTT__LockState = _set_interrupt_priority(SEGGER_RTT_MAX_INTERRUPT_PRIORITY);
#define SEGGER_RTT_UNLOCK() _set_interrupt_priority(_SEGGER_RTT__LockState); \
}
#endif
#endif
/*********************************************************************
*
* RTT lock configuration for CCRX
*/
#ifdef __RX
#include <machine.h>
#define SEGGER_RTT_LOCK() { \
unsigned long _SEGGER_RTT__LockState; \
_SEGGER_RTT__LockState = get_psw() & 0x010000; \
clrpsw_i();
#define SEGGER_RTT_UNLOCK() set_psw(get_psw() | _SEGGER_RTT__LockState); \
}
#endif
/*********************************************************************
*
* RTT lock configuration for embOS Simulation on Windows
* (Can also be used for generic RTT locking with embOS)
*/
#if defined(WIN32) || defined(SEGGER_RTT_LOCK_EMBOS)
void OS_SIM_EnterCriticalSection(void);
void OS_SIM_LeaveCriticalSection(void);
#define SEGGER_RTT_LOCK() { \
OS_SIM_EnterCriticalSection();
#define SEGGER_RTT_UNLOCK() OS_SIM_LeaveCriticalSection(); \
}
#endif
/*********************************************************************
*
* RTT lock configuration fallback
*/
#ifndef SEGGER_RTT_LOCK
#define SEGGER_RTT_LOCK() // Lock RTT (nestable) (i.e. disable interrupts)
#endif
#ifndef SEGGER_RTT_UNLOCK
#define SEGGER_RTT_UNLOCK() // Unlock RTT (nestable) (i.e. enable previous interrupt lock state)
#endif
#endif
/*************************** End of file ****************************/

View File

@ -0,0 +1,85 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_Conf.h
Purpose : SEGGER SystemView configuration file.
Set defines which deviate from the defaults (see SEGGER_SYSVIEW_ConfDefaults.h) here.
Revision: $Rev: 21292 $
Additional information:
Required defines which must be set are:
SEGGER_SYSVIEW_GET_TIMESTAMP
SEGGER_SYSVIEW_GET_INTERRUPT_ID
For known compilers and cores, these might be set to good defaults
in SEGGER_SYSVIEW_ConfDefaults.h.
SystemView needs a (nestable) locking mechanism.
If not defined, the RTT locking mechanism is used,
which then needs to be properly configured.
*/
#ifndef SEGGER_SYSVIEW_CONF_H
#define SEGGER_SYSVIEW_CONF_H
/*********************************************************************
*
* Defines, configurable
*
**********************************************************************
*/
/*********************************************************************
* TODO: Add your defines here. *
**********************************************************************
*/
#endif // SEGGER_SYSVIEW_CONF_H
/*************************** End of file ****************************/

View File

@ -0,0 +1,248 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
----------------------------------------------------------------------
File : SEGGER.h
Purpose : Global types etc & general purpose utility functions
Revision: $Rev: 18102 $
---------------------------END-OF-HEADER------------------------------
*/
#ifndef SEGGER_H // Guard against multiple inclusion
#define SEGGER_H
#include <stdarg.h> // For va_list.
#include "Global.h" // Type definitions: U8, U16, U32, I8, I16, I32
#if defined(__cplusplus)
extern "C" { /* Make sure we have C-declarations in C++ programs */
#endif
/*********************************************************************
*
* Keywords/specifiers
*
**********************************************************************
*/
#ifndef INLINE
#if (defined(__ICCARM__) || defined(__RX) || defined(__ICCRX__))
//
// Other known compilers.
//
#define INLINE inline
#else
#if (defined(_WIN32) && !defined(__clang__))
//
// Microsoft VC6 and newer.
// Force inlining without cost checking.
//
#define INLINE __forceinline
#elif defined(__GNUC__) || defined(__clang__)
//
// Force inlining with GCC + clang
//
#define INLINE inline __attribute__((always_inline))
#elif (defined(__CC_ARM))
//
// Force inlining with ARMCC (Keil)
//
#define INLINE __inline
#else
//
// Unknown compilers.
//
#define INLINE
#endif
#endif
#endif
/*********************************************************************
*
* Function-like macros
*
**********************************************************************
*/
#define SEGGER_COUNTOF(a) (sizeof((a))/sizeof((a)[0]))
#define SEGGER_MIN(a,b) (((a) < (b)) ? (a) : (b))
#define SEGGER_MAX(a,b) (((a) > (b)) ? (a) : (b))
#ifndef SEGGER_USE_PARA // Some compiler complain about unused parameters.
#define SEGGER_USE_PARA(Para) (void)Para // This works for most compilers.
#endif
#define SEGGER_ADDR2PTR(Type, Addr) (/*lint -e(923) -e(9078)*/((Type*)((PTR_ADDR)(Addr)))) // Allow cast from address to pointer.
#define SEGGER_PTR2ADDR(p) (/*lint -e(923) -e(9078)*/((PTR_ADDR)(p))) // Allow cast from pointer to address.
#define SEGGER_PTR2PTR(Type, p) (/*lint -e(740) -e(826) -e(9079) -e(9087)*/((Type*)(p))) // Allow cast from one pointer type to another (ignore different size).
#define SEGGER_PTR_DISTANCE(p0, p1) (SEGGER_PTR2ADDR(p0) - SEGGER_PTR2ADDR(p1))
/*********************************************************************
*
* Defines
*
**********************************************************************
*/
#define SEGGER_PRINTF_FLAG_ADJLEFT (1 << 0)
#define SEGGER_PRINTF_FLAG_SIGNFORCE (1 << 1)
#define SEGGER_PRINTF_FLAG_SIGNSPACE (1 << 2)
#define SEGGER_PRINTF_FLAG_PRECEED (1 << 3)
#define SEGGER_PRINTF_FLAG_ZEROPAD (1 << 4)
#define SEGGER_PRINTF_FLAG_NEGATIVE (1 << 5)
/*********************************************************************
*
* Types
*
**********************************************************************
*/
typedef struct {
char* pBuffer;
int BufferSize;
int Cnt;
} SEGGER_BUFFER_DESC;
typedef struct {
unsigned int CacheLineSize; // 0: No Cache. Most Systems such as ARM9 use a 32 bytes cache line size.
void (*pfDMB) (void); // Optional DMB function for Data Memory Barrier to make sure all memory operations are completed.
void (*pfClean) (void *p, unsigned long NumBytes); // Optional clean function for cached memory.
void (*pfInvalidate)(void *p, unsigned long NumBytes); // Optional invalidate function for cached memory.
} SEGGER_CACHE_CONFIG;
typedef struct SEGGER_SNPRINTF_CONTEXT_struct SEGGER_SNPRINTF_CONTEXT;
struct SEGGER_SNPRINTF_CONTEXT_struct {
void* pContext; // Application specific context.
SEGGER_BUFFER_DESC* pBufferDesc; // Buffer descriptor to use for output.
void (*pfFlush)(SEGGER_SNPRINTF_CONTEXT* pContext); // Callback executed once the buffer is full. Callback decides if the buffer gets cleared to store more or not.
};
typedef struct {
void (*pfStoreChar) (SEGGER_BUFFER_DESC* pBufferDesc, SEGGER_SNPRINTF_CONTEXT* pContext, char c);
int (*pfPrintUnsigned) (SEGGER_BUFFER_DESC* pBufferDesc, SEGGER_SNPRINTF_CONTEXT* pContext, U32 v, unsigned Base, char Flags, int Width, int Precision);
int (*pfPrintInt) (SEGGER_BUFFER_DESC* pBufferDesc, SEGGER_SNPRINTF_CONTEXT* pContext, I32 v, unsigned Base, char Flags, int Width, int Precision);
} SEGGER_PRINTF_API;
typedef void (*SEGGER_pFormatter)(SEGGER_BUFFER_DESC* pBufferDesc, SEGGER_SNPRINTF_CONTEXT* pContext, const SEGGER_PRINTF_API* pApi, va_list* pParamList, char Lead, int Width, int Precision);
typedef struct SEGGER_PRINTF_FORMATTER {
struct SEGGER_PRINTF_FORMATTER* pNext; // Pointer to next formatter.
SEGGER_pFormatter pfFormatter; // Formatter function.
char Specifier; // Format specifier.
} SEGGER_PRINTF_FORMATTER;
typedef struct {
U32 (*pfGetHPTimestamp)(void); // Mandatory, pfGetHPTimestamp
int (*pfGetUID) (U8 abUID[16]); // Optional, pfGetUID
} SEGGER_BSP_API;
/*********************************************************************
*
* Utility functions
*
**********************************************************************
*/
//
// Memory operations.
//
void SEGGER_ARM_memcpy(void* pDest, const void* pSrc, int NumBytes);
void SEGGER_memcpy (void* pDest, const void* pSrc, unsigned NumBytes);
void SEGGER_memxor (void* pDest, const void* pSrc, unsigned NumBytes);
//
// String functions.
//
int SEGGER_atoi (const char* s);
int SEGGER_isalnum (int c);
int SEGGER_isalpha (int c);
unsigned SEGGER_strlen (const char* s);
int SEGGER_tolower (int c);
int SEGGER_strcasecmp (const char* sText1, const char* sText2);
int SEGGER_strncasecmp(const char *sText1, const char *sText2, unsigned Count);
//
// Buffer/printf related.
//
void SEGGER_StoreChar (SEGGER_BUFFER_DESC* pBufferDesc, char c);
void SEGGER_PrintUnsigned(SEGGER_BUFFER_DESC* pBufferDesc, U32 v, unsigned Base, int Precision);
void SEGGER_PrintInt (SEGGER_BUFFER_DESC* pBufferDesc, I32 v, unsigned Base, int Precision);
int SEGGER_snprintf (char* pBuffer, int BufferSize, const char* sFormat, ...);
int SEGGER_vsnprintf (char* pBuffer, int BufferSize, const char* sFormat, va_list ParamList);
int SEGGER_vsnprintfEx (SEGGER_SNPRINTF_CONTEXT* pContext, const char* sFormat, va_list ParamList);
int SEGGER_PRINTF_AddFormatter (SEGGER_PRINTF_FORMATTER* pFormatter, SEGGER_pFormatter pfFormatter, char c);
void SEGGER_PRINTF_AddDoubleFormatter (void);
void SEGGER_PRINTF_AddIPFormatter (void);
void SEGGER_PRINTF_AddBLUEFormatter (void);
void SEGGER_PRINTF_AddCONNECTFormatter(void);
void SEGGER_PRINTF_AddSSLFormatter (void);
void SEGGER_PRINTF_AddSSHFormatter (void);
void SEGGER_PRINTF_AddHTMLFormatter (void);
//
// BSP abstraction API.
//
int SEGGER_BSP_GetUID (U8 abUID[16]);
int SEGGER_BSP_GetUID32(U32* pUID);
void SEGGER_BSP_SetAPI (const SEGGER_BSP_API* pAPI);
void SEGGER_BSP_SeedUID (void);
//
// Other API.
//
void SEGGER_VERSION_GetString(char acText[8], unsigned Version);
#if defined(__cplusplus)
} /* Make sure we have C-declarations in C++ programs */
#endif
#endif // Avoid multiple inclusion
/*************************** End of file ****************************/

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,418 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
---------------------------END-OF-HEADER------------------------------
File : SEGGER_RTT.h
Purpose : Implementation of SEGGER real-time transfer which allows
real-time communication on targets which support debugger
memory accesses while the CPU is running.
Revision: $Rev: 20869 $
----------------------------------------------------------------------
*/
#ifndef SEGGER_RTT_H
#define SEGGER_RTT_H
#include "SEGGER_RTT_Conf.h"
/*********************************************************************
*
* Defines, defaults
*
**********************************************************************
*/
#ifndef RTT_USE_ASM
#if (defined __SES_ARM) // SEGGER Embedded Studio
#define _CC_HAS_RTT_ASM_SUPPORT 1
#elif (defined __CROSSWORKS_ARM) // Rowley Crossworks
#define _CC_HAS_RTT_ASM_SUPPORT 1
#elif (defined __ARMCC_VERSION) // ARM compiler
#if (__ARMCC_VERSION >= 6000000) // ARM compiler V6.0 and later is clang based
#define _CC_HAS_RTT_ASM_SUPPORT 1
#else
#define _CC_HAS_RTT_ASM_SUPPORT 0
#endif
#elif (defined __GNUC__) // GCC
#define _CC_HAS_RTT_ASM_SUPPORT 1
#elif (defined __clang__) // Clang compiler
#define _CC_HAS_RTT_ASM_SUPPORT 1
#elif ((defined __IASMARM__) || (defined __ICCARM__)) // IAR assembler/compiler
#define _CC_HAS_RTT_ASM_SUPPORT 1
#else
#define _CC_HAS_RTT_ASM_SUPPORT 0
#endif
#if ((defined __IASMARM__) || (defined __ICCARM__)) // IAR assembler/compiler
//
// IAR assembler / compiler
//
#if (__VER__ < 6300000)
#define VOLATILE
#else
#define VOLATILE volatile
#endif
#if (defined __ARM7M__) // Needed for old versions that do not know the define yet
#if (__CORE__ == __ARM7M__) // Cortex-M3
#define _CORE_HAS_RTT_ASM_SUPPORT 1
#endif
#endif
#if (defined __ARM7EM__) // Needed for old versions that do not know the define yet
#if (__CORE__ == __ARM7EM__) // Cortex-M4/M7
#define _CORE_HAS_RTT_ASM_SUPPORT 1
#define _CORE_NEEDS_DMB 1
#define RTT__DMB() asm VOLATILE ("DMB");
#endif
#endif
#if (defined __ARM8M_BASELINE__) // Needed for old versions that do not know the define yet
#if (__CORE__ == __ARM8M_BASELINE__) // Cortex-M23
#define _CORE_HAS_RTT_ASM_SUPPORT 0
#define _CORE_NEEDS_DMB 1
#define RTT__DMB() asm VOLATILE ("DMB");
#endif
#endif
#if (defined __ARM8M_MAINLINE__) // Needed for old versions that do not know the define yet
#if (__CORE__ == __ARM8M_MAINLINE__) // Cortex-M33
#define _CORE_HAS_RTT_ASM_SUPPORT 1
#define _CORE_NEEDS_DMB 1
#define RTT__DMB() asm VOLATILE ("DMB");
#endif
#endif
#else
//
// GCC / Clang
//
#if (defined __ARM_ARCH_7M__) // Cortex-M3
#define _CORE_HAS_RTT_ASM_SUPPORT 1
#elif (defined __ARM_ARCH_7EM__) // Cortex-M4/M7
#define _CORE_HAS_RTT_ASM_SUPPORT 1
#define _CORE_NEEDS_DMB 1
#define RTT__DMB() __asm volatile ("dmb\n" : : :);
#elif (defined __ARM_ARCH_8M_BASE__) // Cortex-M23
#define _CORE_HAS_RTT_ASM_SUPPORT 0
#define _CORE_NEEDS_DMB 1
#define RTT__DMB() __asm volatile ("dmb\n" : : :);
#elif (defined __ARM_ARCH_8M_MAIN__) // Cortex-M33
#define _CORE_HAS_RTT_ASM_SUPPORT 1
#define _CORE_NEEDS_DMB 1
#define RTT__DMB() __asm volatile ("dmb\n" : : :);
#else
#define _CORE_HAS_RTT_ASM_SUPPORT 0
#endif
#endif
//
// If IDE and core support the ASM version, enable ASM version by default
//
#ifndef _CORE_HAS_RTT_ASM_SUPPORT
#define _CORE_HAS_RTT_ASM_SUPPORT 0 // Default for unknown cores
#endif
#if (_CC_HAS_RTT_ASM_SUPPORT && _CORE_HAS_RTT_ASM_SUPPORT)
#define RTT_USE_ASM (1)
#else
#define RTT_USE_ASM (0)
#endif
#endif
//
// We need to know if a DMB is needed to make sure that on Cortex-M7 etc.
// the order of accesses to the ring buffers is guaranteed
// Needed for: Cortex-M7, Cortex-M23, Cortex-M33
//
#ifndef _CORE_NEEDS_DMB
#define _CORE_NEEDS_DMB 0
#endif
#ifndef RTT__DMB
#if _CORE_NEEDS_DMB
#error "Don't know how to place inline assembly for DMB"
#else
#define RTT__DMB()
#endif
#endif
#ifndef SEGGER_RTT_CPU_CACHE_LINE_SIZE
#define SEGGER_RTT_CPU_CACHE_LINE_SIZE (0) // On most target systems where RTT is used, we do not have a CPU cache, therefore 0 is a good default here
#endif
#ifndef SEGGER_RTT_UNCACHED_OFF
#if SEGGER_RTT_CPU_CACHE_LINE_SIZE
#error "SEGGER_RTT_UNCACHED_OFF must be defined when setting SEGGER_RTT_CPU_CACHE_LINE_SIZE != 0"
#else
#define SEGGER_RTT_UNCACHED_OFF (0)
#endif
#endif
#if RTT_USE_ASM
#if SEGGER_RTT_CPU_CACHE_LINE_SIZE
#error "RTT_USE_ASM is not available if SEGGER_RTT_CPU_CACHE_LINE_SIZE != 0"
#endif
#endif
#ifndef SEGGER_RTT_ASM // defined when SEGGER_RTT.h is included from assembly file
#include <stdlib.h>
#include <stdarg.h>
/*********************************************************************
*
* Defines, fixed
*
**********************************************************************
*/
//
// Determine how much we must pad the control block to make it a multiple of a cache line in size
// Assuming: U8 = 1B
// U16 = 2B
// U32 = 4B
// U8/U16/U32* = 4B
//
#if SEGGER_RTT_CPU_CACHE_LINE_SIZE // Avoid division by zero in case we do not have any cache
#define SEGGER_RTT__ROUND_UP_2_CACHE_LINE_SIZE(NumBytes) (((NumBytes + SEGGER_RTT_CPU_CACHE_LINE_SIZE - 1) / SEGGER_RTT_CPU_CACHE_LINE_SIZE) * SEGGER_RTT_CPU_CACHE_LINE_SIZE)
#else
#define SEGGER_RTT__ROUND_UP_2_CACHE_LINE_SIZE(NumBytes) (NumBytes)
#endif
#define SEGGER_RTT__CB_SIZE (16 + 4 + 4 + (SEGGER_RTT_MAX_NUM_UP_BUFFERS * 24) + (SEGGER_RTT_MAX_NUM_DOWN_BUFFERS * 24))
#define SEGGER_RTT__CB_PADDING (SEGGER_RTT__ROUND_UP_2_CACHE_LINE_SIZE(SEGGER_RTT__CB_SIZE) - SEGGER_RTT__CB_SIZE)
/*********************************************************************
*
* Types
*
**********************************************************************
*/
//
// Description for a circular buffer (also called "ring buffer")
// which is used as up-buffer (T->H)
//
typedef struct {
const char* sName; // Optional name. Standard names so far are: "Terminal", "SysView", "J-Scope_t4i4"
char* pBuffer; // Pointer to start of buffer
unsigned SizeOfBuffer; // Buffer size in bytes. Note that one byte is lost, as this implementation does not fill up the buffer in order to avoid the problem of being unable to distinguish between full and empty.
unsigned WrOff; // Position of next item to be written by either target.
volatile unsigned RdOff; // Position of next item to be read by host. Must be volatile since it may be modified by host.
unsigned Flags; // Contains configuration flags
} SEGGER_RTT_BUFFER_UP;
//
// Description for a circular buffer (also called "ring buffer")
// which is used as down-buffer (H->T)
//
typedef struct {
const char* sName; // Optional name. Standard names so far are: "Terminal", "SysView", "J-Scope_t4i4"
char* pBuffer; // Pointer to start of buffer
unsigned SizeOfBuffer; // Buffer size in bytes. Note that one byte is lost, as this implementation does not fill up the buffer in order to avoid the problem of being unable to distinguish between full and empty.
volatile unsigned WrOff; // Position of next item to be written by host. Must be volatile since it may be modified by host.
unsigned RdOff; // Position of next item to be read by target (down-buffer).
unsigned Flags; // Contains configuration flags
} SEGGER_RTT_BUFFER_DOWN;
//
// RTT control block which describes the number of buffers available
// as well as the configuration for each buffer
//
//
typedef struct {
char acID[16]; // Initialized to "SEGGER RTT"
int MaxNumUpBuffers; // Initialized to SEGGER_RTT_MAX_NUM_UP_BUFFERS (type. 2)
int MaxNumDownBuffers; // Initialized to SEGGER_RTT_MAX_NUM_DOWN_BUFFERS (type. 2)
SEGGER_RTT_BUFFER_UP aUp[SEGGER_RTT_MAX_NUM_UP_BUFFERS]; // Up buffers, transferring information up from target via debug probe to host
SEGGER_RTT_BUFFER_DOWN aDown[SEGGER_RTT_MAX_NUM_DOWN_BUFFERS]; // Down buffers, transferring information down from host via debug probe to target
#if SEGGER_RTT__CB_PADDING
unsigned char aDummy[SEGGER_RTT__CB_PADDING];
#endif
} SEGGER_RTT_CB;
/*********************************************************************
*
* Global data
*
**********************************************************************
*/
extern SEGGER_RTT_CB _SEGGER_RTT;
/*********************************************************************
*
* RTT API functions
*
**********************************************************************
*/
#ifdef __cplusplus
extern "C" {
#endif
int SEGGER_RTT_AllocDownBuffer (const char* sName, void* pBuffer, unsigned BufferSize, unsigned Flags);
int SEGGER_RTT_AllocUpBuffer (const char* sName, void* pBuffer, unsigned BufferSize, unsigned Flags);
int SEGGER_RTT_ConfigUpBuffer (unsigned BufferIndex, const char* sName, void* pBuffer, unsigned BufferSize, unsigned Flags);
int SEGGER_RTT_ConfigDownBuffer (unsigned BufferIndex, const char* sName, void* pBuffer, unsigned BufferSize, unsigned Flags);
int SEGGER_RTT_GetKey (void);
unsigned SEGGER_RTT_HasData (unsigned BufferIndex);
int SEGGER_RTT_HasKey (void);
unsigned SEGGER_RTT_HasDataUp (unsigned BufferIndex);
void SEGGER_RTT_Init (void);
unsigned SEGGER_RTT_Read (unsigned BufferIndex, void* pBuffer, unsigned BufferSize);
unsigned SEGGER_RTT_ReadNoLock (unsigned BufferIndex, void* pData, unsigned BufferSize);
int SEGGER_RTT_SetNameDownBuffer (unsigned BufferIndex, const char* sName);
int SEGGER_RTT_SetNameUpBuffer (unsigned BufferIndex, const char* sName);
int SEGGER_RTT_SetFlagsDownBuffer (unsigned BufferIndex, unsigned Flags);
int SEGGER_RTT_SetFlagsUpBuffer (unsigned BufferIndex, unsigned Flags);
int SEGGER_RTT_WaitKey (void);
unsigned SEGGER_RTT_Write (unsigned BufferIndex, const void* pBuffer, unsigned NumBytes);
unsigned SEGGER_RTT_WriteNoLock (unsigned BufferIndex, const void* pBuffer, unsigned NumBytes);
unsigned SEGGER_RTT_WriteSkipNoLock (unsigned BufferIndex, const void* pBuffer, unsigned NumBytes);
unsigned SEGGER_RTT_ASM_WriteSkipNoLock (unsigned BufferIndex, const void* pBuffer, unsigned NumBytes);
unsigned SEGGER_RTT_WriteString (unsigned BufferIndex, const char* s);
void SEGGER_RTT_WriteWithOverwriteNoLock(unsigned BufferIndex, const void* pBuffer, unsigned NumBytes);
unsigned SEGGER_RTT_PutChar (unsigned BufferIndex, char c);
unsigned SEGGER_RTT_PutCharSkip (unsigned BufferIndex, char c);
unsigned SEGGER_RTT_PutCharSkipNoLock (unsigned BufferIndex, char c);
unsigned SEGGER_RTT_GetAvailWriteSpace (unsigned BufferIndex);
unsigned SEGGER_RTT_GetBytesInBuffer (unsigned BufferIndex);
//
// Function macro for performance optimization
//
#define SEGGER_RTT_HASDATA(n) (((SEGGER_RTT_BUFFER_DOWN*)((char*)&_SEGGER_RTT.aDown[n] + SEGGER_RTT_UNCACHED_OFF))->WrOff - ((SEGGER_RTT_BUFFER_DOWN*)((char*)&_SEGGER_RTT.aDown[n] + SEGGER_RTT_UNCACHED_OFF))->RdOff)
#if RTT_USE_ASM
#define SEGGER_RTT_WriteSkipNoLock SEGGER_RTT_ASM_WriteSkipNoLock
#endif
/*********************************************************************
*
* RTT transfer functions to send RTT data via other channels.
*
**********************************************************************
*/
unsigned SEGGER_RTT_ReadUpBuffer (unsigned BufferIndex, void* pBuffer, unsigned BufferSize);
unsigned SEGGER_RTT_ReadUpBufferNoLock (unsigned BufferIndex, void* pData, unsigned BufferSize);
unsigned SEGGER_RTT_WriteDownBuffer (unsigned BufferIndex, const void* pBuffer, unsigned NumBytes);
unsigned SEGGER_RTT_WriteDownBufferNoLock (unsigned BufferIndex, const void* pBuffer, unsigned NumBytes);
#define SEGGER_RTT_HASDATA_UP(n) (((SEGGER_RTT_BUFFER_UP*)((char*)&_SEGGER_RTT.aUp[n] + SEGGER_RTT_UNCACHED_OFF))->WrOff - ((SEGGER_RTT_BUFFER_UP*)((char*)&_SEGGER_RTT.aUp[n] + SEGGER_RTT_UNCACHED_OFF))->RdOff) // Access uncached to make sure we see changes made by the J-Link side and all of our changes go into HW directly
/*********************************************************************
*
* RTT "Terminal" API functions
*
**********************************************************************
*/
int SEGGER_RTT_SetTerminal (unsigned char TerminalId);
int SEGGER_RTT_TerminalOut (unsigned char TerminalId, const char* s);
/*********************************************************************
*
* RTT printf functions (require SEGGER_RTT_printf.c)
*
**********************************************************************
*/
int SEGGER_RTT_printf(unsigned BufferIndex, const char * sFormat, ...);
int SEGGER_RTT_vprintf(unsigned BufferIndex, const char * sFormat, va_list * pParamList);
#ifdef __cplusplus
}
#endif
#endif // ifndef(SEGGER_RTT_ASM)
/*********************************************************************
*
* Defines
*
**********************************************************************
*/
//
// Operating modes. Define behavior if buffer is full (not enough space for entire message)
//
#define SEGGER_RTT_MODE_NO_BLOCK_SKIP (0) // Skip. Do not block, output nothing. (Default)
#define SEGGER_RTT_MODE_NO_BLOCK_TRIM (1) // Trim: Do not block, output as much as fits.
#define SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL (2) // Block: Wait until there is space in the buffer.
#define SEGGER_RTT_MODE_MASK (3)
//
// Control sequences, based on ANSI.
// Can be used to control color, and clear the screen
//
#define RTT_CTRL_RESET "\x1B[0m" // Reset to default colors
#define RTT_CTRL_CLEAR "\x1B[2J" // Clear screen, reposition cursor to top left
#define RTT_CTRL_TEXT_BLACK "\x1B[2;30m"
#define RTT_CTRL_TEXT_RED "\x1B[2;31m"
#define RTT_CTRL_TEXT_GREEN "\x1B[2;32m"
#define RTT_CTRL_TEXT_YELLOW "\x1B[2;33m"
#define RTT_CTRL_TEXT_BLUE "\x1B[2;34m"
#define RTT_CTRL_TEXT_MAGENTA "\x1B[2;35m"
#define RTT_CTRL_TEXT_CYAN "\x1B[2;36m"
#define RTT_CTRL_TEXT_WHITE "\x1B[2;37m"
#define RTT_CTRL_TEXT_BRIGHT_BLACK "\x1B[1;30m"
#define RTT_CTRL_TEXT_BRIGHT_RED "\x1B[1;31m"
#define RTT_CTRL_TEXT_BRIGHT_GREEN "\x1B[1;32m"
#define RTT_CTRL_TEXT_BRIGHT_YELLOW "\x1B[1;33m"
#define RTT_CTRL_TEXT_BRIGHT_BLUE "\x1B[1;34m"
#define RTT_CTRL_TEXT_BRIGHT_MAGENTA "\x1B[1;35m"
#define RTT_CTRL_TEXT_BRIGHT_CYAN "\x1B[1;36m"
#define RTT_CTRL_TEXT_BRIGHT_WHITE "\x1B[1;37m"
#define RTT_CTRL_BG_BLACK "\x1B[24;40m"
#define RTT_CTRL_BG_RED "\x1B[24;41m"
#define RTT_CTRL_BG_GREEN "\x1B[24;42m"
#define RTT_CTRL_BG_YELLOW "\x1B[24;43m"
#define RTT_CTRL_BG_BLUE "\x1B[24;44m"
#define RTT_CTRL_BG_MAGENTA "\x1B[24;45m"
#define RTT_CTRL_BG_CYAN "\x1B[24;46m"
#define RTT_CTRL_BG_WHITE "\x1B[24;47m"
#define RTT_CTRL_BG_BRIGHT_BLACK "\x1B[4;40m"
#define RTT_CTRL_BG_BRIGHT_RED "\x1B[4;41m"
#define RTT_CTRL_BG_BRIGHT_GREEN "\x1B[4;42m"
#define RTT_CTRL_BG_BRIGHT_YELLOW "\x1B[4;43m"
#define RTT_CTRL_BG_BRIGHT_BLUE "\x1B[4;44m"
#define RTT_CTRL_BG_BRIGHT_MAGENTA "\x1B[4;45m"
#define RTT_CTRL_BG_BRIGHT_CYAN "\x1B[4;46m"
#define RTT_CTRL_BG_BRIGHT_WHITE "\x1B[4;47m"
#endif
/*************************** End of file ****************************/

View File

@ -0,0 +1,242 @@
/*********************************************************************
* (c) SEGGER Microcontroller GmbH *
* The Embedded Experts *
* www.segger.com *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_RTT_ASM_ARMv7M.S
Purpose : Assembler implementation of RTT functions for ARMv7M
Additional information:
This module is written to be assembler-independent and works with
GCC and clang (Embedded Studio) and IAR.
*/
#define SEGGER_RTT_ASM // Used to control processed input from header file
#include "SEGGER_RTT.h"
/*********************************************************************
*
* Defines, fixed
*
**********************************************************************
*/
#define _CCIAR 0
#define _CCCLANG 1
#if (defined __SES_ARM) || (defined __GNUC__) || (defined __clang__)
#define _CC_TYPE _CCCLANG
#define _PUB_SYM .global
#define _EXT_SYM .extern
#define _END .end
#define _WEAK .weak
#define _THUMB_FUNC .thumb_func
#define _THUMB_CODE .code 16
#define _WORD .word
#define _SECTION(Sect, Type, AlignExp) .section Sect ##, "ax"
#define _ALIGN(Exp) .align Exp
#define _PLACE_LITS .ltorg
#define _DATA_SECT_START
#define _C_STARTUP _start
#define _STACK_END __stack_end__
#define _RAMFUNC
//
// .text => Link to flash
// .fast => Link to RAM
// OtherSect => Usually link to RAM
// Alignment is 2^x
//
#elif defined (__IASMARM__)
#define _CC_TYPE _CCIAR
#define _PUB_SYM PUBLIC
#define _EXT_SYM EXTERN
#define _END END
#define _WEAK _WEAK
#define _THUMB_FUNC
#define _THUMB_CODE THUMB
#define _WORD DCD
#define _SECTION(Sect, Type, AlignExp) SECTION Sect ## : ## Type ## :REORDER:NOROOT ## (AlignExp)
#define _ALIGN(Exp) alignrom Exp
#define _PLACE_LITS
#define _DATA_SECT_START DATA
#define _C_STARTUP __iar_program_start
#define _STACK_END sfe(CSTACK)
#define _RAMFUNC SECTION_TYPE SHT_PROGBITS, SHF_WRITE | SHF_EXECINSTR
//
// .text => Link to flash
// .textrw => Link to RAM
// OtherSect => Usually link to RAM
// NOROOT => Allows linker to throw away the function, if not referenced
// Alignment is 2^x
//
#endif
#if (_CC_TYPE == _CCIAR)
NAME SEGGER_RTT_ASM_ARMv7M
#else
.syntax unified
#endif
#if defined (RTT_USE_ASM) && (RTT_USE_ASM == 1)
#define SHT_PROGBITS 0x1
/*********************************************************************
*
* Public / external symbols
*
**********************************************************************
*/
_EXT_SYM __aeabi_memcpy
_EXT_SYM __aeabi_memcpy4
_EXT_SYM _SEGGER_RTT
_PUB_SYM SEGGER_RTT_ASM_WriteSkipNoLock
/*********************************************************************
*
* SEGGER_RTT_WriteSkipNoLock
*
* Function description
* Stores a specified number of characters in SEGGER RTT
* control block which is then read by the host.
* SEGGER_RTT_WriteSkipNoLock does not lock the application and
* skips all data, if the data does not fit into the buffer.
*
* Parameters
* BufferIndex Index of "Up"-buffer to be used (e.g. 0 for "Terminal").
* pBuffer Pointer to character array. Does not need to point to a \0 terminated string.
* NumBytes Number of bytes to be stored in the SEGGER RTT control block.
* MUST be > 0!!!
* This is done for performance reasons, so no initial check has do be done.
*
* Return value
* 1: Data has been copied
* 0: No space, data has not been copied
*
* Notes
* (1) If there is not enough space in the "Up"-buffer, all data is dropped.
* (2) For performance reasons this function does not call Init()
* and may only be called after RTT has been initialized.
* Either by calling SEGGER_RTT_Init() or calling another RTT API function first.
*/
_SECTION(.text, CODE, 2)
_ALIGN(2)
_THUMB_FUNC
SEGGER_RTT_ASM_WriteSkipNoLock: // unsigned SEGGER_RTT_WriteSkipNoLock(unsigned BufferIndex, const void* pData, unsigned NumBytes) {
//
// Cases:
// 1) RdOff <= WrOff => Space until wrap-around is sufficient
// 2) RdOff <= WrOff => Space after wrap-around needed (copy in 2 chunks)
// 3) RdOff < WrOff => No space in buf
// 4) RdOff > WrOff => Space is sufficient
// 5) RdOff > WrOff => No space in buf
//
// 1) is the most common case for large buffers and assuming that J-Link reads the data fast enough
//
// Register usage:
// R0 Temporary needed as RdOff, <Tmp> register later on
// R1 pData
// R2 <NumBytes>
// R3 <Tmp> register. Hold free for subroutine calls
// R4 <Rem>
// R5 pRing->pBuffer
// R6 pRing (Points to active struct SEGGER_RTT_BUFFER_DOWN)
// R7 WrOff
//
PUSH {R4-R7}
ADD R3,R0,R0, LSL #+1
LDR.W R0,=_SEGGER_RTT // pRing = &_SEGGER_RTT.aUp[BufferIndex];
ADD R0,R0,R3, LSL #+3
ADD R6,R0,#+24
LDR R0,[R6, #+16] // RdOff = pRing->RdOff;
LDR R7,[R6, #+12] // WrOff = pRing->WrOff;
LDR R5,[R6, #+4] // pRing->pBuffer
CMP R7,R0
BCC.N _CheckCase4 // if (RdOff <= WrOff) { => Case 1), 2) or 3)
//
// Handling for case 1, later on identical to case 4
//
LDR R3,[R6, #+8] // Avail = pRing->SizeOfBuffer - WrOff - 1u; => Space until wrap-around (assume 1 byte not usable for case that RdOff == 0)
SUBS R4,R3,R7 // <Rem> (Used in case we jump into case 2 afterwards)
SUBS R3,R4,#+1 // <Avail>
CMP R3,R2
BCC.N _CheckCase2 // if (Avail >= NumBytes) { => Case 1)?
_Case4:
ADDS R5,R7,R5 // pBuffer += WrOff
ADDS R0,R2,R7 // v = WrOff + NumBytes
//
// 2x unrolling for the copy loop that is used most of the time
// This is a special optimization for small SystemView packets and makes them even faster
//
_ALIGN(2)
_LoopCopyStraight: // memcpy(pRing->pBuffer + WrOff, pData, NumBytes);
LDRB R3,[R1], #+1
STRB R3,[R5], #+1 // *pDest++ = *pSrc++
SUBS R2,R2,#+1
BEQ _CSDone
LDRB R3,[R1], #+1
STRB R3,[R5], #+1 // *pDest++ = *pSrc++
SUBS R2,R2,#+1
BNE _LoopCopyStraight
_CSDone:
#if _CORE_NEEDS_DMB // Do not slow down cores that do not need a DMB instruction here
DMB // Cortex-M7 may delay memory writes and also change the order in which the writes happen. Therefore, make sure that all buffer writes are finished, before updating the <WrOff> in the struct
#endif
STR R0,[R6, #+12] // pRing->WrOff = WrOff + NumBytes;
MOVS R0,#+1
POP {R4-R7}
BX LR // Return 1
_CheckCase2:
ADDS R0,R0,R3 // Avail += RdOff; => Space incl. wrap-around
CMP R0,R2
BCC.N _Case3 // if (Avail >= NumBytes) { => Case 2? => If not, we have case 3) (does not fit)
//
// Handling for case 2
//
ADDS R0,R7,R5 // v = pRing->pBuffer + WrOff => Do not change pRing->pBuffer here because 2nd chunk needs org. value
SUBS R2,R2,R4 // NumBytes -= Rem; (Rem = pRing->SizeOfBuffer - WrOff; => Space until end of buffer)
_LoopCopyBeforeWrapAround: // memcpy(pRing->pBuffer + WrOff, pData, Rem); => Copy 1st chunk
LDRB R3,[R1], #+1
STRB R3,[R0], #+1 // *pDest++ = *pSrc++
SUBS R4,R4,#+1
BNE _LoopCopyBeforeWrapAround
//
// Special case: First check that assumed RdOff == 0 calculated that last element before wrap-around could not be used
// But 2nd check (considering space until wrap-around and until RdOff) revealed that RdOff is not 0, so we can use the last element
// In this case, we may use a copy straight until buffer end anyway without needing to copy 2 chunks
// Therefore, check if 2nd memcpy is necessary at all
//
ADDS R4,R2,#+0 // Save <NumBytes> (needed as counter in loop but must be written to <WrOff> after the loop). Also use this inst to update the flags to skip 2nd loop if possible
BEQ.N _No2ChunkNeeded // if (NumBytes) {
_LoopCopyAfterWrapAround: // memcpy(pRing->pBuffer, pData + Rem, NumBytes);
LDRB R3,[R1], #+1 // pData already points to the next src byte due to copy loop increment before this loop
STRB R3,[R5], #+1 // *pDest++ = *pSrc++
SUBS R2,R2,#+1
BNE _LoopCopyAfterWrapAround
_No2ChunkNeeded:
#if _CORE_NEEDS_DMB // Do not slow down cores that do not need a DMB instruction here
DMB // Cortex-M7 may delay memory writes and also change the order in which the writes happen. Therefore, make sure that all buffer writes are finished, before updating the <WrOff> in the struct
#endif
STR R4,[R6, #+12] // pRing->WrOff = NumBytes; => Must be written after copying data because J-Link may read control block asynchronously while writing into buffer
MOVS R0,#+1
POP {R4-R7}
BX LR // Return 1
_CheckCase4:
SUBS R0,R0,R7
SUBS R0,R0,#+1 // Avail = RdOff - WrOff - 1u;
CMP R0,R2
BCS.N _Case4 // if (Avail >= NumBytes) { => Case 4) == 1) ? => If not, we have case 5) == 3) (does not fit)
_Case3:
MOVS R0,#+0
POP {R4-R7}
BX LR // Return 0
_PLACE_LITS
#endif // defined (RTT_USE_ASM) && (RTT_USE_ASM == 1)
_END
/*************************** End of file ****************************/

View File

@ -0,0 +1,504 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
---------------------------END-OF-HEADER------------------------------
File : SEGGER_RTT_printf.c
Purpose : Replacement for printf to write formatted data via RTT
Revision: $Rev: 17697 $
----------------------------------------------------------------------
*/
#include "SEGGER_RTT.h"
#include "SEGGER_RTT_Conf.h"
/*********************************************************************
*
* Defines, configurable
*
**********************************************************************
*/
#ifndef SEGGER_RTT_PRINTF_BUFFER_SIZE
#define SEGGER_RTT_PRINTF_BUFFER_SIZE (64)
#endif
#include <stdlib.h>
#include <stdarg.h>
#define FORMAT_FLAG_LEFT_JUSTIFY (1u << 0)
#define FORMAT_FLAG_PAD_ZERO (1u << 1)
#define FORMAT_FLAG_PRINT_SIGN (1u << 2)
#define FORMAT_FLAG_ALTERNATE (1u << 3)
/*********************************************************************
*
* Types
*
**********************************************************************
*/
typedef struct {
char* pBuffer;
unsigned BufferSize;
unsigned Cnt;
int ReturnValue;
unsigned RTTBufferIndex;
} SEGGER_RTT_PRINTF_DESC;
/*********************************************************************
*
* Function prototypes
*
**********************************************************************
*/
/*********************************************************************
*
* Static code
*
**********************************************************************
*/
/*********************************************************************
*
* _StoreChar
*/
static void _StoreChar(SEGGER_RTT_PRINTF_DESC * p, char c) {
unsigned Cnt;
Cnt = p->Cnt;
if ((Cnt + 1u) <= p->BufferSize) {
*(p->pBuffer + Cnt) = c;
p->Cnt = Cnt + 1u;
p->ReturnValue++;
}
//
// Write part of string, when the buffer is full
//
if (p->Cnt == p->BufferSize) {
if (SEGGER_RTT_Write(p->RTTBufferIndex, p->pBuffer, p->Cnt) != p->Cnt) {
p->ReturnValue = -1;
} else {
p->Cnt = 0u;
}
}
}
/*********************************************************************
*
* _PrintUnsigned
*/
static void _PrintUnsigned(SEGGER_RTT_PRINTF_DESC * pBufferDesc, unsigned v, unsigned Base, unsigned NumDigits, unsigned FieldWidth, unsigned FormatFlags) {
static const char _aV2C[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
unsigned Div;
unsigned Digit;
unsigned Number;
unsigned Width;
char c;
Number = v;
Digit = 1u;
//
// Get actual field width
//
Width = 1u;
while (Number >= Base) {
Number = (Number / Base);
Width++;
}
if (NumDigits > Width) {
Width = NumDigits;
}
//
// Print leading chars if necessary
//
if ((FormatFlags & FORMAT_FLAG_LEFT_JUSTIFY) == 0u) {
if (FieldWidth != 0u) {
if (((FormatFlags & FORMAT_FLAG_PAD_ZERO) == FORMAT_FLAG_PAD_ZERO) && (NumDigits == 0u)) {
c = '0';
} else {
c = ' ';
}
while ((FieldWidth != 0u) && (Width < FieldWidth)) {
FieldWidth--;
_StoreChar(pBufferDesc, c);
if (pBufferDesc->ReturnValue < 0) {
break;
}
}
}
}
if (pBufferDesc->ReturnValue >= 0) {
//
// Compute Digit.
// Loop until Digit has the value of the highest digit required.
// Example: If the output is 345 (Base 10), loop 2 times until Digit is 100.
//
while (1) {
if (NumDigits > 1u) { // User specified a min number of digits to print? => Make sure we loop at least that often, before checking anything else (> 1 check avoids problems with NumDigits being signed / unsigned)
NumDigits--;
} else {
Div = v / Digit;
if (Div < Base) { // Is our divider big enough to extract the highest digit from value? => Done
break;
}
}
Digit *= Base;
}
//
// Output digits
//
do {
Div = v / Digit;
v -= Div * Digit;
_StoreChar(pBufferDesc, _aV2C[Div]);
if (pBufferDesc->ReturnValue < 0) {
break;
}
Digit /= Base;
} while (Digit);
//
// Print trailing spaces if necessary
//
if ((FormatFlags & FORMAT_FLAG_LEFT_JUSTIFY) == FORMAT_FLAG_LEFT_JUSTIFY) {
if (FieldWidth != 0u) {
while ((FieldWidth != 0u) && (Width < FieldWidth)) {
FieldWidth--;
_StoreChar(pBufferDesc, ' ');
if (pBufferDesc->ReturnValue < 0) {
break;
}
}
}
}
}
}
/*********************************************************************
*
* _PrintInt
*/
static void _PrintInt(SEGGER_RTT_PRINTF_DESC * pBufferDesc, int v, unsigned Base, unsigned NumDigits, unsigned FieldWidth, unsigned FormatFlags) {
unsigned Width;
int Number;
Number = (v < 0) ? -v : v;
//
// Get actual field width
//
Width = 1u;
while (Number >= (int)Base) {
Number = (Number / (int)Base);
Width++;
}
if (NumDigits > Width) {
Width = NumDigits;
}
if ((FieldWidth > 0u) && ((v < 0) || ((FormatFlags & FORMAT_FLAG_PRINT_SIGN) == FORMAT_FLAG_PRINT_SIGN))) {
FieldWidth--;
}
//
// Print leading spaces if necessary
//
if ((((FormatFlags & FORMAT_FLAG_PAD_ZERO) == 0u) || (NumDigits != 0u)) && ((FormatFlags & FORMAT_FLAG_LEFT_JUSTIFY) == 0u)) {
if (FieldWidth != 0u) {
while ((FieldWidth != 0u) && (Width < FieldWidth)) {
FieldWidth--;
_StoreChar(pBufferDesc, ' ');
if (pBufferDesc->ReturnValue < 0) {
break;
}
}
}
}
//
// Print sign if necessary
//
if (pBufferDesc->ReturnValue >= 0) {
if (v < 0) {
v = -v;
_StoreChar(pBufferDesc, '-');
} else if ((FormatFlags & FORMAT_FLAG_PRINT_SIGN) == FORMAT_FLAG_PRINT_SIGN) {
_StoreChar(pBufferDesc, '+');
} else {
}
if (pBufferDesc->ReturnValue >= 0) {
//
// Print leading zeros if necessary
//
if (((FormatFlags & FORMAT_FLAG_PAD_ZERO) == FORMAT_FLAG_PAD_ZERO) && ((FormatFlags & FORMAT_FLAG_LEFT_JUSTIFY) == 0u) && (NumDigits == 0u)) {
if (FieldWidth != 0u) {
while ((FieldWidth != 0u) && (Width < FieldWidth)) {
FieldWidth--;
_StoreChar(pBufferDesc, '0');
if (pBufferDesc->ReturnValue < 0) {
break;
}
}
}
}
if (pBufferDesc->ReturnValue >= 0) {
//
// Print number without sign
//
_PrintUnsigned(pBufferDesc, (unsigned)v, Base, NumDigits, FieldWidth, FormatFlags);
}
}
}
}
/*********************************************************************
*
* Public code
*
**********************************************************************
*/
/*********************************************************************
*
* SEGGER_RTT_vprintf
*
* Function description
* Stores a formatted string in SEGGER RTT control block.
* This data is read by the host.
*
* Parameters
* BufferIndex Index of "Up"-buffer to be used. (e.g. 0 for "Terminal")
* sFormat Pointer to format string
* pParamList Pointer to the list of arguments for the format string
*
* Return values
* >= 0: Number of bytes which have been stored in the "Up"-buffer.
* < 0: Error
*/
int SEGGER_RTT_vprintf(unsigned BufferIndex, const char * sFormat, va_list * pParamList) {
char c;
SEGGER_RTT_PRINTF_DESC BufferDesc;
int v;
unsigned NumDigits;
unsigned FormatFlags;
unsigned FieldWidth;
char acBuffer[SEGGER_RTT_PRINTF_BUFFER_SIZE];
BufferDesc.pBuffer = acBuffer;
BufferDesc.BufferSize = SEGGER_RTT_PRINTF_BUFFER_SIZE;
BufferDesc.Cnt = 0u;
BufferDesc.RTTBufferIndex = BufferIndex;
BufferDesc.ReturnValue = 0;
do {
c = *sFormat;
sFormat++;
if (c == 0u) {
break;
}
if (c == '%') {
//
// Filter out flags
//
FormatFlags = 0u;
v = 1;
do {
c = *sFormat;
switch (c) {
case '-': FormatFlags |= FORMAT_FLAG_LEFT_JUSTIFY; sFormat++; break;
case '0': FormatFlags |= FORMAT_FLAG_PAD_ZERO; sFormat++; break;
case '+': FormatFlags |= FORMAT_FLAG_PRINT_SIGN; sFormat++; break;
case '#': FormatFlags |= FORMAT_FLAG_ALTERNATE; sFormat++; break;
default: v = 0; break;
}
} while (v);
//
// filter out field with
//
FieldWidth = 0u;
do {
c = *sFormat;
if ((c < '0') || (c > '9')) {
break;
}
sFormat++;
FieldWidth = (FieldWidth * 10u) + ((unsigned)c - '0');
} while (1);
//
// Filter out precision (number of digits to display)
//
NumDigits = 0u;
c = *sFormat;
if (c == '.') {
sFormat++;
do {
c = *sFormat;
if ((c < '0') || (c > '9')) {
break;
}
sFormat++;
NumDigits = NumDigits * 10u + ((unsigned)c - '0');
} while (1);
}
//
// Filter out length modifier
//
c = *sFormat;
do {
if ((c == 'l') || (c == 'h')) {
sFormat++;
c = *sFormat;
} else {
break;
}
} while (1);
//
// Handle specifiers
//
switch (c) {
case 'c': {
char c0;
v = va_arg(*pParamList, int);
c0 = (char)v;
_StoreChar(&BufferDesc, c0);
break;
}
case 'd':
v = va_arg(*pParamList, int);
_PrintInt(&BufferDesc, v, 10u, NumDigits, FieldWidth, FormatFlags);
break;
case 'u':
v = va_arg(*pParamList, int);
_PrintUnsigned(&BufferDesc, (unsigned)v, 10u, NumDigits, FieldWidth, FormatFlags);
break;
case 'x':
case 'X':
v = va_arg(*pParamList, int);
_PrintUnsigned(&BufferDesc, (unsigned)v, 16u, NumDigits, FieldWidth, FormatFlags);
break;
case 's':
{
const char * s = va_arg(*pParamList, const char *);
do {
c = *s;
s++;
if (c == '\0') {
break;
}
_StoreChar(&BufferDesc, c);
} while (BufferDesc.ReturnValue >= 0);
}
break;
case 'p':
v = va_arg(*pParamList, int);
_PrintUnsigned(&BufferDesc, (unsigned)v, 16u, 8u, 8u, 0u);
break;
case '%':
_StoreChar(&BufferDesc, '%');
break;
default:
break;
}
sFormat++;
} else {
_StoreChar(&BufferDesc, c);
}
} while (BufferDesc.ReturnValue >= 0);
if (BufferDesc.ReturnValue > 0) {
//
// Write remaining data, if any
//
if (BufferDesc.Cnt != 0u) {
SEGGER_RTT_Write(BufferIndex, acBuffer, BufferDesc.Cnt);
}
BufferDesc.ReturnValue += (int)BufferDesc.Cnt;
}
return BufferDesc.ReturnValue;
}
/*********************************************************************
*
* SEGGER_RTT_printf
*
* Function description
* Stores a formatted string in SEGGER RTT control block.
* This data is read by the host.
*
* Parameters
* BufferIndex Index of "Up"-buffer to be used. (e.g. 0 for "Terminal")
* sFormat Pointer to format string, followed by the arguments for conversion
*
* Return values
* >= 0: Number of bytes which have been stored in the "Up"-buffer.
* < 0: Error
*
* Notes
* (1) Conversion specifications have following syntax:
* %[flags][FieldWidth][.Precision]ConversionSpecifier
* (2) Supported flags:
* -: Left justify within the field width
* +: Always print sign extension for signed conversions
* 0: Pad with 0 instead of spaces. Ignored when using '-'-flag or precision
* Supported conversion specifiers:
* c: Print the argument as one char
* d: Print the argument as a signed integer
* u: Print the argument as an unsigned integer
* x: Print the argument as an hexadecimal integer
* s: Print the string pointed to by the argument
* p: Print the argument as an 8-digit hexadecimal integer. (Argument shall be a pointer to void.)
*/
int SEGGER_RTT_printf(unsigned BufferIndex, const char * sFormat, ...) {
int r;
va_list ParamList;
va_start(ParamList, sFormat);
r = SEGGER_RTT_vprintf(BufferIndex, sFormat, &ParamList);
va_end(ParamList);
return r;
}
/*************************** End of file ****************************/

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,370 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW.h
Purpose : System visualization API.
Revision: $Rev: 21292 $
*/
#ifndef SEGGER_SYSVIEW_H
#define SEGGER_SYSVIEW_H
/*********************************************************************
*
* #include Section
*
**********************************************************************
*/
#include "SEGGER.h"
#include "SEGGER_SYSVIEW_ConfDefaults.h"
#ifdef __cplusplus
extern "C" {
#endif
/*********************************************************************
*
* Defines, fixed
*
**********************************************************************
*/
#define SEGGER_SYSVIEW_MAJOR 3
#define SEGGER_SYSVIEW_MINOR 10
#define SEGGER_SYSVIEW_REV 0
#define SEGGER_SYSVIEW_VERSION ((SEGGER_SYSVIEW_MAJOR * 10000) + (SEGGER_SYSVIEW_MINOR * 100) + SEGGER_SYSVIEW_REV)
#define SEGGER_SYSVIEW_INFO_SIZE 9 // Minimum size, which has to be reserved for a packet. 1-2 byte of message type, 0-2 byte of payload length, 1-5 bytes of timestamp.
#define SEGGER_SYSVIEW_QUANTA_U32 5 // Maximum number of bytes to encode a U32, should be reserved for each 32-bit value in a packet.
#define SEGGER_SYSVIEW_LOG (0u)
#define SEGGER_SYSVIEW_WARNING (1u)
#define SEGGER_SYSVIEW_ERROR (2u)
#define SEGGER_SYSVIEW_FLAG_APPEND (1u << 6)
#define SEGGER_SYSVIEW_PREPARE_PACKET(p) (p) + 4
//
// SystemView events. First 32 IDs from 0 .. 31 are reserved for these
//
#define SYSVIEW_EVTID_NOP 0 // Dummy packet.
#define SYSVIEW_EVTID_OVERFLOW 1
#define SYSVIEW_EVTID_ISR_ENTER 2
#define SYSVIEW_EVTID_ISR_EXIT 3
#define SYSVIEW_EVTID_TASK_START_EXEC 4
#define SYSVIEW_EVTID_TASK_STOP_EXEC 5
#define SYSVIEW_EVTID_TASK_START_READY 6
#define SYSVIEW_EVTID_TASK_STOP_READY 7
#define SYSVIEW_EVTID_TASK_CREATE 8
#define SYSVIEW_EVTID_TASK_INFO 9
#define SYSVIEW_EVTID_TRACE_START 10
#define SYSVIEW_EVTID_TRACE_STOP 11
#define SYSVIEW_EVTID_SYSTIME_CYCLES 12
#define SYSVIEW_EVTID_SYSTIME_US 13
#define SYSVIEW_EVTID_SYSDESC 14
#define SYSVIEW_EVTID_MARK_START 15
#define SYSVIEW_EVTID_MARK_STOP 16
#define SYSVIEW_EVTID_IDLE 17
#define SYSVIEW_EVTID_ISR_TO_SCHEDULER 18
#define SYSVIEW_EVTID_TIMER_ENTER 19
#define SYSVIEW_EVTID_TIMER_EXIT 20
#define SYSVIEW_EVTID_STACK_INFO 21
#define SYSVIEW_EVTID_MODULEDESC 22
#define SYSVIEW_EVTID_INIT 24
#define SYSVIEW_EVTID_NAME_RESOURCE 25
#define SYSVIEW_EVTID_PRINT_FORMATTED 26
#define SYSVIEW_EVTID_NUMMODULES 27
#define SYSVIEW_EVTID_END_CALL 28
#define SYSVIEW_EVTID_TASK_TERMINATE 29
#define SYSVIEW_EVTID_EX 31
//
// SystemView extended events. Sent with ID 31.
//
#define SYSVIEW_EVTID_EX_MARK 0
#define SYSVIEW_EVTID_EX_NAME_MARKER 1
//
// Event masks to disable/enable events
//
#define SYSVIEW_EVTMASK_NOP (1 << SYSVIEW_EVTID_NOP)
#define SYSVIEW_EVTMASK_OVERFLOW (1 << SYSVIEW_EVTID_OVERFLOW)
#define SYSVIEW_EVTMASK_ISR_ENTER (1 << SYSVIEW_EVTID_ISR_ENTER)
#define SYSVIEW_EVTMASK_ISR_EXIT (1 << SYSVIEW_EVTID_ISR_EXIT)
#define SYSVIEW_EVTMASK_TASK_START_EXEC (1 << SYSVIEW_EVTID_TASK_START_EXEC)
#define SYSVIEW_EVTMASK_TASK_STOP_EXEC (1 << SYSVIEW_EVTID_TASK_STOP_EXEC)
#define SYSVIEW_EVTMASK_TASK_START_READY (1 << SYSVIEW_EVTID_TASK_START_READY)
#define SYSVIEW_EVTMASK_TASK_STOP_READY (1 << SYSVIEW_EVTID_TASK_STOP_READY)
#define SYSVIEW_EVTMASK_TASK_CREATE (1 << SYSVIEW_EVTID_TASK_CREATE)
#define SYSVIEW_EVTMASK_TASK_INFO (1 << SYSVIEW_EVTID_TASK_INFO)
#define SYSVIEW_EVTMASK_TRACE_START (1 << SYSVIEW_EVTID_TRACE_START)
#define SYSVIEW_EVTMASK_TRACE_STOP (1 << SYSVIEW_EVTID_TRACE_STOP)
#define SYSVIEW_EVTMASK_SYSTIME_CYCLES (1 << SYSVIEW_EVTID_SYSTIME_CYCLES)
#define SYSVIEW_EVTMASK_SYSTIME_US (1 << SYSVIEW_EVTID_SYSTIME_US)
#define SYSVIEW_EVTMASK_SYSDESC (1 << SYSVIEW_EVTID_SYSDESC)
#define SYSVIEW_EVTMASK_USER_START (1 << SYSVIEW_EVTID_USER_START)
#define SYSVIEW_EVTMASK_USER_STOP (1 << SYSVIEW_EVTID_USER_STOP)
#define SYSVIEW_EVTMASK_IDLE (1 << SYSVIEW_EVTID_IDLE)
#define SYSVIEW_EVTMASK_ISR_TO_SCHEDULER (1 << SYSVIEW_EVTID_ISR_TO_SCHEDULER)
#define SYSVIEW_EVTMASK_TIMER_ENTER (1 << SYSVIEW_EVTID_TIMER_ENTER)
#define SYSVIEW_EVTMASK_TIMER_EXIT (1 << SYSVIEW_EVTID_TIMER_EXIT)
#define SYSVIEW_EVTMASK_STACK_INFO (1 << SYSVIEW_EVTID_STACK_INFO)
#define SYSVIEW_EVTMASK_MODULEDESC (1 << SYSVIEW_EVTID_MODULEDESC)
#define SYSVIEW_EVTMASK_INIT (1 << SYSVIEW_EVTID_INIT)
#define SYSVIEW_EVTMASK_NAME_RESOURCE (1 << SYSVIEW_EVTID_NAME_RESOURCE)
#define SYSVIEW_EVTMASK_PRINT_FORMATTED (1 << SYSVIEW_EVTID_PRINT_FORMATTED)
#define SYSVIEW_EVTMASK_NUMMODULES (1 << SYSVIEW_EVTID_NUMMODULES)
#define SYSVIEW_EVTMASK_END_CALL (1 << SYSVIEW_EVTID_END_CALL)
#define SYSVIEW_EVTMASK_TASK_TERMINATE (1 << SYSVIEW_EVTID_TASK_TERMINATE)
#define SYSVIEW_EVTMASK_EX (1 << SYSVIEW_EVTID_EX)
#define SYSVIEW_EVTMASK_ALL_INTERRUPTS ( SYSVIEW_EVTMASK_ISR_ENTER \
| SYSVIEW_EVTMASK_ISR_EXIT \
| SYSVIEW_EVTMASK_ISR_TO_SCHEDULER)
#define SYSVIEW_EVTMASK_ALL_TASKS ( SYSVIEW_EVTMASK_TASK_START_EXEC \
| SYSVIEW_EVTMASK_TASK_STOP_EXEC \
| SYSVIEW_EVTMASK_TASK_START_READY \
| SYSVIEW_EVTMASK_TASK_STOP_READY \
| SYSVIEW_EVTMASK_TASK_CREATE \
| SYSVIEW_EVTMASK_TASK_INFO \
| SYSVIEW_EVTMASK_STACK_INFO \
| SYSVIEW_EVTMASK_TASK_TERMINATE)
/*********************************************************************
*
* Structures
*
**********************************************************************
*/
typedef struct {
U32 TaskID;
const char* sName;
U32 Prio;
U32 StackBase;
U32 StackSize;
} SEGGER_SYSVIEW_TASKINFO;
typedef struct SEGGER_SYSVIEW_MODULE_STRUCT SEGGER_SYSVIEW_MODULE;
struct SEGGER_SYSVIEW_MODULE_STRUCT {
const char* sModule;
U32 NumEvents;
U32 EventOffset;
void (*pfSendModuleDesc)(void);
SEGGER_SYSVIEW_MODULE* pNext;
};
typedef void (SEGGER_SYSVIEW_SEND_SYS_DESC_FUNC)(void);
/*********************************************************************
*
* Global data
*
**********************************************************************
*/
#ifdef EXTERN
#undef EXTERN
#endif
#ifndef SEGGER_SYSVIEW_C // Defined in SEGGER_SYSVIEW.c which includes this header beside other C-files
#define EXTERN extern
#else
#define EXTERN
#endif
EXTERN unsigned int SEGGER_SYSVIEW_TickCnt;
EXTERN unsigned int SEGGER_SYSVIEW_InterruptId;
#undef EXTERN
/*********************************************************************
*
* API functions
*
**********************************************************************
*/
typedef struct {
U64 (*pfGetTime) (void);
void (*pfSendTaskList) (void);
} SEGGER_SYSVIEW_OS_API;
/*********************************************************************
*
* Control and initialization functions
*/
void SEGGER_SYSVIEW_Init (U32 SysFreq, U32 CPUFreq, const SEGGER_SYSVIEW_OS_API *pOSAPI, SEGGER_SYSVIEW_SEND_SYS_DESC_FUNC pfSendSysDesc);
void SEGGER_SYSVIEW_SetRAMBase (U32 RAMBaseAddress);
void SEGGER_SYSVIEW_Start (void);
void SEGGER_SYSVIEW_Stop (void);
void SEGGER_SYSVIEW_GetSysDesc (void);
void SEGGER_SYSVIEW_SendTaskList (void);
void SEGGER_SYSVIEW_SendTaskInfo (const SEGGER_SYSVIEW_TASKINFO* pInfo);
void SEGGER_SYSVIEW_SendSysDesc (const char* sSysDesc);
int SEGGER_SYSVIEW_IsStarted (void);
int SEGGER_SYSVIEW_GetChannelID (void);
/*********************************************************************
*
* Event recording functions
*/
void SEGGER_SYSVIEW_RecordVoid (unsigned int EventId);
void SEGGER_SYSVIEW_RecordU32 (unsigned int EventId, U32 Para0);
void SEGGER_SYSVIEW_RecordU32x2 (unsigned int EventId, U32 Para0, U32 Para1);
void SEGGER_SYSVIEW_RecordU32x3 (unsigned int EventId, U32 Para0, U32 Para1, U32 Para2);
void SEGGER_SYSVIEW_RecordU32x4 (unsigned int EventId, U32 Para0, U32 Para1, U32 Para2, U32 Para3);
void SEGGER_SYSVIEW_RecordU32x5 (unsigned int EventId, U32 Para0, U32 Para1, U32 Para2, U32 Para3, U32 Para4);
void SEGGER_SYSVIEW_RecordU32x6 (unsigned int EventId, U32 Para0, U32 Para1, U32 Para2, U32 Para3, U32 Para4, U32 Para5);
void SEGGER_SYSVIEW_RecordU32x7 (unsigned int EventId, U32 Para0, U32 Para1, U32 Para2, U32 Para3, U32 Para4, U32 Para5, U32 Para6);
void SEGGER_SYSVIEW_RecordU32x8 (unsigned int EventId, U32 Para0, U32 Para1, U32 Para2, U32 Para3, U32 Para4, U32 Para5, U32 Para6, U32 Para7);
void SEGGER_SYSVIEW_RecordU32x9 (unsigned int EventId, U32 Para0, U32 Para1, U32 Para2, U32 Para3, U32 Para4, U32 Para5, U32 Para6, U32 Para7, U32 Para8);
void SEGGER_SYSVIEW_RecordU32x10 (unsigned int EventId, U32 Para0, U32 Para1, U32 Para2, U32 Para3, U32 Para4, U32 Para5, U32 Para6, U32 Para7, U32 Para8, U32 Para9);
void SEGGER_SYSVIEW_RecordString (unsigned int EventId, const char* pString);
void SEGGER_SYSVIEW_RecordSystime (void);
void SEGGER_SYSVIEW_RecordEnterISR (void);
void SEGGER_SYSVIEW_RecordExitISR (void);
void SEGGER_SYSVIEW_RecordExitISRToScheduler (void);
void SEGGER_SYSVIEW_RecordEnterTimer (U32 TimerId);
void SEGGER_SYSVIEW_RecordExitTimer (void);
void SEGGER_SYSVIEW_RecordEndCall (unsigned int EventID);
void SEGGER_SYSVIEW_RecordEndCallU32 (unsigned int EventID, U32 Para0);
void SEGGER_SYSVIEW_OnIdle (void);
void SEGGER_SYSVIEW_OnTaskCreate (U32 TaskId);
void SEGGER_SYSVIEW_OnTaskTerminate (U32 TaskId);
void SEGGER_SYSVIEW_OnTaskStartExec (U32 TaskId);
void SEGGER_SYSVIEW_OnTaskStopExec (void);
void SEGGER_SYSVIEW_OnTaskStartReady (U32 TaskId);
void SEGGER_SYSVIEW_OnTaskStopReady (U32 TaskId, unsigned int Cause);
void SEGGER_SYSVIEW_MarkStart (unsigned int MarkerId);
void SEGGER_SYSVIEW_MarkStop (unsigned int MarkerId);
void SEGGER_SYSVIEW_Mark (unsigned int MarkerId);
void SEGGER_SYSVIEW_NameMarker (unsigned int MarkerId, const char* sName);
void SEGGER_SYSVIEW_NameResource (U32 ResourceId, const char* sName);
int SEGGER_SYSVIEW_SendPacket (U8* pPacket, U8* pPayloadEnd, unsigned int EventId);
/*********************************************************************
*
* Event parameter encoding functions
*/
U8* SEGGER_SYSVIEW_EncodeU32 (U8* pPayload, U32 Value);
U8* SEGGER_SYSVIEW_EncodeData (U8* pPayload, const char* pSrc, unsigned int Len);
U8* SEGGER_SYSVIEW_EncodeString (U8* pPayload, const char* s, unsigned int MaxLen);
U8* SEGGER_SYSVIEW_EncodeId (U8* pPayload, U32 Id);
U32 SEGGER_SYSVIEW_ShrinkId (U32 Id);
/*********************************************************************
*
* Middleware module registration
*/
void SEGGER_SYSVIEW_RegisterModule (SEGGER_SYSVIEW_MODULE* pModule);
void SEGGER_SYSVIEW_RecordModuleDescription (const SEGGER_SYSVIEW_MODULE* pModule, const char* sDescription);
void SEGGER_SYSVIEW_SendModule (U8 ModuleId);
void SEGGER_SYSVIEW_SendModuleDescription (void);
void SEGGER_SYSVIEW_SendNumModules (void);
/*********************************************************************
*
* printf-Style functions
*/
#ifndef SEGGER_SYSVIEW_EXCLUDE_PRINTF // Define in project to avoid warnings about variable parameter list
void SEGGER_SYSVIEW_PrintfHostEx (const char* s, U32 Options, ...);
void SEGGER_SYSVIEW_PrintfTargetEx (const char* s, U32 Options, ...);
void SEGGER_SYSVIEW_PrintfHost (const char* s, ...);
void SEGGER_SYSVIEW_PrintfTarget (const char* s, ...);
void SEGGER_SYSVIEW_WarnfHost (const char* s, ...);
void SEGGER_SYSVIEW_WarnfTarget (const char* s, ...);
void SEGGER_SYSVIEW_ErrorfHost (const char* s, ...);
void SEGGER_SYSVIEW_ErrorfTarget (const char* s, ...);
#endif
void SEGGER_SYSVIEW_Print (const char* s);
void SEGGER_SYSVIEW_Warn (const char* s);
void SEGGER_SYSVIEW_Error (const char* s);
/*********************************************************************
*
* Run-time configuration functions
*/
void SEGGER_SYSVIEW_EnableEvents (U32 EnableMask);
void SEGGER_SYSVIEW_DisableEvents (U32 DisableMask);
/*********************************************************************
*
* Application-provided functions
*/
void SEGGER_SYSVIEW_Conf (void);
U32 SEGGER_SYSVIEW_X_GetTimestamp (void);
U32 SEGGER_SYSVIEW_X_GetInterruptId (void);
void SEGGER_SYSVIEW_X_StartComm (void);
void SEGGER_SYSVIEW_X_OnEventRecorded (unsigned NumBytes);
#ifdef __cplusplus
}
#endif
/*********************************************************************
*
* Compatibility API defines
*/
#define SEGGER_SYSVIEW_OnUserStart SEGGER_SYSVIEW_MarkStart
#define SEGGER_SYSVIEW_OnUserStop SEGGER_SYSVIEW_MarkStop
#endif
/*************************** End of file ****************************/

View File

@ -0,0 +1,553 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_ConfDefaults.h
Purpose : Defines defaults for configurable defines used in
SEGGER SystemView.
Revision: $Rev: 21319 $
*/
#ifndef SEGGER_SYSVIEW_CONFDEFAULTS_H
#define SEGGER_SYSVIEW_CONFDEFAULTS_H
/*********************************************************************
*
* #include Section
*
**********************************************************************
*/
#include "SEGGER_SYSVIEW_Conf.h"
#include "SEGGER_RTT_Conf.h"
#ifdef __cplusplus
extern "C" {
#endif
/*********************************************************************
*
* Defines, fixed
*
**********************************************************************
*/
//
// Use auto-detection for SEGGER_SYSVIEW_CORE define
// based on compiler-/toolchain-specific defines
// to define SEGGER_SYSVIEW_GET_INTERRUPT_ID and SEGGER_SYSVIEW_GET_TIMESTAMP
//
#define SEGGER_SYSVIEW_CORE_OTHER 0
#define SEGGER_SYSVIEW_CORE_CM0 1 // Cortex-M0/M0+/M1
#define SEGGER_SYSVIEW_CORE_CM3 2 // Cortex-M3/M4/M7
#define SEGGER_SYSVIEW_CORE_RX 3 // Renesas RX
#ifndef SEGGER_SYSVIEW_CORE
#if (defined __SES_ARM) || (defined __CROSSWORKS_ARM) || (defined __SEGGER_CC__) || (defined __GNUC__) || (defined __clang__)
#if (defined __ARM_ARCH_6M__) || (defined __ARM_ARCH_8M_BASE__)
#define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_CM0
#elif (defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_8M_MAIN__))
#define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_CM3
#endif
#elif defined(__ICCARM__)
#if (defined (__ARM6M__) && (__CORE__ == __ARM6M__)) \
|| (defined (__ARM8M_BASELINE__) && (__CORE__ == __ARM8M_BASELINE__))
#define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_CM0
#elif (defined (__ARM7EM__) && (__CORE__ == __ARM7EM__)) \
|| (defined (__ARM7M__) && (__CORE__ == __ARM7M__)) \
|| (defined (__ARM8M_MAINLINE__) && (__CORE__ == __ARM8M_MAINLINE__)) \
|| (defined (__ARM8M_MAINLINE__) && (__CORE__ == __ARM8M_MAINLINE__))
#define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_CM3
#endif
#elif defined(__CC_ARM)
#if (defined(__TARGET_ARCH_6S_M))
#define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_CM0
#elif (defined(__TARGET_ARCH_7_M) || defined(__TARGET_ARCH_7E_M))
#define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_CM3
#endif
#elif defined(__TI_ARM__)
#ifdef __TI_ARM_V6M0__
#define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_CM0
#elif (defined(__TI_ARM_V7M3__) || defined(__TI_ARM_V7M4__))
#define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_CM3
#endif
#elif defined(__ICCRX__)
#define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_RX
#elif defined(__RX)
#define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_RX
#endif
#ifndef SEGGER_SYSVIEW_CORE
#define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_OTHER
#endif
#endif
/*********************************************************************
*
* Defines, defaults
*
**********************************************************************
*/
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_APP_NAME
*
* Description
* The application name to be displayed in SystemView.
* Default
* "SystemView-enabled Application"
* Notes
* Convenience define to be used for SEGGER_SYSVIEW_SendSysDesc().
*/
#ifndef SEGGER_SYSVIEW_APP_NAME
#define SEGGER_SYSVIEW_APP_NAME "SystemView-enabled Application"
#endif
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_DEVICE_NAME
*
* Description
* The target device name to be displayed in SystemView.
* Default
* "undefined device"
* Notes
* Convenience define to be used for SEGGER_SYSVIEW_SendSysDesc().
*/
#ifndef SEGGER_SYSVIEW_DEVICE_NAME
#define SEGGER_SYSVIEW_DEVICE_NAME "undefined device"
#endif
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_GET_INTERRUPT_ID()
*
* Description
* Function macro to retrieve the Id of the currently active
* interrupt.
* Default
* Call user-supplied function SEGGER_SYSVIEW_X_GetInterruptId().
* Notes
* For some known compilers and cores, a ready-to-use, core-specific
* default is set.
* ARMv7M: Read ICSR[8:0] (active vector)
* ARMv6M: Read ICSR[5:0] (active vector)
*/
#ifndef SEGGER_SYSVIEW_GET_INTERRUPT_ID
#if SEGGER_SYSVIEW_CORE == SEGGER_SYSVIEW_CORE_CM3
#define SEGGER_SYSVIEW_GET_INTERRUPT_ID() ((*(U32*)(0xE000ED04)) & 0x1FF) // Get the currently active interrupt Id. (i.e. read Cortex-M ICSR[8:0] = active vector)
#elif SEGGER_SYSVIEW_CORE == SEGGER_SYSVIEW_CORE_CM0
#if defined(__ICCARM__)
#if (__VER__ > 6010000)
#define SEGGER_SYSVIEW_GET_INTERRUPT_ID() (__get_IPSR()) // Workaround for IAR, which might do a byte-access to 0xE000ED04. Read IPSR instead.
#else
#define SEGGER_SYSVIEW_GET_INTERRUPT_ID() ((*(U32*)(0xE000ED04)) & 0x3F) // Older versions of IAR do not include __get_IPSR, but might also not optimize to byte-access.
#endif
#else
#define SEGGER_SYSVIEW_GET_INTERRUPT_ID() ((*(U32*)(0xE000ED04)) & 0x3F) // Get the currently active interrupt Id. (i.e. read Cortex-M ICSR[5:0] = active vector)
#endif
#else
#define SEGGER_SYSVIEW_GET_INTERRUPT_ID() SEGGER_SYSVIEW_X_GetInterruptId() // Get the currently active interrupt Id from the user-provided function.
#endif
#endif
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_GET_TIMESTAMP()
*
* Description
* Function macro to retrieve a system timestamp for SYSVIEW events.
* Default
* Call user-supplied function SEGGER_SYSVIEW_X_GetTimestamp().
* Notes
* For some known compilers and cores, a ready-to-use, core-specific
* default is set.
* ARMv7M: Read Cortex-M Cycle Count register.
*
* The system timestamp clock frequency has to be passed in
* SEGGER_SYSVIEW_Init().
*/
#ifndef SEGGER_SYSVIEW_GET_TIMESTAMP
#if defined (SEGGER_SYSVIEW_CORE) && (SEGGER_SYSVIEW_CORE == SEGGER_SYSVIEW_CORE_CM3)
#define SEGGER_SYSVIEW_GET_TIMESTAMP() (*(U32 *)(0xE0001004)) // Retrieve a system timestamp. Cortex-M cycle counter.
#else
#define SEGGER_SYSVIEW_GET_TIMESTAMP() SEGGER_SYSVIEW_X_GetTimestamp() // Retrieve a system timestamp via user-defined function
#endif
#endif
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_TIMESTAMP_BITS
*
* Description
* Number of valid (low-order) bits delivered in system timestamp.
* Default
* 32
* Notes
* Value has to match system timestamp clock source.
*/
// Define number of valid bits low-order delivered by clock source.
#ifndef SEGGER_SYSVIEW_TIMESTAMP_BITS
#define SEGGER_SYSVIEW_TIMESTAMP_BITS 32
#endif
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_RTT_CHANNEL
*
* Description
* The RTT channel that SystemView will use.
* Default
* 0: Auto selection.
* Notes
* Value has to be lower than SEGGER_RTT_MAX_NUM_UP_BUFFERS.
*/
#ifndef SEGGER_SYSVIEW_RTT_CHANNEL
#define SEGGER_SYSVIEW_RTT_CHANNEL 0
#endif
// Sanity check of RTT channel
#if (SEGGER_SYSVIEW_RTT_CHANNEL == 0) && (SEGGER_RTT_MAX_NUM_UP_BUFFERS < 2)
#error "SEGGER_RTT_MAX_NUM_UP_BUFFERS in SEGGER_RTT_Conf.h has to be > 1!"
#elif (SEGGER_SYSVIEW_RTT_CHANNEL >= SEGGER_RTT_MAX_NUM_UP_BUFFERS)
#error "SEGGER_RTT_MAX_NUM_UP_BUFFERS in SEGGER_RTT_Conf.h has to be > SEGGER_SYSVIEW_RTT_CHANNEL!"
#endif
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_RTT_BUFFER_SIZE
*
* Description
* Number of bytes that SystemView uses for the RTT buffer.
* Default
* 1024
*/
#ifndef SEGGER_SYSVIEW_RTT_BUFFER_SIZE
#define SEGGER_SYSVIEW_RTT_BUFFER_SIZE 1024
#endif
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_SECTION
*
* Description
* Section to place the SystemView RTT Buffer into.
* Default
* undefined: Do not place into a specific section.
* Notes
* If SEGGER_RTT_SECTION is defined, the default changes to use
* this section for the SystemView RTT Buffer, too.
*/
#if !(defined SEGGER_SYSVIEW_SECTION) && (defined SEGGER_RTT_SECTION)
#define SEGGER_SYSVIEW_SECTION SEGGER_RTT_SECTION
#endif
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_CPU_CACHE_LINE_SIZE
*
* Description
* Largest cache line size (in bytes) in the target system.
* Default
* 0
* Notes
* Required in systems with caches to make sure that the SystemView
* RTT buffer can be aligned accordingly.
*/
#ifndef SEGGER_SYSVIEW_CPU_CACHE_LINE_SIZE
#define SEGGER_SYSVIEW_CPU_CACHE_LINE_SIZE 0
#endif
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_ID_BASE
*
* Description
* Lowest Id reported by the application.
* Default
* 0
* Notes
* Value is usually subtracted from mailboxes, semaphores, tasks,
* .... addresses, to compress event parameters.
* Should be the lowest RAM address of the system.
*/
#ifndef SEGGER_SYSVIEW_ID_BASE
#define SEGGER_SYSVIEW_ID_BASE 0
#endif
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_ID_SHIFT
*
* Description
* Number of bits to shift Ids.
* Default
* 0
* Notes
* Ids are shifted to compress event parameters.
* Should match the alignment of Ids (addresses),
* e.g. 2 when Ids are 4 byte aligned.
*/
#ifndef SEGGER_SYSVIEW_ID_SHIFT
#define SEGGER_SYSVIEW_ID_SHIFT 0
#endif
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_MAX_ARGUMENTS
*
* Description
* Maximum number of arguments which are handled with SystemView
* print routines or may be encoded in one recording function.
* routines.
* Default
* 16
*/
#ifndef SEGGER_SYSVIEW_MAX_ARGUMENTS
#define SEGGER_SYSVIEW_MAX_ARGUMENTS 16
#endif
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_MAX_STRING_LEN
*
* Description
* Maximum string length which can be used in SystemView print and
* system description routines.
* Default
* 128
*/
#ifndef SEGGER_SYSVIEW_MAX_STRING_LEN
#define SEGGER_SYSVIEW_MAX_STRING_LEN 128
#endif
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_PRINTF_IMPLICIT_FORMAT
*
* Description
* If enabled, on SEGGER_SYSVIEW_PrintHost, check the format string
* and if it includes unsupported formatters, use formatting on the
* target instead.
* Default
* 0: Disabled.
*/
#ifndef SEGGER_SYSVIEW_PRINTF_IMPLICIT_FORMAT
#define SEGGER_SYSVIEW_PRINTF_IMPLICIT_FORMAT 0
#endif
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_USE_INTERNAL_RECORDER
*
* Description
* If set, an internal recorder, such as UART or IP is used.
* Default
* 0: Disabled.
* Notes
* Convenience define to be used by SEGGER_SYSVIEW_Conf(),
* such as in embOS configuration to enable Cortex-M cycle counter.
*/
#ifndef SEGGER_SYSVIEW_USE_INTERNAL_RECORDER
#define SEGGER_SYSVIEW_USE_INTERNAL_RECORDER 0
#endif
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_CAN_RESTART
*
* Description
* If enabled, send the SystemView start sequence on every start
* command, not just on the first one.
* Enables restart when SystemView disconnected unexpectedly.
* Default
* 1: Enabled
*/
#ifndef SEGGER_SYSVIEW_CAN_RESTART
#define SEGGER_SYSVIEW_CAN_RESTART 1
#endif
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_START_ON_INIT
*
* Description
* Enable calling SEGGER_SYSVIEW_Start() after initialization.
* Default
* 0: Disabled.
* Notes
* Convenience define to be used by SEGGER_SYSVIEW_Conf(),
* such as in embOS configuration.
*/
#ifndef SEGGER_SYSVIEW_START_ON_INIT
#define SEGGER_SYSVIEW_START_ON_INIT 0
#endif
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_USE_STATIC_BUFFER
*
* Description
* If enabled, use a static buffer instead of a buffer on the stack
* for SystemView event packets.
* Default
* 1: Enabled.
* Notes
* If enabled, the static memory use by SystemView is increased by
* the maximum packet size. SystemView is locked on entry of a
* recording function.
* If disabled, the stack usage by SystemView recording functions
* might be increased by up to the maximum packet size. SystemView
* is locked when writing the packet to the RTT buffer.
*/
#ifndef SEGGER_SYSVIEW_USE_STATIC_BUFFER
#define SEGGER_SYSVIEW_USE_STATIC_BUFFER 1
#endif
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_MAX_PACKET_SIZE
*
* Description
* Maximum packet size for a SystemView event.
* Default
* Automatically calculated.
* Notes
* The maximum packet size is mainly defined by the maximum string
* length and the maximum number of arguments.
*/
#ifndef SEGGER_SYSVIEW_MAX_PACKET_SIZE
#define SEGGER_SYSVIEW_MAX_PACKET_SIZE (SEGGER_SYSVIEW_INFO_SIZE + SEGGER_SYSVIEW_MAX_STRING_LEN + 2 * SEGGER_SYSVIEW_QUANTA_U32 + SEGGER_SYSVIEW_MAX_ARGUMENTS * SEGGER_SYSVIEW_QUANTA_U32)
#endif
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_POST_MORTEM_MODE
*
* Description
* If enabled, SystemView records for post-mortem analysis instead
* of real-time analysis.
* Default
* 0: Disabled.
* Notes
* For more information refer to
* https://www.segger.com/products/development-tools/systemview/technology/post-mortem-mode
*/
#ifndef SEGGER_SYSVIEW_POST_MORTEM_MODE
#define SEGGER_SYSVIEW_POST_MORTEM_MODE 0
#endif
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_SYNC_PERIOD_SHIFT
*
* Description
* Configure how frequently syncronization is sent in post-mortem
* mode.
* Default
* 8: (1 << 8) = Every 256 Events.
* Notes
* In post-mortem mode, at least one sync has to be in the RTT buffer.
* Recommended sync frequency: Buffer Size / 16
* For more information refer to
* https://www.segger.com/products/development-tools/systemview/technology/post-mortem-mode
*/
#ifndef SEGGER_SYSVIEW_SYNC_PERIOD_SHIFT
#define SEGGER_SYSVIEW_SYNC_PERIOD_SHIFT 8
#endif
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_ON_EVENT_RECORDED()
*
* Description
* Function macro to notify recorder about a new event in buffer.
* Default
* undefined: Do not notify recorder.
* Notes
* Used for non-J-Link recorder,
* such as to enable transmission via UART or notify IP task.
*/
#ifndef SEGGER_SYSVIEW_ON_EVENT_RECORDED
#define SEGGER_SYSVIEW_ON_EVENT_RECORDED(NumBytes)
#endif
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_LOCK()
*
* Description
* Function macro to (nestable) lock SystemView recording.
* Default
* Use RTT Locking mechanism (defined by SEGGER_RTT_LOCK()).
* Notes
* If SystemView recording is not locked, recording events from
* interrupts and tasks may lead to unpredictable, undefined, event
* data.
*/
#ifndef SEGGER_SYSVIEW_LOCK
#define SEGGER_SYSVIEW_LOCK() SEGGER_RTT_LOCK()
#endif
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_UNLOCK
*
* Description
* Function macro to unlock SystemView recording.
* Default
* Use RTT Unlocking mechanism (defined by SEGGER_RTT_UNLOCK()).
*/
#ifndef SEGGER_SYSVIEW_UNLOCK
#define SEGGER_SYSVIEW_UNLOCK() SEGGER_RTT_UNLOCK()
#endif
#ifdef __cplusplus
}
#endif
#endif
/*************************** End of file ****************************/

View File

@ -0,0 +1,99 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_Int.h
Purpose : SEGGER SystemView internal header.
Revision: $Rev: 21281 $
*/
#ifndef SEGGER_SYSVIEW_INT_H
#define SEGGER_SYSVIEW_INT_H
/*********************************************************************
*
* #include Section
*
**********************************************************************
*/
#include "SEGGER_SYSVIEW.h"
#ifdef __cplusplus
extern "C" {
#endif
/*********************************************************************
*
* Private data types
*
**********************************************************************
*/
//
// Commands that Host can send to target
//
typedef enum {
SEGGER_SYSVIEW_COMMAND_ID_START = 1,
SEGGER_SYSVIEW_COMMAND_ID_STOP,
SEGGER_SYSVIEW_COMMAND_ID_GET_SYSTIME,
SEGGER_SYSVIEW_COMMAND_ID_GET_TASKLIST,
SEGGER_SYSVIEW_COMMAND_ID_GET_SYSDESC,
SEGGER_SYSVIEW_COMMAND_ID_GET_NUMMODULES,
SEGGER_SYSVIEW_COMMAND_ID_GET_MODULEDESC,
SEGGER_SYSVIEW_COMMAND_ID_HEARTBEAT = 127,
// Extended commands: Commands >= 128 have a second parameter
SEGGER_SYSVIEW_COMMAND_ID_GET_MODULE = 128
} SEGGER_SYSVIEW_COMMAND_ID;
#ifdef __cplusplus
}
#endif
#endif
/*************************** End of file ****************************/

View File

@ -0,0 +1,124 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
---------------------------END-OF-HEADER------------------------------
File : SEGGER_RTT_Syscalls_GCC.c
Purpose : Low-level functions for using printf() via RTT in GCC.
To use RTT for printf output, include this file in your
application.
Revision: $Rev: 20755 $
----------------------------------------------------------------------
*/
#if (defined __GNUC__) && !(defined __SES_ARM) && !(defined __CROSSWORKS_ARM) && !(defined __ARMCC_VERSION) && !(defined __CC_ARM)
#include <reent.h> // required for _write_r
#include "SEGGER_RTT.h"
/*********************************************************************
*
* Types
*
**********************************************************************
*/
//
// If necessary define the _reent struct
// to match the one passed by the used standard library.
//
struct _reent;
/*********************************************************************
*
* Function prototypes
*
**********************************************************************
*/
_ssize_t _write (int file, const void *ptr, size_t len);
_ssize_t _write_r(struct _reent *r, int file, const void *ptr, size_t len);
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
/*********************************************************************
*
* _write()
*
* Function description
* Low-level write function.
* libc subroutines will use this system routine for output to all files,
* including stdout.
* Write data via RTT.
*/
_ssize_t _write(int file, const void *ptr, size_t len) {
(void) file; /* Not used, avoid warning */
SEGGER_RTT_Write(0, ptr, len);
return len;
}
/*********************************************************************
*
* _write_r()
*
* Function description
* Low-level reentrant write function.
* libc subroutines will use this system routine for output to all files,
* including stdout.
* Write data via RTT.
*/
_ssize_t _write_r(struct _reent *r, int file, const void *ptr, size_t len) {
(void) file; /* Not used, avoid warning */
(void) r; /* Not used, avoid warning */
SEGGER_RTT_Write(0, ptr, len);
return len;
}
#endif
/****** End Of File *************************************************/

View File

@ -0,0 +1,119 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
---------------------------END-OF-HEADER------------------------------
File : SEGGER_RTT_Syscalls_IAR.c
Purpose : Low-level functions for using printf() via RTT in IAR.
To use RTT for printf output, include this file in your
application and set the Library Configuration to Normal.
Revision: $Rev: 17697 $
----------------------------------------------------------------------
*/
#ifdef __IAR_SYSTEMS_ICC__
//
// Since IAR EWARM V8 and EWRX V4, yfuns.h is considered as deprecated and LowLevelIOInterface.h
// shall be used instead. To not break any compatibility with older compiler versions, we have a
// version check in here.
//
#if ((defined __ICCARM__) && (__VER__ >= 8000000)) || ((defined __ICCRX__) && (__VER__ >= 400))
#include <LowLevelIOInterface.h>
#else
#include <yfuns.h>
#endif
#include "SEGGER_RTT.h"
#pragma module_name = "?__write"
/*********************************************************************
*
* Function prototypes
*
**********************************************************************
*/
size_t __write(int handle, const unsigned char * buffer, size_t size);
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
/*********************************************************************
*
* __write()
*
* Function description
* Low-level write function.
* Standard library subroutines will use this system routine
* for output to all files, including stdout.
* Write data via RTT.
*/
size_t __write(int handle, const unsigned char * buffer, size_t size) {
(void) handle; /* Not used, avoid warning */
SEGGER_RTT_Write(0, (const char*)buffer, size);
return size;
}
/*********************************************************************
*
* __write_buffered()
*
* Function description
* Low-level write function.
* Standard library subroutines will use this system routine
* for output to all files, including stdout.
* Write data via RTT.
*/
size_t __write_buffered(int handle, const unsigned char * buffer, size_t size) {
(void) handle; /* Not used, avoid warning */
SEGGER_RTT_Write(0, (const char*)buffer, size);
return size;
}
#endif
/****** End Of File *************************************************/

View File

@ -0,0 +1,393 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
---------------------------END-OF-HEADER------------------------------
File : RTT_Syscalls_KEIL.c
Purpose : Retargeting module for KEIL MDK-CM3.
Low-level functions for using printf() via RTT
Revision: $Rev: 20754 $
Notes : (1) https://wiki.segger.com/Keil_MDK-ARM#RTT_in_uVision
----------------------------------------------------------------------
*/
#if (defined __CC_ARM) || (defined __ARMCC_VERSION)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <rt_sys.h>
#include <rt_misc.h>
#include "SEGGER_RTT.h"
/*********************************************************************
*
* #pragmas
*
**********************************************************************
*/
#if __ARMCC_VERSION < 6000000
#pragma import(__use_no_semihosting)
#endif
#ifdef _MICROLIB
#pragma import(__use_full_stdio)
#endif
/*********************************************************************
*
* Defines non-configurable
*
**********************************************************************
*/
/* Standard IO device handles - arbitrary, but any real file system handles must be
less than 0x8000. */
#define STDIN 0x8001 // Standard Input Stream
#define STDOUT 0x8002 // Standard Output Stream
#define STDERR 0x8003 // Standard Error Stream
/*********************************************************************
*
* Public const
*
**********************************************************************
*/
#if __ARMCC_VERSION < 5000000
//const char __stdin_name[] = "STDIN";
const char __stdout_name[] = "STDOUT";
const char __stderr_name[] = "STDERR";
#endif
/*********************************************************************
*
* Public code
*
**********************************************************************
*/
/*********************************************************************
*
* _ttywrch
*
* Function description:
* Outputs a character to the console
*
* Parameters:
* c - character to output
*
*/
void _ttywrch(int c) {
fputc(c, stdout); // stdout
fflush(stdout);
}
/*********************************************************************
*
* _sys_open
*
* Function description:
* Opens the device/file in order to do read/write operations
*
* Parameters:
* sName - sName of the device/file to open
* OpenMode - This parameter is currently ignored
*
* Return value:
* != 0 - Handle to the object to open, otherwise
* == 0 -"device" is not handled by this module
*
*/
FILEHANDLE _sys_open(const char * sName, int OpenMode) {
(void)OpenMode;
// Register standard Input Output devices.
if (strcmp(sName, __stdout_name) == 0) {
return (STDOUT);
} else if (strcmp(sName, __stderr_name) == 0) {
return (STDERR);
} else
return (0); // Not implemented
}
/*********************************************************************
*
* _sys_close
*
* Function description:
* Closes the handle to the open device/file
*
* Parameters:
* hFile - Handle to a file opened via _sys_open
*
* Return value:
* 0 - device/file closed
*
*/
int _sys_close(FILEHANDLE hFile) {
(void)hFile;
return 0; // Not implemented
}
/*********************************************************************
*
* _sys_write
*
* Function description:
* Writes the data to an open handle.
* Currently this function only outputs data to the console
*
* Parameters:
* hFile - Handle to a file opened via _sys_open
* pBuffer - Pointer to the data that shall be written
* NumBytes - Number of bytes to write
* Mode - The Mode that shall be used
*
* Return value:
* Number of bytes *not* written to the file/device
*
*/
int _sys_write(FILEHANDLE hFile, const unsigned char * pBuffer, unsigned NumBytes, int Mode) {
int r = 0;
(void)Mode;
if (hFile == STDOUT) {
SEGGER_RTT_Write(0, (const char*)pBuffer, NumBytes);
return 0;
}
return r;
}
/*********************************************************************
*
* _sys_read
*
* Function description:
* Reads data from an open handle.
* Currently this modules does nothing.
*
* Parameters:
* hFile - Handle to a file opened via _sys_open
* pBuffer - Pointer to buffer to store the read data
* NumBytes - Number of bytes to read
* Mode - The Mode that shall be used
*
* Return value:
* Number of bytes read from the file/device
*
*/
int _sys_read(FILEHANDLE hFile, unsigned char * pBuffer, unsigned NumBytes, int Mode) {
(void)hFile;
(void)pBuffer;
(void)NumBytes;
(void)Mode;
return (0); // Not implemented
}
/*********************************************************************
*
* _sys_istty
*
* Function description:
* This function shall return whether the opened file
* is a console device or not.
*
* Parameters:
* hFile - Handle to a file opened via _sys_open
*
* Return value:
* 1 - Device is a console
* 0 - Device is not a console
*
*/
int _sys_istty(FILEHANDLE hFile) {
if (hFile > 0x8000) {
return (1);
}
return (0); // Not implemented
}
/*********************************************************************
*
* _sys_seek
*
* Function description:
* Seeks via the file to a specific position
*
* Parameters:
* hFile - Handle to a file opened via _sys_open
* Pos -
*
* Return value:
* int -
*
*/
int _sys_seek(FILEHANDLE hFile, long Pos) {
(void)hFile;
(void)Pos;
return (0); // Not implemented
}
/*********************************************************************
*
* _sys_ensure
*
* Function description:
*
*
* Parameters:
* hFile - Handle to a file opened via _sys_open
*
* Return value:
* int -
*
*/
int _sys_ensure(FILEHANDLE hFile) {
(void)hFile;
return (-1); // Not implemented
}
/*********************************************************************
*
* _sys_flen
*
* Function description:
* Returns the length of the opened file handle
*
* Parameters:
* hFile - Handle to a file opened via _sys_open
*
* Return value:
* Length of the file
*
*/
long _sys_flen(FILEHANDLE hFile) {
(void)hFile;
return (0); // Not implemented
}
/*********************************************************************
*
* _sys_tmpnam
*
* Function description:
* This function converts the file number fileno for a temporary
* file to a unique filename, for example, tmp0001.
*
* Parameters:
* pBuffer - Pointer to a buffer to store the name
* FileNum - file number to convert
* MaxLen - Size of the buffer
*
* Return value:
* 1 - Error
* 0 - Success
*
*/
int _sys_tmpnam(char * pBuffer, int FileNum, unsigned MaxLen) {
(void)pBuffer;
(void)FileNum;
(void)MaxLen;
return (1); // Not implemented
}
/*********************************************************************
*
* _sys_command_string
*
* Function description:
* This function shall execute a system command.
*
* Parameters:
* cmd - Pointer to the command string
* len - Length of the string
*
* Return value:
* == NULL - Command was not successfully executed
* == sCmd - Command was passed successfully
*
*/
char * _sys_command_string(char * cmd, int len) {
(void)len;
return cmd; // Not implemented
}
/*********************************************************************
*
* _sys_exit
*
* Function description:
* This function is called when the application returns from main
*
* Parameters:
* ReturnCode - Return code from the main function
*
*
*/
void _sys_exit(int ReturnCode) {
(void)ReturnCode;
while (1); // Not implemented
}
#if __ARMCC_VERSION >= 5000000
/*********************************************************************
*
* stdout_putchar
*
* Function description:
* Put a character to the stdout
*
* Parameters:
* ch - Character to output
*
*
*/
int stdout_putchar(int ch) {
(void)ch;
return ch; // Not implemented
}
#endif
#endif
/*************************** End of file ****************************/

View File

@ -0,0 +1,251 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
---------------------------END-OF-HEADER------------------------------
File : SEGGER_RTT_Syscalls_SES.c
Purpose : Reimplementation of printf, puts and __getchar using RTT
in SEGGER Embedded Studio.
To use RTT for printf output, include this file in your
application.
Revision: $Rev: 18539 $
----------------------------------------------------------------------
*/
#if (defined __SES_ARM) || (defined __SES_RISCV) || (defined __CROSSWORKS_ARM)
#include "SEGGER_RTT.h"
#include <stdarg.h>
#include <stdio.h>
#include "limits.h"
#include "__libc.h"
#include "__vfprintf.h"
/*********************************************************************
*
* Defines, configurable
*
**********************************************************************
*/
//
// Select string formatting implementation.
//
// RTT printf formatting
// - Configurable stack usage. (SEGGER_RTT_PRINTF_BUFFER_SIZE in SEGGER_RTT_Conf.h)
// - No maximum string length.
// - Limited conversion specifiers and flags. (See SEGGER_RTT_printf.c)
// Standard library printf formatting
// - Configurable formatting capabilities.
// - Full conversion specifier and flag support.
// - Maximum string length has to be known or (slightly) slower character-wise output.
//
// #define PRINTF_USE_SEGGER_RTT_FORMATTING 0 // Use standard library formatting
// #define PRINTF_USE_SEGGER_RTT_FORMATTING 1 // Use RTT formatting
//
#ifndef PRINTF_USE_SEGGER_RTT_FORMATTING
#define PRINTF_USE_SEGGER_RTT_FORMATTING 0
#endif
//
// If using standard library formatting,
// select maximum output string buffer size or character-wise output.
//
// #define PRINTF_BUFFER_SIZE 0 // Use character-wise output
// #define PRINTF_BUFFER_SIZE 128 // Default maximum string length
//
#ifndef PRINTF_BUFFER_SIZE
#define PRINTF_BUFFER_SIZE 128
#endif
#if PRINTF_USE_SEGGER_RTT_FORMATTING // Use SEGGER RTT formatting implementation
/*********************************************************************
*
* Function prototypes
*
**********************************************************************
*/
int SEGGER_RTT_vprintf(unsigned BufferIndex, const char * sFormat, va_list * pParamList);
/*********************************************************************
*
* Global functions, printf
*
**********************************************************************
*/
/*********************************************************************
*
* printf()
*
* Function description
* print a formatted string using RTT and SEGGER RTT formatting.
*/
int printf(const char *fmt,...) {
int n;
va_list args;
va_start (args, fmt);
n = SEGGER_RTT_vprintf(0, fmt, &args);
va_end(args);
return n;
}
#elif PRINTF_BUFFER_SIZE == 0 // Use standard library formatting with character-wise output
/*********************************************************************
*
* Static functions
*
**********************************************************************
*/
static int _putchar(int x, __printf_tag_ptr ctx) {
(void)ctx;
SEGGER_RTT_Write(0, (char *)&x, 1);
return x;
}
/*********************************************************************
*
* Global functions, printf
*
**********************************************************************
*/
/*********************************************************************
*
* printf()
*
* Function description
* print a formatted string character-wise, using RTT and standard
* library formatting.
*/
int printf(const char *fmt, ...) {
int n;
va_list args;
__printf_t iod;
va_start(args, fmt);
iod.string = 0;
iod.maxchars = INT_MAX;
iod.output_fn = _putchar;
SEGGER_RTT_LOCK();
n = __vfprintf(&iod, fmt, args);
SEGGER_RTT_UNLOCK();
va_end(args);
return n;
}
#else // Use standard library formatting with static buffer
/*********************************************************************
*
* Global functions, printf
*
**********************************************************************
*/
/*********************************************************************
*
* printf()
*
* Function description
* print a formatted string using RTT and standard library formatting.
*/
int printf(const char *fmt,...) {
int n;
char aBuffer[PRINTF_BUFFER_SIZE];
va_list args;
va_start (args, fmt);
n = vsnprintf(aBuffer, sizeof(aBuffer), fmt, args);
if (n > (int)sizeof(aBuffer)) {
SEGGER_RTT_Write(0, aBuffer, sizeof(aBuffer));
} else if (n > 0) {
SEGGER_RTT_Write(0, aBuffer, n);
}
va_end(args);
return n;
}
#endif
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
/*********************************************************************
*
* puts()
*
* Function description
* print a string using RTT.
*/
int puts(const char *s) {
return SEGGER_RTT_WriteString(0, s);
}
/*********************************************************************
*
* __putchar()
*
* Function description
* Write one character via RTT.
*/
int __putchar(int x, __printf_tag_ptr ctx) {
(void)ctx;
SEGGER_RTT_Write(0, (char *)&x, 1);
return x;
}
/*********************************************************************
*
* __getchar()
*
* Function description
* Wait for and get a character via RTT.
*/
int __getchar() {
return SEGGER_RTT_WaitKey();
}
#endif
/****** End Of File *************************************************/

View File

@ -0,0 +1,445 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_COMM_IP_embOS_emNet.c
Purpose : SystemView Communication for IP Recorder with embOS and emNet.
Revision: $Rev: 15024 $
Additional Information
emNet needs to be initialized by the application, ideally before calling SEGGER_SYSVIEW_X_StartComm.
Example code:
static OS_STACKPTR int _IPStack[TASK_STACK_SIZE_IP_TASK/sizeof(int)]; // Stack of the IP_Task.
static OS_TASK _IPTCB; // Task-Control-Block of the IP_Task.
void MainTask(void) {
//
// Initialize emNet
//
IP_Init();
OS_CREATETASK(&_IPTCB , "IP_Task" , IP_Task , TASK_PRIO_IP_TASK , _IPStack); // Start the IP_Task.
IP_Connect(IP_INFO_GetNumInterfaces() - 1); // Connect the interface if necessary.
//
// Start SystemView communication
//
SEGGER_SYSVIEW_X_StartComm();
...
}
*/
#include "SEGGER_SYSVIEW.h"
#include "SEGGER_SYSVIEW_Conf.h"
#include "SEGGER_RTT.h"
#include "RTOS.h"
#include "IP.h"
#include "IP_Int.h"
/*********************************************************************
*
* Defines, OS
*
**********************************************************************
*/
#define SYSVIEW_COMM_TASK_STACK_SIZE 1024
/*********************************************************************
*
* Defines, configurable
*
**********************************************************************
*/
/*********************************************************************
*
* SYSVIEW_COMM_TASK_PRIO
* Priority of the communication task.
* Typically low to keep SystemVeiw minimally intrusive.
* Higher when there are overflows due to too long blocking time.
*
*/
#ifndef SYSVIEW_COMM_TASK_PRIO
#define SYSVIEW_COMM_TASK_PRIO 1
#endif
/*********************************************************************
*
* SYSVIEW_COMM_SEND_THRESHOLD
* Threshold for the SystemView RTT Buffer level,
* after which the data is sent to SystemView App.
*
*/
#ifndef SYSVIEW_COMM_SEND_THRESHOLD
#define SYSVIEW_COMM_SEND_THRESHOLD 512
#endif
/*********************************************************************
*
* SYSVIEW_COMM_IDLE_DELAY
* Maximum delay after which available data from the SystemView RTT
* Buffer is sent to SystemView App.
*
*/
#ifndef SYSVIEW_COMM_IDLE_DELAY
#define SYSVIEW_COMM_IDLE_DELAY 100
#endif
/*********************************************************************
*
* SYSVIEW_COMM_POLL_INTERVAL
* Polling interval to check for send threshold or idle delay timeout.
*
*/
#ifndef SYSVIEW_COMM_POLL_INTERVAL
#define SYSVIEW_COMM_POLL_INTERVAL 2
#endif
/*********************************************************************
*
* SYSVIEW_COMM_SERVER_PORT
* Communication port on which SystemView App can connect.
*
*/
#ifndef SYSVIEW_COMM_SERVER_PORT
#define SYSVIEW_COMM_SERVER_PORT 19111
#endif
/*********************************************************************
*
* Defines, fixed
*
**********************************************************************
*/
#define SYSVIEW_COMM_APP_HELLO_SIZE 32
#define SYSVIEW_COMM_TARGET_HELLO_SIZE 32
/*********************************************************************
*
* Static data, OS
*
**********************************************************************
*/
static OS_STACKPTR int _SysViewCommStack[SYSVIEW_COMM_TASK_STACK_SIZE/sizeof(int)];
static OS_TASK _SysViewCommTCB;
/*********************************************************************
*
* Static data
*
**********************************************************************
*/
// "Hello" message expected by SystemView App: SEGGER SystemView VM.mm.rr
static const U8 _abHelloMsg[SYSVIEW_COMM_TARGET_HELLO_SIZE] = { 'S', 'E', 'G', 'G', 'E', 'R', ' ', 'S', 'y', 's', 't', 'e', 'm', 'V', 'i', 'e', 'w', ' ', 'V', '0' + SEGGER_SYSVIEW_MAJOR, '.', '0' + (SEGGER_SYSVIEW_MINOR / 10), '0' + (SEGGER_SYSVIEW_MINOR % 10), '.', '0' + (SEGGER_SYSVIEW_REV / 10), '0' + (SEGGER_SYSVIEW_REV % 10), '\0', 0, 0, 0, 0, 0 };
static int _ChannelID;
static char _acBuf[SYSVIEW_COMM_SEND_THRESHOLD * 2];
/*********************************************************************
*
* Local functions, OS
*
**********************************************************************
*/
/*********************************************************************
*
* _Delay
*
* Function description
* Delay for some time.
*
*/
static void _Delay(int Ticks) {
OS_TASK_Delay(Ticks);
}
/*********************************************************************
*
* _WaitPolling
*
* Function description
* Poll SystemView Buffer to reach threshold fill level.
*
*/
static void _WaitPolling(int Timeout) {
int BytesInBuffer;
do {
BytesInBuffer = SEGGER_RTT_GetBytesInBuffer(_ChannelID);
if (BytesInBuffer >= SYSVIEW_COMM_SEND_THRESHOLD) {
break;
}
_Delay(SYSVIEW_COMM_POLL_INTERVAL);
Timeout -= SYSVIEW_COMM_POLL_INTERVAL;
} while (Timeout > 0);
}
/*********************************************************************
*
* Local functions, IP
*
**********************************************************************
*/
/*********************************************************************
*
* _WaitForIPInit
*
* Function description
* Wait for IP Stack to be initialized.
*
*/
static void _WaitForIPInit(void) {
while (IP_Global.InitCompleted == 0) {
_Delay(2);
}
}
/*********************************************************************
*
* _ListenAtTcpPort()
*
* Function description
* Creates a socket, binds it to a port and sets the socket into
* listening state.
*
* Parameter
* Port - Port which should be to wait for connections.
*
* Return value
* O.K. : Socket handle.
* Error: SOCKET_ERROR .
*/
static int _ListenAtTcpPort(U16 Port) {
int hSock;
int r;
struct sockaddr_in Addr;
//
// Create socket
//
hSock = socket(AF_INET, SOCK_STREAM, 0);
if (hSock != SOCKET_ERROR) {
//
// Bind it to the port
//
IP_MEMSET(&Addr, 0, sizeof(Addr));
Addr.sin_family = AF_INET;
Addr.sin_port = htons(Port);
Addr.sin_addr.s_addr = INADDR_ANY;
r = bind(hSock, (struct sockaddr*)&Addr, sizeof(Addr));
//
// Start listening on the socket.
//
if (r != 0) {
hSock = SOCKET_ERROR;
} else {
r = listen(hSock, 1);
if (r != 0) {
hSock = SOCKET_ERROR;
}
}
}
return hSock;
}
/*********************************************************************
*
* _SocketIsReadable
*
* Function description
* Check if data can be read from the connected socket.
*
* Parameters
* hSocket Socket to check.
*
* Return value
* == 1 O.K., socket readable
* == 0 O.K., socket not readable
*/
static int _SocketIsReadable(int hSocket, int TimeoutMs) {
I32 tv = TimeoutMs;
IP_fd_set rfds;
IP_fd_set efds;
int v;
FD_ZERO(&rfds); // Zero init file descriptor list
FD_SET(hSocket, &rfds); // Add socket to file descriptor list to be monitored by select()
FD_ZERO(&efds);
FD_SET(hSocket, &efds);
v = select(&rfds, NULL, &efds, tv); // > 0: in case of success, == 0: Timeout, < 0: Error
return v;
}
/*********************************************************************
*
* Local functions, SystemView Communication
*
**********************************************************************
*/
/*********************************************************************
*
* _SysViewCommTask
*
* Function description
* Task that handles TCP/IP connection and communication
* with SystemView App.
*
*/
static void _SysViewCommTask(void) {
int hSockListen;
int hSockSV;
int v;
int r;
int NumBytes;
char acRecv[16];
//
_ChannelID = SEGGER_SYSVIEW_GetChannelID();
//
// Wait for IP Stack to be initialized.
//
_WaitForIPInit();
//
// Try until we get a valid listening socket.
//
while (1) {
hSockListen = _ListenAtTcpPort(SYSVIEW_COMM_SERVER_PORT);
if (hSockListen == SOCKET_ERROR) {
_Delay(100);
continue; // Error, try again.
}
break;
}
//
// Wait for a connection and process the communication.
//
do {
//
// Check for a new connection.
//
hSockSV = accept(hSockListen, NULL, NULL);
if (hSockSV == SOCKET_ERROR) {
continue; // Error, try again.
}
//
// Successful connection? => Start systemview session
// First, receive <Hello> message from SysView and send back own <Hello> message
//
r = recv(hSockSV, acRecv, SYSVIEW_COMM_APP_HELLO_SIZE, 0);
if (r != SYSVIEW_COMM_APP_HELLO_SIZE) { // Failed to receive Hello message from SystemView App
closesocket(hSockSV);
hSockSV = SOCKET_ERROR;
}
r = send(hSockSV, (const char*)_abHelloMsg, SYSVIEW_COMM_TARGET_HELLO_SIZE, 0);
if (r != SYSVIEW_COMM_TARGET_HELLO_SIZE) { // Failed to send Hello message to SystemView App
closesocket(hSockSV);
hSockSV = SOCKET_ERROR;
}
//
// After a succesful connection, poll RTT buffer for data
//
while (hSockSV != SOCKET_ERROR) {
_WaitPolling(SYSVIEW_COMM_IDLE_DELAY); // Wait until there is "enough" data in the buffer to be sent.
//
// Check for data to be received from SystemView App
//
r = _SocketIsReadable(hSockSV, 0);
if (r == 1) { // Data to read from SysView available?
r = recv(hSockSV, acRecv, 1, 0); // Receive <NumBytes> to read
if (r != 1) { // Failed to receive data? => Connection lost
break;
}
v = acRecv[0];
r = recv(hSockSV, acRecv, v, 0); // Receive all data
if (r != v) { // Failed to receive data? => Connection lost
break;
}
NumBytes = SEGGER_RTT_WriteDownBufferNoLock(_ChannelID, &acRecv[0], r); // Write data into corresponding RTT buffer for application to read and handle accordingly
}
//
// Read available RTT data into send bufer and send it.
//
NumBytes = SEGGER_RTT_ReadUpBufferNoLock(_ChannelID, &_acBuf[0], sizeof(_acBuf));
if (NumBytes > 0) {
//
// Send data to SystemView App
//
r = send(hSockSV, _acBuf, NumBytes, 0);
if (NumBytes != r) { // Failed to send data? => Connection lost
break;
}
}
}
//
// Processing done. close socket handle.
//
if (hSockSV != SOCKET_ERROR) {
closesocket(hSockSV);
}
} while (1);
}
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
/*********************************************************************
*
* SEGGER_SYSVIEW_X_StartComm()
*
* Function description
* Setup communication channel.
*/
void SEGGER_SYSVIEW_X_StartComm(void) {
//
// Initialize SystemView communication
//
OS_TASK_CREATE(&_SysViewCommTCB, "SysView Comm", SYSVIEW_COMM_TASK_PRIO, _SysViewCommTask, _SysViewCommStack);
}
/*************************** End of file ****************************/

View File

@ -0,0 +1,479 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_COMM_IP_embOS_emNet.c
Purpose : SystemView Communication for IP Recorder with embOS and emNet.
Revision: $Rev: 15024 $
Additional Information
emNet needs to be initialized by the application, ideally before calling SEGGER_SYSVIEW_X_StartComm.
Example code:
static OS_STACKPTR int _IPStack[TASK_STACK_SIZE_IP_TASK/sizeof(int)]; // Stack of the IP_Task.
static OS_TASK _IPTCB; // Task-Control-Block of the IP_Task.
void MainTask(void) {
//
// Initialize emNet
//
IP_Init();
OS_CREATETASK(&_IPTCB , "IP_Task" , IP_Task , TASK_PRIO_IP_TASK , _IPStack); // Start the IP_Task.
IP_Connect(IP_INFO_GetNumInterfaces() - 1); // Connect the interface if necessary.
//
// Start SystemView communication
//
SEGGER_SYSVIEW_X_StartComm();
...
}
*/
#include "SEGGER_SYSVIEW.h"
#include "SEGGER_SYSVIEW_Conf.h"
#include "SEGGER_RTT.h"
#include "RTOS.h"
#include "IP.h"
#include "IP_Int.h"
/*********************************************************************
*
* Defines, OS
*
**********************************************************************
*/
#define SYSVIEW_COMM_TASK_STACK_SIZE 1024
/*********************************************************************
*
* Defines, configurable
*
**********************************************************************
*/
#ifndef SYSVIEW_COMM_TASK_PRIO
#define SYSVIEW_COMM_TASK_PRIO 1 // Priority of the communication task
#endif
#ifndef SYSVIEW_COMM_SEND_THRESHOLD
#define SYSVIEW_COMM_SEND_THRESHOLD 512 // Minimum number of bytes to read and send from the RTT Buffer.
#endif
#ifndef SYSVIEW_COMM_IDLE_DELAY
#define SYSVIEW_COMM_IDLE_DELAY 100 // Delay if no data had to be sent.
#endif
#ifndef SYSVIEW_COMM_POLL_INTERVAL
#define SYSVIEW_COMM_POLL_INTERVAL 2 // Interval to check for buffer level.
#endif
#ifndef SYSVIEW_COMM_SERVER_PORT
#define SYSVIEW_COMM_SERVER_PORT 19111
#endif
#define _NO_NOTIFY
/*********************************************************************
*
* Defines, fixed
*
**********************************************************************
*/
#define SYSVIEW_COMM_SERVER_HELLO_SIZE 4
#define SYSVIEW_COMM_TARGET_HELLO_SIZE 4
/*********************************************************************
*
* Static data, OS
*
**********************************************************************
*/
static OS_STACKPTR int _SysViewCommStack[SYSVIEW_COMM_TASK_STACK_SIZE/sizeof(int)];
static OS_TASK _SysViewCommTCB;
/*********************************************************************
*
* Static data
*
**********************************************************************
*/
static int _ChannelID;
static const U8 _abHelloMsg[SYSVIEW_COMM_TARGET_HELLO_SIZE] = { 'S', 'V', (SEGGER_SYSVIEW_VERSION / 10000), (SEGGER_SYSVIEW_VERSION / 1000) % 10 }; // "Hello" message expected by SysView: [ 'S', 'V', <PROTOCOL_MAJOR>, <PROTOCOL_MINOR> ]
static char _acBuf[SYSVIEW_COMM_SEND_THRESHOLD * 2];
#ifndef _NO_NOTIFY
static unsigned _NumBytesRecorded;
#endif
/*********************************************************************
*
* Local functions, OS
*
**********************************************************************
*/
/*********************************************************************
*
* _Delay
*
* Function description
* Delay for some time.
*
*/
static void _Delay(int Ticks) {
OS_TASK_Delay(Ticks);
}
#ifdef _NO_NOTIFY
/*********************************************************************
*
* _WaitPolling
*
* Function description
* Poll SystemView Buffer to reach threshold fill level.
*
*/
static void _WaitPolling(int Timeout) {
int BytesInBuffer;
do {
BytesInBuffer = SEGGER_RTT_GetBytesInBuffer(_ChannelID);
if (BytesInBuffer >= SYSVIEW_COMM_SEND_THRESHOLD) {
break;
}
_Delay(SYSVIEW_COMM_POLL_INTERVAL);
Timeout -= SYSVIEW_COMM_POLL_INTERVAL;
} while (Timeout > 0);
}
#else
/*********************************************************************
*
* _WaitNotify
*
* Function description
* Wait to be notified or the timeout runs out.
*
*/
static void _WaitNotify(int Timeout) {
OS_TASKEVENT_GetTimed(1, Timeout);
}
/*********************************************************************
*
* _Notify
*
* Function description
* Notify the communication task.
*
*/
static void _Notify(void) {
//
// There might be SystemView Events before the communication task is created.
// Only notify task when it has been created
//
if (OS_TASK_IsTask(&_SysViewCommTCB)) {
OS_TASKEVENT_Set(&_SysViewCommTCB, 1);
}
}
#endif
/*********************************************************************
*
* Local functions, IP
*
**********************************************************************
*/
/*********************************************************************
*
* _WaitForIPInit
*
* Function description
* Wait for IP Stack to be initialized.
*
*/
static void _WaitForIPInit(void) {
while (IP_Global.InitCompleted == 0) {
_Delay(2);
}
}
/*********************************************************************
*
* _ListenAtTcpPort()
*
* Function description
* Creates a socket, binds it to a port and sets the socket into
* listening state.
*
* Parameter
* Port - Port which should be to wait for connections.
*
* Return value
* O.K. : Socket handle.
* Error: SOCKET_ERROR .
*/
static int _ListenAtTcpPort(U16 Port) {
int hSock;
int r;
struct sockaddr_in Addr;
//
// Create socket
//
hSock = socket(AF_INET, SOCK_STREAM, 0);
if (hSock != SOCKET_ERROR) {
//
// Bind it to the port
//
IP_MEMSET(&Addr, 0, sizeof(Addr));
Addr.sin_family = AF_INET;
Addr.sin_port = htons(Port);
Addr.sin_addr.s_addr = INADDR_ANY;
r = bind(hSock, (struct sockaddr*)&Addr, sizeof(Addr));
//
// Start listening on the socket.
//
if (r != 0) {
hSock = SOCKET_ERROR;
} else {
r = listen(hSock, 1);
if (r != 0) {
hSock = SOCKET_ERROR;
}
}
}
return hSock;
}
/*********************************************************************
*
* _SocketIsReadable
*
* Function description
* Check if data can be read from the connected socket.
*
* Parameters
* hSocket Socket to check.
*
* Return value
* == 1 O.K., socket readable
* == 0 O.K., socket not readable
*/
static int _SocketIsReadable(int hSocket, int TimeoutMs) {
I32 tv = TimeoutMs;
IP_fd_set rfds;
IP_fd_set efds;
int v;
FD_ZERO(&rfds); // Zero init file descriptor list
FD_SET(hSocket, &rfds); // Add socket to file descriptor list to be monitored by select()
FD_ZERO(&efds);
FD_SET(hSocket, &efds);
v = select(&rfds, NULL, &efds, tv); // > 0: in case of success, == 0: Timeout, < 0: Error
return v;
}
/*********************************************************************
*
* Local functions, SystemView Communication
*
**********************************************************************
*/
/*********************************************************************
*
* _SysViewCommTask
*
* Function description
* Task that handles TCP/IP connection and communication
* with SystemView App.
*
*/
static void _SysViewCommTask(void) {
int hSockListen;
int hSockSV;
int v;
int r;
int NumBytes;
char acRecv[16];
//
_ChannelID = SEGGER_SYSVIEW_GetChannelID();
hSockSV = SOCKET_ERROR;
//
// Wait for IP Stack to be initialized.
//
_WaitForIPInit();
//
// Try until we get a valid listening socket.
//
while (1) {
hSockListen = _ListenAtTcpPort(SYSVIEW_COMM_SERVER_PORT);
if (hSockListen == SOCKET_ERROR) {
_Delay(100);
continue; // Error, try again.
}
break;
}
//
// Wait for a connection and process the communication.
//
do {
//
// Check for a new connection.
//
hSockSV = accept(hSockListen, NULL, NULL);
if (hSockSV == SOCKET_ERROR) {
continue; // Error, try again.
}
//
// Successful connection? => Start systemview session
// First, receive <Hello> message from SysView and send back own <Hello> message
//
r = recv(hSockSV, acRecv, SYSVIEW_COMM_SERVER_HELLO_SIZE, 0);
if (r != SYSVIEW_COMM_SERVER_HELLO_SIZE) { // Failed to receive Hello message from SystemView App
closesocket(hSockSV);
hSockSV = SOCKET_ERROR;
}
r = send(hSockSV, (const char*)_abHelloMsg, SYSVIEW_COMM_TARGET_HELLO_SIZE, 0);
if (r != SYSVIEW_COMM_TARGET_HELLO_SIZE) { // Failed to send Hello message to SystemView App
closesocket(hSockSV);
hSockSV = SOCKET_ERROR;
}
//
// After a succesful connection, poll RTT buffer for data
//
while (hSockSV != SOCKET_ERROR) {
#ifdef _NO_NOTIFY
_WaitPolling(SYSVIEW_COMM_IDLE_DELAY); // Wait until there is "enough" data in the buffer to be sent.
#else
_WaitNotify(SYSVIEW_COMM_IDLE_DELAY); // Wait for event to be signaled when there is "enough" data in the buffer to be sent.
_NumBytesRecorded = 0; // Reset counter when we are going to send current RTT Buffer
#endif
//
// Check for data to be received from SystemView App
//
r = _SocketIsReadable(hSockSV, 0);
if (r == 1) { // Data to read from SysView available?
r = recv(hSockSV, acRecv, 1, 0); // Receive <NumBytes> to read
if (r != 1) { // Failed to receive data? => Connection lost
break;
}
v = acRecv[0];
r = recv(hSockSV, acRecv, v, 0); // Receive all data
if (r != v) { // Failed to receive data? => Connection lost
break;
}
NumBytes = SEGGER_RTT_WriteDownBufferNoLock(_ChannelID, &acRecv[0], r); // Write data into corresponding RTT buffer for application to read and handle accordingly
}
//
// Read available RTT data into send bufer and send it.
//
NumBytes = SEGGER_RTT_ReadUpBufferNoLock(_ChannelID, &_acBuf[0], sizeof(_acBuf));
if (NumBytes > 0) {
//
// Send data to SystemView App
//
r = send(hSockSV, _acBuf, NumBytes, 0);
if (NumBytes != r) { // Failed to send data? => Connection lost
break;
}
}
}
//
// Processing done. close socket handle.
//
if (hSockSV != SOCKET_ERROR) {
closesocket(hSockSV);
hSockSV = SOCKET_ERROR;
}
} while (1);
}
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
/*********************************************************************
*
* SEGGER_SYSVIEW_X_StartComm()
*
* Function description
* Setup communication channel.
*/
void SEGGER_SYSVIEW_X_StartComm(void) {
//
// Initialize SystemView communication
//
OS_TASK_CREATE(&_SysViewCommTCB, "SysView Comm", SYSVIEW_COMM_TASK_PRIO, _SysViewCommTask, _SysViewCommStack);
}
#ifndef _NO_NOTIFY
/*********************************************************************
*
* SEGGER_SYSVIEW_X_OnEventRecorded()
*
* Function description
* Macro callback to be called when an event has been stored in the
* SystemView RTT Buffer.
*
* Parameters
* NumBytes: Number of bytes stored in the buffer.
*/
void SEGGER_SYSVIEW_X_OnEventRecorded(unsigned NumBytes) {
//
// Notify SystemView Communication Task when the send threshold is reached.
//
_NumBytesRecorded += NumBytes;
if (_NumBytesRecorded >= SYSVIEW_COMM_SEND_THRESHOLD) {
_NumBytesRecorded = 0;
_Notify();
}
}
#endif
/*************************** End of file ****************************/

View File

@ -0,0 +1,104 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_Config_FreeRTOS.c
Purpose : Sample setup configuration of SystemView with FreeRTOS.
Revision: $Rev: 7745 $
*/
#include "FreeRTOS.h"
#include "SEGGER_SYSVIEW.h"
extern const SEGGER_SYSVIEW_OS_API SYSVIEW_X_OS_TraceAPI;
/*********************************************************************
*
* Defines, configurable
*
**********************************************************************
*/
// The application name to be displayed in SystemViewer
#define SYSVIEW_APP_NAME "FreeRTOS Demo Application"
// The target device name
#define SYSVIEW_DEVICE_NAME "Cortex-M4"
// Frequency of the timestamp. Must match SEGGER_SYSVIEW_GET_TIMESTAMP in SEGGER_SYSVIEW_Conf.h
#define SYSVIEW_TIMESTAMP_FREQ (configCPU_CLOCK_HZ)
// System Frequency. SystemcoreClock is used in most CMSIS compatible projects.
#define SYSVIEW_CPU_FREQ configCPU_CLOCK_HZ
// The lowest RAM address used for IDs (pointers)
#define SYSVIEW_RAM_BASE (0x10000000)
/*********************************************************************
*
* _cbSendSystemDesc()
*
* Function description
* Sends SystemView description strings.
*/
static void _cbSendSystemDesc(void) {
SEGGER_SYSVIEW_SendSysDesc("N="SYSVIEW_APP_NAME",D="SYSVIEW_DEVICE_NAME",O=FreeRTOS");
SEGGER_SYSVIEW_SendSysDesc("I#15=SysTick");
}
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
void SEGGER_SYSVIEW_Conf(void) {
SEGGER_SYSVIEW_Init(SYSVIEW_TIMESTAMP_FREQ, SYSVIEW_CPU_FREQ,
&SYSVIEW_X_OS_TraceAPI, _cbSendSystemDesc);
SEGGER_SYSVIEW_SetRAMBase(SYSVIEW_RAM_BASE);
}
/*************************** End of file ****************************/

View File

@ -0,0 +1,308 @@
diff -rupN org/lib/FreeRTOS/portable/GCC/ARM_CM0/port.c new/lib/FreeRTOS/portable/GCC/ARM_CM0/port.c
--- org/lib/FreeRTOS/portable/GCC/ARM_CM0/port.c 2017-11-28 13:48:34.000000000 -0800
+++ new/lib/FreeRTOS/portable/GCC/ARM_CM0/port.c 2017-12-11 01:11:45.061429000 -0800
@@ -333,13 +333,19 @@ void xPortSysTickHandler( void )
uint32_t ulPreviousMask;
ulPreviousMask = portSET_INTERRUPT_MASK_FROM_ISR();
+ traceISR_ENTER();
{
/* Increment the RTOS tick. */
if( xTaskIncrementTick() != pdFALSE )
{
+ traceISR_EXIT_TO_SCHEDULER();
/* Pend a context switch. */
*(portNVIC_INT_CTRL) = portNVIC_PENDSVSET;
}
+ else
+ {
+ traceISR_EXIT();
+ }
}
portCLEAR_INTERRUPT_MASK_FROM_ISR( ulPreviousMask );
}
diff -rupN org/lib/FreeRTOS/portable/GCC/ARM_CM0/portmacro.h new/lib/FreeRTOS/portable/GCC/ARM_CM0/portmacro.h
--- org/lib/FreeRTOS/portable/GCC/ARM_CM0/portmacro.h 2017-11-28 13:48:34.000000000 -0800
+++ new/lib/FreeRTOS/portable/GCC/ARM_CM0/portmacro.h 2017-12-11 01:10:27.732228000 -0800
@@ -82,7 +82,7 @@ extern void vPortYield( void );
#define portNVIC_INT_CTRL_REG ( * ( ( volatile uint32_t * ) 0xe000ed04 ) )
#define portNVIC_PENDSVSET_BIT ( 1UL << 28UL )
#define portYIELD() vPortYield()
-#define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired ) portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT
+#define portEND_SWITCHING_ISR( xSwitchRequired ) { if( xSwitchRequired ) { traceISR_EXIT_TO_SCHEDULER(); portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT; } else { traceISR_EXIT(); } }
#define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
/*-----------------------------------------------------------*/
diff -rupN org/lib/FreeRTOS/portable/GCC/ARM_CM3/port.c new/lib/FreeRTOS/portable/GCC/ARM_CM3/port.c
--- org/lib/FreeRTOS/portable/GCC/ARM_CM3/port.c 2017-11-28 13:48:34.000000000 -0800
+++ new/lib/FreeRTOS/portable/GCC/ARM_CM3/port.c 2017-12-11 01:14:50.515630000 -0800
@@ -431,14 +431,20 @@ void xPortSysTickHandler( void )
save and then restore the interrupt mask value as its value is already
known. */
portDISABLE_INTERRUPTS();
+ traceISR_ENTER();
{
/* Increment the RTOS tick. */
if( xTaskIncrementTick() != pdFALSE )
{
+ traceISR_EXIT_TO_SCHEDULER();
/* A context switch is required. Context switching is performed in
the PendSV interrupt. Pend the PendSV interrupt. */
portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT;
}
+ else
+ {
+ traceISR_EXIT();
+ }
}
portENABLE_INTERRUPTS();
}
diff -rupN org/lib/FreeRTOS/portable/GCC/ARM_CM3/portmacro.h new/lib/FreeRTOS/portable/GCC/ARM_CM3/portmacro.h
--- org/lib/FreeRTOS/portable/GCC/ARM_CM3/portmacro.h 2017-11-28 13:48:34.000000000 -0800
+++ new/lib/FreeRTOS/portable/GCC/ARM_CM3/portmacro.h 2017-12-11 01:13:36.868029000 -0800
@@ -90,7 +90,7 @@ typedef unsigned long UBaseType_t;
#define portNVIC_INT_CTRL_REG ( * ( ( volatile uint32_t * ) 0xe000ed04 ) )
#define portNVIC_PENDSVSET_BIT ( 1UL << 28UL )
-#define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired != pdFALSE ) portYIELD()
+#define portEND_SWITCHING_ISR( xSwitchRequired ) { if( xSwitchRequired != pdFALSE ) { traceISR_EXIT_TO_SCHEDULER(); portYIELD() } else { traceISR_EXIT(); } }
#define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
/*-----------------------------------------------------------*/
diff -rupN org/lib/FreeRTOS/portable/GCC/ARM_CM4F/port.c new/lib/FreeRTOS/portable/GCC/ARM_CM4F/port.c
--- org/lib/FreeRTOS/portable/GCC/ARM_CM4F/port.c 2017-11-28 13:48:34.000000000 -0800
+++ new/lib/FreeRTOS/portable/GCC/ARM_CM4F/port.c 2017-12-11 01:16:01.771230000 -0800
@@ -493,14 +493,20 @@ void xPortSysTickHandler( void )
save and then restore the interrupt mask value as its value is already
known. */
portDISABLE_INTERRUPTS();
+ traceISR_ENTER();
{
/* Increment the RTOS tick. */
if( xTaskIncrementTick() != pdFALSE )
{
+ traceISR_EXIT_TO_SCHEDULER();
/* A context switch is required. Context switching is performed in
the PendSV interrupt. Pend the PendSV interrupt. */
portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT;
}
+ else
+ {
+ traceISR_EXIT();
+ }
}
portENABLE_INTERRUPTS();
}
diff -rupN org/lib/FreeRTOS/portable/GCC/ARM_CM4F/portmacro.h new/lib/FreeRTOS/portable/GCC/ARM_CM4F/portmacro.h
--- org/lib/FreeRTOS/portable/GCC/ARM_CM4F/portmacro.h 2017-11-28 13:48:34.000000000 -0800
+++ new/lib/FreeRTOS/portable/GCC/ARM_CM4F/portmacro.h 2017-12-11 01:15:16.546830000 -0800
@@ -90,7 +90,7 @@ typedef unsigned long UBaseType_t;
#define portNVIC_INT_CTRL_REG ( * ( ( volatile uint32_t * ) 0xe000ed04 ) )
#define portNVIC_PENDSVSET_BIT ( 1UL << 28UL )
-#define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired != pdFALSE ) portYIELD()
+#define portEND_SWITCHING_ISR( xSwitchRequired ) { if( xSwitchRequired != pdFALSE ) { traceISR_EXIT_TO_SCHEDULER(); portYIELD(); } else { traceISR_EXIT(); } }
#define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
/*-----------------------------------------------------------*/
diff -rupN org/lib/FreeRTOS/tasks.c new/lib/FreeRTOS/tasks.c
--- org/lib/FreeRTOS/tasks.c 2017-11-28 13:48:34.000000000 -0800
+++ new/lib/FreeRTOS/tasks.c 2017-12-11 01:08:48.591428000 -0800
@@ -237,6 +237,17 @@ count overflows. */
taskRECORD_READY_PRIORITY( ( pxTCB )->uxPriority ); \
vListInsertEnd( &( pxReadyTasksLists[ ( pxTCB )->uxPriority ] ), &( ( pxTCB )->xStateListItem ) ); \
tracePOST_MOVED_TASK_TO_READY_STATE( pxTCB )
+
+/*
+ * Place the task represented by pxTCB which has been in a ready list before
+ * into the appropriate ready list for the task.
+ * It is inserted at the end of the list.
+ */
+#define prvReaddTaskToReadyList( pxTCB ) \
+ traceREADDED_TASK_TO_READY_STATE( pxTCB ); \
+ taskRECORD_READY_PRIORITY( ( pxTCB )->uxPriority ); \
+ vListInsertEnd( &( pxReadyTasksLists[ ( pxTCB )->uxPriority ] ), &( ( pxTCB )->xStateListItem ) ); \
+ tracePOST_MOVED_TASK_TO_READY_STATE( pxTCB )
/*-----------------------------------------------------------*/
/*
@@ -1598,7 +1609,7 @@ static void prvAddNewTaskToReadyList( TC
{
mtCOVERAGE_TEST_MARKER();
}
- prvAddTaskToReadyList( pxTCB );
+ prvReaddTaskToReadyList( pxTCB );
}
else
{
@@ -1659,7 +1670,7 @@ static void prvAddNewTaskToReadyList( TC
{
mtCOVERAGE_TEST_MARKER();
}
-
+ traceMOVED_TASK_TO_SUSPENDED_LIST(pxTCB);
vListInsertEnd( &xSuspendedTaskList, &( pxTCB->xStateListItem ) );
#if( configUSE_TASK_NOTIFICATIONS == 1 )
@@ -3671,6 +3682,20 @@ static void prvCheckTasksWaitingTerminat
#endif /* INCLUDE_uxTaskGetStackHighWaterMark */
/*-----------------------------------------------------------*/
+#if (INCLUDE_pxTaskGetStackStart == 1)
+ uint8_t* pxTaskGetStackStart( TaskHandle_t xTask)
+ {
+ TCB_t *pxTCB;
+ UBaseType_t uxReturn;
+ (void)uxReturn;
+
+ pxTCB = prvGetTCBFromHandle( xTask );
+ return ( uint8_t * ) pxTCB->pxStack;
+ }
+
+#endif /* INCLUDE_pxTaskGetStackStart */
+/*-----------------------------------------------------------*/
+
#if ( INCLUDE_vTaskDelete == 1 )
static void prvDeleteTCB( TCB_t *pxTCB )
@@ -3840,7 +3865,7 @@ TCB_t *pxTCB;
/* Inherit the priority before being moved into the new list. */
pxMutexHolderTCB->uxPriority = pxCurrentTCB->uxPriority;
- prvAddTaskToReadyList( pxMutexHolderTCB );
+ prvReaddTaskToReadyList( pxMutexHolderTCB );
}
else
{
@@ -3930,7 +3955,7 @@ TCB_t *pxTCB;
any other purpose if this task is running, and it must be
running to give back the mutex. */
listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), ( TickType_t ) configMAX_PRIORITIES - ( TickType_t ) pxTCB->uxPriority ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */
- prvAddTaskToReadyList( pxTCB );
+ prvReaddTaskToReadyList( pxTCB );
/* Return true to indicate that a context switch is required.
This is only actually required in the corner case whereby
@@ -4940,6 +4965,7 @@ const TickType_t xConstTickCount = xTick
/* Add the task to the suspended task list instead of a delayed task
list to ensure it is not woken by a timing event. It will block
indefinitely. */
+ traceMOVED_TASK_TO_SUSPENDED_LIST(pxCurrentTCB);
vListInsertEnd( &xSuspendedTaskList, &( pxCurrentTCB->xStateListItem ) );
}
else
@@ -4956,12 +4982,14 @@ const TickType_t xConstTickCount = xTick
{
/* Wake time has overflowed. Place this item in the overflow
list. */
+ traceMOVED_TASK_TO_OVERFLOW_DELAYED_LIST();
vListInsert( pxOverflowDelayedTaskList, &( pxCurrentTCB->xStateListItem ) );
}
else
{
/* The wake time has not overflowed, so the current block list
is used. */
+ traceMOVED_TASK_TO_DELAYED_LIST();
vListInsert( pxDelayedTaskList, &( pxCurrentTCB->xStateListItem ) );
/* If the task entering the blocked state was placed at the
@@ -4991,11 +5019,13 @@ const TickType_t xConstTickCount = xTick
if( xTimeToWake < xConstTickCount )
{
/* Wake time has overflowed. Place this item in the overflow list. */
+ traceMOVED_TASK_TO_OVERFLOW_DELAYED_LIST();
vListInsert( pxOverflowDelayedTaskList, &( pxCurrentTCB->xStateListItem ) );
}
else
{
/* The wake time has not overflowed, so the current block list is used. */
+ traceMOVED_TASK_TO_DELAYED_LIST();
vListInsert( pxDelayedTaskList, &( pxCurrentTCB->xStateListItem ) );
/* If the task entering the blocked state was placed at the head of the
diff -rupN org/lib/include/FreeRTOS.h new/lib/include/FreeRTOS.h
--- org/lib/include/FreeRTOS.h 2017-11-28 13:48:34.000000000 -0800
+++ new/lib/include/FreeRTOS.h 2017-12-11 00:54:49.522222000 -0800
@@ -157,6 +157,10 @@ extern "C" {
#define INCLUDE_uxTaskGetStackHighWaterMark 0
#endif
+#ifndef INCLUDE_pxTaskGetStackStart
+ #define INCLUDE_pxTaskGetStackStart 0
+#endif
+
#ifndef INCLUDE_eTaskGetState
#define INCLUDE_eTaskGetState 0
#endif
@@ -393,6 +397,23 @@ extern "C" {
#define tracePOST_MOVED_TASK_TO_READY_STATE( pxTCB )
#endif
+#ifndef traceREADDED_TASK_TO_READY_STATE
+ #define traceREADDED_TASK_TO_READY_STATE( pxTCB ) traceMOVED_TASK_TO_READY_STATE( pxTCB )
+#endif
+
+#ifndef traceMOVED_TASK_TO_DELAYED_LIST
+ #define traceMOVED_TASK_TO_DELAYED_LIST()
+#endif
+
+#ifndef traceMOVED_TASK_TO_OVERFLOW_DELAYED_LIST
+ #define traceMOVED_TASK_TO_OVERFLOW_DELAYED_LIST()
+#endif
+
+#ifndef traceMOVED_TASK_TO_SUSPENDED_LIST
+ #define traceMOVED_TASK_TO_SUSPENDED_LIST( pxTCB )
+#endif
+
+
#ifndef traceQUEUE_CREATE
#define traceQUEUE_CREATE( pxNewQueue )
#endif
@@ -637,6 +658,18 @@ extern "C" {
#define traceTASK_NOTIFY_GIVE_FROM_ISR()
#endif
+#ifndef traceISR_EXIT_TO_SCHEDULER
+ #define traceISR_EXIT_TO_SCHEDULER()
+#endif
+
+#ifndef traceISR_EXIT
+ #define traceISR_EXIT()
+#endif
+
+#ifndef traceISR_ENTER
+ #define traceISR_ENTER()
+#endif
+
#ifndef traceSTREAM_BUFFER_CREATE_FAILED
#define traceSTREAM_BUFFER_CREATE_FAILED( xIsMessageBuffer )
#endif
diff -rupN org/lib/include/task.h new/lib/include/task.h
--- org/lib/include/task.h 2017-11-28 13:48:34.000000000 -0800
+++ new/lib/include/task.h 2017-12-11 00:56:29.783423000 -0800
@@ -1422,6 +1422,25 @@ TaskHandle_t xTaskGetHandle( const char
*/
UBaseType_t uxTaskGetStackHighWaterMark( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
+/**
+ * task.h
+ * <PRE>uint8_t* pxTaskGetStackStart( TaskHandle_t xTask);</PRE>
+ *
+ * INCLUDE_pxTaskGetStackStart must be set to 1 in FreeRTOSConfig.h for
+ * this function to be available.
+ *
+ * Returns the start of the stack associated with xTask. That is,
+ * the highest stack memory address on architectures where the stack grows down
+ * from high memory, and the lowest memory address on architectures where the
+ * stack grows up from low memory.
+ *
+ * @param xTask Handle of the task associated with the stack returned.
+ * Set xTask to NULL to return the stack of the calling task.
+ *
+ * @return A pointer to the start of the stack.
+ */
+uint8_t* pxTaskGetStackStart( TaskHandle_t xTask) PRIVILEGED_FUNCTION;
+
/* When using trace macros it is sometimes necessary to include task.h before
FreeRTOS.h. When this is done TaskHookFunction_t will not yet have been defined,
so the following two prototypes will cause a compilation error. This can be

View File

@ -0,0 +1,308 @@
diff -rupN org/Source/include/FreeRTOS.h new/Source/include/FreeRTOS.h
--- org/Source/include/FreeRTOS.h 2017-11-28 13:48:34.000000000 -0800
+++ new/Source/include/FreeRTOS.h 2017-12-11 00:54:49.522222000 -0800
@@ -157,6 +157,10 @@ extern "C" {
#define INCLUDE_uxTaskGetStackHighWaterMark 0
#endif
+#ifndef INCLUDE_pxTaskGetStackStart
+ #define INCLUDE_pxTaskGetStackStart 0
+#endif
+
#ifndef INCLUDE_eTaskGetState
#define INCLUDE_eTaskGetState 0
#endif
@@ -393,6 +397,23 @@ extern "C" {
#define tracePOST_MOVED_TASK_TO_READY_STATE( pxTCB )
#endif
+#ifndef traceREADDED_TASK_TO_READY_STATE
+ #define traceREADDED_TASK_TO_READY_STATE( pxTCB ) traceMOVED_TASK_TO_READY_STATE( pxTCB )
+#endif
+
+#ifndef traceMOVED_TASK_TO_DELAYED_LIST
+ #define traceMOVED_TASK_TO_DELAYED_LIST()
+#endif
+
+#ifndef traceMOVED_TASK_TO_OVERFLOW_DELAYED_LIST
+ #define traceMOVED_TASK_TO_OVERFLOW_DELAYED_LIST()
+#endif
+
+#ifndef traceMOVED_TASK_TO_SUSPENDED_LIST
+ #define traceMOVED_TASK_TO_SUSPENDED_LIST( pxTCB )
+#endif
+
+
#ifndef traceQUEUE_CREATE
#define traceQUEUE_CREATE( pxNewQueue )
#endif
@@ -637,6 +658,18 @@ extern "C" {
#define traceTASK_NOTIFY_GIVE_FROM_ISR()
#endif
+#ifndef traceISR_EXIT_TO_SCHEDULER
+ #define traceISR_EXIT_TO_SCHEDULER()
+#endif
+
+#ifndef traceISR_EXIT
+ #define traceISR_EXIT()
+#endif
+
+#ifndef traceISR_ENTER
+ #define traceISR_ENTER()
+#endif
+
#ifndef traceSTREAM_BUFFER_CREATE_FAILED
#define traceSTREAM_BUFFER_CREATE_FAILED( xIsMessageBuffer )
#endif
diff -rupN org/Source/include/task.h new/Source/include/task.h
--- org/Source/include/task.h 2017-11-28 13:48:34.000000000 -0800
+++ new/Source/include/task.h 2017-12-11 00:56:29.783423000 -0800
@@ -1422,6 +1422,25 @@ TaskHandle_t xTaskGetHandle( const char
*/
UBaseType_t uxTaskGetStackHighWaterMark( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
+/**
+ * task.h
+ * <PRE>uint8_t* pxTaskGetStackStart( TaskHandle_t xTask);</PRE>
+ *
+ * INCLUDE_pxTaskGetStackStart must be set to 1 in FreeRTOSConfig.h for
+ * this function to be available.
+ *
+ * Returns the start of the stack associated with xTask. That is,
+ * the highest stack memory address on architectures where the stack grows down
+ * from high memory, and the lowest memory address on architectures where the
+ * stack grows up from low memory.
+ *
+ * @param xTask Handle of the task associated with the stack returned.
+ * Set xTask to NULL to return the stack of the calling task.
+ *
+ * @return A pointer to the start of the stack.
+ */
+uint8_t* pxTaskGetStackStart( TaskHandle_t xTask) PRIVILEGED_FUNCTION;
+
/* When using trace macros it is sometimes necessary to include task.h before
FreeRTOS.h. When this is done TaskHookFunction_t will not yet have been defined,
so the following two prototypes will cause a compilation error. This can be
diff -rupN org/Source/portable/GCC/ARM_CM0/port.c new/Source/portable/GCC/ARM_CM0/port.c
--- org/Source/portable/GCC/ARM_CM0/port.c 2017-11-28 13:48:34.000000000 -0800
+++ new/Source/portable/GCC/ARM_CM0/port.c 2017-12-11 01:11:45.061429000 -0800
@@ -333,13 +333,19 @@ void xPortSysTickHandler( void )
uint32_t ulPreviousMask;
ulPreviousMask = portSET_INTERRUPT_MASK_FROM_ISR();
+ traceISR_ENTER();
{
/* Increment the RTOS tick. */
if( xTaskIncrementTick() != pdFALSE )
{
+ traceISR_EXIT_TO_SCHEDULER();
/* Pend a context switch. */
*(portNVIC_INT_CTRL) = portNVIC_PENDSVSET;
}
+ else
+ {
+ traceISR_EXIT();
+ }
}
portCLEAR_INTERRUPT_MASK_FROM_ISR( ulPreviousMask );
}
diff -rupN org/Source/portable/GCC/ARM_CM0/portmacro.h new/Source/portable/GCC/ARM_CM0/portmacro.h
--- org/Source/portable/GCC/ARM_CM0/portmacro.h 2017-11-28 13:48:34.000000000 -0800
+++ new/Source/portable/GCC/ARM_CM0/portmacro.h 2017-12-11 01:10:27.732228000 -0800
@@ -82,7 +82,7 @@ extern void vPortYield( void );
#define portNVIC_INT_CTRL_REG ( * ( ( volatile uint32_t * ) 0xe000ed04 ) )
#define portNVIC_PENDSVSET_BIT ( 1UL << 28UL )
#define portYIELD() vPortYield()
-#define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired ) portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT
+#define portEND_SWITCHING_ISR( xSwitchRequired ) { if( xSwitchRequired ) { traceISR_EXIT_TO_SCHEDULER(); portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT; } else { traceISR_EXIT(); } }
#define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
/*-----------------------------------------------------------*/
diff -rupN org/Source/portable/GCC/ARM_CM3/port.c new/Source/portable/GCC/ARM_CM3/port.c
--- org/Source/portable/GCC/ARM_CM3/port.c 2017-11-28 13:48:34.000000000 -0800
+++ new/Source/portable/GCC/ARM_CM3/port.c 2017-12-11 01:14:50.515630000 -0800
@@ -431,14 +431,20 @@ void xPortSysTickHandler( void )
save and then restore the interrupt mask value as its value is already
known. */
portDISABLE_INTERRUPTS();
+ traceISR_ENTER();
{
/* Increment the RTOS tick. */
if( xTaskIncrementTick() != pdFALSE )
{
+ traceISR_EXIT_TO_SCHEDULER();
/* A context switch is required. Context switching is performed in
the PendSV interrupt. Pend the PendSV interrupt. */
portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT;
}
+ else
+ {
+ traceISR_EXIT();
+ }
}
portENABLE_INTERRUPTS();
}
diff -rupN org/Source/portable/GCC/ARM_CM3/portmacro.h new/Source/portable/GCC/ARM_CM3/portmacro.h
--- org/Source/portable/GCC/ARM_CM3/portmacro.h 2017-11-28 13:48:34.000000000 -0800
+++ new/Source/portable/GCC/ARM_CM3/portmacro.h 2017-12-11 01:13:36.868029000 -0800
@@ -90,7 +90,7 @@ typedef unsigned long UBaseType_t;
#define portNVIC_INT_CTRL_REG ( * ( ( volatile uint32_t * ) 0xe000ed04 ) )
#define portNVIC_PENDSVSET_BIT ( 1UL << 28UL )
-#define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired != pdFALSE ) portYIELD()
+#define portEND_SWITCHING_ISR( xSwitchRequired ) { if( xSwitchRequired != pdFALSE ) { traceISR_EXIT_TO_SCHEDULER(); portYIELD() } else { traceISR_EXIT(); } }
#define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
/*-----------------------------------------------------------*/
diff -rupN org/Source/portable/GCC/ARM_CM4F/port.c new/Source/portable/GCC/ARM_CM4F/port.c
--- org/Source/portable/GCC/ARM_CM4F/port.c 2017-11-28 13:48:34.000000000 -0800
+++ new/Source/portable/GCC/ARM_CM4F/port.c 2017-12-11 01:16:01.771230000 -0800
@@ -493,14 +493,20 @@ void xPortSysTickHandler( void )
save and then restore the interrupt mask value as its value is already
known. */
portDISABLE_INTERRUPTS();
+ traceISR_ENTER();
{
/* Increment the RTOS tick. */
if( xTaskIncrementTick() != pdFALSE )
{
+ traceISR_EXIT_TO_SCHEDULER();
/* A context switch is required. Context switching is performed in
the PendSV interrupt. Pend the PendSV interrupt. */
portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT;
}
+ else
+ {
+ traceISR_EXIT();
+ }
}
portENABLE_INTERRUPTS();
}
diff -rupN org/Source/portable/GCC/ARM_CM4F/portmacro.h new/Source/portable/GCC/ARM_CM4F/portmacro.h
--- org/Source/portable/GCC/ARM_CM4F/portmacro.h 2017-11-28 13:48:34.000000000 -0800
+++ new/Source/portable/GCC/ARM_CM4F/portmacro.h 2017-12-11 01:15:16.546830000 -0800
@@ -90,7 +90,7 @@ typedef unsigned long UBaseType_t;
#define portNVIC_INT_CTRL_REG ( * ( ( volatile uint32_t * ) 0xe000ed04 ) )
#define portNVIC_PENDSVSET_BIT ( 1UL << 28UL )
-#define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired != pdFALSE ) portYIELD()
+#define portEND_SWITCHING_ISR( xSwitchRequired ) { if( xSwitchRequired != pdFALSE ) { traceISR_EXIT_TO_SCHEDULER(); portYIELD(); } else { traceISR_EXIT(); } }
#define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
/*-----------------------------------------------------------*/
diff -rupN org/Source/tasks.c new/Source/tasks.c
--- org/Source/tasks.c 2017-11-28 13:48:34.000000000 -0800
+++ new/Source/tasks.c 2017-12-11 01:08:48.591428000 -0800
@@ -237,6 +237,17 @@ count overflows. */
taskRECORD_READY_PRIORITY( ( pxTCB )->uxPriority ); \
vListInsertEnd( &( pxReadyTasksLists[ ( pxTCB )->uxPriority ] ), &( ( pxTCB )->xStateListItem ) ); \
tracePOST_MOVED_TASK_TO_READY_STATE( pxTCB )
+
+/*
+ * Place the task represented by pxTCB which has been in a ready list before
+ * into the appropriate ready list for the task.
+ * It is inserted at the end of the list.
+ */
+#define prvReaddTaskToReadyList( pxTCB ) \
+ traceREADDED_TASK_TO_READY_STATE( pxTCB ); \
+ taskRECORD_READY_PRIORITY( ( pxTCB )->uxPriority ); \
+ vListInsertEnd( &( pxReadyTasksLists[ ( pxTCB )->uxPriority ] ), &( ( pxTCB )->xStateListItem ) ); \
+ tracePOST_MOVED_TASK_TO_READY_STATE( pxTCB )
/*-----------------------------------------------------------*/
/*
@@ -1598,7 +1609,7 @@ static void prvAddNewTaskToReadyList( TC
{
mtCOVERAGE_TEST_MARKER();
}
- prvAddTaskToReadyList( pxTCB );
+ prvReaddTaskToReadyList( pxTCB );
}
else
{
@@ -1659,7 +1670,7 @@ static void prvAddNewTaskToReadyList( TC
{
mtCOVERAGE_TEST_MARKER();
}
-
+ traceMOVED_TASK_TO_SUSPENDED_LIST(pxTCB);
vListInsertEnd( &xSuspendedTaskList, &( pxTCB->xStateListItem ) );
#if( configUSE_TASK_NOTIFICATIONS == 1 )
@@ -3671,6 +3682,20 @@ static void prvCheckTasksWaitingTerminat
#endif /* INCLUDE_uxTaskGetStackHighWaterMark */
/*-----------------------------------------------------------*/
+#if (INCLUDE_pxTaskGetStackStart == 1)
+ uint8_t* pxTaskGetStackStart( TaskHandle_t xTask)
+ {
+ TCB_t *pxTCB;
+ UBaseType_t uxReturn;
+ (void)uxReturn;
+
+ pxTCB = prvGetTCBFromHandle( xTask );
+ return ( uint8_t * ) pxTCB->pxStack;
+ }
+
+#endif /* INCLUDE_pxTaskGetStackStart */
+/*-----------------------------------------------------------*/
+
#if ( INCLUDE_vTaskDelete == 1 )
static void prvDeleteTCB( TCB_t *pxTCB )
@@ -3840,7 +3865,7 @@ TCB_t *pxTCB;
/* Inherit the priority before being moved into the new list. */
pxMutexHolderTCB->uxPriority = pxCurrentTCB->uxPriority;
- prvAddTaskToReadyList( pxMutexHolderTCB );
+ prvReaddTaskToReadyList( pxMutexHolderTCB );
}
else
{
@@ -3930,7 +3955,7 @@ TCB_t *pxTCB;
any other purpose if this task is running, and it must be
running to give back the mutex. */
listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), ( TickType_t ) configMAX_PRIORITIES - ( TickType_t ) pxTCB->uxPriority ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */
- prvAddTaskToReadyList( pxTCB );
+ prvReaddTaskToReadyList( pxTCB );
/* Return true to indicate that a context switch is required.
This is only actually required in the corner case whereby
@@ -4940,6 +4965,7 @@ const TickType_t xConstTickCount = xTick
/* Add the task to the suspended task list instead of a delayed task
list to ensure it is not woken by a timing event. It will block
indefinitely. */
+ traceMOVED_TASK_TO_SUSPENDED_LIST(pxCurrentTCB);
vListInsertEnd( &xSuspendedTaskList, &( pxCurrentTCB->xStateListItem ) );
}
else
@@ -4956,12 +4982,14 @@ const TickType_t xConstTickCount = xTick
{
/* Wake time has overflowed. Place this item in the overflow
list. */
+ traceMOVED_TASK_TO_OVERFLOW_DELAYED_LIST();
vListInsert( pxOverflowDelayedTaskList, &( pxCurrentTCB->xStateListItem ) );
}
else
{
/* The wake time has not overflowed, so the current block list
is used. */
+ traceMOVED_TASK_TO_DELAYED_LIST();
vListInsert( pxDelayedTaskList, &( pxCurrentTCB->xStateListItem ) );
/* If the task entering the blocked state was placed at the
@@ -4991,11 +5019,13 @@ const TickType_t xConstTickCount = xTick
if( xTimeToWake < xConstTickCount )
{
/* Wake time has overflowed. Place this item in the overflow list. */
+ traceMOVED_TASK_TO_OVERFLOW_DELAYED_LIST();
vListInsert( pxOverflowDelayedTaskList, &( pxCurrentTCB->xStateListItem ) );
}
else
{
/* The wake time has not overflowed, so the current block list is used. */
+ traceMOVED_TASK_TO_DELAYED_LIST();
vListInsert( pxDelayedTaskList, &( pxCurrentTCB->xStateListItem ) );
/* If the task entering the blocked state was placed at the head of the

View File

@ -0,0 +1,252 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_FreeRTOS.c
Purpose : Interface between FreeRTOS and SystemView.
Revision: $Rev: 7947 $
*/
#include "FreeRTOS.h"
#include "task.h"
#include "SEGGER_SYSVIEW.h"
#include "SEGGER_SYSVIEW_FreeRTOS.h"
#include "string.h" // Required for memset
typedef struct SYSVIEW_FREERTOS_TASK_STATUS SYSVIEW_FREERTOS_TASK_STATUS;
struct SYSVIEW_FREERTOS_TASK_STATUS {
U32 xHandle;
const char* pcTaskName;
unsigned uxCurrentPriority;
U32 pxStack;
unsigned uStackHighWaterMark;
};
static SYSVIEW_FREERTOS_TASK_STATUS _aTasks[SYSVIEW_FREERTOS_MAX_NOF_TASKS];
static unsigned _NumTasks;
/*********************************************************************
*
* _cbSendTaskList()
*
* Function description
* This function is part of the link between FreeRTOS and SYSVIEW.
* Called from SystemView when asked by the host, it uses SYSVIEW
* functions to send the entire task list to the host.
*/
static void _cbSendTaskList(void) {
unsigned n;
for (n = 0; n < _NumTasks; n++) {
#if INCLUDE_uxTaskGetStackHighWaterMark // Report Task Stack High Watermark
_aTasks[n].uStackHighWaterMark = uxTaskGetStackHighWaterMark((TaskHandle_t)_aTasks[n].xHandle);
#endif
SYSVIEW_SendTaskInfo((U32)_aTasks[n].xHandle, _aTasks[n].pcTaskName, (unsigned)_aTasks[n].uxCurrentPriority, (U32)_aTasks[n].pxStack, (unsigned)_aTasks[n].uStackHighWaterMark);
}
}
/*********************************************************************
*
* _cbGetTime()
*
* Function description
* This function is part of the link between FreeRTOS and SYSVIEW.
* Called from SystemView when asked by the host, returns the
* current system time in micro seconds.
*/
static U64 _cbGetTime(void) {
U64 Time;
Time = xTaskGetTickCountFromISR();
Time *= portTICK_PERIOD_MS;
Time *= 1000;
return Time;
}
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
/*********************************************************************
*
* SYSVIEW_AddTask()
*
* Function description
* Add a task to the internal list and record its information.
*/
void SYSVIEW_AddTask(U32 xHandle, const char* pcTaskName, unsigned uxCurrentPriority, U32 pxStack, unsigned uStackHighWaterMark) {
if (memcmp(pcTaskName, "IDLE", 5) == 0) {
return;
}
if (_NumTasks >= SYSVIEW_FREERTOS_MAX_NOF_TASKS) {
SEGGER_SYSVIEW_Warn("SYSTEMVIEW: Could not record task information. Maximum number of tasks reached.");
return;
}
_aTasks[_NumTasks].xHandle = xHandle;
_aTasks[_NumTasks].pcTaskName = pcTaskName;
_aTasks[_NumTasks].uxCurrentPriority = uxCurrentPriority;
_aTasks[_NumTasks].pxStack = pxStack;
_aTasks[_NumTasks].uStackHighWaterMark = uStackHighWaterMark;
_NumTasks++;
SYSVIEW_SendTaskInfo(xHandle, pcTaskName,uxCurrentPriority, pxStack, uStackHighWaterMark);
}
/*********************************************************************
*
* SYSVIEW_UpdateTask()
*
* Function description
* Update a task in the internal list and record its information.
*/
void SYSVIEW_UpdateTask(U32 xHandle, const char* pcTaskName, unsigned uxCurrentPriority, U32 pxStack, unsigned uStackHighWaterMark) {
unsigned n;
if (memcmp(pcTaskName, "IDLE", 5) == 0) {
return;
}
for (n = 0; n < _NumTasks; n++) {
if (_aTasks[n].xHandle == xHandle) {
break;
}
}
if (n < _NumTasks) {
_aTasks[n].pcTaskName = pcTaskName;
_aTasks[n].uxCurrentPriority = uxCurrentPriority;
_aTasks[n].pxStack = pxStack;
_aTasks[n].uStackHighWaterMark = uStackHighWaterMark;
SYSVIEW_SendTaskInfo(xHandle, pcTaskName, uxCurrentPriority, pxStack, uStackHighWaterMark);
} else {
SYSVIEW_AddTask(xHandle, pcTaskName, uxCurrentPriority, pxStack, uStackHighWaterMark);
}
}
/*********************************************************************
*
* SYSVIEW_DeleteTask()
*
* Function description
* Delete a task from the internal list.
*/
void SYSVIEW_DeleteTask(U32 xHandle) {
unsigned n;
if (_NumTasks == 0) {
return; // Early out
}
for (n = 0; n < _NumTasks; n++) {
if (_aTasks[n].xHandle == xHandle) {
break;
}
}
if (n == (_NumTasks - 1)) {
//
// Task is last item in list.
// Simply zero the item and decrement number of tasks.
//
memset(&_aTasks[n], 0, sizeof(_aTasks[n]));
_NumTasks--;
} else if (n < _NumTasks) {
//
// Task is in the middle of the list.
// Move last item to current position and decrement number of tasks.
// Order of tasks does not really matter, so no need to move all following items.
//
_aTasks[n].xHandle = _aTasks[_NumTasks - 1].xHandle;
_aTasks[n].pcTaskName = _aTasks[_NumTasks - 1].pcTaskName;
_aTasks[n].uxCurrentPriority = _aTasks[_NumTasks - 1].uxCurrentPriority;
_aTasks[n].pxStack = _aTasks[_NumTasks - 1].pxStack;
_aTasks[n].uStackHighWaterMark = _aTasks[_NumTasks - 1].uStackHighWaterMark;
memset(&_aTasks[_NumTasks - 1], 0, sizeof(_aTasks[_NumTasks - 1]));
_NumTasks--;
}
}
/*********************************************************************
*
* SYSVIEW_SendTaskInfo()
*
* Function description
* Record task information.
*/
void SYSVIEW_SendTaskInfo(U32 TaskID, const char* sName, unsigned Prio, U32 StackBase, unsigned StackSize) {
SEGGER_SYSVIEW_TASKINFO TaskInfo;
memset(&TaskInfo, 0, sizeof(TaskInfo)); // Fill all elements with 0 to allow extending the structure in future version without breaking the code
TaskInfo.TaskID = TaskID;
TaskInfo.sName = sName;
TaskInfo.Prio = Prio;
TaskInfo.StackBase = StackBase;
TaskInfo.StackSize = StackSize;
SEGGER_SYSVIEW_SendTaskInfo(&TaskInfo);
}
/*********************************************************************
*
* Public API structures
*
**********************************************************************
*/
// Callbacks provided to SYSTEMVIEW by FreeRTOS
const SEGGER_SYSVIEW_OS_API SYSVIEW_X_OS_TraceAPI = {
_cbGetTime,
_cbSendTaskList,
};
/*************************** End of file ****************************/

View File

@ -0,0 +1,330 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_FreeRTOS.h
Purpose : Interface between FreeRTOS and SystemView.
Revision: $Rev: 7745 $
Notes:
(1) Include this file at the end of FreeRTOSConfig.h
*/
#ifndef SYSVIEW_FREERTOS_H
#define SYSVIEW_FREERTOS_H
#include "SEGGER_SYSVIEW.h"
/*********************************************************************
*
* Defines, configurable
*
**********************************************************************
*/
#ifndef portSTACK_GROWTH
#define portSTACK_GROWTH ( -1 )
#endif
#define SYSVIEW_FREERTOS_MAX_NOF_TASKS 8
/*********************************************************************
*
* Defines, fixed
*
**********************************************************************
*/
#define apiID_OFFSET (32u)
#define apiID_VTASKALLOCATEMPUREGIONS (1u)
#define apiID_VTASKDELETE (2u)
#define apiID_VTASKDELAY (3u)
#define apiID_VTASKDELAYUNTIL (4u)
#define apiID_UXTASKPRIORITYGET (5u)
#define apiID_UXTASKPRIORITYGETFROMISR (6u)
#define apiID_ETASKGETSTATE (7u)
#define apiID_VTASKPRIORITYSET (8u)
#define apiID_VTASKSUSPEND (9u)
#define apiID_VTASKRESUME (10u)
#define apiID_XTASKRESUMEFROMISR (11u)
#define apiID_VTASKSTARTSCHEDULER (12u)
#define apiID_VTASKENDSCHEDULER (13u)
#define apiID_VTASKSUSPENDALL (14u)
#define apiID_XTASKRESUMEALL (15u)
#define apiID_XTASKGETTICKCOUNT (16u)
#define apiID_XTASKGETTICKCOUNTFROMISR (17u)
#define apiID_UXTASKGETNUMBEROFTASKS (18u)
#define apiID_PCTASKGETTASKNAME (19u)
#define apiID_UXTASKGETSTACKHIGHWATERMARK (20u)
#define apiID_VTASKSETAPPLICATIONTASKTAG (21u)
#define apiID_XTASKGETAPPLICATIONTASKTAG (22u)
#define apiID_VTASKSETTHREADLOCALSTORAGEPOINTER (23u)
#define apiID_PVTASKGETTHREADLOCALSTORAGEPOINTER (24u)
#define apiID_XTASKCALLAPPLICATIONTASKHOOK (25u)
#define apiID_XTASKGETIDLETASKHANDLE (26u)
#define apiID_UXTASKGETSYSTEMSTATE (27u)
#define apiID_VTASKLIST (28u)
#define apiID_VTASKGETRUNTIMESTATS (29u)
#define apiID_XTASKGENERICNOTIFY (30u)
#define apiID_XTASKGENERICNOTIFYFROMISR (31u)
#define apiID_XTASKNOTIFYWAIT (32u)
#define apiID_VTASKNOTIFYGIVEFROMISR (33u)
#define apiID_ULTASKNOTIFYTAKE (34u)
#define apiID_XTASKNOTIFYSTATECLEAR (35u)
#define apiID_XTASKGETCURRENTTASKHANDLE (36u)
#define apiID_VTASKSETTIMEOUTSTATE (37u)
#define apiID_XTASKCHECKFORTIMEOUT (38u)
#define apiID_VTASKMISSEDYIELD (39u)
#define apiID_XTASKGETSCHEDULERSTATE (40u)
#define apiID_VTASKPRIORITYINHERIT (41u)
#define apiID_XTASKPRIORITYDISINHERIT (42u)
#define apiID_XTASKGENERICCREATE (43u)
#define apiID_UXTASKGETTASKNUMBER (44u)
#define apiID_VTASKSETTASKNUMBER (45u)
#define apiID_VTASKSTEPTICK (46u)
#define apiID_ETASKCONFIRMSLEEPMODESTATUS (47u)
#define apiID_XTIMERCREATE (48u)
#define apiID_PVTIMERGETTIMERID (49u)
#define apiID_VTIMERSETTIMERID (50u)
#define apiID_XTIMERISTIMERACTIVE (51u)
#define apiID_XTIMERGETTIMERDAEMONTASKHANDLE (52u)
#define apiID_XTIMERPENDFUNCTIONCALLFROMISR (53u)
#define apiID_XTIMERPENDFUNCTIONCALL (54u)
#define apiID_PCTIMERGETTIMERNAME (55u)
#define apiID_XTIMERCREATETIMERTASK (56u)
#define apiID_XTIMERGENERICCOMMAND (57u)
#define apiID_XQUEUEGENERICSEND (58u)
#define apiID_XQUEUEPEEKFROMISR (59u)
#define apiID_XQUEUEGENERICRECEIVE (60u)
#define apiID_UXQUEUEMESSAGESWAITING (61u)
#define apiID_UXQUEUESPACESAVAILABLE (62u)
#define apiID_VQUEUEDELETE (63u)
#define apiID_XQUEUEGENERICSENDFROMISR (64u)
#define apiID_XQUEUEGIVEFROMISR (65u)
#define apiID_XQUEUERECEIVEFROMISR (66u)
#define apiID_XQUEUEISQUEUEEMPTYFROMISR (67u)
#define apiID_XQUEUEISQUEUEFULLFROMISR (68u)
#define apiID_UXQUEUEMESSAGESWAITINGFROMISR (69u)
#define apiID_XQUEUEALTGENERICSEND (70u)
#define apiID_XQUEUEALTGENERICRECEIVE (71u)
#define apiID_XQUEUECRSENDFROMISR (72u)
#define apiID_XQUEUECRRECEIVEFROMISR (73u)
#define apiID_XQUEUECRSEND (74u)
#define apiID_XQUEUECRRECEIVE (75u)
#define apiID_XQUEUECREATEMUTEX (76u)
#define apiID_XQUEUECREATECOUNTINGSEMAPHORE (77u)
#define apiID_XQUEUEGETMUTEXHOLDER (78u)
#define apiID_XQUEUETAKEMUTEXRECURSIVE (79u)
#define apiID_XQUEUEGIVEMUTEXRECURSIVE (80u)
#define apiID_VQUEUEADDTOREGISTRY (81u)
#define apiID_VQUEUEUNREGISTERQUEUE (82u)
#define apiID_XQUEUEGENERICCREATE (83u)
#define apiID_XQUEUECREATESET (84u)
#define apiID_XQUEUEADDTOSET (85u)
#define apiID_XQUEUEREMOVEFROMSET (86u)
#define apiID_XQUEUESELECTFROMSET (87u)
#define apiID_XQUEUESELECTFROMSETFROMISR (88u)
#define apiID_XQUEUEGENERICRESET (89u)
#define apiID_VLISTINITIALISE (90u)
#define apiID_VLISTINITIALISEITEM (91u)
#define apiID_VLISTINSERT (92u)
#define apiID_VLISTINSERTEND (93u)
#define apiID_UXLISTREMOVE (94u)
#define apiID_XEVENTGROUPCREATE (95u)
#define apiID_XEVENTGROUPWAITBITS (96u)
#define apiID_XEVENTGROUPCLEARBITS (97u)
#define apiID_XEVENTGROUPCLEARBITSFROMISR (98u)
#define apiID_XEVENTGROUPSETBITS (99u)
#define apiID_XEVENTGROUPSETBITSFROMISR (100u)
#define apiID_XEVENTGROUPSYNC (101u)
#define apiID_XEVENTGROUPGETBITSFROMISR (102u)
#define apiID_VEVENTGROUPDELETE (103u)
#define apiID_UXEVENTGROUPGETNUMBER (104u)
#define apiID_XSTREAMBUFFERCREATE (105u)
#define apiID_VSTREAMBUFFERDELETE (106u)
#define apiID_XSTREAMBUFFERRESET (107u)
#define apiID_XSTREAMBUFFERSEND (108u)
#define apiID_XSTREAMBUFFERSENDFROMISR (109u)
#define apiID_XSTREAMBUFFERRECEIVE (110u)
#define apiID_XSTREAMBUFFERRECEIVEFROMISR (111u)
#define traceTASK_NOTIFY_TAKE() SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET + apiID_ULTASKNOTIFYTAKE, xClearCountOnExit, xTicksToWait)
#define traceTASK_DELAY() SEGGER_SYSVIEW_RecordU32 (apiID_OFFSET + apiID_VTASKDELAY, xTicksToDelay)
#define traceTASK_DELAY_UNTIL(xTimeToWake) SEGGER_SYSVIEW_RecordVoid (apiID_OFFSET + apiID_VTASKDELAYUNTIL)
#define traceTASK_NOTIFY_GIVE_FROM_ISR() SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET + apiID_VTASKNOTIFYGIVEFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxTCB), (U32)pxHigherPriorityTaskWoken)
#define traceTASK_PRIORITY_INHERIT( pxTCB, uxPriority ) SEGGER_SYSVIEW_RecordU32 (apiID_OFFSET + apiID_VTASKPRIORITYINHERIT, (U32)pxMutexHolder)
#define traceTASK_RESUME( pxTCB ) SEGGER_SYSVIEW_RecordU32 (apiID_OFFSET + apiID_VTASKRESUME, SEGGER_SYSVIEW_ShrinkId((U32)pxTCB))
#define traceINCREASE_TICK_COUNT( xTicksToJump ) SEGGER_SYSVIEW_RecordU32 (apiID_OFFSET + apiID_VTASKSTEPTICK, xTicksToJump)
#define traceTASK_SUSPEND( pxTCB ) SEGGER_SYSVIEW_RecordU32 (apiID_OFFSET + apiID_VTASKSUSPEND, SEGGER_SYSVIEW_ShrinkId((U32)pxTCB))
#define traceTASK_PRIORITY_DISINHERIT( pxTCB, uxBasePriority ) SEGGER_SYSVIEW_RecordU32 (apiID_OFFSET + apiID_XTASKPRIORITYDISINHERIT, (U32)pxMutexHolder)
#define traceTASK_RESUME_FROM_ISR( pxTCB ) SEGGER_SYSVIEW_RecordU32 (apiID_OFFSET + apiID_XTASKRESUMEFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxTCB))
#define traceTASK_NOTIFY() SEGGER_SYSVIEW_RecordU32x4(apiID_OFFSET + apiID_XTASKGENERICNOTIFY, SEGGER_SYSVIEW_ShrinkId((U32)pxTCB), ulValue, eAction, (U32)pulPreviousNotificationValue)
#define traceTASK_NOTIFY_FROM_ISR() SEGGER_SYSVIEW_RecordU32x5(apiID_OFFSET + apiID_XTASKGENERICNOTIFYFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxTCB), ulValue, eAction, (U32)pulPreviousNotificationValue, (U32)pxHigherPriorityTaskWoken)
#define traceTASK_NOTIFY_WAIT() SEGGER_SYSVIEW_RecordU32x4(apiID_OFFSET + apiID_XTASKNOTIFYWAIT, ulBitsToClearOnEntry, ulBitsToClearOnExit, (U32)pulNotificationValue, xTicksToWait)
#define traceQUEUE_CREATE( pxNewQueue ) SEGGER_SYSVIEW_RecordU32x3(apiID_OFFSET + apiID_XQUEUEGENERICCREATE, uxQueueLength, uxItemSize, ucQueueType)
#define traceQUEUE_DELETE( pxQueue ) SEGGER_SYSVIEW_RecordU32 (apiID_OFFSET + apiID_VQUEUEDELETE, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue))
#define traceQUEUE_PEEK( pxQueue ) SEGGER_SYSVIEW_RecordU32x4(apiID_OFFSET + apiID_XQUEUEGENERICRECEIVE, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), SEGGER_SYSVIEW_ShrinkId((U32)pvBuffer), xTicksToWait, 1)
#define traceQUEUE_PEEK_FROM_ISR( pxQueue ) SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET + apiID_XQUEUEPEEKFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), SEGGER_SYSVIEW_ShrinkId((U32)pvBuffer))
#define traceQUEUE_PEEK_FROM_ISR_FAILED( pxQueue ) SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET + apiID_XQUEUEPEEKFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), SEGGER_SYSVIEW_ShrinkId((U32)pvBuffer))
#define traceQUEUE_RECEIVE( pxQueue ) SEGGER_SYSVIEW_RecordU32x4(apiID_OFFSET + apiID_XQUEUEGENERICRECEIVE, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), SEGGER_SYSVIEW_ShrinkId((U32)0), xTicksToWait, 1)
#define traceQUEUE_RECEIVE_FAILED( pxQueue ) SEGGER_SYSVIEW_RecordU32x4(apiID_OFFSET + apiID_XQUEUEGENERICRECEIVE, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), SEGGER_SYSVIEW_ShrinkId((U32)0), xTicksToWait, 1)
#define traceQUEUE_SEMAPHORE_RECEIVE( pxQueue ) SEGGER_SYSVIEW_RecordU32x4(apiID_OFFSET + apiID_XQUEUEGENERICRECEIVE, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), SEGGER_SYSVIEW_ShrinkId((U32)0), xTicksToWait, 0)
#define traceQUEUE_RECEIVE_FROM_ISR( pxQueue ) SEGGER_SYSVIEW_RecordU32x3(apiID_OFFSET + apiID_XQUEUERECEIVEFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), SEGGER_SYSVIEW_ShrinkId((U32)pvBuffer), (U32)pxHigherPriorityTaskWoken)
#define traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue ) SEGGER_SYSVIEW_RecordU32x3(apiID_OFFSET + apiID_XQUEUERECEIVEFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), SEGGER_SYSVIEW_ShrinkId((U32)pvBuffer), (U32)pxHigherPriorityTaskWoken)
#define traceQUEUE_REGISTRY_ADD( xQueue, pcQueueName ) SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET + apiID_VQUEUEADDTOREGISTRY, SEGGER_SYSVIEW_ShrinkId((U32)xQueue), (U32)pcQueueName)
#if ( configUSE_QUEUE_SETS != 1 )
#define traceQUEUE_SEND( pxQueue ) SEGGER_SYSVIEW_RecordU32x4(apiID_OFFSET + apiID_XQUEUEGENERICSEND, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), (U32)pvItemToQueue, xTicksToWait, xCopyPosition)
#else
#define traceQUEUE_SEND( pxQueue ) SEGGER_SYSVIEW_RecordU32x4(apiID_OFFSET + apiID_XQUEUEGENERICSEND, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), 0u, 0u, xCopyPosition)
#endif
#define traceQUEUE_SEND_FAILED( pxQueue ) SEGGER_SYSVIEW_RecordU32x4(apiID_OFFSET + apiID_XQUEUEGENERICSEND, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), (U32)pvItemToQueue, xTicksToWait, xCopyPosition)
#define traceQUEUE_SEND_FROM_ISR( pxQueue ) SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET + apiID_XQUEUEGENERICSENDFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), (U32)pxHigherPriorityTaskWoken)
#define traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue ) SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET + apiID_XQUEUEGENERICSENDFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), (U32)pxHigherPriorityTaskWoken)
#define traceSTREAM_BUFFER_CREATE( pxStreamBuffer, xIsMessageBuffer ) SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET + apiID_XSTREAMBUFFERCREATE, (U32)xIsMessageBuffer, (U32)pxStreamBuffer)
#define traceSTREAM_BUFFER_CREATE_FAILED( xIsMessageBuffer ) SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET + apiID_XSTREAMBUFFERCREATE, (U32)xIsMessageBuffer, 0u)
#define traceSTREAM_BUFFER_DELETE( xStreamBuffer ) SEGGER_SYSVIEW_RecordU32 (apiID_OFFSET + apiID_VSTREAMBUFFERDELETE, (U32)xStreamBuffer)
#define traceSTREAM_BUFFER_RESET( xStreamBuffer ) SEGGER_SYSVIEW_RecordU32 (apiID_OFFSET + apiID_XSTREAMBUFFERRESET, (U32)xStreamBuffer)
#define traceSTREAM_BUFFER_SEND( xStreamBuffer, xBytesSent ) SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET + apiID_XSTREAMBUFFERSEND, (U32)xStreamBuffer, (U32)xBytesSent)
#define traceSTREAM_BUFFER_SEND_FAILED( xStreamBuffer ) SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET + apiID_XSTREAMBUFFERSEND, (U32)xStreamBuffer, 0u)
#define traceSTREAM_BUFFER_SEND_FROM_ISR( xStreamBuffer, xBytesSent ) SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET + apiID_XSTREAMBUFFERSENDFROMISR, (U32)xStreamBuffer, (U32)xBytesSent)
#define traceSTREAM_BUFFER_RECEIVE( xStreamBuffer, xReceivedLength ) SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET + apiID_XSTREAMBUFFERRECEIVE, (U32)xStreamBuffer, (U32)xReceivedLength)
#define traceSTREAM_BUFFER_RECEIVE_FAILED( xStreamBuffer ) SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET + apiID_XSTREAMBUFFERRECEIVE, (U32)xStreamBuffer, 0u)
#define traceSTREAM_BUFFER_RECEIVE_FROM_ISR( xStreamBuffer, xReceivedLength ) SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET + apiID_XSTREAMBUFFERRECEIVEFROMISR, (U32)xStreamBuffer, (U32)xReceivedLength)
#define traceTASK_DELETE( pxTCB ) { \
SEGGER_SYSVIEW_RecordU32(apiID_OFFSET + apiID_VTASKDELETE, SEGGER_SYSVIEW_ShrinkId((U32)pxTCB)); \
SYSVIEW_DeleteTask((U32)pxTCB); \
}
#if( portSTACK_GROWTH < 0 )
#define traceTASK_CREATE(pxNewTCB) if (pxNewTCB != NULL) { \
SEGGER_SYSVIEW_OnTaskCreate((U32)pxNewTCB); \
SYSVIEW_AddTask((U32)pxNewTCB, \
&(pxNewTCB->pcTaskName[0]), \
pxNewTCB->uxPriority, \
(U32)pxNewTCB->pxStack, \
((U32)pxNewTCB->pxTopOfStack - (U32)pxNewTCB->pxStack) \
); \
}
#else
#define traceTASK_CREATE(pxNewTCB) if (pxNewTCB != NULL) { \
SEGGER_SYSVIEW_OnTaskCreate((U32)pxNewTCB); \
SYSVIEW_AddTask((U32)pxNewTCB, \
&(pxNewTCB->pcTaskName[0]), \
pxNewTCB->uxPriority, \
(U32)pxNewTCB->pxStack, \
(U32)(pxNewTCB->pxStack-pxNewTCB->pxTopOfStack) \
); \
}
#endif
#define traceTASK_PRIORITY_SET(pxTask, uxNewPriority) { \
SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET+apiID_VTASKPRIORITYSET, \
SEGGER_SYSVIEW_ShrinkId((U32)pxTCB), \
uxNewPriority \
); \
SYSVIEW_UpdateTask((U32)pxTask, \
&(pxTask->pcTaskName[0]), \
uxNewPriority, \
(U32)pxTask->pxStack, \
0 \
); \
}
//
// Define INCLUDE_xTaskGetIdleTaskHandle as 1 in FreeRTOSConfig.h to allow identification of Idle state.
//
#if ( INCLUDE_xTaskGetIdleTaskHandle == 1 )
#define traceTASK_SWITCHED_IN() if(prvGetTCBFromHandle(NULL) == xIdleTaskHandle) { \
SEGGER_SYSVIEW_OnIdle(); \
} else { \
SEGGER_SYSVIEW_OnTaskStartExec((U32)pxCurrentTCB); \
}
#else
#define traceTASK_SWITCHED_IN() { \
if (memcmp(pxCurrentTCB->pcTaskName, "IDLE", 5) != 0) { \
SEGGER_SYSVIEW_OnTaskStartExec((U32)pxCurrentTCB); \
} else { \
SEGGER_SYSVIEW_OnIdle(); \
} \
}
#endif
#define traceMOVED_TASK_TO_READY_STATE(pxTCB) SEGGER_SYSVIEW_OnTaskStartReady((U32)pxTCB)
#define traceREADDED_TASK_TO_READY_STATE(pxTCB)
#define traceMOVED_TASK_TO_DELAYED_LIST() SEGGER_SYSVIEW_OnTaskStopReady((U32)pxCurrentTCB, (1u << 2))
#define traceMOVED_TASK_TO_OVERFLOW_DELAYED_LIST() SEGGER_SYSVIEW_OnTaskStopReady((U32)pxCurrentTCB, (1u << 2))
#define traceMOVED_TASK_TO_SUSPENDED_LIST(pxTCB) SEGGER_SYSVIEW_OnTaskStopReady((U32)pxTCB, ((3u << 3) | 3))
#define traceISR_EXIT_TO_SCHEDULER() SEGGER_SYSVIEW_RecordExitISRToScheduler()
#define traceISR_EXIT() SEGGER_SYSVIEW_RecordExitISR()
#define traceISR_ENTER() SEGGER_SYSVIEW_RecordEnterISR()
/*********************************************************************
*
* API functions
*
**********************************************************************
*/
#ifdef __cplusplus
extern "C" {
#endif
void SYSVIEW_AddTask (U32 xHandle, const char* pcTaskName, unsigned uxCurrentPriority, U32 pxStack, unsigned uStackHighWaterMark);
void SYSVIEW_UpdateTask (U32 xHandle, const char* pcTaskName, unsigned uxCurrentPriority, U32 pxStack, unsigned uStackHighWaterMark);
void SYSVIEW_DeleteTask (U32 xHandle);
void SYSVIEW_SendTaskInfo (U32 TaskID, const char* sName, unsigned Prio, U32 StackBase, unsigned StackSize);
#ifdef __cplusplus
}
#endif
#endif
/*************************** End of file ****************************/

View File

@ -0,0 +1,104 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_Config_FreeRTOS.c
Purpose : Sample setup configuration of SystemView with FreeRTOS.
Revision: $Rev: 18540 $
*/
#include "FreeRTOS.h"
#include "SEGGER_SYSVIEW.h"
extern const SEGGER_SYSVIEW_OS_API SYSVIEW_X_OS_TraceAPI;
/*********************************************************************
*
* Defines, configurable
*
**********************************************************************
*/
// The application name to be displayed in SystemViewer
#define SYSVIEW_APP_NAME "FreeRTOS Demo Application"
// The target device name
#define SYSVIEW_DEVICE_NAME "Cortex-M4"
// Frequency of the timestamp. Must match SEGGER_SYSVIEW_GET_TIMESTAMP in SEGGER_SYSVIEW_Conf.h
#define SYSVIEW_TIMESTAMP_FREQ (configCPU_CLOCK_HZ)
// System Frequency. SystemcoreClock is used in most CMSIS compatible projects.
#define SYSVIEW_CPU_FREQ configCPU_CLOCK_HZ
// The lowest RAM address used for IDs (pointers)
#define SYSVIEW_RAM_BASE (0x10000000)
/*********************************************************************
*
* _cbSendSystemDesc()
*
* Function description
* Sends SystemView description strings.
*/
static void _cbSendSystemDesc(void) {
SEGGER_SYSVIEW_SendSysDesc("N="SYSVIEW_APP_NAME",D="SYSVIEW_DEVICE_NAME",O=FreeRTOS");
SEGGER_SYSVIEW_SendSysDesc("I#15=SysTick");
}
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
void SEGGER_SYSVIEW_Conf(void) {
SEGGER_SYSVIEW_Init(SYSVIEW_TIMESTAMP_FREQ, SYSVIEW_CPU_FREQ,
&SYSVIEW_X_OS_TraceAPI, _cbSendSystemDesc);
SEGGER_SYSVIEW_SetRAMBase(SYSVIEW_RAM_BASE);
}
/*************************** End of file ****************************/

View File

@ -0,0 +1,252 @@
diff -rupN ./Source_org/include/FreeRTOS.h ./Source_new/include/FreeRTOS.h
--- ./Source_org/include/FreeRTOS.h 2015-10-16 15:12:58.000000000 +0200
+++ ./Source_new/include/FreeRTOS.h 2015-11-13 18:08:30.000000000 +0100
@@ -203,6 +203,10 @@ extern "C" {
#define INCLUDE_uxTaskGetStackHighWaterMark 0
#endif
+#ifndef INCLUDE_pxTaskGetStackStart
+ #define INCLUDE_pxTaskGetStackStart 0
+#endif
+
#ifndef INCLUDE_eTaskGetState
#define INCLUDE_eTaskGetState 0
#endif
@@ -405,6 +409,22 @@ extern "C" {
#define traceMOVED_TASK_TO_READY_STATE( pxTCB )
#endif
+#ifndef traceREADDED_TASK_TO_READY_STATE
+ #define traceREADDED_TASK_TO_READY_STATE( pxTCB ) traceMOVED_TASK_TO_READY_STATE( pxTCB )
+#endif
+
+#ifndef traceMOVED_TASK_TO_DELAYED_LIST
+ #define traceMOVED_TASK_TO_DELAYED_LIST()
+#endif
+
+#ifndef traceMOVED_TASK_TO_OVERFLOW_DELAYED_LIST
+ #define traceMOVED_TASK_TO_OVERFLOW_DELAYED_LIST()
+#endif
+
+#ifndef traceMOVED_TASK_TO_SUSPENDED_LIST
+ #define traceMOVED_TASK_TO_SUSPENDED_LIST( pxTCB )
+#endif
+
#ifndef traceQUEUE_CREATE
#define traceQUEUE_CREATE( pxNewQueue )
#endif
@@ -645,6 +665,19 @@ extern "C" {
#define traceTASK_NOTIFY_GIVE_FROM_ISR()
#endif
+#ifndef traceISR_EXIT_TO_SCHEDULER
+ #define traceISR_EXIT_TO_SCHEDULER()
+#endif
+
+#ifndef traceISR_EXIT
+ #define traceISR_EXIT()
+#endif
+
+#ifndef traceISR_ENTER
+ #define traceISR_ENTER()
+#endif
+
+
#ifndef configGENERATE_RUN_TIME_STATS
#define configGENERATE_RUN_TIME_STATS 0
#endif
diff -rupN ./Source_org/include/task.h ./Source_new/include/task.h
--- ./Source_org/include/task.h 2015-10-17 19:12:22.000000000 +0200
+++ ./Source_new/include/task.h 2015-11-13 18:08:30.000000000 +0100
@@ -1131,6 +1131,25 @@ char *pcTaskGetTaskName( TaskHandle_t xT
*/
UBaseType_t uxTaskGetStackHighWaterMark( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
+/**
+ * task.h
+ * <PRE>uint8_t* pxTaskGetStackStart( TaskHandle_t xTask);</PRE>
+ *
+ * INCLUDE_pxTaskGetStackStart must be set to 1 in FreeRTOSConfig.h for
+ * this function to be available.
+ *
+ * Returns the start of the stack associated with xTask. That is,
+ * the highest stack memory address on architectures where the stack grows down
+ * from high memory, and the lowest memory address on architectures where the
+ * stack grows up from low memory.
+ *
+ * @param xTask Handle of the task associated with the stack returned.
+ * Set xTask to NULL to return the stack of the calling task.
+ *
+ * @return A pointer to the start of the stack.
+ */
+uint8_t* pxTaskGetStackStart( TaskHandle_t xTask) PRIVILEGED_FUNCTION;
+
/* When using trace macros it is sometimes necessary to include task.h before
FreeRTOS.h. When this is done TaskHookFunction_t will not yet have been defined,
so the following two prototypes will cause a compilation error. This can be
diff -rupN ./Source_org/portable/GCC/ARM_CM4F/port.c ./Source_new/portable/GCC/ARM_CM4F/port.c
--- ./Source_org/portable/GCC/ARM_CM4F/port.c 2015-10-16 15:12:58.000000000 +0200
+++ ./Source_new/portable/GCC/ARM_CM4F/port.c 2015-11-12 10:35:25.000000000 +0100
@@ -493,14 +493,20 @@ void xPortSysTickHandler( void )
save and then restore the interrupt mask value as its value is already
known. */
( void ) portSET_INTERRUPT_MASK_FROM_ISR();
+ traceISR_ENTER();
{
/* Increment the RTOS tick. */
if( xTaskIncrementTick() != pdFALSE )
{
+ traceISR_EXIT_TO_SCHEDULER();
/* A context switch is required. Context switching is performed in
the PendSV interrupt. Pend the PendSV interrupt. */
portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT;
}
+ else
+ {
+ traceISR_EXIT();
+ }
}
portCLEAR_INTERRUPT_MASK_FROM_ISR( 0 );
}
diff -rupN ./Source_org/portable/GCC/ARM_CM4F/portmacro.h ./Source_new/portable/GCC/ARM_CM4F/portmacro.h
--- ./Source_org/portable/GCC/ARM_CM4F/portmacro.h 2015-10-16 15:12:58.000000000 +0200
+++ ./Source_new/portable/GCC/ARM_CM4F/portmacro.h 2015-11-11 18:49:58.000000000 +0100
@@ -131,7 +131,7 @@ typedef unsigned long UBaseType_t;
#define portNVIC_INT_CTRL_REG ( * ( ( volatile uint32_t * ) 0xe000ed04 ) )
#define portNVIC_PENDSVSET_BIT ( 1UL << 28UL )
-#define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired != pdFALSE ) portYIELD()
+#define portEND_SWITCHING_ISR( xSwitchRequired ) { if( xSwitchRequired != pdFALSE ) { traceISR_EXIT_TO_SCHEDULER(); portYIELD(); } else { traceISR_EXIT(); } }
#define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
/*-----------------------------------------------------------*/
diff -rupN ./Source_org/tasks.c ./Source_new/tasks.c
--- ./Source_org/tasks.c 2015-10-16 15:12:59.000000000 +0200
+++ ./Source_new/tasks.c 2015-11-13 18:14:04.000000000 +0100
@@ -390,6 +390,16 @@ count overflows. */
traceMOVED_TASK_TO_READY_STATE( pxTCB ); \
taskRECORD_READY_PRIORITY( ( pxTCB )->uxPriority ); \
vListInsertEnd( &( pxReadyTasksLists[ ( pxTCB )->uxPriority ] ), &( ( pxTCB )->xGenericListItem ) )
+
+/*
+ * Place the task represented by pxTCB which has been in a ready list before
+ * into the appropriate ready list for the task.
+ * It is inserted at the end of the list.
+ */
+#define prvReaddTaskToReadyList( pxTCB ) \
+ traceREADDED_TASK_TO_READY_STATE( pxTCB ); \
+ taskRECORD_READY_PRIORITY( ( pxTCB )->uxPriority ); \
+ vListInsertEnd( &( pxReadyTasksLists[ ( pxTCB )->uxPriority ] ), &( ( pxTCB )->xGenericListItem ) )
/*-----------------------------------------------------------*/
/*
@@ -1252,7 +1262,7 @@ StackType_t *pxTopOfStack;
{
mtCOVERAGE_TEST_MARKER();
}
- prvAddTaskToReadyList( pxTCB );
+ prvReaddTaskToReadyList( pxTCB );
}
else
{
@@ -1313,7 +1323,7 @@ StackType_t *pxTopOfStack;
{
mtCOVERAGE_TEST_MARKER();
}
-
+ traceMOVED_TASK_TO_SUSPENDED_LIST(pxTCB);
vListInsertEnd( &xSuspendedTaskList, &( pxTCB->xGenericListItem ) );
}
taskEXIT_CRITICAL();
@@ -2295,6 +2305,7 @@ TickType_t xTimeToWake;
/* Add the task to the suspended task list instead of a delayed task
list to ensure the task is not woken by a timing event. It will
block indefinitely. */
+ traceMOVED_TASK_TO_SUSPENDED_LIST(pxCurrentTCB);
vListInsertEnd( &xSuspendedTaskList, &( pxCurrentTCB->xGenericListItem ) );
}
else
@@ -2361,6 +2372,7 @@ TickType_t xTimeToWake;
/* Add the task to the suspended task list instead of a delayed task
list to ensure it is not woken by a timing event. It will block
indefinitely. */
+ traceMOVED_TASK_TO_SUSPENDED_LIST(pxCurrentTCB);
vListInsertEnd( &xSuspendedTaskList, &( pxCurrentTCB->xGenericListItem ) );
}
else
@@ -2432,6 +2444,7 @@ TickType_t xTimeToWake;
/* Add the task to the suspended task list instead of a delayed
task list to ensure the task is not woken by a timing event. It
will block indefinitely. */
+ traceMOVED_TASK_TO_SUSPENDED_LIST(pxCurrentTCB);
vListInsertEnd( &xSuspendedTaskList, &( pxCurrentTCB->xGenericListItem ) );
}
else
@@ -3075,11 +3088,13 @@ static void prvAddCurrentTaskToDelayedLi
if( xTimeToWake < xTickCount )
{
+ traceMOVED_TASK_TO_OVERFLOW_DELAYED_LIST();
/* Wake time has overflowed. Place this item in the overflow list. */
vListInsert( pxOverflowDelayedTaskList, &( pxCurrentTCB->xGenericListItem ) );
}
else
{
+ traceMOVED_TASK_TO_DELAYED_LIST();
/* The wake time has not overflowed, so the current block list is used. */
vListInsert( pxDelayedTaskList, &( pxCurrentTCB->xGenericListItem ) );
@@ -3306,6 +3321,19 @@ TCB_t *pxNewTCB;
#endif /* INCLUDE_uxTaskGetStackHighWaterMark */
/*-----------------------------------------------------------*/
+#if (INCLUDE_pxTaskGetStackStart == 1)
+ uint8_t* pxTaskGetStackStart( TaskHandle_t xTask)
+ {
+ TCB_t *pxTCB;
+ UBaseType_t uxReturn;
+
+ pxTCB = prvGetTCBFromHandle( xTask );
+ return ( uint8_t * ) pxTCB->pxStack;
+ }
+
+#endif /* INCLUDE_pxTaskGetStackStart */
+/*-----------------------------------------------------------*/
+
#if ( INCLUDE_vTaskDelete == 1 )
static void prvDeleteTCB( TCB_t *pxTCB )
@@ -3455,7 +3483,7 @@ TCB_t *pxTCB;
/* Inherit the priority before being moved into the new list. */
pxTCB->uxPriority = pxCurrentTCB->uxPriority;
- prvAddTaskToReadyList( pxTCB );
+ prvReaddTaskToReadyList( pxTCB );
}
else
{
@@ -3527,7 +3555,7 @@ TCB_t *pxTCB;
any other purpose if this task is running, and it must be
running to give back the mutex. */
listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), ( TickType_t ) configMAX_PRIORITIES - ( TickType_t ) pxTCB->uxPriority ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */
- prvAddTaskToReadyList( pxTCB );
+ prvReaddTaskToReadyList( pxTCB );
/* Return true to indicate that a context switch is required.
This is only actually required in the corner case whereby
@@ -3935,6 +3963,7 @@ TickType_t uxReturn;
of a delayed task list to ensure the task is not
woken by a timing event. It will block
indefinitely. */
+ traceMOVED_TASK_TO_SUSPENDED_LIST(pxCurrentTCB);
vListInsertEnd( &xSuspendedTaskList, &( pxCurrentTCB->xGenericListItem ) );
}
else
@@ -4053,6 +4082,7 @@ TickType_t uxReturn;
of a delayed task list to ensure the task is not
woken by a timing event. It will block
indefinitely. */
+ traceMOVED_TASK_TO_SUSPENDED_LIST(pxCurrentTCB);
vListInsertEnd( &xSuspendedTaskList, &( pxCurrentTCB->xGenericListItem ) );
}
else

View File

@ -0,0 +1,293 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_FreeRTOS.c
Purpose : Interface between FreeRTOS and SystemView.
Revision: $Rev: 9599 $
*/
#include "FreeRTOS.h"
#include "task.h"
#include "SEGGER_SYSVIEW.h"
#include "SEGGER_SYSVIEW_FreeRTOS.h"
#include "string.h" // Required for memset
typedef struct SYSVIEW_FREERTOS_TASK_STATUS SYSVIEW_FREERTOS_TASK_STATUS;
struct SYSVIEW_FREERTOS_TASK_STATUS {
U32 xHandle;
const char* pcTaskName;
unsigned uxCurrentPriority;
U32 pxStack;
unsigned uStackHighWaterMark;
};
static SYSVIEW_FREERTOS_TASK_STATUS _aTasks[SYSVIEW_FREERTOS_MAX_NOF_TASKS];
static unsigned _NumTasks;
/*********************************************************************
*
* _cbSendTaskList()
*
* Function description
* This function is part of the link between FreeRTOS and SYSVIEW.
* Called from SystemView when asked by the host, it uses SYSVIEW
* functions to send the entire task list to the host.
*/
static void _cbSendTaskList(void) {
unsigned n;
for (n = 0; n < _NumTasks; n++) {
#if INCLUDE_uxTaskGetStackHighWaterMark // Report Task Stack High Watermark
_aTasks[n].uStackHighWaterMark = uxTaskGetStackHighWaterMark((TaskHandle_t)_aTasks[n].xHandle);
#endif
SYSVIEW_SendTaskInfo((U32)_aTasks[n].xHandle, _aTasks[n].pcTaskName, (unsigned)_aTasks[n].uxCurrentPriority, (U32)_aTasks[n].pxStack, (unsigned)_aTasks[n].uStackHighWaterMark);
}
}
/*********************************************************************
*
* _cbGetTime()
*
* Function description
* This function is part of the link between FreeRTOS and SYSVIEW.
* Called from SystemView when asked by the host, returns the
* current system time in micro seconds.
*/
static U64 _cbGetTime(void) {
U64 Time;
Time = xTaskGetTickCountFromISR();
Time *= portTICK_PERIOD_MS;
Time *= 1000;
return Time;
}
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
/*********************************************************************
*
* SYSVIEW_AddTask()
*
* Function description
* Add a task to the internal list and record its information.
*/
void SYSVIEW_AddTask(U32 xHandle, const char* pcTaskName, unsigned uxCurrentPriority, U32 pxStack, unsigned uStackHighWaterMark) {
if (memcmp(pcTaskName, "IDLE", 5) == 0) {
return;
}
if (_NumTasks >= SYSVIEW_FREERTOS_MAX_NOF_TASKS) {
SEGGER_SYSVIEW_Warn("SYSTEMVIEW: Could not record task information. Maximum number of tasks reached.");
return;
}
_aTasks[_NumTasks].xHandle = xHandle;
_aTasks[_NumTasks].pcTaskName = pcTaskName;
_aTasks[_NumTasks].uxCurrentPriority = uxCurrentPriority;
_aTasks[_NumTasks].pxStack = pxStack;
_aTasks[_NumTasks].uStackHighWaterMark = uStackHighWaterMark;
_NumTasks++;
SYSVIEW_SendTaskInfo(xHandle, pcTaskName,uxCurrentPriority, pxStack, uStackHighWaterMark);
}
/*********************************************************************
*
* SYSVIEW_UpdateTask()
*
* Function description
* Update a task in the internal list and record its information.
*/
void SYSVIEW_UpdateTask(U32 xHandle, const char* pcTaskName, unsigned uxCurrentPriority, U32 pxStack, unsigned uStackHighWaterMark) {
unsigned n;
if (memcmp(pcTaskName, "IDLE", 5) == 0) {
return;
}
for (n = 0; n < _NumTasks; n++) {
if (_aTasks[n].xHandle == xHandle) {
break;
}
}
if (n < _NumTasks) {
_aTasks[n].pcTaskName = pcTaskName;
_aTasks[n].uxCurrentPriority = uxCurrentPriority;
_aTasks[n].pxStack = pxStack;
_aTasks[n].uStackHighWaterMark = uStackHighWaterMark;
SYSVIEW_SendTaskInfo(xHandle, pcTaskName, uxCurrentPriority, pxStack, uStackHighWaterMark);
} else {
SYSVIEW_AddTask(xHandle, pcTaskName, uxCurrentPriority, pxStack, uStackHighWaterMark);
}
}
/*********************************************************************
*
* SYSVIEW_DeleteTask()
*
* Function description
* Delete a task from the internal list.
*/
void SYSVIEW_DeleteTask(U32 xHandle) {
unsigned n;
if (_NumTasks == 0) {
return; // Early out
}
for (n = 0; n < _NumTasks; n++) {
if (_aTasks[n].xHandle == xHandle) {
break;
}
}
if (n == (_NumTasks - 1)) {
//
// Task is last item in list.
// Simply zero the item and decrement number of tasks.
//
memset(&_aTasks[n], 0, sizeof(_aTasks[n]));
_NumTasks--;
} else if (n < _NumTasks) {
//
// Task is in the middle of the list.
// Move last item to current position and decrement number of tasks.
// Order of tasks does not really matter, so no need to move all following items.
//
_aTasks[n].xHandle = _aTasks[_NumTasks - 1].xHandle;
_aTasks[n].pcTaskName = _aTasks[_NumTasks - 1].pcTaskName;
_aTasks[n].uxCurrentPriority = _aTasks[_NumTasks - 1].uxCurrentPriority;
_aTasks[n].pxStack = _aTasks[_NumTasks - 1].pxStack;
_aTasks[n].uStackHighWaterMark = _aTasks[_NumTasks - 1].uStackHighWaterMark;
memset(&_aTasks[_NumTasks - 1], 0, sizeof(_aTasks[_NumTasks - 1]));
_NumTasks--;
}
}
/*********************************************************************
*
* SYSVIEW_SendTaskInfo()
*
* Function description
* Record task information.
*/
void SYSVIEW_SendTaskInfo(U32 TaskID, const char* sName, unsigned Prio, U32 StackBase, unsigned StackSize) {
SEGGER_SYSVIEW_TASKINFO TaskInfo;
memset(&TaskInfo, 0, sizeof(TaskInfo)); // Fill all elements with 0 to allow extending the structure in future version without breaking the code
TaskInfo.TaskID = TaskID;
TaskInfo.sName = sName;
TaskInfo.Prio = Prio;
TaskInfo.StackBase = StackBase;
TaskInfo.StackSize = StackSize;
SEGGER_SYSVIEW_SendTaskInfo(&TaskInfo);
}
/*********************************************************************
*
* SYSVIEW_RecordU32x4()
*
* Function description
* Record an event with 4 parameters
*/
void SYSVIEW_RecordU32x4(unsigned Id, U32 Para0, U32 Para1, U32 Para2, U32 Para3) {
U8 aPacket[SEGGER_SYSVIEW_INFO_SIZE + 4 * SEGGER_SYSVIEW_QUANTA_U32];
U8* pPayload;
//
pPayload = SEGGER_SYSVIEW_PREPARE_PACKET(aPacket); // Prepare the packet for SystemView
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para0); // Add the first parameter to the packet
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para1); // Add the second parameter to the packet
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para2); // Add the third parameter to the packet
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para3); // Add the fourth parameter to the packet
//
SEGGER_SYSVIEW_SendPacket(&aPacket[0], pPayload, Id); // Send the packet
}
/*********************************************************************
*
* SYSVIEW_RecordU32x5()
*
* Function description
* Record an event with 5 parameters
*/
void SYSVIEW_RecordU32x5(unsigned Id, U32 Para0, U32 Para1, U32 Para2, U32 Para3, U32 Para4) {
U8 aPacket[SEGGER_SYSVIEW_INFO_SIZE + 5 * SEGGER_SYSVIEW_QUANTA_U32];
U8* pPayload;
//
pPayload = SEGGER_SYSVIEW_PREPARE_PACKET(aPacket); // Prepare the packet for SystemView
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para0); // Add the first parameter to the packet
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para1); // Add the second parameter to the packet
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para2); // Add the third parameter to the packet
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para3); // Add the fourth parameter to the packet
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para4); // Add the fifth parameter to the packet
//
SEGGER_SYSVIEW_SendPacket(&aPacket[0], pPayload, Id); // Send the packet
}
/*********************************************************************
*
* Public API structures
*
**********************************************************************
*/
// Callbacks provided to SYSTEMVIEW by FreeRTOS
const SEGGER_SYSVIEW_OS_API SYSVIEW_X_OS_TraceAPI = {
_cbGetTime,
_cbSendTaskList,
};
/*************************** End of file ****************************/

View File

@ -0,0 +1,313 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_FreeRTOS.h
Purpose : Interface between FreeRTOS and SystemView.
Revision: $Rev: 9599 $
Notes:
(1) Include this file at the end of FreeRTOSConfig.h
*/
#ifndef SYSVIEW_FREERTOS_H
#define SYSVIEW_FREERTOS_H
#include "SEGGER_SYSVIEW.h"
/*********************************************************************
*
* Defines, configurable
*
**********************************************************************
*/
#ifndef portSTACK_GROWTH
#define portSTACK_GROWTH ( -1 )
#endif
#define SYSVIEW_FREERTOS_MAX_NOF_TASKS 8
/*********************************************************************
*
* Defines, fixed
*
**********************************************************************
*/
#define apiID_OFFSET (32u)
#define apiID_VTASKALLOCATEMPUREGIONS (1u)
#define apiID_VTASKDELETE (2u)
#define apiID_VTASKDELAY (3u)
#define apiID_VTASKDELAYUNTIL (4u)
#define apiID_UXTASKPRIORITYGET (5u)
#define apiID_UXTASKPRIORITYGETFROMISR (6u)
#define apiID_ETASKGETSTATE (7u)
#define apiID_VTASKPRIORITYSET (8u)
#define apiID_VTASKSUSPEND (9u)
#define apiID_VTASKRESUME (10u)
#define apiID_XTASKRESUMEFROMISR (11u)
#define apiID_VTASKSTARTSCHEDULER (12u)
#define apiID_VTASKENDSCHEDULER (13u)
#define apiID_VTASKSUSPENDALL (14u)
#define apiID_XTASKRESUMEALL (15u)
#define apiID_XTASKGETTICKCOUNT (16u)
#define apiID_XTASKGETTICKCOUNTFROMISR (17u)
#define apiID_UXTASKGETNUMBEROFTASKS (18u)
#define apiID_PCTASKGETTASKNAME (19u)
#define apiID_UXTASKGETSTACKHIGHWATERMARK (20u)
#define apiID_VTASKSETAPPLICATIONTASKTAG (21u)
#define apiID_XTASKGETAPPLICATIONTASKTAG (22u)
#define apiID_VTASKSETTHREADLOCALSTORAGEPOINTER (23u)
#define apiID_PVTASKGETTHREADLOCALSTORAGEPOINTER (24u)
#define apiID_XTASKCALLAPPLICATIONTASKHOOK (25u)
#define apiID_XTASKGETIDLETASKHANDLE (26u)
#define apiID_UXTASKGETSYSTEMSTATE (27u)
#define apiID_VTASKLIST (28u)
#define apiID_VTASKGETRUNTIMESTATS (29u)
#define apiID_XTASKGENERICNOTIFY (30u)
#define apiID_XTASKGENERICNOTIFYFROMISR (31u)
#define apiID_XTASKNOTIFYWAIT (32u)
#define apiID_VTASKNOTIFYGIVEFROMISR (33u)
#define apiID_ULTASKNOTIFYTAKE (34u)
#define apiID_XTASKNOTIFYSTATECLEAR (35u)
#define apiID_XTASKGETCURRENTTASKHANDLE (36u)
#define apiID_VTASKSETTIMEOUTSTATE (37u)
#define apiID_XTASKCHECKFORTIMEOUT (38u)
#define apiID_VTASKMISSEDYIELD (39u)
#define apiID_XTASKGETSCHEDULERSTATE (40u)
#define apiID_VTASKPRIORITYINHERIT (41u)
#define apiID_XTASKPRIORITYDISINHERIT (42u)
#define apiID_XTASKGENERICCREATE (43u)
#define apiID_UXTASKGETTASKNUMBER (44u)
#define apiID_VTASKSETTASKNUMBER (45u)
#define apiID_VTASKSTEPTICK (46u)
#define apiID_ETASKCONFIRMSLEEPMODESTATUS (47u)
#define apiID_XTIMERCREATE (48u)
#define apiID_PVTIMERGETTIMERID (49u)
#define apiID_VTIMERSETTIMERID (50u)
#define apiID_XTIMERISTIMERACTIVE (51u)
#define apiID_XTIMERGETTIMERDAEMONTASKHANDLE (52u)
#define apiID_XTIMERPENDFUNCTIONCALLFROMISR (53u)
#define apiID_XTIMERPENDFUNCTIONCALL (54u)
#define apiID_PCTIMERGETTIMERNAME (55u)
#define apiID_XTIMERCREATETIMERTASK (56u)
#define apiID_XTIMERGENERICCOMMAND (57u)
#define apiID_XQUEUEGENERICSEND (58u)
#define apiID_XQUEUEPEEKFROMISR (59u)
#define apiID_XQUEUEGENERICRECEIVE (60u)
#define apiID_UXQUEUEMESSAGESWAITING (61u)
#define apiID_UXQUEUESPACESAVAILABLE (62u)
#define apiID_VQUEUEDELETE (63u)
#define apiID_XQUEUEGENERICSENDFROMISR (64u)
#define apiID_XQUEUEGIVEFROMISR (65u)
#define apiID_XQUEUERECEIVEFROMISR (66u)
#define apiID_XQUEUEISQUEUEEMPTYFROMISR (67u)
#define apiID_XQUEUEISQUEUEFULLFROMISR (68u)
#define apiID_UXQUEUEMESSAGESWAITINGFROMISR (69u)
#define apiID_XQUEUEALTGENERICSEND (70u)
#define apiID_XQUEUEALTGENERICRECEIVE (71u)
#define apiID_XQUEUECRSENDFROMISR (72u)
#define apiID_XQUEUECRRECEIVEFROMISR (73u)
#define apiID_XQUEUECRSEND (74u)
#define apiID_XQUEUECRRECEIVE (75u)
#define apiID_XQUEUECREATEMUTEX (76u)
#define apiID_XQUEUECREATECOUNTINGSEMAPHORE (77u)
#define apiID_XQUEUEGETMUTEXHOLDER (78u)
#define apiID_XQUEUETAKEMUTEXRECURSIVE (79u)
#define apiID_XQUEUEGIVEMUTEXRECURSIVE (80u)
#define apiID_VQUEUEADDTOREGISTRY (81u)
#define apiID_VQUEUEUNREGISTERQUEUE (82u)
#define apiID_XQUEUEGENERICCREATE (83u)
#define apiID_XQUEUECREATESET (84u)
#define apiID_XQUEUEADDTOSET (85u)
#define apiID_XQUEUEREMOVEFROMSET (86u)
#define apiID_XQUEUESELECTFROMSET (87u)
#define apiID_XQUEUESELECTFROMSETFROMISR (88u)
#define apiID_XQUEUEGENERICRESET (89u)
#define apiID_VLISTINITIALISE (90u)
#define apiID_VLISTINITIALISEITEM (91u)
#define apiID_VLISTINSERT (92u)
#define apiID_VLISTINSERTEND (93u)
#define apiID_UXLISTREMOVE (94u)
#define apiID_XEVENTGROUPCREATE (95u)
#define apiID_XEVENTGROUPWAITBITS (96u)
#define apiID_XEVENTGROUPCLEARBITS (97u)
#define apiID_XEVENTGROUPCLEARBITSFROMISR (98u)
#define apiID_XEVENTGROUPSETBITS (99u)
#define apiID_XEVENTGROUPSETBITSFROMISR (100u)
#define apiID_XEVENTGROUPSYNC (101u)
#define apiID_XEVENTGROUPGETBITSFROMISR (102u)
#define apiID_VEVENTGROUPDELETE (103u)
#define apiID_UXEVENTGROUPGETNUMBER (104u)
#define traceTASK_NOTIFY_TAKE() SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET + apiID_ULTASKNOTIFYTAKE, xClearCountOnExit, xTicksToWait)
#define traceTASK_DELAY() SEGGER_SYSVIEW_RecordU32(apiID_OFFSET + apiID_VTASKDELAY, xTicksToDelay)
#define traceTASK_DELAY_UNTIL() SEGGER_SYSVIEW_RecordVoid(apiID_OFFSET + apiID_VTASKDELAYUNTIL)
#define traceTASK_NOTIFY_GIVE_FROM_ISR() SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET + apiID_VTASKNOTIFYGIVEFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxTCB), (U32)pxHigherPriorityTaskWoken)
#define traceTASK_PRIORITY_INHERIT( pxTCB, uxPriority ) SEGGER_SYSVIEW_RecordU32(apiID_OFFSET + apiID_VTASKPRIORITYINHERIT, (U32)pxMutexHolder)
#define traceTASK_RESUME( pxTCB ) SEGGER_SYSVIEW_RecordU32(apiID_OFFSET + apiID_VTASKRESUME, SEGGER_SYSVIEW_ShrinkId((U32)pxTCB))
#define traceINCREASE_TICK_COUNT( xTicksToJump ) SEGGER_SYSVIEW_RecordU32(apiID_OFFSET + apiID_VTASKSTEPTICK, xTicksToJump)
#define traceTASK_SUSPEND( pxTCB ) SEGGER_SYSVIEW_RecordU32(apiID_OFFSET + apiID_VTASKSUSPEND, SEGGER_SYSVIEW_ShrinkId((U32)pxTCB))
#define traceTASK_PRIORITY_DISINHERIT( pxTCB, uxBasePriority ) SEGGER_SYSVIEW_RecordU32(apiID_OFFSET + apiID_XTASKPRIORITYDISINHERIT, (U32)pxMutexHolder)
#define traceTASK_RESUME_FROM_ISR( pxTCB ) SEGGER_SYSVIEW_RecordU32(apiID_OFFSET + apiID_XTASKRESUMEFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxTCB))
#define traceTASK_NOTIFY() SYSVIEW_RecordU32x4(apiID_OFFSET + apiID_XTASKGENERICNOTIFY, SEGGER_SYSVIEW_ShrinkId((U32)pxTCB), ulValue, eAction, (U32)pulPreviousNotificationValue)
#define traceTASK_NOTIFY_FROM_ISR() SYSVIEW_RecordU32x5(apiID_OFFSET + apiID_XTASKGENERICNOTIFYFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxTCB), ulValue, eAction, (U32)pulPreviousNotificationValue, (U32)pxHigherPriorityTaskWoken)
#define traceTASK_NOTIFY_WAIT() SYSVIEW_RecordU32x4(apiID_OFFSET + apiID_XTASKNOTIFYWAIT, ulBitsToClearOnEntry, ulBitsToClearOnExit, (U32)pulNotificationValue, xTicksToWait)
#define traceQUEUE_CREATE( pxNewQueue ) SEGGER_SYSVIEW_RecordU32x3(apiID_OFFSET + apiID_XQUEUEGENERICCREATE, uxQueueLength, uxItemSize, ucQueueType)
#define traceQUEUE_DELETE( pxQueue ) SEGGER_SYSVIEW_RecordU32(apiID_OFFSET + apiID_VQUEUEDELETE, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue))
#define traceQUEUE_PEEK( pxQueue ) SYSVIEW_RecordU32x4(apiID_OFFSET + apiID_XQUEUEGENERICRECEIVE, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), SEGGER_SYSVIEW_ShrinkId((U32)pvBuffer), xTicksToWait, xJustPeeking)
#define traceQUEUE_PEEK_FROM_ISR( pxQueue ) SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET + apiID_XQUEUEPEEKFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), SEGGER_SYSVIEW_ShrinkId((U32)pvBuffer))
#define traceQUEUE_PEEK_FROM_ISR_FAILED( pxQueue ) SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET + apiID_XQUEUEPEEKFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), SEGGER_SYSVIEW_ShrinkId((U32)pvBuffer))
#define traceQUEUE_RECEIVE( pxQueue ) SYSVIEW_RecordU32x4(apiID_OFFSET + apiID_XQUEUEGENERICRECEIVE, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), SEGGER_SYSVIEW_ShrinkId((U32)pvBuffer), xTicksToWait, xJustPeeking)
#define traceQUEUE_RECEIVE_FAILED( pxQueue ) SYSVIEW_RecordU32x4(apiID_OFFSET + apiID_XQUEUEGENERICRECEIVE, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), SEGGER_SYSVIEW_ShrinkId((U32)pvBuffer), xTicksToWait, xJustPeeking)
#define traceQUEUE_RECEIVE_FROM_ISR( pxQueue ) SEGGER_SYSVIEW_RecordU32x3(apiID_OFFSET + apiID_XQUEUERECEIVEFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), SEGGER_SYSVIEW_ShrinkId((U32)pvBuffer), (U32)pxHigherPriorityTaskWoken)
#define traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue ) SEGGER_SYSVIEW_RecordU32x3(apiID_OFFSET + apiID_XQUEUERECEIVEFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), SEGGER_SYSVIEW_ShrinkId((U32)pvBuffer), (U32)pxHigherPriorityTaskWoken)
#define traceQUEUE_REGISTRY_ADD( xQueue, pcQueueName ) SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET + apiID_VQUEUEADDTOREGISTRY, SEGGER_SYSVIEW_ShrinkId((U32)xQueue), (U32)pcQueueName)
#if ( configUSE_QUEUE_SETS != 1 )
#define traceQUEUE_SEND( pxQueue ) SYSVIEW_RecordU32x4(apiID_OFFSET + apiID_XQUEUEGENERICSEND, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), (U32)pvItemToQueue, xTicksToWait, xCopyPosition)
#else
#define traceQUEUE_SEND( pxQueue ) SYSVIEW_RecordU32x4(apiID_OFFSET + apiID_XQUEUEGENERICSEND, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), 0, 0, xCopyPosition)
#endif
#define traceQUEUE_SEND_FAILED( pxQueue ) SYSVIEW_RecordU32x4(apiID_OFFSET + apiID_XQUEUEGENERICSEND, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), (U32)pvItemToQueue, xTicksToWait, xCopyPosition)
#define traceQUEUE_SEND_FROM_ISR( pxQueue ) SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET + apiID_XQUEUEGENERICSENDFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), (U32)pxHigherPriorityTaskWoken)
#define traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue ) SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET + apiID_XQUEUEGENERICSENDFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), (U32)pxHigherPriorityTaskWoken)
#define traceTASK_DELETE( pxTCB ) { \
SEGGER_SYSVIEW_RecordU32(apiID_OFFSET + apiID_VTASKDELETE, SEGGER_SYSVIEW_ShrinkId((U32)pxTCB)); \
SYSVIEW_DeleteTask((U32)pxTCB); \
}
#if( portSTACK_GROWTH < 0 )
#define traceTASK_CREATE(pxNewTCB) if (pxNewTCB != NULL) { \
SEGGER_SYSVIEW_OnTaskCreate((U32)pxNewTCB); \
SYSVIEW_AddTask((U32)pxNewTCB, \
&(pxNewTCB->pcTaskName[0]), \
pxNewTCB->uxPriority, \
(U32)pxNewTCB->pxStack, \
((U32)pxNewTCB->pxTopOfStack - (U32)pxNewTCB->pxStack) \
); \
}
#else
#define traceTASK_CREATE(pxNewTCB) if (pxNewTCB != NULL) { \
SEGGER_SYSVIEW_OnTaskCreate((U32)pxNewTCB); \
SYSVIEW_AddTask((U32)pxNewTCB, \
&(pxNewTCB->pcTaskName[0]), \
pxNewTCB->uxPriority, \
(U32)pxNewTCB->pxStack, \
(U32)(pxNewTCB->pxStack-pxNewTCB->pxTopOfStack) \
); \
}
#endif
#define traceTASK_PRIORITY_SET(pxTask, uxNewPriority) { \
SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET+apiID_VTASKPRIORITYSET, \
SEGGER_SYSVIEW_ShrinkId((U32)pxTCB), \
uxNewPriority \
); \
SYSVIEW_UpdateTask((U32)pxTask, \
&(pxTask->pcTaskName[0]), \
uxNewPriority, \
(U32)pxTask->pxStack, \
0 \
); \
}
//
// Define INCLUDE_xTaskGetIdleTaskHandle as 1 in FreeRTOSConfig.h to allow identification of Idle state.
//
#if ( INCLUDE_xTaskGetIdleTaskHandle == 1 )
#define traceTASK_SWITCHED_IN() if(prvGetTCBFromHandle(NULL) == xIdleTaskHandle) { \
SEGGER_SYSVIEW_OnIdle(); \
} else { \
SEGGER_SYSVIEW_OnTaskStartExec((U32)pxCurrentTCB); \
}
#else
#define traceTASK_SWITCHED_IN() { \
if (memcmp(pxCurrentTCB->pcTaskName, "IDLE", 5) != 0) { \
SEGGER_SYSVIEW_OnTaskStartExec((U32)pxCurrentTCB); \
} else { \
SEGGER_SYSVIEW_OnIdle(); \
} \
}
#endif
#define traceMOVED_TASK_TO_READY_STATE(pxTCB) SEGGER_SYSVIEW_OnTaskStartReady((U32)pxTCB)
#define traceREADDED_TASK_TO_READY_STATE(pxTCB)
#define traceMOVED_TASK_TO_DELAYED_LIST() SEGGER_SYSVIEW_OnTaskStopReady((U32)pxCurrentTCB, (1u << 2))
#define traceMOVED_TASK_TO_OVERFLOW_DELAYED_LIST() SEGGER_SYSVIEW_OnTaskStopReady((U32)pxCurrentTCB, (1u << 2))
#define traceMOVED_TASK_TO_SUSPENDED_LIST(pxTCB) SEGGER_SYSVIEW_OnTaskStopReady((U32)pxTCB, ((3u << 3) | 3))
#define traceISR_EXIT_TO_SCHEDULER() SEGGER_SYSVIEW_RecordExitISRToScheduler()
#define traceISR_EXIT() SEGGER_SYSVIEW_RecordExitISR()
#define traceISR_ENTER() SEGGER_SYSVIEW_RecordEnterISR()
/*********************************************************************
*
* API functions
*
**********************************************************************
*/
#ifdef __cplusplus
extern "C" {
#endif
void SYSVIEW_AddTask (U32 xHandle, const char* pcTaskName, unsigned uxCurrentPriority, U32 pxStack, unsigned uStackHighWaterMark);
void SYSVIEW_UpdateTask (U32 xHandle, const char* pcTaskName, unsigned uxCurrentPriority, U32 pxStack, unsigned uStackHighWaterMark);
void SYSVIEW_DeleteTask (U32 xHandle);
void SYSVIEW_SendTaskInfo (U32 TaskID, const char* sName, unsigned Prio, U32 StackBase, unsigned StackSize);
void SYSVIEW_RecordU32x4 (unsigned Id, U32 Para0, U32 Para1, U32 Para2, U32 Para3);
void SYSVIEW_RecordU32x5 (unsigned Id, U32 Para0, U32 Para1, U32 Para2, U32 Para3, U32 Para4);
#ifdef __cplusplus
}
#endif
#endif
/*************************** End of file ****************************/

View File

@ -0,0 +1,104 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_Config_FreeRTOS.c
Purpose : Sample setup configuration of SystemView with FreeRTOS.
Revision: $Rev: 7745 $
*/
#include "FreeRTOS.h"
#include "SEGGER_SYSVIEW.h"
extern const SEGGER_SYSVIEW_OS_API SYSVIEW_X_OS_TraceAPI;
/*********************************************************************
*
* Defines, configurable
*
**********************************************************************
*/
// The application name to be displayed in SystemViewer
#define SYSVIEW_APP_NAME "FreeRTOS Demo Application"
// The target device name
#define SYSVIEW_DEVICE_NAME "Cortex-M4"
// Frequency of the timestamp. Must match SEGGER_SYSVIEW_GET_TIMESTAMP in SEGGER_SYSVIEW_Conf.h
#define SYSVIEW_TIMESTAMP_FREQ (configCPU_CLOCK_HZ)
// System Frequency. SystemcoreClock is used in most CMSIS compatible projects.
#define SYSVIEW_CPU_FREQ configCPU_CLOCK_HZ
// The lowest RAM address used for IDs (pointers)
#define SYSVIEW_RAM_BASE (0x10000000)
/*********************************************************************
*
* _cbSendSystemDesc()
*
* Function description
* Sends SystemView description strings.
*/
static void _cbSendSystemDesc(void) {
SEGGER_SYSVIEW_SendSysDesc("N="SYSVIEW_APP_NAME",D="SYSVIEW_DEVICE_NAME",O=FreeRTOS");
SEGGER_SYSVIEW_SendSysDesc("I#15=SysTick");
}
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
void SEGGER_SYSVIEW_Conf(void) {
SEGGER_SYSVIEW_Init(SYSVIEW_TIMESTAMP_FREQ, SYSVIEW_CPU_FREQ,
&SYSVIEW_X_OS_TraceAPI, _cbSendSystemDesc);
SEGGER_SYSVIEW_SetRAMBase(SYSVIEW_RAM_BASE);
}
/*************************** End of file ****************************/

View File

@ -0,0 +1,296 @@
From 37806244da7d4f4fe26bf966cf9ad3f479be931d Mon Sep 17 00:00:00 2001
From: Maxime Vincent <maxime.vince@gmail.com>
Date: Tue, 18 Apr 2017 15:55:05 +0200
Subject: [PATCH] Patch FreeRTOS 9 for Segger SystemView
---
libs/FreeRTOS/include/FreeRTOS.h | 33 ++++++++++++++++++++++
libs/FreeRTOS/include/task.h | 19 +++++++++++++
libs/FreeRTOS/portable/GCC/ARM_CM0/port.c | 6 ++++
libs/FreeRTOS/portable/GCC/ARM_CM0/portmacro.h | 2 +-
libs/FreeRTOS/portable/GCC/ARM_CM4F/port.c | 6 ++++
libs/FreeRTOS/portable/GCC/ARM_CM4F/portmacro.h | 2 +-
libs/FreeRTOS/tasks.c | 37 +++++++++++++++++++++++--
7 files changed, 100 insertions(+), 5 deletions(-)
diff --git a/libs/FreeRTOS/include/FreeRTOS.h b/libs/FreeRTOS/include/FreeRTOS.h
index 08a6be4..b10b407 100644
--- a/libs/FreeRTOS/include/FreeRTOS.h
+++ b/libs/FreeRTOS/include/FreeRTOS.h
@@ -198,6 +198,10 @@ extern "C" {
#define INCLUDE_uxTaskGetStackHighWaterMark 0
#endif
+#ifndef INCLUDE_pxTaskGetStackStart
+ #define INCLUDE_pxTaskGetStackStart 0
+#endif
+
#ifndef INCLUDE_eTaskGetState
#define INCLUDE_eTaskGetState 0
#endif
@@ -418,6 +422,22 @@ extern "C" {
#define tracePOST_MOVED_TASK_TO_READY_STATE( pxTCB )
#endif
+#ifndef traceREADDED_TASK_TO_READY_STATE
+ #define traceREADDED_TASK_TO_READY_STATE( pxTCB ) traceMOVED_TASK_TO_READY_STATE( pxTCB )
+#endif
+
+#ifndef traceMOVED_TASK_TO_DELAYED_LIST
+ #define traceMOVED_TASK_TO_DELAYED_LIST()
+#endif
+
+#ifndef traceMOVED_TASK_TO_OVERFLOW_DELAYED_LIST
+ #define traceMOVED_TASK_TO_OVERFLOW_DELAYED_LIST()
+#endif
+
+#ifndef traceMOVED_TASK_TO_SUSPENDED_LIST
+ #define traceMOVED_TASK_TO_SUSPENDED_LIST( pxTCB )
+#endif
+
#ifndef traceQUEUE_CREATE
#define traceQUEUE_CREATE( pxNewQueue )
#endif
@@ -658,6 +678,19 @@ extern "C" {
#define traceTASK_NOTIFY_GIVE_FROM_ISR()
#endif
+#ifndef traceISR_EXIT_TO_SCHEDULER
+ #define traceISR_EXIT_TO_SCHEDULER()
+#endif
+
+#ifndef traceISR_EXIT
+ #define traceISR_EXIT()
+#endif
+
+#ifndef traceISR_ENTER
+ #define traceISR_ENTER()
+#endif
+
+
#ifndef configGENERATE_RUN_TIME_STATS
#define configGENERATE_RUN_TIME_STATS 0
#endif
diff --git a/libs/FreeRTOS/include/task.h b/libs/FreeRTOS/include/task.h
index 5e409c8..f9e24dd 100644
--- a/libs/FreeRTOS/include/task.h
+++ b/libs/FreeRTOS/include/task.h
@@ -1367,6 +1367,25 @@ TaskHandle_t xTaskGetHandle( const char *pcNameToQuery ) PRIVILEGED_FUNCTION; /*
*/
UBaseType_t uxTaskGetStackHighWaterMark( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
+/**
+ * task.h
+ * <PRE>uint8_t* pxTaskGetStackStart( TaskHandle_t xTask);</PRE>
+ *
+ * INCLUDE_pxTaskGetStackStart must be set to 1 in FreeRTOSConfig.h for
+ * this function to be available.
+ *
+ * Returns the start of the stack associated with xTask. That is,
+ * the highest stack memory address on architectures where the stack grows down
+ * from high memory, and the lowest memory address on architectures where the
+ * stack grows up from low memory.
+ *
+ * @param xTask Handle of the task associated with the stack returned.
+ * Set xTask to NULL to return the stack of the calling task.
+ *
+ * @return A pointer to the start of the stack.
+ */
+uint8_t* pxTaskGetStackStart( TaskHandle_t xTask) PRIVILEGED_FUNCTION;
+
/* When using trace macros it is sometimes necessary to include task.h before
FreeRTOS.h. When this is done TaskHookFunction_t will not yet have been defined,
so the following two prototypes will cause a compilation error. This can be
diff --git a/libs/FreeRTOS/portable/GCC/ARM_CM0/port.c b/libs/FreeRTOS/portable/GCC/ARM_CM0/port.c
index 191d19c..dffbfb5 100644
--- a/libs/FreeRTOS/portable/GCC/ARM_CM0/port.c
+++ b/libs/FreeRTOS/portable/GCC/ARM_CM0/port.c
@@ -345,13 +345,19 @@ void xPortSysTickHandler( void )
uint32_t ulPreviousMask;
ulPreviousMask = portSET_INTERRUPT_MASK_FROM_ISR();
+ traceISR_ENTER();
{
/* Increment the RTOS tick. */
if( xTaskIncrementTick() != pdFALSE )
{
+ traceISR_EXIT_TO_SCHEDULER();
/* Pend a context switch. */
*(portNVIC_INT_CTRL) = portNVIC_PENDSVSET;
}
+ else
+ {
+ traceISR_EXIT();
+ }
}
portCLEAR_INTERRUPT_MASK_FROM_ISR( ulPreviousMask );
}
diff --git a/libs/FreeRTOS/portable/GCC/ARM_CM0/portmacro.h b/libs/FreeRTOS/portable/GCC/ARM_CM0/portmacro.h
index c947595..6465ad8 100644
--- a/libs/FreeRTOS/portable/GCC/ARM_CM0/portmacro.h
+++ b/libs/FreeRTOS/portable/GCC/ARM_CM0/portmacro.h
@@ -123,7 +123,7 @@ extern void vPortYield( void );
#define portNVIC_INT_CTRL_REG ( * ( ( volatile uint32_t * ) 0xe000ed04 ) )
#define portNVIC_PENDSVSET_BIT ( 1UL << 28UL )
#define portYIELD() vPortYield()
-#define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired ) portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT
+#define portEND_SWITCHING_ISR( xSwitchRequired ) { if( xSwitchRequired ) { traceISR_EXIT_TO_SCHEDULER(); portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT; } else { traceISR_EXIT(); } }
#define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
/*-----------------------------------------------------------*/
diff --git a/libs/FreeRTOS/portable/GCC/ARM_CM4F/port.c b/libs/FreeRTOS/portable/GCC/ARM_CM4F/port.c
index 42f5b37..6b8483d 100644
--- a/libs/FreeRTOS/portable/GCC/ARM_CM4F/port.c
+++ b/libs/FreeRTOS/portable/GCC/ARM_CM4F/port.c
@@ -497,14 +497,20 @@ void xPortSysTickHandler( void )
save and then restore the interrupt mask value as its value is already
known. */
portDISABLE_INTERRUPTS();
+ traceISR_ENTER();
{
/* Increment the RTOS tick. */
if( xTaskIncrementTick() != pdFALSE )
{
+ traceISR_EXIT_TO_SCHEDULER();
/* A context switch is required. Context switching is performed in
the PendSV interrupt. Pend the PendSV interrupt. */
portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT;
}
+ else
+ {
+ traceISR_EXIT();
+ }
}
portENABLE_INTERRUPTS();
}
diff --git a/libs/FreeRTOS/portable/GCC/ARM_CM4F/portmacro.h b/libs/FreeRTOS/portable/GCC/ARM_CM4F/portmacro.h
index b72042d..1a449e7 100644
--- a/libs/FreeRTOS/portable/GCC/ARM_CM4F/portmacro.h
+++ b/libs/FreeRTOS/portable/GCC/ARM_CM4F/portmacro.h
@@ -131,7 +131,7 @@ typedef unsigned long UBaseType_t;
#define portNVIC_INT_CTRL_REG ( * ( ( volatile uint32_t * ) 0xe000ed04 ) )
#define portNVIC_PENDSVSET_BIT ( 1UL << 28UL )
-#define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired != pdFALSE ) portYIELD()
+#define portEND_SWITCHING_ISR( xSwitchRequired ) { if( xSwitchRequired != pdFALSE ) { traceISR_EXIT_TO_SCHEDULER(); portYIELD(); } else { traceISR_EXIT(); } }
#define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
/*-----------------------------------------------------------*/
diff --git a/libs/FreeRTOS/tasks.c b/libs/FreeRTOS/tasks.c
index 94b1f6d..1631637 100644
--- a/libs/FreeRTOS/tasks.c
+++ b/libs/FreeRTOS/tasks.c
@@ -261,6 +261,17 @@ count overflows. */
taskRECORD_READY_PRIORITY( ( pxTCB )->uxPriority ); \
vListInsertEnd( &( pxReadyTasksLists[ ( pxTCB )->uxPriority ] ), &( ( pxTCB )->xStateListItem ) ); \
tracePOST_MOVED_TASK_TO_READY_STATE( pxTCB )
+
+/*
+ * Place the task represented by pxTCB which has been in a ready list before
+ * into the appropriate ready list for the task.
+ * It is inserted at the end of the list.
+ */
+#define prvReaddTaskToReadyList( pxTCB ) \
+ traceREADDED_TASK_TO_READY_STATE( pxTCB ); \
+ taskRECORD_READY_PRIORITY( ( pxTCB )->uxPriority ); \
+ vListInsertEnd( &( pxReadyTasksLists[ ( pxTCB )->uxPriority ] ), &( ( pxTCB )->xStateListItem ) ); \
+ tracePOST_MOVED_TASK_TO_READY_STATE( pxTCB )
/*-----------------------------------------------------------*/
/*
@@ -1534,7 +1545,7 @@ static void prvAddNewTaskToReadyList( TCB_t *pxNewTCB )
{
mtCOVERAGE_TEST_MARKER();
}
- prvAddTaskToReadyList( pxTCB );
+ prvReaddTaskToReadyList( pxTCB );
}
else
{
@@ -1596,6 +1607,7 @@ static void prvAddNewTaskToReadyList( TCB_t *pxNewTCB )
mtCOVERAGE_TEST_MARKER();
}
+ traceMOVED_TASK_TO_SUSPENDED_LIST(pxTCB);
vListInsertEnd( &xSuspendedTaskList, &( pxTCB->xStateListItem ) );
}
taskEXIT_CRITICAL();
@@ -3576,6 +3588,20 @@ static void prvCheckTasksWaitingTermination( void )
#endif /* INCLUDE_uxTaskGetStackHighWaterMark */
/*-----------------------------------------------------------*/
+#if (INCLUDE_pxTaskGetStackStart == 1)
+ uint8_t* pxTaskGetStackStart( TaskHandle_t xTask)
+ {
+ TCB_t *pxTCB;
+ UBaseType_t uxReturn;
+ (void)uxReturn;
+
+ pxTCB = prvGetTCBFromHandle( xTask );
+ return ( uint8_t * ) pxTCB->pxStack;
+ }
+
+#endif /* INCLUDE_pxTaskGetStackStart */
+/*-----------------------------------------------------------*/
+
#if ( INCLUDE_vTaskDelete == 1 )
static void prvDeleteTCB( TCB_t *pxTCB )
@@ -3743,7 +3769,7 @@ TCB_t *pxTCB;
/* Inherit the priority before being moved into the new list. */
pxTCB->uxPriority = pxCurrentTCB->uxPriority;
- prvAddTaskToReadyList( pxTCB );
+ prvReaddTaskToReadyList( pxTCB );
}
else
{
@@ -3815,7 +3841,7 @@ TCB_t *pxTCB;
any other purpose if this task is running, and it must be
running to give back the mutex. */
listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), ( TickType_t ) configMAX_PRIORITIES - ( TickType_t ) pxTCB->uxPriority ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */
- prvAddTaskToReadyList( pxTCB );
+ prvReaddTaskToReadyList( pxTCB );
/* Return true to indicate that a context switch is required.
This is only actually required in the corner case whereby
@@ -4723,6 +4749,7 @@ const TickType_t xConstTickCount = xTickCount;
/* Add the task to the suspended task list instead of a delayed task
list to ensure it is not woken by a timing event. It will block
indefinitely. */
+ traceMOVED_TASK_TO_SUSPENDED_LIST(pxCurrentTCB);
vListInsertEnd( &xSuspendedTaskList, &( pxCurrentTCB->xStateListItem ) );
}
else
@@ -4737,12 +4764,14 @@ const TickType_t xConstTickCount = xTickCount;
if( xTimeToWake < xConstTickCount )
{
+ traceMOVED_TASK_TO_OVERFLOW_DELAYED_LIST();
/* Wake time has overflowed. Place this item in the overflow
list. */
vListInsert( pxOverflowDelayedTaskList, &( pxCurrentTCB->xStateListItem ) );
}
else
{
+ traceMOVED_TASK_TO_DELAYED_LIST();
/* The wake time has not overflowed, so the current block list
is used. */
vListInsert( pxDelayedTaskList, &( pxCurrentTCB->xStateListItem ) );
@@ -4773,11 +4802,13 @@ const TickType_t xConstTickCount = xTickCount;
if( xTimeToWake < xConstTickCount )
{
+ traceMOVED_TASK_TO_OVERFLOW_DELAYED_LIST();
/* Wake time has overflowed. Place this item in the overflow list. */
vListInsert( pxOverflowDelayedTaskList, &( pxCurrentTCB->xStateListItem ) );
}
else
{
+ traceMOVED_TASK_TO_DELAYED_LIST();
/* The wake time has not overflowed, so the current block list is used. */
vListInsert( pxDelayedTaskList, &( pxCurrentTCB->xStateListItem ) );
--
2.12.2

View File

@ -0,0 +1,293 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_FreeRTOS.c
Purpose : Interface between FreeRTOS and SystemView.
Revision: $Rev: 7947 $
*/
#include "FreeRTOS.h"
#include "task.h"
#include "SEGGER_SYSVIEW.h"
#include "SEGGER_SYSVIEW_FreeRTOS.h"
#include "string.h" // Required for memset
typedef struct SYSVIEW_FREERTOS_TASK_STATUS SYSVIEW_FREERTOS_TASK_STATUS;
struct SYSVIEW_FREERTOS_TASK_STATUS {
U32 xHandle;
const char* pcTaskName;
unsigned uxCurrentPriority;
U32 pxStack;
unsigned uStackHighWaterMark;
};
static SYSVIEW_FREERTOS_TASK_STATUS _aTasks[SYSVIEW_FREERTOS_MAX_NOF_TASKS];
static unsigned _NumTasks;
/*********************************************************************
*
* _cbSendTaskList()
*
* Function description
* This function is part of the link between FreeRTOS and SYSVIEW.
* Called from SystemView when asked by the host, it uses SYSVIEW
* functions to send the entire task list to the host.
*/
static void _cbSendTaskList(void) {
unsigned n;
for (n = 0; n < _NumTasks; n++) {
#if INCLUDE_uxTaskGetStackHighWaterMark // Report Task Stack High Watermark
_aTasks[n].uStackHighWaterMark = uxTaskGetStackHighWaterMark((TaskHandle_t)_aTasks[n].xHandle);
#endif
SYSVIEW_SendTaskInfo((U32)_aTasks[n].xHandle, _aTasks[n].pcTaskName, (unsigned)_aTasks[n].uxCurrentPriority, (U32)_aTasks[n].pxStack, (unsigned)_aTasks[n].uStackHighWaterMark);
}
}
/*********************************************************************
*
* _cbGetTime()
*
* Function description
* This function is part of the link between FreeRTOS and SYSVIEW.
* Called from SystemView when asked by the host, returns the
* current system time in micro seconds.
*/
static U64 _cbGetTime(void) {
U64 Time;
Time = xTaskGetTickCountFromISR();
Time *= portTICK_PERIOD_MS;
Time *= 1000;
return Time;
}
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
/*********************************************************************
*
* SYSVIEW_AddTask()
*
* Function description
* Add a task to the internal list and record its information.
*/
void SYSVIEW_AddTask(U32 xHandle, const char* pcTaskName, unsigned uxCurrentPriority, U32 pxStack, unsigned uStackHighWaterMark) {
if (memcmp(pcTaskName, "IDLE", 5) == 0) {
return;
}
if (_NumTasks >= SYSVIEW_FREERTOS_MAX_NOF_TASKS) {
SEGGER_SYSVIEW_Warn("SYSTEMVIEW: Could not record task information. Maximum number of tasks reached.");
return;
}
_aTasks[_NumTasks].xHandle = xHandle;
_aTasks[_NumTasks].pcTaskName = pcTaskName;
_aTasks[_NumTasks].uxCurrentPriority = uxCurrentPriority;
_aTasks[_NumTasks].pxStack = pxStack;
_aTasks[_NumTasks].uStackHighWaterMark = uStackHighWaterMark;
_NumTasks++;
SYSVIEW_SendTaskInfo(xHandle, pcTaskName,uxCurrentPriority, pxStack, uStackHighWaterMark);
}
/*********************************************************************
*
* SYSVIEW_UpdateTask()
*
* Function description
* Update a task in the internal list and record its information.
*/
void SYSVIEW_UpdateTask(U32 xHandle, const char* pcTaskName, unsigned uxCurrentPriority, U32 pxStack, unsigned uStackHighWaterMark) {
unsigned n;
if (memcmp(pcTaskName, "IDLE", 5) == 0) {
return;
}
for (n = 0; n < _NumTasks; n++) {
if (_aTasks[n].xHandle == xHandle) {
break;
}
}
if (n < _NumTasks) {
_aTasks[n].pcTaskName = pcTaskName;
_aTasks[n].uxCurrentPriority = uxCurrentPriority;
_aTasks[n].pxStack = pxStack;
_aTasks[n].uStackHighWaterMark = uStackHighWaterMark;
SYSVIEW_SendTaskInfo(xHandle, pcTaskName, uxCurrentPriority, pxStack, uStackHighWaterMark);
} else {
SYSVIEW_AddTask(xHandle, pcTaskName, uxCurrentPriority, pxStack, uStackHighWaterMark);
}
}
/*********************************************************************
*
* SYSVIEW_DeleteTask()
*
* Function description
* Delete a task from the internal list.
*/
void SYSVIEW_DeleteTask(U32 xHandle) {
unsigned n;
if (_NumTasks == 0) {
return; // Early out
}
for (n = 0; n < _NumTasks; n++) {
if (_aTasks[n].xHandle == xHandle) {
break;
}
}
if (n == (_NumTasks - 1)) {
//
// Task is last item in list.
// Simply zero the item and decrement number of tasks.
//
memset(&_aTasks[n], 0, sizeof(_aTasks[n]));
_NumTasks--;
} else if (n < _NumTasks) {
//
// Task is in the middle of the list.
// Move last item to current position and decrement number of tasks.
// Order of tasks does not really matter, so no need to move all following items.
//
_aTasks[n].xHandle = _aTasks[_NumTasks - 1].xHandle;
_aTasks[n].pcTaskName = _aTasks[_NumTasks - 1].pcTaskName;
_aTasks[n].uxCurrentPriority = _aTasks[_NumTasks - 1].uxCurrentPriority;
_aTasks[n].pxStack = _aTasks[_NumTasks - 1].pxStack;
_aTasks[n].uStackHighWaterMark = _aTasks[_NumTasks - 1].uStackHighWaterMark;
memset(&_aTasks[_NumTasks - 1], 0, sizeof(_aTasks[_NumTasks - 1]));
_NumTasks--;
}
}
/*********************************************************************
*
* SYSVIEW_SendTaskInfo()
*
* Function description
* Record task information.
*/
void SYSVIEW_SendTaskInfo(U32 TaskID, const char* sName, unsigned Prio, U32 StackBase, unsigned StackSize) {
SEGGER_SYSVIEW_TASKINFO TaskInfo;
memset(&TaskInfo, 0, sizeof(TaskInfo)); // Fill all elements with 0 to allow extending the structure in future version without breaking the code
TaskInfo.TaskID = TaskID;
TaskInfo.sName = sName;
TaskInfo.Prio = Prio;
TaskInfo.StackBase = StackBase;
TaskInfo.StackSize = StackSize;
SEGGER_SYSVIEW_SendTaskInfo(&TaskInfo);
}
/*********************************************************************
*
* SYSVIEW_RecordU32x4()
*
* Function description
* Record an event with 4 parameters
*/
void SYSVIEW_RecordU32x4(unsigned Id, U32 Para0, U32 Para1, U32 Para2, U32 Para3) {
U8 aPacket[SEGGER_SYSVIEW_INFO_SIZE + 4 * SEGGER_SYSVIEW_QUANTA_U32];
U8* pPayload;
//
pPayload = SEGGER_SYSVIEW_PREPARE_PACKET(aPacket); // Prepare the packet for SystemView
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para0); // Add the first parameter to the packet
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para1); // Add the second parameter to the packet
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para2); // Add the third parameter to the packet
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para3); // Add the fourth parameter to the packet
//
SEGGER_SYSVIEW_SendPacket(&aPacket[0], pPayload, Id); // Send the packet
}
/*********************************************************************
*
* SYSVIEW_RecordU32x5()
*
* Function description
* Record an event with 5 parameters
*/
void SYSVIEW_RecordU32x5(unsigned Id, U32 Para0, U32 Para1, U32 Para2, U32 Para3, U32 Para4) {
U8 aPacket[SEGGER_SYSVIEW_INFO_SIZE + 5 * SEGGER_SYSVIEW_QUANTA_U32];
U8* pPayload;
//
pPayload = SEGGER_SYSVIEW_PREPARE_PACKET(aPacket); // Prepare the packet for SystemView
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para0); // Add the first parameter to the packet
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para1); // Add the second parameter to the packet
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para2); // Add the third parameter to the packet
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para3); // Add the fourth parameter to the packet
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para4); // Add the fifth parameter to the packet
//
SEGGER_SYSVIEW_SendPacket(&aPacket[0], pPayload, Id); // Send the packet
}
/*********************************************************************
*
* Public API structures
*
**********************************************************************
*/
// Callbacks provided to SYSTEMVIEW by FreeRTOS
const SEGGER_SYSVIEW_OS_API SYSVIEW_X_OS_TraceAPI = {
_cbGetTime,
_cbSendTaskList,
};
/*************************** End of file ****************************/

View File

@ -0,0 +1,313 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_FreeRTOS.h
Purpose : Interface between FreeRTOS and SystemView.
Revision: $Rev: 7745 $
Notes:
(1) Include this file at the end of FreeRTOSConfig.h
*/
#ifndef SYSVIEW_FREERTOS_H
#define SYSVIEW_FREERTOS_H
#include "SEGGER_SYSVIEW.h"
/*********************************************************************
*
* Defines, configurable
*
**********************************************************************
*/
#ifndef portSTACK_GROWTH
#define portSTACK_GROWTH ( -1 )
#endif
#define SYSVIEW_FREERTOS_MAX_NOF_TASKS 8
/*********************************************************************
*
* Defines, fixed
*
**********************************************************************
*/
#define apiID_OFFSET (32u)
#define apiID_VTASKALLOCATEMPUREGIONS (1u)
#define apiID_VTASKDELETE (2u)
#define apiID_VTASKDELAY (3u)
#define apiID_VTASKDELAYUNTIL (4u)
#define apiID_UXTASKPRIORITYGET (5u)
#define apiID_UXTASKPRIORITYGETFROMISR (6u)
#define apiID_ETASKGETSTATE (7u)
#define apiID_VTASKPRIORITYSET (8u)
#define apiID_VTASKSUSPEND (9u)
#define apiID_VTASKRESUME (10u)
#define apiID_XTASKRESUMEFROMISR (11u)
#define apiID_VTASKSTARTSCHEDULER (12u)
#define apiID_VTASKENDSCHEDULER (13u)
#define apiID_VTASKSUSPENDALL (14u)
#define apiID_XTASKRESUMEALL (15u)
#define apiID_XTASKGETTICKCOUNT (16u)
#define apiID_XTASKGETTICKCOUNTFROMISR (17u)
#define apiID_UXTASKGETNUMBEROFTASKS (18u)
#define apiID_PCTASKGETTASKNAME (19u)
#define apiID_UXTASKGETSTACKHIGHWATERMARK (20u)
#define apiID_VTASKSETAPPLICATIONTASKTAG (21u)
#define apiID_XTASKGETAPPLICATIONTASKTAG (22u)
#define apiID_VTASKSETTHREADLOCALSTORAGEPOINTER (23u)
#define apiID_PVTASKGETTHREADLOCALSTORAGEPOINTER (24u)
#define apiID_XTASKCALLAPPLICATIONTASKHOOK (25u)
#define apiID_XTASKGETIDLETASKHANDLE (26u)
#define apiID_UXTASKGETSYSTEMSTATE (27u)
#define apiID_VTASKLIST (28u)
#define apiID_VTASKGETRUNTIMESTATS (29u)
#define apiID_XTASKGENERICNOTIFY (30u)
#define apiID_XTASKGENERICNOTIFYFROMISR (31u)
#define apiID_XTASKNOTIFYWAIT (32u)
#define apiID_VTASKNOTIFYGIVEFROMISR (33u)
#define apiID_ULTASKNOTIFYTAKE (34u)
#define apiID_XTASKNOTIFYSTATECLEAR (35u)
#define apiID_XTASKGETCURRENTTASKHANDLE (36u)
#define apiID_VTASKSETTIMEOUTSTATE (37u)
#define apiID_XTASKCHECKFORTIMEOUT (38u)
#define apiID_VTASKMISSEDYIELD (39u)
#define apiID_XTASKGETSCHEDULERSTATE (40u)
#define apiID_VTASKPRIORITYINHERIT (41u)
#define apiID_XTASKPRIORITYDISINHERIT (42u)
#define apiID_XTASKGENERICCREATE (43u)
#define apiID_UXTASKGETTASKNUMBER (44u)
#define apiID_VTASKSETTASKNUMBER (45u)
#define apiID_VTASKSTEPTICK (46u)
#define apiID_ETASKCONFIRMSLEEPMODESTATUS (47u)
#define apiID_XTIMERCREATE (48u)
#define apiID_PVTIMERGETTIMERID (49u)
#define apiID_VTIMERSETTIMERID (50u)
#define apiID_XTIMERISTIMERACTIVE (51u)
#define apiID_XTIMERGETTIMERDAEMONTASKHANDLE (52u)
#define apiID_XTIMERPENDFUNCTIONCALLFROMISR (53u)
#define apiID_XTIMERPENDFUNCTIONCALL (54u)
#define apiID_PCTIMERGETTIMERNAME (55u)
#define apiID_XTIMERCREATETIMERTASK (56u)
#define apiID_XTIMERGENERICCOMMAND (57u)
#define apiID_XQUEUEGENERICSEND (58u)
#define apiID_XQUEUEPEEKFROMISR (59u)
#define apiID_XQUEUEGENERICRECEIVE (60u)
#define apiID_UXQUEUEMESSAGESWAITING (61u)
#define apiID_UXQUEUESPACESAVAILABLE (62u)
#define apiID_VQUEUEDELETE (63u)
#define apiID_XQUEUEGENERICSENDFROMISR (64u)
#define apiID_XQUEUEGIVEFROMISR (65u)
#define apiID_XQUEUERECEIVEFROMISR (66u)
#define apiID_XQUEUEISQUEUEEMPTYFROMISR (67u)
#define apiID_XQUEUEISQUEUEFULLFROMISR (68u)
#define apiID_UXQUEUEMESSAGESWAITINGFROMISR (69u)
#define apiID_XQUEUEALTGENERICSEND (70u)
#define apiID_XQUEUEALTGENERICRECEIVE (71u)
#define apiID_XQUEUECRSENDFROMISR (72u)
#define apiID_XQUEUECRRECEIVEFROMISR (73u)
#define apiID_XQUEUECRSEND (74u)
#define apiID_XQUEUECRRECEIVE (75u)
#define apiID_XQUEUECREATEMUTEX (76u)
#define apiID_XQUEUECREATECOUNTINGSEMAPHORE (77u)
#define apiID_XQUEUEGETMUTEXHOLDER (78u)
#define apiID_XQUEUETAKEMUTEXRECURSIVE (79u)
#define apiID_XQUEUEGIVEMUTEXRECURSIVE (80u)
#define apiID_VQUEUEADDTOREGISTRY (81u)
#define apiID_VQUEUEUNREGISTERQUEUE (82u)
#define apiID_XQUEUEGENERICCREATE (83u)
#define apiID_XQUEUECREATESET (84u)
#define apiID_XQUEUEADDTOSET (85u)
#define apiID_XQUEUEREMOVEFROMSET (86u)
#define apiID_XQUEUESELECTFROMSET (87u)
#define apiID_XQUEUESELECTFROMSETFROMISR (88u)
#define apiID_XQUEUEGENERICRESET (89u)
#define apiID_VLISTINITIALISE (90u)
#define apiID_VLISTINITIALISEITEM (91u)
#define apiID_VLISTINSERT (92u)
#define apiID_VLISTINSERTEND (93u)
#define apiID_UXLISTREMOVE (94u)
#define apiID_XEVENTGROUPCREATE (95u)
#define apiID_XEVENTGROUPWAITBITS (96u)
#define apiID_XEVENTGROUPCLEARBITS (97u)
#define apiID_XEVENTGROUPCLEARBITSFROMISR (98u)
#define apiID_XEVENTGROUPSETBITS (99u)
#define apiID_XEVENTGROUPSETBITSFROMISR (100u)
#define apiID_XEVENTGROUPSYNC (101u)
#define apiID_XEVENTGROUPGETBITSFROMISR (102u)
#define apiID_VEVENTGROUPDELETE (103u)
#define apiID_UXEVENTGROUPGETNUMBER (104u)
#define traceTASK_NOTIFY_TAKE() SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET + apiID_ULTASKNOTIFYTAKE, xClearCountOnExit, xTicksToWait)
#define traceTASK_DELAY() SEGGER_SYSVIEW_RecordU32(apiID_OFFSET + apiID_VTASKDELAY, xTicksToDelay)
#define traceTASK_DELAY_UNTIL(xTimeToWake) SEGGER_SYSVIEW_RecordVoid(apiID_OFFSET + apiID_VTASKDELAYUNTIL)
#define traceTASK_NOTIFY_GIVE_FROM_ISR() SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET + apiID_VTASKNOTIFYGIVEFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxTCB), (U32)pxHigherPriorityTaskWoken)
#define traceTASK_PRIORITY_INHERIT( pxTCB, uxPriority ) SEGGER_SYSVIEW_RecordU32(apiID_OFFSET + apiID_VTASKPRIORITYINHERIT, (U32)pxMutexHolder)
#define traceTASK_RESUME( pxTCB ) SEGGER_SYSVIEW_RecordU32(apiID_OFFSET + apiID_VTASKRESUME, SEGGER_SYSVIEW_ShrinkId((U32)pxTCB))
#define traceINCREASE_TICK_COUNT( xTicksToJump ) SEGGER_SYSVIEW_RecordU32(apiID_OFFSET + apiID_VTASKSTEPTICK, xTicksToJump)
#define traceTASK_SUSPEND( pxTCB ) SEGGER_SYSVIEW_RecordU32(apiID_OFFSET + apiID_VTASKSUSPEND, SEGGER_SYSVIEW_ShrinkId((U32)pxTCB))
#define traceTASK_PRIORITY_DISINHERIT( pxTCB, uxBasePriority ) SEGGER_SYSVIEW_RecordU32(apiID_OFFSET + apiID_XTASKPRIORITYDISINHERIT, (U32)pxMutexHolder)
#define traceTASK_RESUME_FROM_ISR( pxTCB ) SEGGER_SYSVIEW_RecordU32(apiID_OFFSET + apiID_XTASKRESUMEFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxTCB))
#define traceTASK_NOTIFY() SYSVIEW_RecordU32x4(apiID_OFFSET + apiID_XTASKGENERICNOTIFY, SEGGER_SYSVIEW_ShrinkId((U32)pxTCB), ulValue, eAction, (U32)pulPreviousNotificationValue)
#define traceTASK_NOTIFY_FROM_ISR() SYSVIEW_RecordU32x5(apiID_OFFSET + apiID_XTASKGENERICNOTIFYFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxTCB), ulValue, eAction, (U32)pulPreviousNotificationValue, (U32)pxHigherPriorityTaskWoken)
#define traceTASK_NOTIFY_WAIT() SYSVIEW_RecordU32x4(apiID_OFFSET + apiID_XTASKNOTIFYWAIT, ulBitsToClearOnEntry, ulBitsToClearOnExit, (U32)pulNotificationValue, xTicksToWait)
#define traceQUEUE_CREATE( pxNewQueue ) SEGGER_SYSVIEW_RecordU32x3(apiID_OFFSET + apiID_XQUEUEGENERICCREATE, uxQueueLength, uxItemSize, ucQueueType)
#define traceQUEUE_DELETE( pxQueue ) SEGGER_SYSVIEW_RecordU32(apiID_OFFSET + apiID_VQUEUEDELETE, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue))
#define traceQUEUE_PEEK( pxQueue ) SYSVIEW_RecordU32x4(apiID_OFFSET + apiID_XQUEUEGENERICRECEIVE, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), SEGGER_SYSVIEW_ShrinkId((U32)pvBuffer), xTicksToWait, xJustPeeking)
#define traceQUEUE_PEEK_FROM_ISR( pxQueue ) SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET + apiID_XQUEUEPEEKFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), SEGGER_SYSVIEW_ShrinkId((U32)pvBuffer))
#define traceQUEUE_PEEK_FROM_ISR_FAILED( pxQueue ) SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET + apiID_XQUEUEPEEKFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), SEGGER_SYSVIEW_ShrinkId((U32)pvBuffer))
#define traceQUEUE_RECEIVE( pxQueue ) SYSVIEW_RecordU32x4(apiID_OFFSET + apiID_XQUEUEGENERICRECEIVE, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), SEGGER_SYSVIEW_ShrinkId((U32)pvBuffer), xTicksToWait, xJustPeeking)
#define traceQUEUE_RECEIVE_FAILED( pxQueue ) SYSVIEW_RecordU32x4(apiID_OFFSET + apiID_XQUEUEGENERICRECEIVE, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), SEGGER_SYSVIEW_ShrinkId((U32)pvBuffer), xTicksToWait, xJustPeeking)
#define traceQUEUE_RECEIVE_FROM_ISR( pxQueue ) SEGGER_SYSVIEW_RecordU32x3(apiID_OFFSET + apiID_XQUEUERECEIVEFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), SEGGER_SYSVIEW_ShrinkId((U32)pvBuffer), (U32)pxHigherPriorityTaskWoken)
#define traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue ) SEGGER_SYSVIEW_RecordU32x3(apiID_OFFSET + apiID_XQUEUERECEIVEFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), SEGGER_SYSVIEW_ShrinkId((U32)pvBuffer), (U32)pxHigherPriorityTaskWoken)
#define traceQUEUE_REGISTRY_ADD( xQueue, pcQueueName ) SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET + apiID_VQUEUEADDTOREGISTRY, SEGGER_SYSVIEW_ShrinkId((U32)xQueue), (U32)pcQueueName)
#if ( configUSE_QUEUE_SETS != 1 )
#define traceQUEUE_SEND( pxQueue ) SYSVIEW_RecordU32x4(apiID_OFFSET + apiID_XQUEUEGENERICSEND, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), (U32)pvItemToQueue, xTicksToWait, xCopyPosition)
#else
#define traceQUEUE_SEND( pxQueue ) SYSVIEW_RecordU32x4(apiID_OFFSET + apiID_XQUEUEGENERICSEND, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), 0, 0, xCopyPosition)
#endif
#define traceQUEUE_SEND_FAILED( pxQueue ) SYSVIEW_RecordU32x4(apiID_OFFSET + apiID_XQUEUEGENERICSEND, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), (U32)pvItemToQueue, xTicksToWait, xCopyPosition)
#define traceQUEUE_SEND_FROM_ISR( pxQueue ) SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET + apiID_XQUEUEGENERICSENDFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), (U32)pxHigherPriorityTaskWoken)
#define traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue ) SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET + apiID_XQUEUEGENERICSENDFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), (U32)pxHigherPriorityTaskWoken)
#define traceTASK_DELETE( pxTCB ) { \
SEGGER_SYSVIEW_RecordU32(apiID_OFFSET + apiID_VTASKDELETE, SEGGER_SYSVIEW_ShrinkId((U32)pxTCB)); \
SYSVIEW_DeleteTask((U32)pxTCB); \
}
#if( portSTACK_GROWTH < 0 )
#define traceTASK_CREATE(pxNewTCB) if (pxNewTCB != NULL) { \
SEGGER_SYSVIEW_OnTaskCreate((U32)pxNewTCB); \
SYSVIEW_AddTask((U32)pxNewTCB, \
&(pxNewTCB->pcTaskName[0]), \
pxNewTCB->uxPriority, \
(U32)pxNewTCB->pxStack, \
((U32)pxNewTCB->pxTopOfStack - (U32)pxNewTCB->pxStack) \
); \
}
#else
#define traceTASK_CREATE(pxNewTCB) if (pxNewTCB != NULL) { \
SEGGER_SYSVIEW_OnTaskCreate((U32)pxNewTCB); \
SYSVIEW_AddTask((U32)pxNewTCB, \
&(pxNewTCB->pcTaskName[0]), \
pxNewTCB->uxPriority, \
(U32)pxNewTCB->pxStack, \
(U32)(pxNewTCB->pxStack-pxNewTCB->pxTopOfStack) \
); \
}
#endif
#define traceTASK_PRIORITY_SET(pxTask, uxNewPriority) { \
SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET+apiID_VTASKPRIORITYSET, \
SEGGER_SYSVIEW_ShrinkId((U32)pxTCB), \
uxNewPriority \
); \
SYSVIEW_UpdateTask((U32)pxTask, \
&(pxTask->pcTaskName[0]), \
uxNewPriority, \
(U32)pxTask->pxStack, \
0 \
); \
}
//
// Define INCLUDE_xTaskGetIdleTaskHandle as 1 in FreeRTOSConfig.h to allow identification of Idle state.
//
#if ( INCLUDE_xTaskGetIdleTaskHandle == 1 )
#define traceTASK_SWITCHED_IN() if(prvGetTCBFromHandle(NULL) == xIdleTaskHandle) { \
SEGGER_SYSVIEW_OnIdle(); \
} else { \
SEGGER_SYSVIEW_OnTaskStartExec((U32)pxCurrentTCB); \
}
#else
#define traceTASK_SWITCHED_IN() { \
if (memcmp(pxCurrentTCB->pcTaskName, "IDLE", 5) != 0) { \
SEGGER_SYSVIEW_OnTaskStartExec((U32)pxCurrentTCB); \
} else { \
SEGGER_SYSVIEW_OnIdle(); \
} \
}
#endif
#define traceMOVED_TASK_TO_READY_STATE(pxTCB) SEGGER_SYSVIEW_OnTaskStartReady((U32)pxTCB)
#define traceREADDED_TASK_TO_READY_STATE(pxTCB)
#define traceMOVED_TASK_TO_DELAYED_LIST() SEGGER_SYSVIEW_OnTaskStopReady((U32)pxCurrentTCB, (1u << 2))
#define traceMOVED_TASK_TO_OVERFLOW_DELAYED_LIST() SEGGER_SYSVIEW_OnTaskStopReady((U32)pxCurrentTCB, (1u << 2))
#define traceMOVED_TASK_TO_SUSPENDED_LIST(pxTCB) SEGGER_SYSVIEW_OnTaskStopReady((U32)pxTCB, ((3u << 3) | 3))
#define traceISR_EXIT_TO_SCHEDULER() SEGGER_SYSVIEW_RecordExitISRToScheduler()
#define traceISR_EXIT() SEGGER_SYSVIEW_RecordExitISR()
#define traceISR_ENTER() SEGGER_SYSVIEW_RecordEnterISR()
/*********************************************************************
*
* API functions
*
**********************************************************************
*/
#ifdef __cplusplus
extern "C" {
#endif
void SYSVIEW_AddTask (U32 xHandle, const char* pcTaskName, unsigned uxCurrentPriority, U32 pxStack, unsigned uStackHighWaterMark);
void SYSVIEW_UpdateTask (U32 xHandle, const char* pcTaskName, unsigned uxCurrentPriority, U32 pxStack, unsigned uStackHighWaterMark);
void SYSVIEW_DeleteTask (U32 xHandle);
void SYSVIEW_SendTaskInfo (U32 TaskID, const char* sName, unsigned Prio, U32 StackBase, unsigned StackSize);
void SYSVIEW_RecordU32x4 (unsigned Id, U32 Para0, U32 Para1, U32 Para2, U32 Para3);
void SYSVIEW_RecordU32x5 (unsigned Id, U32 Para0, U32 Para1, U32 Para2, U32 Para3, U32 Para4);
#ifdef __cplusplus
}
#endif
#endif
/*************************** End of file ****************************/

View File

@ -0,0 +1,116 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_Config_MicriumOSKernel.c
Purpose : Sample setup configuration of SystemView with Micrium
OS Kernel on the Silicon Labs Giant Gecko.
Revision: $Rev: 9599 $
*/
#include "SEGGER_SYSVIEW.h"
#include <rtos/kernel/include/os.h>
#include <rtos/cpu/include/cpu.h>
#if (defined(OS_CFG_TRACE_EN) && (OS_CFG_TRACE_EN > 0u))
extern const SEGGER_SYSVIEW_OS_API SYSVIEW_X_OS_TraceAPI;
RTOS_ERR local_err;
/*********************************************************************
*
* Defines, configurable
*
**********************************************************************
*/
// The application name to be displayed in SystemViewer
#define SYSVIEW_APP_NAME "App Name Here"
// The target device name
#define SYSVIEW_DEVICE_NAME "Dev Name Here"
// Frequency of the timestamp. Must match SEGGER_SYSVIEW_GET_TIMESTAMP in SEGGER_SYSVIEW_Conf.h
#define SYSVIEW_TIMESTAMP_FREQ (CPU_TS_TmrFreqGet(&local_err))
// System Frequency. SystemcoreClock is used in most CMSIS compatible projects.
#define SYSVIEW_CPU_FREQ (CPU_TS_TmrFreqGet(&local_err))
// The lowest RAM address used for IDs (pointers)
#define SYSVIEW_RAM_BASE (0x20000000)
/*********************************************************************
*
* _cbSendSystemDesc()
*
* Function description
* Sends SystemView description strings.
*/
static void _cbSendSystemDesc(void) {
SEGGER_SYSVIEW_SendSysDesc("N="SYSVIEW_APP_NAME",D="SYSVIEW_DEVICE_NAME",O=Micrium OS Kernel");
SEGGER_SYSVIEW_SendSysDesc("I#15=SysTick IRQ");
//
SYSVIEW_SendResourceList();
}
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
void SEGGER_SYSVIEW_Conf(void) {
SEGGER_SYSVIEW_Init(SYSVIEW_TIMESTAMP_FREQ, SYSVIEW_CPU_FREQ,
&SYSVIEW_X_OS_TraceAPI, _cbSendSystemDesc);
SEGGER_SYSVIEW_SetRAMBase(SYSVIEW_RAM_BASE);
}
#endif
/*************************** End of file ****************************/

View File

@ -0,0 +1,83 @@
/*
*********************************************************************************************************
* EXAMPLE CODE
*********************************************************************************************************
* Licensing:
* The licensor of this EXAMPLE CODE is Silicon Laboratories Inc.
*
* Silicon Laboratories Inc. grants you a personal, worldwide, royalty-free, fully paid-up license to
* use, copy, modify and distribute the EXAMPLE CODE software, or portions thereof, in any of your
* products.
*
* Your use of this EXAMPLE CODE is at your own risk. This EXAMPLE CODE does not come with any
* warranties, and the licensor disclaims all implied warranties concerning performance, accuracy,
* non-infringement, merchantability and fitness for your application.
*
* The EXAMPLE CODE is provided "AS IS" and does not come with any support.
*
* You can find user manuals, API references, release notes and more at: https://doc.micrium.com
*
* You can contact us at: https://www.micrium.com
*********************************************************************************************************
*/
/*
*********************************************************************************************************
*
* KERNEL TRACE RECORDER CONFIGURATION
*
* CONFIGURATION TEMPLATE FILE
*
* File : os_cfg_trace.h
*********************************************************************************************************
*/
/*
*********************************************************************************************************
*********************************************************************************************************
* MODULE
*********************************************************************************************************
*********************************************************************************************************
*/
#ifndef _OS_CFG_TRACE_H_
#define _OS_CFG_TRACE_H_
/*
*********************************************************************************************************
*********************************************************************************************************
* INCLUDE FILES
*********************************************************************************************************
*********************************************************************************************************
*/
#include <rtos/common/include/lib_def.h>
/*
*********************************************************************************************************
*********************************************************************************************************
* TRACE RECORDER RESOURCES
*********************************************************************************************************
*********************************************************************************************************
*/
#define OS_CFG_TRACE_MAX_TASK 32
#define OS_CFG_TRACE_MAX_RESOURCES 256
#define OS_CFG_TRACE_API_ENTER_EN DEF_DISABLED
#define OS_CFG_TRACE_API_EXIT_EN DEF_DISABLED
/*
*********************************************************************************************************
*********************************************************************************************************
* MODULE END
*********************************************************************************************************
*********************************************************************************************************
*/
#endif /* End of os_cfg_trace.h module include. */

View File

@ -0,0 +1,346 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_MicriumOSKernel.c
Purpose : Interface between Micrium OS Kernel and SystemView.
*/
#include <rtos/kernel/include/os.h>
#include <rtos/kernel/include/os_trace_events.h>
#ifndef SYSVIEW_MEMSET
#include <string.h>
#define SYSVIEW_MEMSET(p, v, n) memset(p, v, n)
#endif
#ifndef OS_CFG_TRACE_MAX_RESOURCES
#define OS_CFG_TRACE_MAX_RESOURCES 0
#endif
typedef struct SYSVIEW_UCOSIII_TASK_STATUS SYSVIEW_UCOSIII_TASK_STATUS;
struct SYSVIEW_UCOSIII_TASK_STATUS {
U32 TaskID;
const char* NamePtr;
OS_PRIO Prio;
CPU_STK* StkBasePtr;
CPU_STK_SIZE StkSize;
};
typedef struct SYSVIEW_UCOSIII_RESOURCE SYSVIEW_UCOSIII_RESOURCE;
struct SYSVIEW_UCOSIII_RESOURCE {
U32 ResourceId;
const char* sResource;
U32 Registered;
};
static SYSVIEW_UCOSIII_TASK_STATUS _aTasks[OS_CFG_TRACE_MAX_TASK];
static unsigned _NumTasks;
#if OS_CFG_TRACE_MAX_RESOURCES > 0
static SYSVIEW_UCOSIII_RESOURCE _aResources[OS_CFG_TRACE_MAX_RESOURCES];
static unsigned _NumResources;
#endif
/*********************************************************************
*
* _cbSendTaskList()
*
* Function description
* This function is part of the link between FreeRTOS and SYSVIEW.
* Called from SystemView when asked by the host, it uses SYSVIEW
* functions to send the entire task list to the host.
*/
static void _cbSendTaskList(void) {
unsigned n;
for (n = 0; n < _NumTasks; n++) {
SYSVIEW_SendTaskInfo((U32)_aTasks[n].TaskID, _aTasks[n].NamePtr, (unsigned)_aTasks[n].Prio, (U32)_aTasks[n].StkBasePtr, (unsigned)_aTasks[n].StkSize);
}
}
/*********************************************************************
*
* _cbGetTime()
*
* Function description
* This function is part of the link between FreeRTOS and SYSVIEW.
* Called from SystemView when asked by the host, returns the
* current system time in micro seconds.
*/
static U64 _cbGetTime(void) {
RTOS_ERR Err;
OS_TICK Tick;
Tick = OSTimeGet(&Err);
if (RTOS_ERR_CODE_GET(Err) != RTOS_ERR_NONE) {
Tick = 0;
}
return Tick * 1000;
}
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
/*********************************************************************
*
* SYSVIEW_TaskReady()
*
* Function description
* Record when a task is ready for execution.
*/
void SYSVIEW_TaskReady(U32 TaskID) {
if (TaskID != (U32)&OSIdleTaskTCB) {
SEGGER_SYSVIEW_OnTaskStartReady(TaskID);
}
}
/*********************************************************************
*
* SYSVIEW_TaskSwitchedIn()
*
* Function description
* Record when a task starts/continues execution.
* If the idle task continues, record an on idle event.
*/
void SYSVIEW_TaskSwitchedIn(U32 TaskID) {
if (TaskID != (U32)&OSIdleTaskTCB) {
SEGGER_SYSVIEW_OnTaskStartExec(TaskID);
} else {
SEGGER_SYSVIEW_OnIdle();
}
}
/*********************************************************************
*
* SYSVIEW_TaskSuspend()
*
* Function description
* Record when a task is suspended.
*/
void SYSVIEW_TaskSuspend(U32 TaskID) {
if (TaskID != (U32)&OSIdleTaskTCB) {
SEGGER_SYSVIEW_OnTaskStopReady(TaskID, (1u << 2));
}
}
/*********************************************************************
*
* SYSVIEW_AddTask()
*
* Function description
* Add a task to the internal list and record its information.
*/
void SYSVIEW_AddTask(U32 TaskID, const char* NamePtr, OS_PRIO Prio, CPU_STK* StkBasePtr, CPU_STK_SIZE StkSize) {
if (TaskID != (U32)&OSIdleTaskTCB) {
if (_NumTasks >= OS_CFG_TRACE_MAX_TASK) {
SEGGER_SYSVIEW_Warn("SYSTEMVIEW: Could not record task information. Maximum number of tasks reached.");
return;
}
_aTasks[_NumTasks].TaskID = TaskID;
_aTasks[_NumTasks].NamePtr = NamePtr;
_aTasks[_NumTasks].Prio = Prio;
_aTasks[_NumTasks].StkBasePtr = StkBasePtr;
_aTasks[_NumTasks].StkSize = StkSize;
_NumTasks++;
SYSVIEW_SendTaskInfo(TaskID, NamePtr, (unsigned)Prio, (U32)StkBasePtr, (unsigned)StkSize);
}
}
/*********************************************************************
*
* SYSVIEW_UpdateTask()
*
* Function description
* Update a task in the internal list and record its information.
*/
void SYSVIEW_UpdateTask(U32 TaskID, const char* NamePtr, OS_PRIO Prio, CPU_STK* StkBasePtr, CPU_STK_SIZE StkSize) {
unsigned n;
if (TaskID != (U32)&OSIdleTaskTCB) {
for (n = 0; n < _NumTasks; n++) {
if (_aTasks[n].TaskID == TaskID) {
break;
}
}
if (n < _NumTasks) {
_aTasks[n].NamePtr = NamePtr;
_aTasks[n].Prio = Prio;
_aTasks[n].StkBasePtr = StkBasePtr;
_aTasks[n].StkSize = StkSize;
SYSVIEW_SendTaskInfo(TaskID, NamePtr, (unsigned)Prio, (U32)StkBasePtr, (unsigned)StkSize);
} else {
SYSVIEW_AddTask(TaskID, NamePtr, Prio, StkBasePtr, StkSize);
}
}
}
/*********************************************************************
*
* SYSVIEW_SendTaskInfo()
*
* Function description
* Record task information.
*/
void SYSVIEW_SendTaskInfo(U32 TaskID, const char* sName, unsigned Prio, U32 StackBase, unsigned StackSize) {
SEGGER_SYSVIEW_TASKINFO TaskInfo;
//
// Fill all elements with 0 to allow extending the structure in future version without breaking the code
//
SYSVIEW_MEMSET(&TaskInfo, 0, sizeof(TaskInfo));
TaskInfo.TaskID = TaskID;
TaskInfo.sName = sName;
TaskInfo.Prio = Prio;
TaskInfo.StackBase = StackBase;
TaskInfo.StackSize = StackSize;
SEGGER_SYSVIEW_SendTaskInfo(&TaskInfo);
}
/*********************************************************************
*
* SYSVIEW_RecordU32x4()
*
* Function description
* Record an event with 4 parameters
*/
void SYSVIEW_RecordU32x4(unsigned Id, U32 Para0, U32 Para1, U32 Para2, U32 Para3) {
U8 aPacket[SEGGER_SYSVIEW_INFO_SIZE + 4 * SEGGER_SYSVIEW_QUANTA_U32];
U8* pPayload;
//
pPayload = SEGGER_SYSVIEW_PREPARE_PACKET(aPacket); // Prepare the packet for SystemView
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para0); // Add the first parameter to the packet
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para1); // Add the second parameter to the packet
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para2); // Add the third parameter to the packet
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para3); // Add the fourth parameter to the packet
//
SEGGER_SYSVIEW_SendPacket(&aPacket[0], pPayload, Id); // Send the packet
}
/*********************************************************************
*
* SYSVIEW_RecordU32x5()
*
* Function description
* Record an event with 5 parameters
*/
void SYSVIEW_RecordU32x5(unsigned Id, U32 Para0, U32 Para1, U32 Para2, U32 Para3, U32 Para4) {
U8 aPacket[SEGGER_SYSVIEW_INFO_SIZE + 5 * SEGGER_SYSVIEW_QUANTA_U32];
U8* pPayload;
//
pPayload = SEGGER_SYSVIEW_PREPARE_PACKET(aPacket); // Prepare the packet for SystemView
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para0); // Add the first parameter to the packet
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para1); // Add the second parameter to the packet
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para2); // Add the third parameter to the packet
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para3); // Add the fourth parameter to the packet
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para4); // Add the fifth parameter to the packet
//
SEGGER_SYSVIEW_SendPacket(&aPacket[0], pPayload, Id); // Send the packet
}
/*********************************************************************
*
* SYSVIEW_RecordU32Register()
*
* Function description
* Record an event with 1 parameter and register the resource to be
* sent in the system description.
*/
void SYSVIEW_RecordU32Register(unsigned EventId, U32 ResourceId, const char* sResource) {
SEGGER_SYSVIEW_NameResource(ResourceId, sResource);
SEGGER_SYSVIEW_RecordU32(EventId, SEGGER_SYSVIEW_ShrinkId(ResourceId));
#if OS_CFG_TRACE_MAX_RESOURCES > 0
if (_NumResources >= OS_CFG_TRACE_MAX_RESOURCES) {
SEGGER_SYSVIEW_Warn("SYSTEMVIEW: Could not register resource name. Maximum number of resources reached.");
return;
}
_aResources[_NumResources].ResourceId = ResourceId;
_aResources[_NumResources].sResource = sResource;
_aResources[_NumResources].Registered = 0;
_NumResources++;
#endif
}
void SYSVIEW_SendResourceList(void) {
#if OS_CFG_TRACE_MAX_RESOURCES > 0
unsigned int n;
for (n = 0; n < _NumResources; n++) {
if (_aResources[n].Registered == 0) {
SEGGER_SYSVIEW_NameResource(_aResources[n].ResourceId, _aResources[n].sResource);
_aResources[n].Registered = 1;
}
}
#endif
}
/*********************************************************************
*
* Public API structures
*
**********************************************************************
*/
// Callbacks provided to SYSTEMVIEW by FreeRTOS
const SEGGER_SYSVIEW_OS_API SYSVIEW_X_OS_TraceAPI = {
_cbGetTime,
_cbSendTaskList,
};
/*************************** End of file ****************************/

View File

@ -0,0 +1,488 @@
/*
*********************************************************************************************************
* Micrium OS
* Kernel
*
* (c) Copyright 2009; Silicon Laboratories Inc.
* https://www.micrium.com
*
*********************************************************************************************************
* Licensing:
* YOUR USE OF THIS SOFTWARE IS SUBJECT TO THE TERMS OF A MICRIUM SOFTWARE LICENSE.
* If you are not willing to accept the terms of an appropriate Micrium Software License, you must not
* download or use this software for any reason.
* Information about Micrium software licensing is available at https://www.micrium.com/licensing/
* It is your obligation to select an appropriate license based on your intended use of the Micrium OS.
* Unless you have executed a Micrium Commercial License, your use of the Micrium OS is limited to
* evaluation, educational or personal non-commercial uses. The Micrium OS may not be redistributed or
* disclosed to any third party without the written consent of Silicon Laboratories Inc.
*********************************************************************************************************
* Documentation:
* You can find user manuals, API references, release notes and more at: https://doc.micrium.com
*********************************************************************************************************
* Technical Support:
* Support is available for commercially licensed users of Micrium's software. For additional
* information on support, you can contact info@micrium.com.
*********************************************************************************************************
*/
/*
*********************************************************************************************************
*
* KERNEL TRACE EVENTS
*
* File : os_trace_events.h
*********************************************************************************************************
*/
/*
*********************************************************************************************************
*********************************************************************************************************
* MODULE
*********************************************************************************************************
*********************************************************************************************************
*/
#ifndef _OS_TRACE_EVENTS_H_
#define _OS_TRACE_EVENTS_H_
#ifdef VSC_INCLUDE_H_FILE_NAMES
const CPU_CHAR *os_trace_events__h = "$Id: $";
#endif
/*
*********************************************************************************************************
*********************************************************************************************************
* INCLUDE FILES
*********************************************************************************************************
*********************************************************************************************************
*/
#include <SEGGER_SYSVIEW.h>
#include <os_cfg_trace.h>
#include "os.h"
/*
*********************************************************************************************************
*********************************************************************************************************
* TRACE EVENT MACROS
*********************************************************************************************************
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* RECORDER CONTROL
*********************************************************************************************************
*/
#if (OS_CFG_TRACE_EN == DEF_ENABLED)
#define OS_TRACE_INIT() SEGGER_SYSVIEW_Conf()
#define OS_TRACE_START() SEGGER_SYSVIEW_Start()
#define OS_TRACE_STOP() SEGGER_SYSVIEW_Stop()
#else
#define OS_TRACE_INIT()
#define OS_TRACE_START()
#define OS_TRACE_STOP()
#endif
/*
*********************************************************************************************************
* TRACE EVENT IDS
*********************************************************************************************************
*/
#if (OS_CFG_TRACE_EN == DEF_ENABLED)
#define OS_TRACE_ID_OFFSET (32u)
#define OS_TRACE_ID_TICK_INCREMENT ( 1u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_ISR_REGISTER ( 2u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_TASK_MSG_Q_CREATE ( 3u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_TASK_MSG_Q_POST ( 4u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_TASK_MSG_Q_PEND ( 5u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_TASK_SEM_CREATE ( 6u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_TASK_SEM_POST ( 7u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_TASK_SEM_PEND ( 8u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_MUTEX_CREATE ( 9u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_MUTEX_DEL (10u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_MUTEX_POST (11u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_MUTEX_PEND (12u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_MUTEX_TASK_PRIO_INHERIT (13u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_MUTEX_TASK_PRIO_DISINHERIT (14u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_SEM_CREATE (15u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_SEM_DEL (16u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_SEM_POST (17u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_SEM_PEND (18u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_Q_CREATE (19u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_Q_DEL (20u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_Q_POST (21u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_Q_PEND (22u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_FLAG_CREATE (23u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_FLAG_DEL (24u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_FLAG_POST (25u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_FLAG_PEND (26u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_MEM_CREATE (27u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_MEM_PUT (28u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_MEM_GET (29u + OS_TRACE_ID_OFFSET)
#endif
/*
*********************************************************************************************************
* KERNEL RELATED MACROS
*********************************************************************************************************
*/
#if (OS_CFG_TRACE_EN == DEF_ENABLED)
#define OS_TRACE_TASK_CREATE(p_tcb) if (p_tcb != 0) { \
SEGGER_SYSVIEW_OnTaskCreate((U32)p_tcb); \
SYSVIEW_AddTask((U32)p_tcb, \
&(p_tcb->NamePtr[0]), \
p_tcb->Prio, \
p_tcb->StkBasePtr, \
p_tcb->StkSize \
); \
}
#define OS_TRACE_TASK_READY(p_tcb) SYSVIEW_TaskReady((U32)p_tcb)
#define OS_TRACE_TASK_SWITCHED_IN(p_tcb) SYSVIEW_TaskSwitchedIn((U32)p_tcb)
#define OS_TRACE_TASK_DLY(dly_ticks)
#define OS_TRACE_TASK_SUSPEND(p_tcb)
#define OS_TRACE_TASK_SUSPENDED(p_tcb) SYSVIEW_TaskSuspend((U32)p_tcb)
#define OS_TRACE_TASK_RESUME(p_tcb) SYSVIEW_TaskReady((U32)p_tcb)
#define OS_TRACE_ISR_BEGIN(isr_id)
#define OS_TRACE_ISR_END()
#define OS_TRACE_ISR_ENTER() SEGGER_SYSVIEW_RecordEnterISR()
#define OS_TRACE_ISR_EXIT() SEGGER_SYSVIEW_RecordExitISR()
#define OS_TRACE_ISR_EXIT_TO_SCHEDULER() SEGGER_SYSVIEW_RecordExitISRToScheduler()
/*
*********************************************************************************************************
* SIMPLE RECORDER FUNCTIONS
*********************************************************************************************************
*/
#define OS_TRACE_TICK_INCREMENT(OSTickCtr) SEGGER_SYSVIEW_RecordU32 (OS_TRACE_ID_TICK_INCREMENT, (U32)OSTickCtr)
#define OS_TRACE_ISR_REGISTER(isr_id, isr_name, isr_prio) SEGGER_SYSVIEW_RecordU32x2(OS_TRACE_ID_ISR_REGISTER, (U32)isr_id, (U32)isr_prio)
#define OS_TRACE_MUTEX_TASK_PRIO_INHERIT(p_tcb, prio) SEGGER_SYSVIEW_RecordU32x2(OS_TRACE_ID_MUTEX_TASK_PRIO_INHERIT, SEGGER_SYSVIEW_ShrinkId((U32)p_tcb), (U32)prio)
#define OS_TRACE_MUTEX_TASK_PRIO_DISINHERIT(p_tcb, prio) SEGGER_SYSVIEW_RecordU32x2(OS_TRACE_ID_MUTEX_TASK_PRIO_DISINHERIT, SEGGER_SYSVIEW_ShrinkId((U32)p_tcb), (U32)prio)
#define OS_TRACE_TASK_DEL(p_tcb)
/*
*********************************************************************************************************
* COMPLEX RECORDER FUNCTIONS
*********************************************************************************************************
*/
#define OS_TRACE_MUTEX_CREATE(p_mutex, p_name) SYSVIEW_RecordU32Register(OS_TRACE_ID_MUTEX_CREATE, ((U32)p_mutex), p_name)
#define OS_TRACE_TASK_MSG_Q_CREATE(p_msg_q, p_name) SYSVIEW_RecordU32Register(OS_TRACE_ID_TASK_MSG_Q_CREATE, ((U32)p_msg_q), p_name)
#define OS_TRACE_TASK_SEM_CREATE(p_tcb, p_name) SYSVIEW_RecordU32Register(OS_TRACE_ID_TASK_SEM_CREATE, ((U32)p_tcb), p_name)
#define OS_TRACE_SEM_CREATE(p_sem, p_name) SYSVIEW_RecordU32Register(OS_TRACE_ID_SEM_CREATE, ((U32)p_sem), p_name)
#define OS_TRACE_Q_CREATE(p_q, p_name) SYSVIEW_RecordU32Register(OS_TRACE_ID_Q_CREATE, ((U32)p_q), p_name)
#define OS_TRACE_FLAG_CREATE(p_grp, p_name) SYSVIEW_RecordU32Register(OS_TRACE_ID_FLAG_CREATE, ((U32)p_grp), p_name)
#define OS_TRACE_MEM_CREATE(p_mem, p_name) SYSVIEW_RecordU32Register(OS_TRACE_ID_MEM_CREATE, ((U32)p_mem), p_name)
/*
*********************************************************************************************************
* KERNEL API ENTER FUNCTIONS
*********************************************************************************************************
*/
#if (OS_CFG_TRACE_API_ENTER_EN == DEF_ENABLED)
#define OS_TRACE_MUTEX_DEL_ENTER(p_mutex, opt) SEGGER_SYSVIEW_RecordU32x2(OS_TRACE_ID_MUTEX_DEL, SEGGER_SYSVIEW_ShrinkId((U32)p_mutex), (U32)opt)
#define OS_TRACE_MUTEX_POST_ENTER(p_mutex, opt) SEGGER_SYSVIEW_RecordU32x2(OS_TRACE_ID_MUTEX_POST, SEGGER_SYSVIEW_ShrinkId((U32)p_mutex), (U32)opt)
#define OS_TRACE_MUTEX_PEND_ENTER(p_mutex, timeout, opt, p_ts) SEGGER_SYSVIEW_RecordU32x3(OS_TRACE_ID_MUTEX_PEND, SEGGER_SYSVIEW_ShrinkId((U32)p_mutex), (U32)timeout, (U32)opt)
#define OS_TRACE_TASK_MSG_Q_POST_ENTER(p_msg_q, p_void, msg_size, opt) SEGGER_SYSVIEW_RecordU32x3(OS_TRACE_ID_TASK_MSG_Q_POST, SEGGER_SYSVIEW_ShrinkId((U32)p_msg_q), (U32)msg_size, (U32)opt)
#define OS_TRACE_TASK_MSG_Q_PEND_ENTER(p_msg_q, timeout, opt, p_msg_size, p_ts) SEGGER_SYSVIEW_RecordU32x3(OS_TRACE_ID_TASK_MSG_Q_PEND, SEGGER_SYSVIEW_ShrinkId((U32)p_msg_q), (U32)timeout, (U32)opt)
#define OS_TRACE_TASK_SEM_POST_ENTER(p_tcb, opt) SEGGER_SYSVIEW_RecordU32x2(OS_TRACE_ID_TASK_SEM_POST, SEGGER_SYSVIEW_ShrinkId((U32)p_tcb), (U32)opt)
#define OS_TRACE_TASK_SEM_PEND_ENTER(p_tcb, timeout, opt, p_ts) SEGGER_SYSVIEW_RecordU32x3(OS_TRACE_ID_TASK_SEM_PEND, SEGGER_SYSVIEW_ShrinkId((U32)p_tcb), (U32)timeout, (U32)opt)
#define OS_TRACE_SEM_DEL_ENTER(p_sem, opt) SEGGER_SYSVIEW_RecordU32x2(OS_TRACE_ID_SEM_DEL, SEGGER_SYSVIEW_ShrinkId((U32)p_sem), (U32)opt)
#define OS_TRACE_SEM_POST_ENTER(p_sem, opt) SEGGER_SYSVIEW_RecordU32x2(OS_TRACE_ID_SEM_POST, SEGGER_SYSVIEW_ShrinkId((U32)p_sem), (U32)opt)
#define OS_TRACE_SEM_PEND_ENTER(p_sem, timeout, opt, p_ts) SEGGER_SYSVIEW_RecordU32x3(OS_TRACE_ID_SEM_PEND, SEGGER_SYSVIEW_ShrinkId((U32)p_sem), (U32)timeout, (U32)opt)
#define OS_TRACE_Q_DEL_ENTER(p_q, opt) SEGGER_SYSVIEW_RecordU32x2(OS_TRACE_ID_Q_DEL, SEGGER_SYSVIEW_ShrinkId((U32)p_q), (U32)opt)
#define OS_TRACE_Q_POST_ENTER(p_q, p_void, msg_size, opt) SEGGER_SYSVIEW_RecordU32x3(OS_TRACE_ID_Q_POST, SEGGER_SYSVIEW_ShrinkId((U32)p_q), (U32)msg_size, (U32)opt)
#define OS_TRACE_Q_PEND_ENTER(p_q, timeout, opt, p_msg_size, p_ts) SEGGER_SYSVIEW_RecordU32x3(OS_TRACE_ID_Q_PEND, SEGGER_SYSVIEW_ShrinkId((U32)p_q), (U32)timeout, (U32)opt)
#define OS_TRACE_FLAG_DEL_ENTER(p_grp, opt) SEGGER_SYSVIEW_RecordU32x2(OS_TRACE_ID_FLAG_DEL, SEGGER_SYSVIEW_ShrinkId((U32)p_grp), (U32)opt)
#define OS_TRACE_FLAG_POST_ENTER(p_grp, flags, opt) SEGGER_SYSVIEW_RecordU32x3(OS_TRACE_ID_FLAG_POST, SEGGER_SYSVIEW_ShrinkId((U32)p_grp), (U32)flags, (U32)opt)
#define OS_TRACE_FLAG_PEND_ENTER(p_grp, flags, timeout, opt, p_ts) SYSVIEW_RecordU32x4 (OS_TRACE_ID_FLAG_PEND, SEGGER_SYSVIEW_ShrinkId((U32)p_grp), (U32)flags, (U32)timeout, (U32)opt)
#define OS_TRACE_MEM_PUT_ENTER(p_mem, p_blk) SEGGER_SYSVIEW_RecordU32x2(OS_TRACE_ID_MEM_PUT, SEGGER_SYSVIEW_ShrinkId((U32)p_mem), (U32)p_blk)
#define OS_TRACE_MEM_GET_ENTER(p_mem) SEGGER_SYSVIEW_RecordU32 (OS_TRACE_ID_MEM_GET, SEGGER_SYSVIEW_ShrinkId((U32)p_mem))
#else
#define OS_TRACE_MUTEX_DEL_ENTER(p_mutex, opt)
#define OS_TRACE_MUTEX_POST_ENTER(p_mutex, opt)
#define OS_TRACE_MUTEX_PEND_ENTER(p_mutex, timeout, opt, p_ts)
#define OS_TRACE_TASK_MSG_Q_POST_ENTER(p_msg_q, p_void, msg_size, opt)
#define OS_TRACE_TASK_MSG_Q_PEND_ENTER(p_msg_q, timeout, opt, p_msg_size, p_ts)
#define OS_TRACE_TASK_SEM_POST_ENTER(p_tcb, opt)
#define OS_TRACE_TASK_SEM_PEND_ENTER(p_tcb, timeout, opt, p_ts)
#define OS_TRACE_SEM_DEL_ENTER(p_sem, opt)
#define OS_TRACE_SEM_POST_ENTER(p_sem, opt)
#define OS_TRACE_SEM_PEND_ENTER(p_sem, timeout, opt, p_ts)
#define OS_TRACE_Q_DEL_ENTER(p_q, opt)
#define OS_TRACE_Q_POST_ENTER(p_q, p_void, msg_size, opt)
#define OS_TRACE_Q_PEND_ENTER(p_q, timeout, opt, p_msg_size, p_ts)
#define OS_TRACE_FLAG_DEL_ENTER(p_grp, opt)
#define OS_TRACE_FLAG_POST_ENTER(p_grp, flags, opt)
#define OS_TRACE_FLAG_PEND_ENTER(p_grp, flags, timeout, opt, p_ts)
#define OS_TRACE_MEM_PUT_ENTER(p_mem, p_blk)
#define OS_TRACE_MEM_GET_ENTER(p_mem)
#endif
/*
*********************************************************************************************************
* KERNEL API EXIT FUNCTIONS
*********************************************************************************************************
*/
#if (OS_CFG_TRACE_API_EXIT_EN == DEF_ENABLED)
#define OS_TRACE_MUTEX_DEL_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallReturnValue (OS_TRACE_ID_MUTEX_DEL, RetVal)
#define OS_TRACE_MUTEX_POST_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallReturnValue (OS_TRACE_ID_MUTEX_POST, RetVal)
#define OS_TRACE_MUTEX_PEND_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallReturnValue (OS_TRACE_ID_MUTEX_PEND, RetVal)
#define OS_TRACE_TASK_MSG_Q_POST_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallReturnValue (OS_TRACE_ID_TASK_MSG_Q_POST, RetVal)
#define OS_TRACE_TASK_MSG_Q_PEND_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallReturnValue (OS_TRACE_ID_TASK_MSG_Q_PEND, RetVal)
#define OS_TRACE_TASK_SEM_POST_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallReturnValue (OS_TRACE_ID_TASK_SEM_POST, RetVal)
#define OS_TRACE_TASK_SEM_PEND_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallReturnValue (OS_TRACE_ID_TASK_SEM_PEND, RetVal)
#define OS_TRACE_SEM_DEL_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallReturnValue (OS_TRACE_ID_SEM_DEL, RetVal)
#define OS_TRACE_SEM_POST_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallReturnValue (OS_TRACE_ID_SEM_POST, RetVal)
#define OS_TRACE_SEM_PEND_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallReturnValue (OS_TRACE_ID_SEM_PEND, RetVal)
#define OS_TRACE_Q_DEL_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallReturnValue (OS_TRACE_ID_Q_DEL, RetVal)
#define OS_TRACE_Q_POST_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallReturnValue (OS_TRACE_ID_Q_POST, RetVal)
#define OS_TRACE_Q_PEND_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallReturnValue (OS_TRACE_ID_Q_PEND, RetVal)
#define OS_TRACE_FLAG_DEL_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallReturnValue (OS_TRACE_ID_FLAG_DEL, RetVal)
#define OS_TRACE_FLAG_POST_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallReturnValue (OS_TRACE_ID_FLAG_POST, RetVal)
#define OS_TRACE_FLAG_PEND_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallReturnValue (OS_TRACE_ID_FLAG_PEND, RetVal)
#define OS_TRACE_MEM_PUT_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallReturnValue (OS_TRACE_ID_MEM_PUT, RetVal)
#define OS_TRACE_MEM_GET_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallReturnValue (OS_TRACE_ID_MEM_GET, RetVal)
#else
#define OS_TRACE_MUTEX_DEL_EXIT(RetVal)
#define OS_TRACE_MUTEX_POST_EXIT(RetVal)
#define OS_TRACE_MUTEX_PEND_EXIT(RetVal)
#define OS_TRACE_TASK_MSG_Q_POST_EXIT(RetVal)
#define OS_TRACE_TASK_MSG_Q_PEND_EXIT(RetVal)
#define OS_TRACE_TASK_SEM_POST_EXIT(RetVal)
#define OS_TRACE_TASK_SEM_PEND_EXIT(RetVal)
#define OS_TRACE_SEM_DEL_EXIT(RetVal)
#define OS_TRACE_SEM_POST_EXIT(RetVal)
#define OS_TRACE_SEM_PEND_EXIT(RetVal)
#define OS_TRACE_Q_DEL_EXIT(RetVal)
#define OS_TRACE_Q_POST_EXIT(RetVal)
#define OS_TRACE_Q_PEND_EXIT(RetVal)
#define OS_TRACE_FLAG_DEL_EXIT(RetVal)
#define OS_TRACE_FLAG_POST_EXIT(RetVal)
#define OS_TRACE_FLAG_PEND_EXIT(RetVal)
#define OS_TRACE_MEM_PUT_EXIT(RetVal)
#define OS_TRACE_MEM_GET_EXIT(RetVal)
#endif
/*
*********************************************************************************************************
* UNUSED FUNCTIONS (OTHER RECORDERS)
*********************************************************************************************************
*/
#define OS_TRACE_MUTEX_DEL(p_mutex)
#define OS_TRACE_MUTEX_POST(p_mutex)
#define OS_TRACE_MUTEX_PEND(p_mutex)
#define OS_TRACE_TASK_MSG_Q_POST(p_msg_q)
#define OS_TRACE_TASK_MSG_Q_PEND(p_msg_q)
#define OS_TRACE_TASK_SEM_POST(p_tcb)
#define OS_TRACE_TASK_SEM_PEND(p_tcb)
#define OS_TRACE_SEM_DEL(p_sem)
#define OS_TRACE_SEM_POST(p_sem)
#define OS_TRACE_SEM_PEND(p_sem)
#define OS_TRACE_Q_DEL(p_q)
#define OS_TRACE_Q_POST(p_q)
#define OS_TRACE_Q_PEND(p_q)
#define OS_TRACE_FLAG_DEL(p_grp)
#define OS_TRACE_FLAG_POST(p_grp)
#define OS_TRACE_FLAG_PEND(p_grp)
#define OS_TRACE_MEM_PUT(p_mem)
#define OS_TRACE_MEM_GET(p_mem)
#define OS_TRACE_MUTEX_POST_FAILED(p_mutex)
#define OS_TRACE_MUTEX_PEND_FAILED(p_mutex)
#define OS_TRACE_MUTEX_PEND_BLOCK(p_mutex)
#define OS_TRACE_TASK_CREATE_FAILED(p_tcb)
#define OS_TRACE_TASK_MSG_Q_POST_FAILED(p_msg_q)
#define OS_TRACE_TASK_MSG_Q_PEND_FAILED(p_msg_q)
#define OS_TRACE_TASK_MSG_Q_PEND_BLOCK(p_msg_q)
#define OS_TRACE_TASK_SEM_POST_FAILED(p_tcb)
#define OS_TRACE_TASK_SEM_PEND_FAILED(p_tcb)
#define OS_TRACE_TASK_SEM_PEND_BLOCK(p_tcb)
#define OS_TRACE_SEM_POST_FAILED(p_sem)
#define OS_TRACE_SEM_PEND_FAILED(p_sem)
#define OS_TRACE_SEM_PEND_BLOCK(p_sem)
#define OS_TRACE_Q_POST_FAILED(p_q)
#define OS_TRACE_Q_PEND_FAILED(p_q)
#define OS_TRACE_Q_PEND_BLOCK(p_q)
#define OS_TRACE_FLAG_POST_FAILED(p_grp)
#define OS_TRACE_FLAG_PEND_FAILED(p_grp)
#define OS_TRACE_FLAG_PEND_BLOCK(p_grp)
#define OS_TRACE_MEM_PUT_FAILED(p_mem)
#define OS_TRACE_MEM_GET_FAILED(p_mem)
#define OS_TRACE_TASK_PRIO_CHANGE(p_tcb, prio)
#else /* End of OS_CFG_TRACE_EN == DEF_ENABLED */
#define OS_TRACE_TICK_INCREMENT(OSTickCtr)
#define OS_TRACE_TASK_CREATE(p_tcb)
#define OS_TRACE_TASK_CREATE_FAILED(p_tcb)
#define OS_TRACE_TASK_DEL(p_tcb)
#define OS_TRACE_TASK_READY(p_tcb)
#define OS_TRACE_TASK_SWITCHED_IN(p_tcb)
#define OS_TRACE_TASK_DLY(dly_ticks)
#define OS_TRACE_TASK_SUSPEND(p_tcb)
#define OS_TRACE_TASK_SUSPENDED(p_tcb)
#define OS_TRACE_TASK_RESUME(p_tcb)
#define OS_TRACE_ISR_BEGIN(isr_id)
#define OS_TRACE_ISR_END()
#define OS_TRACE_ISR_ENTER()
#define OS_TRACE_ISR_EXIT()
#define OS_TRACE_ISR_EXIT_TO_SCHEDULER()
#define OS_TRACE_TASK_MSG_Q_CREATE(p_msg_q, p_name)
#define OS_TRACE_TASK_MSG_Q_POST(p_msg_q)
#define OS_TRACE_TASK_MSG_Q_POST_FAILED(p_msg_q)
#define OS_TRACE_TASK_MSG_Q_PEND(p_msg_q)
#define OS_TRACE_TASK_MSG_Q_PEND_FAILED(p_msg_q)
#define OS_TRACE_TASK_MSG_Q_PEND_BLOCK(p_msg_q)
#define OS_TRACE_TASK_SEM_CREATE(p_tcb, p_name)
#define OS_TRACE_TASK_SEM_POST(p_tcb)
#define OS_TRACE_TASK_SEM_POST_FAILED(p_tcb)
#define OS_TRACE_TASK_SEM_PEND(p_tcb)
#define OS_TRACE_TASK_SEM_PEND_FAILED(p_tcb)
#define OS_TRACE_TASK_SEM_PEND_BLOCK(p_tcb)
#define OS_TRACE_MUTEX_CREATE(p_mutex, p_name)
#define OS_TRACE_MUTEX_DEL(p_mutex)
#define OS_TRACE_MUTEX_POST(p_mutex)
#define OS_TRACE_MUTEX_POST_FAILED(p_mutex)
#define OS_TRACE_MUTEX_PEND(p_mutex)
#define OS_TRACE_MUTEX_PEND_FAILED(p_mutex)
#define OS_TRACE_MUTEX_PEND_BLOCK(p_mutex)
#define OS_TRACE_MUTEX_TASK_PRIO_INHERIT(p_tcb, prio)
#define OS_TRACE_MUTEX_TASK_PRIO_DISINHERIT(p_tcb, prio)
#define OS_TRACE_SEM_CREATE(p_sem, p_name)
#define OS_TRACE_SEM_DEL(p_sem)
#define OS_TRACE_SEM_POST(p_sem)
#define OS_TRACE_SEM_POST_FAILED(p_sem)
#define OS_TRACE_SEM_PEND(p_sem)
#define OS_TRACE_SEM_PEND_FAILED(p_sem)
#define OS_TRACE_SEM_PEND_BLOCK(p_sem)
#define OS_TRACE_Q_CREATE(p_q, p_name)
#define OS_TRACE_Q_DEL(p_q)
#define OS_TRACE_Q_POST(p_q)
#define OS_TRACE_Q_POST_FAILED(p_q)
#define OS_TRACE_Q_PEND(p_q)
#define OS_TRACE_Q_PEND_FAILED(p_q)
#define OS_TRACE_Q_PEND_BLOCK(p_q)
#define OS_TRACE_FLAG_CREATE(p_grp, p_name)
#define OS_TRACE_FLAG_DEL(p_grp)
#define OS_TRACE_FLAG_POST(p_grp)
#define OS_TRACE_FLAG_POST_FAILED(p_grp)
#define OS_TRACE_FLAG_PEND(p_grp)
#define OS_TRACE_FLAG_PEND_FAILED(p_grp)
#define OS_TRACE_FLAG_PEND_BLOCK(p_grp)
#define OS_TRACE_MEM_CREATE(p_mem, p_name)
#define OS_TRACE_MEM_PUT(p_mem)
#define OS_TRACE_MEM_PUT_FAILED(p_mem)
#define OS_TRACE_MEM_GET(p_mem)
#define OS_TRACE_MEM_GET_FAILED(p_mem)
#define OS_TRACE_TASK_PRIO_CHANGE(p_tcb, prio)
#define OS_TRACE_MUTEX_DEL_ENTER(p_mutex, opt)
#define OS_TRACE_MUTEX_POST_ENTER(p_mutex, opt)
#define OS_TRACE_MUTEX_PEND_ENTER(p_mutex, timeout, opt, p_ts)
#define OS_TRACE_TASK_MSG_Q_POST_ENTER(p_msg_q, p_void, msg_size, opt)
#define OS_TRACE_TASK_MSG_Q_PEND_ENTER(p_msg_q, timeout, opt, p_msg_size, p_ts)
#define OS_TRACE_TASK_SEM_POST_ENTER(p_tcb, opt)
#define OS_TRACE_TASK_SEM_PEND_ENTER(p_tcb, timeout, opt, p_ts)
#define OS_TRACE_SEM_DEL_ENTER(p_sem, opt)
#define OS_TRACE_SEM_POST_ENTER(p_sem, opt)
#define OS_TRACE_SEM_PEND_ENTER(p_sem, timeout, opt, p_ts)
#define OS_TRACE_Q_DEL_ENTER(p_q, opt)
#define OS_TRACE_Q_POST_ENTER(p_q, p_void, msg_size, opt)
#define OS_TRACE_Q_PEND_ENTER(p_q, timeout, opt, p_msg_size, p_ts)
#define OS_TRACE_FLAG_DEL_ENTER(p_grp, opt)
#define OS_TRACE_FLAG_POST_ENTER(p_grp, flags, opt)
#define OS_TRACE_FLAG_PEND_ENTER(p_grp, flags, timeout, opt, p_ts)
#define OS_TRACE_MEM_PUT_ENTER(p_mem, p_blk)
#define OS_TRACE_MEM_GET_ENTER(p_mem)
#define OS_TRACE_MUTEX_DEL_EXIT(RetVal)
#define OS_TRACE_MUTEX_POST_EXIT(RetVal)
#define OS_TRACE_MUTEX_PEND_EXIT(RetVal)
#define OS_TRACE_TASK_MSG_Q_POST_EXIT(RetVal)
#define OS_TRACE_TASK_MSG_Q_PEND_EXIT(RetVal)
#define OS_TRACE_TASK_SEM_POST_EXIT(RetVal)
#define OS_TRACE_TASK_SEM_PEND_EXIT(RetVal)
#define OS_TRACE_SEM_DEL_EXIT(RetVal)
#define OS_TRACE_SEM_POST_EXIT(RetVal)
#define OS_TRACE_SEM_PEND_EXIT(RetVal)
#define OS_TRACE_Q_DEL_EXIT(RetVal)
#define OS_TRACE_Q_POST_EXIT(RetVal)
#define OS_TRACE_Q_PEND_EXIT(RetVal)
#define OS_TRACE_FLAG_DEL_EXIT(RetVal)
#define OS_TRACE_FLAG_POST_EXIT(RetVal)
#define OS_TRACE_FLAG_PEND_EXIT(RetVal)
#define OS_TRACE_MEM_PUT_EXIT(RetVal)
#define OS_TRACE_MEM_GET_EXIT(RetVal)
#endif
/*
*********************************************************************************************************
* RECORDER API FUNCTIONS
*********************************************************************************************************
*/
#ifdef __cplusplus
extern "C" {
#endif
void SYSVIEW_TaskReady (U32 TaskID);
void SYSVIEW_TaskSwitchedIn (U32 TaskID);
void SYSVIEW_TaskSuspend (U32 TaskID);
void SYSVIEW_AddTask (U32 TaskID, const char* NamePtr, OS_PRIO Prio, CPU_STK* StkBasePtr, CPU_STK_SIZE StkSize);
void SYSVIEW_UpdateTask (U32 TaskID, const char* NamePtr, OS_PRIO Prio, CPU_STK* StkBasePtr, CPU_STK_SIZE StkSize);
void SYSVIEW_SendTaskInfo (U32 TaskID, const char* sName, unsigned Prio, U32 StackBase, unsigned StackSize);
void SYSVIEW_RecordU32x4 (unsigned Id, U32 Para0, U32 Para1, U32 Para2, U32 Para3);
void SYSVIEW_RecordU32x5 (unsigned Id, U32 Para0, U32 Para1, U32 Para2, U32 Para3, U32 Para4);
void SYSVIEW_RecordU32Register(unsigned EventId, U32 ResourceId, const char* sResource);
void SYSVIEW_SendResourceList (void);
#ifdef __cplusplus
}
#endif
/*
*********************************************************************************************************
*********************************************************************************************************
* MODULE END
*********************************************************************************************************
*********************************************************************************************************
*/
#endif /* End of Kernel trace events module include. */

View File

@ -0,0 +1,147 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_Config_NoOS.c
Purpose : Sample setup configuration of SystemView without an OS.
Revision: $Rev: 9599 $
*/
#include "SEGGER_SYSVIEW.h"
#include "SEGGER_SYSVIEW_Conf.h"
// SystemcoreClock can be used in most CMSIS compatible projects.
// In non-CMSIS projects define SYSVIEW_CPU_FREQ.
extern unsigned int SystemCoreClock;
/*********************************************************************
*
* Defines, configurable
*
**********************************************************************
*/
// The application name to be displayed in SystemViewer
#define SYSVIEW_APP_NAME "Demo Application"
// The target device name
#define SYSVIEW_DEVICE_NAME "Cortex-M4"
// Frequency of the timestamp. Must match SEGGER_SYSVIEW_Conf.h
#define SYSVIEW_TIMESTAMP_FREQ (SystemCoreClock)
// System Frequency. SystemcoreClock is used in most CMSIS compatible projects.
#define SYSVIEW_CPU_FREQ (SystemCoreClock)
// The lowest RAM address used for IDs (pointers)
#define SYSVIEW_RAM_BASE (0x10000000)
// Define as 1 if the Cortex-M cycle counter is used as SystemView timestamp. Must match SEGGER_SYSVIEW_Conf.h
#ifndef USE_CYCCNT_TIMESTAMP
#define USE_CYCCNT_TIMESTAMP 1
#endif
// Define as 1 if the Cortex-M cycle counter is used and there might be no debugger attached while recording.
#ifndef ENABLE_DWT_CYCCNT
#define ENABLE_DWT_CYCCNT (USE_CYCCNT_TIMESTAMP & SEGGER_SYSVIEW_POST_MORTEM_MODE)
#endif
/*********************************************************************
*
* Defines, fixed
*
**********************************************************************
*/
#define DEMCR (*(volatile unsigned long*) (0xE000EDFCuL)) // Debug Exception and Monitor Control Register
#define TRACEENA_BIT (1uL << 24) // Trace enable bit
#define DWT_CTRL (*(volatile unsigned long*) (0xE0001000uL)) // DWT Control Register
#define NOCYCCNT_BIT (1uL << 25) // Cycle counter support bit
#define CYCCNTENA_BIT (1uL << 0) // Cycle counter enable bit
/*********************************************************************
*
* _cbSendSystemDesc()
*
* Function description
* Sends SystemView description strings.
*/
static void _cbSendSystemDesc(void) {
SEGGER_SYSVIEW_SendSysDesc("N="SYSVIEW_APP_NAME",D="SYSVIEW_DEVICE_NAME);
SEGGER_SYSVIEW_SendSysDesc("I#15=SysTick");
}
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
void SEGGER_SYSVIEW_Conf(void) {
#if USE_CYCCNT_TIMESTAMP
#if ENABLE_DWT_CYCCNT
//
// If no debugger is connected, the DWT must be enabled by the application
//
if ((DEMCR & TRACEENA_BIT) == 0) {
DEMCR |= TRACEENA_BIT;
}
#endif
//
// The cycle counter must be activated in order
// to use time related functions.
//
if ((DWT_CTRL & NOCYCCNT_BIT) == 0) { // Cycle counter supported?
if ((DWT_CTRL & CYCCNTENA_BIT) == 0) { // Cycle counter not enabled?
DWT_CTRL |= CYCCNTENA_BIT; // Enable Cycle counter
}
}
#endif
SEGGER_SYSVIEW_Init(SYSVIEW_TIMESTAMP_FREQ, SYSVIEW_CPU_FREQ,
0, _cbSendSystemDesc);
SEGGER_SYSVIEW_SetRAMBase(SYSVIEW_RAM_BASE);
}
/*************************** End of file ****************************/

View File

@ -0,0 +1,232 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_Config_NoOS.c
Purpose : Sample setup configuration of SystemView without an OS for Cortex-M0.
Revision: $Rev: 18540 $
*/
#include "SEGGER_SYSVIEW.h"
#include "SEGGER_SYSVIEW_Conf.h"
// SystemcoreClock can be used in most CMSIS compatible projects.
// In non-CMSIS projects define SYSVIEW_CPU_FREQ.
extern unsigned int SystemCoreClock;
extern unsigned int SEGGER_SYSVIEW_TickCnt;
/*********************************************************************
*
* Defines, fixed
*
**********************************************************************
*/
#define SCB_ICSR (*(volatile U32*) (0xE000ED04uL)) // Interrupt Control State Register
#define SCB_ICSR_PENDSTSET_MASK (1UL << 26) // SysTick pending bit
#define SYST_RVR (*(volatile U32*) (0xE000E014uL)) // SysTick Reload Value Register
#define SYST_CVR (*(volatile U32*) (0xE000E018uL)) // SysTick Current Value Register
/*********************************************************************
*
* Defines, configurable
*
**********************************************************************
*/
// The application name to be displayed in SystemViewer
#define SYSVIEW_APP_NAME "Demo Application"
// The target device name
#define SYSVIEW_DEVICE_NAME "Cortex-M0"
// Frequency of the timestamp. Must match SEGGER_SYSVIEW_Conf.h
#define SYSVIEW_TIMESTAMP_FREQ (SystemCoreClock)
// System Frequency. SystemcoreClock is used in most CMSIS compatible projects.
#define SYSVIEW_CPU_FREQ (SystemCoreClock)
// The lowest RAM address used for IDs (pointers)
#define SYSVIEW_RAM_BASE (0x10000000)
// Define as 1 if the Cortex-M cycle counter is used as SystemView timestamp. Must match SEGGER_SYSVIEW_Conf.h
#ifndef USE_CYCCNT_TIMESTAMP
#define USE_CYCCNT_TIMESTAMP 1
#endif
// Define as 1 if the Cortex-M cycle counter is used and there might be no debugger attached while recording.
#ifndef ENABLE_DWT_CYCCNT
#define ENABLE_DWT_CYCCNT (USE_CYCCNT_TIMESTAMP & SEGGER_SYSVIEW_POST_MORTEM_MODE)
#endif
/*********************************************************************
*
* Defines, fixed
*
**********************************************************************
*/
#define DEMCR (*(volatile unsigned long*) (0xE000EDFCuL)) // Debug Exception and Monitor Control Register
#define TRACEENA_BIT (1uL << 24) // Trace enable bit
#define DWT_CTRL (*(volatile unsigned long*) (0xE0001000uL)) // DWT Control Register
#define NOCYCCNT_BIT (1uL << 25) // Cycle counter support bit
#define CYCCNTENA_BIT (1uL << 0) // Cycle counter enable bit
/*********************************************************************
*
* _cbSendSystemDesc()
*
* Function description
* Sends SystemView description strings.
*/
static void _cbSendSystemDesc(void) {
SEGGER_SYSVIEW_SendSysDesc("N="SYSVIEW_APP_NAME",D="SYSVIEW_DEVICE_NAME);
SEGGER_SYSVIEW_SendSysDesc("I#15=SysTick");
}
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
void SEGGER_SYSVIEW_Conf(void) {
#if USE_CYCCNT_TIMESTAMP
#if ENABLE_DWT_CYCCNT
//
// If no debugger is connected, the DWT must be enabled by the application
//
if ((DEMCR & TRACEENA_BIT) == 0) {
DEMCR |= TRACEENA_BIT;
}
#endif
//
// The cycle counter must be activated in order
// to use time related functions.
//
if ((DWT_CTRL & NOCYCCNT_BIT) == 0) { // Cycle counter supported?
if ((DWT_CTRL & CYCCNTENA_BIT) == 0) { // Cycle counter not enabled?
DWT_CTRL |= CYCCNTENA_BIT; // Enable Cycle counter
}
}
#endif
SEGGER_SYSVIEW_Init(SYSVIEW_TIMESTAMP_FREQ, SYSVIEW_CPU_FREQ,
0, _cbSendSystemDesc);
SEGGER_SYSVIEW_SetRAMBase(SYSVIEW_RAM_BASE);
}
/*********************************************************************
*
* SEGGER_SYSVIEW_X_GetTimestamp()
*
* Function description
* Returns the current timestamp in ticks using the system tick
* count and the SysTick counter.
* All parameters of the SysTick have to be known and are set via
* configuration defines on top of the file.
*
* Return value
* The current timestamp.
*
* Additional information
* SEGGER_SYSVIEW_X_GetTimestamp is always called when interrupts are
* disabled. Therefore locking here is not required.
*/
U32 SEGGER_SYSVIEW_X_GetTimestamp(void) {
#if USE_CYCCNT_TIMESTAMP
U32 TickCount;
U32 Cycles;
U32 CyclesPerTick;
//
// Get the cycles of the current system tick.
// SysTick is down-counting, subtract the current value from the number of cycles per tick.
//
CyclesPerTick = SYST_RVR + 1;
Cycles = (CyclesPerTick - SYST_CVR);
//
// Get the system tick count.
//
TickCount = SEGGER_SYSVIEW_TickCnt;
//
// If a SysTick interrupt is pending, re-read timer and adjust result
//
if ((SCB_ICSR & SCB_ICSR_PENDSTSET_MASK) != 0) {
Cycles = (CyclesPerTick - SYST_CVR);
TickCount++;
}
Cycles += TickCount * CyclesPerTick;
return Cycles;
#endif
}
/*********************************************************************
*
* SEGGER_SYSVIEW_X_GetInterruptId()
*
* Function description
* Return the currently active interrupt Id,
* which ist the active vector taken from IPSR[5:0].
*
* Return value
* The current currently active interrupt Id.
*
* Additional information
* This function is not used by default, as the active vector can be
* read from ICSR instead on Cortex-M0.
* For Cortex-M0+ devices, change SEGGER_SYSVIEW_GET_INTERRUPT_ID
* in SEGGER_SYSVIEW_Conf.h to call this function instead.
*/
U32 SEGGER_SYSVIEW_X_GetInterruptId(void) {
U32 Id;
__asm volatile ("mrs %0, ipsr"
: "=r" (Id)
);
Id &= 0x3F;
return Id;
}
/*************************** End of file ****************************/

View File

@ -0,0 +1,211 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_Config_NoOS_RX.c
Purpose : Sample setup configuration of SystemView on Renesas RX
systems without an operating system.
Revision: $Rev: 18540 $
*/
#include "RTOS.h"
#include "SEGGER_SYSVIEW.h"
#include "SEGGER_SYSVIEW_embOS.h"
//
// SystemcoreClock can be used in most CMSIS compatible projects.
// In non-CMSIS projects define SYSVIEW_CPU_FREQ directly.
//
extern unsigned int SystemCoreClock;
/*********************************************************************
*
* Defines, fixed
*
**********************************************************************
*/
/*********************************************************************
*
* Defines, configurable
*
**********************************************************************
*/
// The application name to be displayed in SystemViewer
#ifndef SYSVIEW_APP_NAME
#define SYSVIEW_APP_NAME "Demo Application"
#endif
// The target device name
#ifndef SYSVIEW_DEVICE_NAME
#define SYSVIEW_DEVICE_NAME "RX64M"
#endif
// System Frequency. SystemcoreClock is used in most CMSIS compatible projects.
#ifndef SYSVIEW_CPU_FREQ
#define SYSVIEW_CPU_FREQ (SystemCoreClock)
#endif
// Frequency of the timestamp. Must match SEGGER_SYSVIEW_Conf.h and RTOSInit.c
#ifndef SYSVIEW_TIMESTAMP_FREQ
#define SYSVIEW_TIMESTAMP_FREQ (SYSVIEW_CPU_FREQ/2u/8u) // Assume system timer runs at 1/16th of the CPU frequency
#endif
// The lowest RAM address used for IDs (pointers)
#ifndef SYSVIEW_RAM_BASE
#define SYSVIEW_RAM_BASE (0)
#endif
#ifndef SYSVIEW_SYSDESC0
#define SYSVIEW_SYSDESC0 "I#0=IntPrio0,I#1=IntPrio1,I#2=IntPrio2,I#3=IntPrio3,I#4=IntPrio4"
#endif
//#ifndef SYSVIEW_SYSDESC1
// #define SYSVIEW_SYSDESC1 "I#5=IntPrio5,I#6=IntPrio6,I#7=IntPrio7,I#8=IntPrio8,I#9=IntPrio9,I#10=IntPrio10"
//#endif
//#ifndef SYSVIEW_SYSDESC2
// #define SYSVIEW_SYSDESC2 "I#11=IntPrio11,I#12=IntPrio12,I#13=IntPrio13,I#14=IntPrio14,I#15=IntPrio15"
//#endif
// System Timer configuration
#define IRR_BASE_ADDR (0x00087000u)
#define CMT0_VECT 28u
#define OS_TIMER_VECT CMT0_VECT
#define TIMER_PRESCALE (8u)
#define CMT0_BASE_ADDR (0x00088000u)
#define CMT0_CMCNT (*(volatile U16*) (CMT0_BASE_ADDR + 0x04u))
extern unsigned SEGGER_SYSVIEW_TickCnt; // Tick Counter value incremented in the tick handler.
/*********************************************************************
*
* _cbSendSystemDesc()
*
* Function description
* Sends SystemView description strings.
*/
static void _cbSendSystemDesc(void) {
SEGGER_SYSVIEW_SendSysDesc("N="SYSVIEW_APP_NAME",D="SYSVIEW_DEVICE_NAME);
#ifdef SYSVIEW_SYSDESC0
SEGGER_SYSVIEW_SendSysDesc(SYSVIEW_SYSDESC0);
#endif
#ifdef SYSVIEW_SYSDESC1
SEGGER_SYSVIEW_SendSysDesc(SYSVIEW_SYSDESC1);
#endif
#ifdef SYSVIEW_SYSDESC2
SEGGER_SYSVIEW_SendSysDesc(SYSVIEW_SYSDESC2);
#endif
}
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
void SEGGER_SYSVIEW_Conf(void) {
SEGGER_SYSVIEW_Init(SYSVIEW_TIMESTAMP_FREQ, SYSVIEW_CPU_FREQ,
0, _cbSendSystemDesc);
SEGGER_SYSVIEW_SetRAMBase(SYSVIEW_RAM_BASE);
}
/*********************************************************************
*
* SEGGER_SYSVIEW_X_GetTimestamp()
*
* Function description
* Returns the current timestamp in ticks using the system tick
* count and the SysTick counter.
* All parameters of the SysTick have to be known and are set via
* configuration defines on top of the file.
*
* Return value
* The current timestamp.
*
* Additional information
* SEGGER_SYSVIEW_X_GetTimestamp is always called when interrupts are
* disabled.
* Therefore locking here is not required and OS_GetTime_Cycles() may
* be called.
*/
U32 SEGGER_SYSVIEW_X_GetTimestamp(void) {
U32 Time;
U32 Cnt;
Time = SEGGER_SYSVIEW_TickCnt;
Cnt = CMT0_CMCNT;
//
// Check if timer interrupt pending ...
//
if ((*(volatile U8*)(IRR_BASE_ADDR + OS_TIMER_VECT) & (1u << 0u)) != 0u) {
Cnt = CMT0_CMCNT; // Interrupt pending, re-read timer and adjust result
Time++;
}
return ((SYSVIEW_TIMESTAMP_FREQ/1000) * Time) + Cnt;
}
/*********************************************************************
*
* SEGGER_SYSVIEW_X_GetInterruptId()
*
* Function description
* Return the priority of the currently active interrupt.
*/
U32 SEGGER_SYSVIEW_X_GetInterruptId(void) {
U32 IntId;
__asm volatile ("mvfc PSW, %0 \t\n" // Load current PSW
"and #0x0F000000, %0 \t\n" // Clear all except IPL ([27:24])
"shlr #24, %0 \t\n" // Shift IPL to [3:0]
: "=r" (IntId) // Output result
: // Input
: // Clobbered list
);
return IntId;
}
/*************************** End of file ****************************/

View File

@ -0,0 +1,79 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
--------- END-OF-HEADER --------------------------------------------
File : Main_RTT_MenuApp.c
Purpose : Sample application to demonstrate RTT bi-directional functionality
*/
#define MAIN_C
#include <stdio.h>
#include "SEGGER_RTT.h"
volatile int _Cnt;
volatile int _Delay;
static char r;
/*********************************************************************
*
* main
*/
void main(void) {
SEGGER_RTT_WriteString(0, "SEGGER Real-Time-Terminal Sample\r\n");
SEGGER_RTT_ConfigUpBuffer(0, NULL, NULL, 0, SEGGER_RTT_MODE_NO_BLOCK_SKIP);
do {
r = SEGGER_RTT_WaitKey();
SEGGER_RTT_Write(0, &r, 1);
r++;
} while (1);
}
/*************************** End of file ****************************/

View File

@ -0,0 +1,107 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
--------- END-OF-HEADER --------------------------------------------
File : Main_RTT_MenuApp.c
Purpose : Sample application to demonstrate RTT bi-directional functionality
*/
#define MAIN_C
#include <stdio.h>
#include "SEGGER_RTT.h"
volatile int _Cnt;
volatile int _Delay;
/*********************************************************************
*
* main
*/
void main(void) {
int r;
int CancelOp;
do {
_Cnt = 0;
SEGGER_RTT_WriteString(0, "SEGGER Real-Time-Terminal Sample\r\n");
SEGGER_RTT_WriteString(0, "Press <1> to continue in blocking mode (Application waits if necessary, no data lost)\r\n");
SEGGER_RTT_WriteString(0, "Press <2> to continue in non-blocking mode (Application does not wait, data lost if fifo full)\r\n");
do {
r = SEGGER_RTT_WaitKey();
} while ((r != '1') && (r != '2'));
if (r == '1') {
SEGGER_RTT_WriteString(0, "\r\nSelected <1>. Configuring RTT and starting...\r\n");
SEGGER_RTT_ConfigUpBuffer(0, NULL, NULL, 0, SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL);
} else {
SEGGER_RTT_WriteString(0, "\r\nSelected <2>. Configuring RTT and starting...\r\n");
SEGGER_RTT_ConfigUpBuffer(0, NULL, NULL, 0, SEGGER_RTT_MODE_NO_BLOCK_SKIP);
}
CancelOp = 0;
do {
//for (_Delay = 0; _Delay < 10000; _Delay++);
SEGGER_RTT_printf(0, "Count: %d. Press <Space> to get back to menu.\r\n", _Cnt++);
r = SEGGER_RTT_HasKey();
if (r) {
CancelOp = (SEGGER_RTT_GetKey() == ' ') ? 1 : 0;
}
//
// Check if user selected to cancel the current operation
//
if (CancelOp) {
SEGGER_RTT_WriteString(0, "Operation cancelled, going back to menu...\r\n");
break;
}
} while (1);
SEGGER_RTT_GetKey();
SEGGER_RTT_WriteString(0, "\r\n");
} while (1);
}
/*************************** End of file ****************************/

View File

@ -0,0 +1,154 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
--------- END-OF-HEADER --------------------------------------------
File : Main_RTT_MenuApp.c
Purpose : Sample application to demonstrate RTT bi-directional functionality
*/
#define MAIN_C
#include <stdio.h>
#include "SEGGER_RTT.h"
volatile int _Cnt;
/*********************************************************************
*
* main
*/
void main(void) {
SEGGER_RTT_ConfigUpBuffer(0, NULL, NULL, 0, SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL);
SEGGER_RTT_WriteString(0, "SEGGER Real-Time-Terminal Sample\r\n\r\n");
SEGGER_RTT_WriteString(0, "###### Testing SEGGER_printf() ######\r\n");
SEGGER_RTT_printf(0, "printf Test: %%c, 'S' : %c.\r\n", 'S');
SEGGER_RTT_printf(0, "printf Test: %%5c, 'E' : %5c.\r\n", 'E');
SEGGER_RTT_printf(0, "printf Test: %%-5c, 'G' : %-5c.\r\n", 'G');
SEGGER_RTT_printf(0, "printf Test: %%5.3c, 'G' : %-5c.\r\n", 'G');
SEGGER_RTT_printf(0, "printf Test: %%.3c, 'E' : %-5c.\r\n", 'E');
SEGGER_RTT_printf(0, "printf Test: %%c, 'R' : %c.\r\n", 'R');
SEGGER_RTT_printf(0, "printf Test: %%s, \"RTT\" : %s.\r\n", "RTT");
SEGGER_RTT_printf(0, "printf Test: %%s, \"RTT\\r\\nRocks.\" : %s.\r\n", "RTT\r\nRocks.");
SEGGER_RTT_printf(0, "printf Test: %%u, 12345 : %u.\r\n", 12345);
SEGGER_RTT_printf(0, "printf Test: %%+u, 12345 : %+u.\r\n", 12345);
SEGGER_RTT_printf(0, "printf Test: %%.3u, 12345 : %.3u.\r\n", 12345);
SEGGER_RTT_printf(0, "printf Test: %%.6u, 12345 : %.6u.\r\n", 12345);
SEGGER_RTT_printf(0, "printf Test: %%6.3u, 12345 : %6.3u.\r\n", 12345);
SEGGER_RTT_printf(0, "printf Test: %%8.6u, 12345 : %8.6u.\r\n", 12345);
SEGGER_RTT_printf(0, "printf Test: %%08u, 12345 : %08u.\r\n", 12345);
SEGGER_RTT_printf(0, "printf Test: %%08.6u, 12345 : %08.6u.\r\n", 12345);
SEGGER_RTT_printf(0, "printf Test: %%0u, 12345 : %0u.\r\n", 12345);
SEGGER_RTT_printf(0, "printf Test: %%-.6u, 12345 : %-.6u.\r\n", 12345);
SEGGER_RTT_printf(0, "printf Test: %%-6.3u, 12345 : %-6.3u.\r\n", 12345);
SEGGER_RTT_printf(0, "printf Test: %%-8.6u, 12345 : %-8.6u.\r\n", 12345);
SEGGER_RTT_printf(0, "printf Test: %%-08u, 12345 : %-08u.\r\n", 12345);
SEGGER_RTT_printf(0, "printf Test: %%-08.6u, 12345 : %-08.6u.\r\n", 12345);
SEGGER_RTT_printf(0, "printf Test: %%-0u, 12345 : %-0u.\r\n", 12345);
SEGGER_RTT_printf(0, "printf Test: %%u, -12345 : %u.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%+u, -12345 : %+u.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%.3u, -12345 : %.3u.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%.6u, -12345 : %.6u.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%6.3u, -12345 : %6.3u.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%8.6u, -12345 : %8.6u.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%08u, -12345 : %08u.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%08.6u, -12345 : %08.6u.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%0u, -12345 : %0u.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%-.6u, -12345 : %-.6u.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%-6.3u, -12345 : %-6.3u.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%-8.6u, -12345 : %-8.6u.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%-08u, -12345 : %-08u.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%-08.6u, -12345 : %-08.6u.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%-0u, -12345 : %-0u.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%d, -12345 : %d.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%+d, -12345 : %+d.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%.3d, -12345 : %.3d.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%.6d, -12345 : %.6d.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%6.3d, -12345 : %6.3d.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%8.6d, -12345 : %8.6d.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%08d, -12345 : %08d.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%08.6d, -12345 : %08.6d.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%0d, -12345 : %0d.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%-.6d, -12345 : %-.6d.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%-6.3d, -12345 : %-6.3d.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%-8.6d, -12345 : %-8.6d.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%-08d, -12345 : %-08d.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%-08.6d, -12345 : %-08.6d.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%-0d, -12345 : %-0d.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%x, 0x1234ABC : %x.\r\n", 0x1234ABC);
SEGGER_RTT_printf(0, "printf Test: %%+x, 0x1234ABC : %+x.\r\n", 0x1234ABC);
SEGGER_RTT_printf(0, "printf Test: %%.3x, 0x1234ABC : %.3x.\r\n", 0x1234ABC);
SEGGER_RTT_printf(0, "printf Test: %%.6x, 0x1234ABC : %.6x.\r\n", 0x1234ABC);
SEGGER_RTT_printf(0, "printf Test: %%6.3x, 0x1234ABC : %6.3x.\r\n", 0x1234ABC);
SEGGER_RTT_printf(0, "printf Test: %%8.6x, 0x1234ABC : %8.6x.\r\n", 0x1234ABC);
SEGGER_RTT_printf(0, "printf Test: %%08x, 0x1234ABC : %08x.\r\n", 0x1234ABC);
SEGGER_RTT_printf(0, "printf Test: %%08.6x, 0x1234ABC : %08.6x.\r\n", 0x1234ABC);
SEGGER_RTT_printf(0, "printf Test: %%0x, 0x1234ABC : %0x.\r\n", 0x1234ABC);
SEGGER_RTT_printf(0, "printf Test: %%-.6x, 0x1234ABC : %-.6x.\r\n", 0x1234ABC);
SEGGER_RTT_printf(0, "printf Test: %%-6.3x, 0x1234ABC : %-6.3x.\r\n", 0x1234ABC);
SEGGER_RTT_printf(0, "printf Test: %%-8.6x, 0x1234ABC : %-8.6x.\r\n", 0x1234ABC);
SEGGER_RTT_printf(0, "printf Test: %%-08x, 0x1234ABC : %-08x.\r\n", 0x1234ABC);
SEGGER_RTT_printf(0, "printf Test: %%-08.6x, 0x1234ABC : %-08.6x.\r\n", 0x1234ABC);
SEGGER_RTT_printf(0, "printf Test: %%-0x, 0x1234ABC : %-0x.\r\n", 0x1234ABC);
SEGGER_RTT_printf(0, "printf Test: %%p, &_Cnt : %p.\r\n", &_Cnt);
SEGGER_RTT_WriteString(0, "###### SEGGER_printf() Tests done. ######\r\n");
do {
_Cnt++;
} while (1);
}
/*************************** End of file ****************************/

View File

@ -0,0 +1,105 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
--------- END-OF-HEADER --------------------------------------------
File : Main_RTT_SpeedTestApp.c
Purpose : Sample program for measuring RTT performance.
*/
#include "RTOS.h"
#include "BSP.h"
#include "SEGGER_RTT.h"
#include <stdio.h>
OS_STACKPTR int StackHP[128], StackLP[128]; /* Task stacks */
OS_TASK TCBHP, TCBLP; /* Task-control-blocks */
static void HPTask(void) {
while (1) {
//
// Measure time needed for RTT output
// Perform dummy write with 0 characters, so we know the overhead of toggling LEDs and RTT in general
//
// Set BP here. Then start sampling on scope
BSP_ClrLED(0);
SEGGER_RTT_Write(0, 0, 0);
BSP_SetLED(0);
BSP_ClrLED(0);
SEGGER_RTT_Write(0, "01234567890123456789012345678901234567890123456789012345678901234567890123456789\r\n", 82);
BSP_SetLED(0);
// Set BP here. Then stop sampling on scope
OS_Delay(200);
}
}
static void LPTask(void) {
while (1) {
BSP_ToggleLED(1);
OS_Delay (500);
}
}
/*********************************************************************
*
* main
*
*********************************************************************/
int main(void) {
OS_IncDI(); /* Initially disable interrupts */
OS_InitKern(); /* Initialize OS */
OS_InitHW(); /* Initialize Hardware for OS */
BSP_Init(); /* Initialize LED ports */
BSP_SetLED(0);
/* You need to create at least one task before calling OS_Start() */
OS_CREATETASK(&TCBHP, "HP Task", HPTask, 100, StackHP);
OS_CREATETASK(&TCBLP, "LP Task", LPTask, 50, StackLP);
OS_Start(); /* Start multitasking */
return 0;
}

View File

@ -0,0 +1,98 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_Conf.h
Purpose : SEGGER SystemView configuration file.
Set defines which deviate from the defaults (see SEGGER_SYSVIEW_ConfDefaults.h) here.
Revision: $Rev: 17066 $
Additional information:
Required defines which must be set are:
SEGGER_SYSVIEW_GET_TIMESTAMP
SEGGER_SYSVIEW_GET_INTERRUPT_ID
For known compilers and cores, these might be set to good defaults
in SEGGER_SYSVIEW_ConfDefaults.h.
SystemView needs a (nestable) locking mechanism.
If not defined, the RTT locking mechanism is used,
which then needs to be properly configured.
*/
#ifndef SEGGER_SYSVIEW_CONF_H
#define SEGGER_SYSVIEW_CONF_H
/*********************************************************************
*
* Defines, configurable
*
**********************************************************************
*/
// The application name to be displayed in SystemViewer
#define SEGGER_SYSVIEW_APP_NAME "embOS start project"
// The target device name
#define SEGGER_SYSVIEW_DEVICE_NAME "Cortex-M3/M4/M7"
// Frequency of the timestamp
#define SEGGER_SYSVIEW_TIMESTAMP_FREQ (SystemCoreClock)
// System Frequency. SystemcoreClock is used in most CMSIS compatible projects.
#define SEGGER_SYSVIEW_CPU_FREQ (SystemCoreClock)
#define SEGGER_SYSVIEW_SYSDESC0 "I#15=SysTick"
//
// SystemCoreClock can be used in most CMSIS compatible projects.
// In non-CMSIS projects define SYSVIEW_CPU_FREQ directly.
//
extern unsigned int SystemCoreClock;
#endif // SEGGER_SYSVIEW_CONF_H
/*************************** End of file ****************************/

View File

@ -0,0 +1,144 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_Config_embOS.c
Purpose : Sample setup configuration of SystemView with embOS.
Revision: $Rev: 21319 $
*/
#include "RTOS.h"
#include "SEGGER_SYSVIEW.h"
#include "SEGGER_SYSVIEW_embOS.h"
/*********************************************************************
*
* Defines, fixed
*
**********************************************************************
*/
#define DEMCR (*(volatile U32*) (0xE000EDFCuL)) // Debug Exception and Monitor Control Register
#define TRACEENA_BIT (1uL << 24) // Trace enable bit
#define DWT_CTRL (*(volatile U32*) (0xE0001000uL)) // DWT Control Register
#define NOCYCCNT_BIT (1uL << 25) // Cycle counter support bit
#define CYCCNTENA_BIT (1uL << 0) // Cycle counter enable bit
//
// If events will be recorded without a debug probe (J-Link) attached,
// enable the cycle counter
//
#define ENABLE_DWT_CYCCNT (SEGGER_SYSVIEW_POST_MORTEM_MODE || SEGGER_SYSVIEW_USE_INTERNAL_RECORDER)
/*********************************************************************
*
* Local functions
*
**********************************************************************
*/
/*********************************************************************
*
* _cbSendSystemDesc()
*
* Function description
* Sends SystemView description strings.
*/
static void _cbSendSystemDesc(void) {
SEGGER_SYSVIEW_SendSysDesc("N=" SEGGER_SYSVIEW_APP_NAME ",O=embOS,D=" SEGGER_SYSVIEW_DEVICE_NAME );
#ifdef SEGGER_SYSVIEW_SYSDESC0
SEGGER_SYSVIEW_SendSysDesc(SEGGER_SYSVIEW_SYSDESC0);
#endif
#ifdef SEGGER_SYSVIEW_SYSDESC1
SEGGER_SYSVIEW_SendSysDesc(SEGGER_SYSVIEW_SYSDESC1);
#endif
#ifdef SEGGER_SYSVIEW_SYSDESC2
SEGGER_SYSVIEW_SendSysDesc(SEGGER_SYSVIEW_SYSDESC2);
#endif
}
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
/*********************************************************************
*
* SEGGER_SYSVIEW_Conf()
*
* Function description
* Configure and initialize SystemView and register it with embOS.
*
* Additional information
* If enabled, SEGGER_SYSVIEW_Conf() will also immediately start
* recording events with SystemView.
*/
void SEGGER_SYSVIEW_Conf(void) {
#if ENABLE_DWT_CYCCNT
//
// If no debugger is connected, the DWT must be enabled by the application
//
if ((DEMCR & TRACEENA_BIT) == 0) {
DEMCR |= TRACEENA_BIT;
}
#endif
//
// The cycle counter must be activated in order
// to use time related functions.
//
if ((DWT_CTRL & NOCYCCNT_BIT) == 0) { // Cycle counter supported?
if ((DWT_CTRL & CYCCNTENA_BIT) == 0) { // Cycle counter not enabled?
DWT_CTRL |= CYCCNTENA_BIT; // Enable Cycle counter
}
}
SEGGER_SYSVIEW_Init(SEGGER_SYSVIEW_TIMESTAMP_FREQ, SEGGER_SYSVIEW_CPU_FREQ,
&SYSVIEW_X_OS_TraceAPI, _cbSendSystemDesc);
OS_TRACE_SetAPI(&embOS_TraceAPI_SYSVIEW); // Configure embOS to use SYSVIEW.
#if SEGGER_SYSVIEW_START_ON_INIT
SEGGER_SYSVIEW_Start(); // Start recording to catch system initialization.
#endif
}
/*************************** End of file ****************************/

View File

@ -0,0 +1,98 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_Conf.h
Purpose : SEGGER SystemView configuration file.
Set defines which deviate from the defaults (see SEGGER_SYSVIEW_ConfDefaults.h) here.
Revision: $Rev: 17066 $
Additional information:
Required defines which must be set are:
SEGGER_SYSVIEW_GET_TIMESTAMP
SEGGER_SYSVIEW_GET_INTERRUPT_ID
For known compilers and cores, these might be set to good defaults
in SEGGER_SYSVIEW_ConfDefaults.h.
SystemView needs a (nestable) locking mechanism.
If not defined, the RTT locking mechanism is used,
which then needs to be properly configured.
*/
#ifndef SEGGER_SYSVIEW_CONF_H
#define SEGGER_SYSVIEW_CONF_H
/*********************************************************************
*
* Defines, configurable
*
**********************************************************************
*/
// The application name to be displayed in SystemViewer
#define SEGGER_SYSVIEW_APP_NAME "embOS start project"
// The target device name
#define SEGGER_SYSVIEW_DEVICE_NAME "Cortex-M0/M0+/M1"
//
// SystemCoreClock can be used in most CMSIS compatible projects.
// In non-CMSIS projects define SYSVIEW_CPU_FREQ directly.
//
extern unsigned int SystemCoreClock;
// Frequency of the timestamp
#define SEGGER_SYSVIEW_TIMESTAMP_FREQ (SystemCoreClock)
// System Frequency. SystemcoreClock is used in most CMSIS compatible projects.
#define SEGGER_SYSVIEW_CPU_FREQ (SystemCoreClock)
#define SEGGER_SYSVIEW_SYSDESC0 "I#15=SysTick"
#endif // SEGGER_SYSVIEW_CONF_H
/*************************** End of file ****************************/

View File

@ -0,0 +1,181 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_Config_embOS_CM0.c
Purpose : Sample setup configuration of SystemView with embOS
on Cortex-M0/Cortex-M0+/Cortex-M1 systems which do not
have a cycle counter.
Revision: $Rev: 21298 $
Additional information:
SEGGER_SYSVIEW_TickCnt must be incremented in the SysTick
handler before any SYSVIEW event is generated.
Example in embOS RTOSInit.c:
void SysTick_Handler(void) {
#if (OS_PROFILE != 0)
SEGGER_SYSVIEW_TickCnt++; // Increment SEGGER_SYSVIEW_TickCnt before calling OS_INT_EnterNestable().
#endif
OS_INT_EnterNestable();
OS_TICK_Handle();
OS_INT_LeaveNestable();
}
*/
#include "RTOS.h"
#include "SEGGER_SYSVIEW.h"
#include "SEGGER_SYSVIEW_embOS.h"
/*********************************************************************
*
* Defines, fixed
*
**********************************************************************
*/
#define SCB_ICSR (*(volatile U32*) (0xE000ED04uL)) // Interrupt Control State Register
#define SCB_ICSR_PENDSTSET_MASK (1UL << 26) // SysTick pending bit
#define SYST_RVR (*(volatile U32*) (0xE000E014uL)) // SysTick Reload Value Register
#define SYST_CVR (*(volatile U32*) (0xE000E018uL)) // SysTick Current Value Register
/*********************************************************************
*
* Local functions
*
**********************************************************************
*/
/*********************************************************************
*
* _cbSendSystemDesc()
*
* Function description
* Sends SystemView description strings.
*/
static void _cbSendSystemDesc(void) {
SEGGER_SYSVIEW_SendSysDesc("N=" SEGGER_SYSVIEW_APP_NAME ",O=embOS,D=" SEGGER_SYSVIEW_DEVICE_NAME );
#ifdef SEGGER_SYSVIEW_SYSDESC0
SEGGER_SYSVIEW_SendSysDesc(SEGGER_SYSVIEW_SYSDESC0);
#endif
#ifdef SEGGER_SYSVIEW_SYSDESC1
SEGGER_SYSVIEW_SendSysDesc(SEGGER_SYSVIEW_SYSDESC1);
#endif
#ifdef SEGGER_SYSVIEW_SYSDESC2
SEGGER_SYSVIEW_SendSysDesc(SEGGER_SYSVIEW_SYSDESC2);
#endif
}
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
/*********************************************************************
*
* SEGGER_SYSVIEW_Conf()
*
* Function description
* Configure and initialize SystemView and register it with embOS.
*
* Additional information
* If enabled, SEGGER_SYSVIEW_Conf() will also immediately start
* recording events with SystemView.
*/
void SEGGER_SYSVIEW_Conf(void) {
SEGGER_SYSVIEW_Init(SEGGER_SYSVIEW_TIMESTAMP_FREQ, SEGGER_SYSVIEW_CPU_FREQ,
&SYSVIEW_X_OS_TraceAPI, _cbSendSystemDesc);
OS_TRACE_SetAPI(&embOS_TraceAPI_SYSVIEW); // Configure embOS to use SYSVIEW.
#if SEGGER_SYSVIEW_START_ON_INIT
SEGGER_SYSVIEW_Start(); // Start recording to catch system initialization.
#endif
}
/*********************************************************************
*
* SEGGER_SYSVIEW_X_GetTimestamp()
*
* Function description
* Returns the current timestamp in cycles using the system tick
* count and the SysTick counter.
* All parameters of the SysTick have to be known and are set via
* configuration defines on top of the file.
*
* Return value
* The current timestamp.
*
* Additional information
* SEGGER_SYSVIEW_X_GetTimestamp is always called when interrupts are
* disabled. Therefore locking here is not required.
*/
U32 SEGGER_SYSVIEW_X_GetTimestamp(void) {
U32 TickCount;
U32 Cycles;
U32 CyclesPerTick;
//
// Get the cycles of the current system tick.
// SysTick is down-counting, subtract the current value from the number of cycles per tick.
//
CyclesPerTick = SYST_RVR + 1;
Cycles = (CyclesPerTick - SYST_CVR);
//
// Get the system tick count.
//
TickCount = SEGGER_SYSVIEW_TickCnt;
//
// If a SysTick interrupt is pending, re-read timer and adjust result
//
if ((SCB_ICSR & SCB_ICSR_PENDSTSET_MASK) != 0) {
Cycles = (CyclesPerTick - SYST_CVR);
TickCount++;
}
Cycles += TickCount * CyclesPerTick;
return Cycles;
}
/*************************** End of file ****************************/

View File

@ -0,0 +1,104 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_Conf.h
Purpose : SEGGER SystemView configuration file.
Set defines which deviate from the defaults (see SEGGER_SYSVIEW_ConfDefaults.h) here.
Revision: $Rev: 17066 $
Additional information:
Required defines which must be set are:
SEGGER_SYSVIEW_GET_TIMESTAMP
SEGGER_SYSVIEW_GET_INTERRUPT_ID
For known compilers and cores, these might be set to good defaults
in SEGGER_SYSVIEW_ConfDefaults.h.
SystemView needs a (nestable) locking mechanism.
If not defined, the RTT locking mechanism is used,
which then needs to be properly configured.
*/
#ifndef SEGGER_SYSVIEW_CONF_H
#define SEGGER_SYSVIEW_CONF_H
/*********************************************************************
*
* Defines, configurable
*
**********************************************************************
*/
// The application name to be displayed in SystemViewer
#define SEGGER_SYSVIEW_APP_NAME "embOS start project"
// The target device name
#define SEGGER_SYSVIEW_DEVICE_NAME "MAX3263x"
//
// SystemCoreClock can be used in most CMSIS compatible projects.
// In non-CMSIS projects define SYSVIEW_CPU_FREQ directly.
//
extern unsigned int SystemCoreClock;
// Frequency of the timestamp
#define SEGGER_SYSVIEW_TIMESTAMP_FREQ (SystemCoreClock)
// System Frequency. SystemcoreClock is used in most CMSIS compatible projects.
#define SEGGER_SYSVIEW_CPU_FREQ (SystemCoreClock)
// The lowest RAM address used for IDs (pointers)
#define SEGGER_SYSVIEW_ID_BASE (0x20000000)
#define SEGGER_SYSVIEW_SYSDESC0 "I#15=SysTick"
// Retrieve a system timestamp used for SystemView events.
#define SEGGER_SYSVIEW_GET_TIMESTAMP() SEGGER_SYSVIEW_X_GetTimestamp()
#endif // SEGGER_SYSVIEW_CONF_H
/*************************** End of file ****************************/

View File

@ -0,0 +1,179 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_Config_embOS_MAX3263x.c
Purpose : Sample setup configuration of SystemView with embOS.
Revision: $Rev: 12706 $
Additional information:
SEGGER_SYSVIEW_TickCnt must be incremented in the SysTick
handler before any SYSVIEW event is generated.
Example in embOS RTOSInit.c:
void SysTick_Handler(void) {
#if (OS_PROFILE != 0)
SEGGER_SYSVIEW_TickCnt++; // Increment SEGGER_SYSVIEW_TickCnt before calling OS_INT_EnterNestable().
#endif
OS_INT_EnterNestable();
OS_TICK_Handle();
OS_INT_LeaveNestable();
}
*/
#include "RTOS.h"
#include "SEGGER_SYSVIEW.h"
#include "SEGGER_SYSVIEW_embOS.h"
/*********************************************************************
*
* Defines, fixed
*
**********************************************************************
*/
#define SCB_ICSR (*(volatile U32*) (0xE000ED04uL)) // Interrupt Control State Register
#define SCB_ICSR_PENDSTSET_MASK (1UL << 26) // SysTick pending bit
#define SYST_RVR (*(volatile U32*) (0xE000E014uL)) // SysTick Reload Value Register
#define SYST_CVR (*(volatile U32*) (0xE000E018uL)) // SysTick Current Value Register
/*********************************************************************
*
* Local functions
*
**********************************************************************
*/
/*********************************************************************
*
* _cbSendSystemDesc()
*
* Function description
* Sends SystemView description strings.
*/
static void _cbSendSystemDesc(void) {
SEGGER_SYSVIEW_SendSysDesc("N=" SEGGER_SYSVIEW_APP_NAME ",O=embOS,D=" SEGGER_SYSVIEW_DEVICE_NAME );
#ifdef SEGGER_SYSVIEW_SYSDESC0
SEGGER_SYSVIEW_SendSysDesc(SEGGER_SYSVIEW_SYSDESC0);
#endif
#ifdef SEGGER_SYSVIEW_SYSDESC1
SEGGER_SYSVIEW_SendSysDesc(SEGGER_SYSVIEW_SYSDESC1);
#endif
#ifdef SEGGER_SYSVIEW_SYSDESC2
SEGGER_SYSVIEW_SendSysDesc(SEGGER_SYSVIEW_SYSDESC2);
#endif
}
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
/*********************************************************************
*
* SEGGER_SYSVIEW_Conf()
*
* Function description
* Configure and initialize SystemView and register it with embOS.
*
* Additional information
* If enabled, SEGGER_SYSVIEW_Conf() will also immediately start
* recording events with SystemView.
*/
void SEGGER_SYSVIEW_Conf(void) {
SEGGER_SYSVIEW_Init(SEGGER_SYSVIEW_TIMESTAMP_FREQ, SEGGER_SYSVIEW_CPU_FREQ,
&SYSVIEW_X_OS_TraceAPI, _cbSendSystemDesc);
OS_TRACE_SetAPI(&embOS_TraceAPI_SYSVIEW); // Configure embOS to use SYSVIEW.
#if SEGGER_SYSVIEW_START_ON_INIT
SEGGER_SYSVIEW_Start(); // Start recording to catch system initialization.
#endif
}
/*********************************************************************
*
* SEGGER_SYSVIEW_X_GetTimestamp()
*
* Function description
* Returns the current timestamp in cycles using the system tick
* count and the SysTick counter.
* All parameters of the SysTick have to be known and are set via
* configuration defines on top of the file.
*
* Return value
* The current timestamp.
*
* Additional information
* SEGGER_SYSVIEW_X_GetTimestamp is always called when interrupts are
* disabled. Therefore locking here is not required.
*/
U32 SEGGER_SYSVIEW_X_GetTimestamp(void) {
U32 TickCount;
U32 Cycles;
U32 CyclesPerTick;
//
// Get the cycles of the current system tick.
// SysTick is down-counting, subtract the current value from the number of cycles per tick.
//
CyclesPerTick = SYST_RVR + 1;
Cycles = (CyclesPerTick - SYST_CVR);
//
// Get the system tick count.
//
TickCount = SEGGER_SYSVIEW_TickCnt;
//
// If a SysTick interrupt is pending, re-read timer and adjust result
//
if ((SCB_ICSR & SCB_ICSR_PENDSTSET_MASK) != 0) {
Cycles = (CyclesPerTick - SYST_CVR);
TickCount++;
}
Cycles += TickCount * CyclesPerTick;
return Cycles;
}
/*************************** End of file ****************************/

View File

@ -0,0 +1,104 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_Conf.h
Purpose : SEGGER SystemView configuration file.
Set defines which deviate from the defaults (see SEGGER_SYSVIEW_ConfDefaults.h) here.
Revision: $Rev: 17066 $
Additional information:
Required defines which must be set are:
SEGGER_SYSVIEW_GET_TIMESTAMP
SEGGER_SYSVIEW_GET_INTERRUPT_ID
For known compilers and cores, these might be set to good defaults
in SEGGER_SYSVIEW_ConfDefaults.h.
SystemView needs a (nestable) locking mechanism.
If not defined, the RTT locking mechanism is used,
which then needs to be properly configured.
*/
#ifndef SEGGER_SYSVIEW_CONF_H
#define SEGGER_SYSVIEW_CONF_H
/*********************************************************************
*
* Defines, configurable
*
**********************************************************************
*/
// The application name to be displayed in SystemViewer
#define SEGGER_SYSVIEW_APP_NAME "embOS start project"
// The target device name
#define SEGGER_SYSVIEW_DEVICE_NAME "RISC-V"
// Frequency of the timestamp
#warning "SEGGER_SYSVIEW_TIMESTAMP_FREQ needs to be set."
#define SEGGER_SYSVIEW_TIMESTAMP_FREQ (0)
// System Frequency. SystemcoreClock is used in most CMSIS compatible projects.
#warning "SEGGER_SYSVIEW_CPU_FREQ needs to be set."
#define SEGGER_SYSVIEW_CPU_FREQ (0)
// Lowest Id reported by the Application.
#define SEGGER_SYSVIEW_ID_BASE (0x00000000)
#define SEGGER_SYSVIEW_SYSDESC0 "I#7=System Tick"
// Retrieve a system timestamp via user-defined function
#define SEGGER_SYSVIEW_GET_TIMESTAMP() SEGGER_SYSVIEW_X_GetTimestamp()
// Get the currently active interrupt Id from the user-provided function.
#define SEGGER_SYSVIEW_GET_INTERRUPT_ID() SEGGER_SYSVIEW_X_GetInterruptId()
#endif // SEGGER_SYSVIEW_CONF_H
/*************************** End of file ****************************/

View File

@ -0,0 +1,169 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_Config_embOS_RISCV.c
Purpose : Sample setup configuration of SystemView with embOS.
Revision: $Rev: 12706 $
Additional information:
SEGGER_SYSVIEW_TickCnt must be incremented in the SysTick
handler before any SYSVIEW event is generated.
Example in embOS RTOSInit.c:
void SysTick_Handler(void) {
#if (OS_PROFILE != 0)
SEGGER_SYSVIEW_TickCnt++; // Increment SEGGER_SYSVIEW_TickCnt before calling OS_INT_EnterNestable().
#endif
OS_INT_EnterNestable();
OS_TICK_Handle();
OS_INT_LeaveNestable();
}
*/
#include "RTOS.h"
#include "SEGGER_SYSVIEW.h"
#include "SEGGER_SYSVIEW_embOS.h"
/*********************************************************************
*
* Local functions
*
**********************************************************************
*/
/*********************************************************************
*
* _cbSendSystemDesc()
*
* Function description
* Sends SystemView description strings.
*/
static void _cbSendSystemDesc(void) {
SEGGER_SYSVIEW_SendSysDesc("N=" SEGGER_SYSVIEW_APP_NAME ",O=embOS,D=" SEGGER_SYSVIEW_DEVICE_NAME );
#ifdef SEGGER_SYSVIEW_SYSDESC0
SEGGER_SYSVIEW_SendSysDesc(SEGGER_SYSVIEW_SYSDESC0);
#endif
#ifdef SEGGER_SYSVIEW_SYSDESC1
SEGGER_SYSVIEW_SendSysDesc(SEGGER_SYSVIEW_SYSDESC1);
#endif
#ifdef SEGGER_SYSVIEW_SYSDESC2
SEGGER_SYSVIEW_SendSysDesc(SEGGER_SYSVIEW_SYSDESC2);
#endif
}
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
/*********************************************************************
*
* SEGGER_SYSVIEW_Conf()
*
* Function description
* Configure and initialize SystemView and register it with embOS.
*
* Additional information
* If enabled, SEGGER_SYSVIEW_Conf() will also immediately start
* recording events with SystemView.
*/
void SEGGER_SYSVIEW_Conf(void) {
SEGGER_SYSVIEW_Init(SEGGER_SYSVIEW_TIMESTAMP_FREQ, SEGGER_SYSVIEW_CPU_FREQ,
&SYSVIEW_X_OS_TraceAPI, _cbSendSystemDesc);
OS_TRACE_SetAPI(&embOS_TraceAPI_SYSVIEW); // Configure embOS to use SYSVIEW.
#if SEGGER_SYSVIEW_START_ON_INIT
SEGGER_SYSVIEW_Start(); // Start recording to catch system initialization.
#endif
}
/*********************************************************************
*
* SEGGER_SYSVIEW_X_GetTimestamp()
*
* Function description
* Returns the current timestamp in ticks.
*
* Return value
* The current timestamp.
*
* Additional information
* SEGGER_SYSVIEW_X_GetTimestamp is always called when interrupts are
* disabled. Therefore locking here is not required.
*/
U32 SEGGER_SYSVIEW_X_GetTimestamp(void) {
register unsigned long MCycle;
__asm volatile("csrr %0, mcycle \n\t"
: "=r" (MCycle) // Output
: // Input
: // Clobbered list
);
return MCycle;
}
/*********************************************************************
*
* SEGGER_SYSVIEW_X_GetInterruptId()
*
* Function description
* Return the currently active IRQ interrupt number
* from the INTC_SIR_IRQ.
*/
U32 SEGGER_SYSVIEW_X_GetInterruptId(void) {
register unsigned long MCauseValue;
__asm volatile("csrr %0, mcause \n\t"
: "=r" (MCauseValue) // Output
: // Input
: // Clobbered list
);
return MCauseValue & 0x7FFFFFFFuL;
}
/*************************** End of file ****************************/

View File

@ -0,0 +1,100 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_Conf.h
Purpose : SEGGER SystemView configuration file.
Set defines which deviate from the defaults (see SEGGER_SYSVIEW_ConfDefaults.h) here.
Revision: $Rev: 17066 $
Additional information:
Required defines which must be set are:
SEGGER_SYSVIEW_GET_TIMESTAMP
SEGGER_SYSVIEW_GET_INTERRUPT_ID
For known compilers and cores, these might be set to good defaults
in SEGGER_SYSVIEW_ConfDefaults.h.
SystemView needs a (nestable) locking mechanism.
If not defined, the RTT locking mechanism is used,
which then needs to be properly configured.
*/
#ifndef SEGGER_SYSVIEW_CONF_H
#define SEGGER_SYSVIEW_CONF_H
/*********************************************************************
*
* Defines, configurable
*
**********************************************************************
*/
// The application name to be displayed in SystemViewer
#define SEGGER_SYSVIEW_APP_NAME "embOS start project"
// The target device name
#define SEGGER_SYSVIEW_DEVICE_NAME "RL78G14"
// Frequency of the timestamp
#define SEGGER_SYSVIEW_TIMESTAMP_FREQ (32000000uL)
// System Frequency
#define SEGGER_SYSVIEW_CPU_FREQ (32000000uL)
// Lowest Id reported by the Application.
#define SEGGER_SYSVIEW_ID_BASE (0x00000000)
// Retrieve a system timestamp via user-defined function
#define SEGGER_SYSVIEW_GET_TIMESTAMP() SEGGER_SYSVIEW_X_GetTimestamp()
// Get the currently active interrupt Id from the user-provided function.
#define SEGGER_SYSVIEW_GET_INTERRUPT_ID() SEGGER_SYSVIEW_X_GetInterruptId()
#endif // SEGGER_SYSVIEW_CONF_H
/*************************** End of file ****************************/

View File

@ -0,0 +1,189 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_Config_embOS_RL78.c
Purpose : Sample setup configuration of SystemView with embOS.
Revision: $Rev: 21298 $
Additional information:
SEGGER_SYSVIEW_TickCnt must be incremented in the SysTick
handler before any SYSVIEW event is generated.
Example in embOS RTOSInit.c:
void SysTick_Handler(void) {
#if (OS_PROFILE != 0)
SEGGER_SYSVIEW_TickCnt++; // Increment SEGGER_SYSVIEW_TickCnt before calling OS_INT_EnterNestable().
#endif
OS_INT_EnterNestable();
OS_TICK_Handle();
OS_INT_LeaveNestable();
}
*/
#include "RTOS.h"
#include "SEGGER_SYSVIEW.h"
#include "SEGGER_SYSVIEW_embOS.h"
/*********************************************************************
*
* Defines, fixed
*
**********************************************************************
*/
#define TDR00 (*(volatile U16*) (0xFF18)) // System Timer Reload Value Register
#define TCR00 (*(volatile U16*) (0x0180)) // System Timer Current Value Register
#define IF1 (*(volatile U16*) (0xFFE2))
/*********************************************************************
*
* Local functions
*
**********************************************************************
*/
/*********************************************************************
*
* _cbSendSystemDesc()
*
* Function description
* Sends SystemView description strings.
*/
static void _cbSendSystemDesc(void) {
SEGGER_SYSVIEW_SendSysDesc("N=" SEGGER_SYSVIEW_APP_NAME ",O=embOS,D=" SEGGER_SYSVIEW_DEVICE_NAME );
#ifdef SEGGER_SYSVIEW_SYSDESC0
SEGGER_SYSVIEW_SendSysDesc(SEGGER_SYSVIEW_SYSDESC0);
#endif
#ifdef SEGGER_SYSVIEW_SYSDESC1
SEGGER_SYSVIEW_SendSysDesc(SEGGER_SYSVIEW_SYSDESC1);
#endif
#ifdef SEGGER_SYSVIEW_SYSDESC2
SEGGER_SYSVIEW_SendSysDesc(SEGGER_SYSVIEW_SYSDESC2);
#endif
}
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
/*********************************************************************
*
* SEGGER_SYSVIEW_Conf()
*
* Function description
* Configure and initialize SystemView and register it with embOS.
*
* Additional information
* If enabled, SEGGER_SYSVIEW_Conf() will also immediately start
* recording events with SystemView.
*/
void SEGGER_SYSVIEW_Conf(void) {
SEGGER_SYSVIEW_Init(SEGGER_SYSVIEW_TIMESTAMP_FREQ, SEGGER_SYSVIEW_CPU_FREQ,
&SYSVIEW_X_OS_TraceAPI, _cbSendSystemDesc);
OS_TRACE_SetAPI(&embOS_TraceAPI_SYSVIEW); // Configure embOS to use SYSVIEW.
#if SEGGER_SYSVIEW_START_ON_INIT
SEGGER_SYSVIEW_Start(); // Start recording to catch system initialization.
#endif
}
/*********************************************************************
*
* SEGGER_SYSVIEW_X_GetTimestamp()
*
* Function description
* Returns the current timestamp in cycles using the system tick
* count and the System Tick counter.
* All parameters of the System Tick have to be known and are set via
* configuration defines on top of the file.
*
* Return value
* The current timestamp.
*
* Additional information
* SEGGER_SYSVIEW_X_GetTimestamp is always called when interrupts are
* disabled. Therefore locking here is not required.
*/
U32 SEGGER_SYSVIEW_X_GetTimestamp(void) {
U32 TickCount;
U32 Cycles;
U32 CyclesPerTick;
//
// Get the cycles of the current system tick.
// System Tick is down-counting, subtract the current value from the number of cycles per tick.
//
CyclesPerTick = TDR00 + 1;
Cycles = (CyclesPerTick - TCR00);
//
// Get the system tick count.
//
TickCount = SEGGER_SYSVIEW_TickCnt;
//
// If a System Tick interrupt is pending, re-read timer and adjust result
//
if (IF1 & (1u << 4u)) {
Cycles = (CyclesPerTick - TCR00);
TickCount++;
}
Cycles += TickCount * CyclesPerTick;
return Cycles;
}
/*********************************************************************
*
* SEGGER_SYSVIEW_X_GetInterruptId()
*
* Function description
* Return the priority of the currently active interrupt.
*/
U32 SEGGER_SYSVIEW_X_GetInterruptId(void) {
return 0;
}
/*************************** End of file ****************************/

View File

@ -0,0 +1,104 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_Conf.h
Purpose : SEGGER SystemView configuration file.
Set defines which deviate from the defaults (see SEGGER_SYSVIEW_ConfDefaults.h) here.
Revision: $Rev: 17066 $
Additional information:
Required defines which must be set are:
SEGGER_SYSVIEW_GET_TIMESTAMP
SEGGER_SYSVIEW_GET_INTERRUPT_ID
For known compilers and cores, these might be set to good defaults
in SEGGER_SYSVIEW_ConfDefaults.h.
SystemView needs a (nestable) locking mechanism.
If not defined, the RTT locking mechanism is used,
which then needs to be properly configured.
*/
#ifndef SEGGER_SYSVIEW_CONF_H
#define SEGGER_SYSVIEW_CONF_H
/*********************************************************************
*
* Defines, configurable
*
**********************************************************************
*/
// The application name to be displayed in SystemViewer
#define SEGGER_SYSVIEW_APP_NAME "embOS start project"
// The target device name
#define SEGGER_SYSVIEW_DEVICE_NAME "RX"
// System Frequency
#define SEGGER_SYSVIEW_CPU_FREQ (96000000u)
// Frequency of the timestamp
#define SEGGER_SYSVIEW_TIMESTAMP_FREQ (SEGGER_SYSVIEW_CPU_FREQ/2u/8u) // Assume system timer runs at 1/16th of the CPU frequency
// Lowest Id reported by the Application.
#define SEGGER_SYSVIEW_ID_BASE (0x00000000)
#define SEGGER_SYSVIEW_SYSDESC0 "I#0=IntPrio0,I#1=IntPrio1,I#2=IntPrio2,I#3=IntPrio3,I#4=IntPrio4"
//#define SEGGER_SYSVIEW_SYSDESC1 "I#5=IntPrio5,I#6=IntPrio6,I#7=IntPrio7,I#8=IntPrio8,I#9=IntPrio9,I#10=IntPrio10"
//#define SEGGER_SYSVIEW_SYSDESC2 "I#11=IntPrio11,I#12=IntPrio12,I#13=IntPrio13,I#14=IntPrio14,I#15=IntPrio15"
// Retrieve a system timestamp via user-defined function
#define SEGGER_SYSVIEW_GET_TIMESTAMP() SEGGER_SYSVIEW_X_GetTimestamp()
// Get the currently active interrupt Id from the user-provided function.
#define SEGGER_SYSVIEW_GET_INTERRUPT_ID() SEGGER_SYSVIEW_X_GetInterruptId()
#endif // SEGGER_SYSVIEW_CONF_H
/*************************** End of file ****************************/

View File

@ -0,0 +1,197 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_Config_embOS_RX.c
Purpose : Sample setup configuration of SystemView with embOS
on Renesas RX systems.
Revision: $Rev: 21298 $
Additional information:
SEGGER_SYSVIEW_TickCnt must be incremented in the SysTick
handler before any SYSVIEW event is generated.
Example in embOS RTOSInit.c:
void SysTick_Handler(void) {
#if (OS_PROFILE != 0)
SEGGER_SYSVIEW_TickCnt++; // Increment SEGGER_SYSVIEW_TickCnt before calling OS_INT_EnterNestable().
#endif
OS_INT_EnterNestable();
OS_TICK_Handle();
OS_INT_LeaveNestable();
}
*/
#include "RTOS.h"
#include "SEGGER_SYSVIEW.h"
#include "SEGGER_SYSVIEW_embOS.h"
/*********************************************************************
*
* Defines, fixed
*
**********************************************************************
*/
#define IRR_BASE_ADDR (0x00087000u)
#define CMT0_VECT 28u
#define OS_TIMER_VECT CMT0_VECT
#define TIMER_PRESCALE (8u)
#define CMT0_BASE_ADDR (0x00088000u)
#define CMT0_CMCNT (*(volatile U16*) (CMT0_BASE_ADDR + 0x04u))
/*********************************************************************
*
* Local functions
*
**********************************************************************
*/
/*********************************************************************
*
* _cbSendSystemDesc()
*
* Function description
* Sends SystemView description strings.
*/
static void _cbSendSystemDesc(void) {
SEGGER_SYSVIEW_SendSysDesc("N=" SEGGER_SYSVIEW_APP_NAME ",O=embOS,D=" SEGGER_SYSVIEW_DEVICE_NAME );
#ifdef SEGGER_SYSVIEW_SYSDESC0
SEGGER_SYSVIEW_SendSysDesc(SEGGER_SYSVIEW_SYSDESC0);
#endif
#ifdef SEGGER_SYSVIEW_SYSDESC1
SEGGER_SYSVIEW_SendSysDesc(SEGGER_SYSVIEW_SYSDESC1);
#endif
#ifdef SEGGER_SYSVIEW_SYSDESC2
SEGGER_SYSVIEW_SendSysDesc(SEGGER_SYSVIEW_SYSDESC2);
#endif
}
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
/*********************************************************************
*
* SEGGER_SYSVIEW_Conf()
*
* Function description
* Configure and initialize SystemView and register it with embOS.
*
* Additional information
* If enabled, SEGGER_SYSVIEW_Conf() will also immediately start
* recording events with SystemView.
*/
void SEGGER_SYSVIEW_Conf(void) {
SEGGER_SYSVIEW_Init(SEGGER_SYSVIEW_TIMESTAMP_FREQ, SEGGER_SYSVIEW_CPU_FREQ,
&SYSVIEW_X_OS_TraceAPI, _cbSendSystemDesc);
OS_TRACE_SetAPI(&embOS_TraceAPI_SYSVIEW); // Configure embOS to use SYSVIEW.
#if SEGGER_SYSVIEW_START_ON_INIT
SEGGER_SYSVIEW_Start(); // Start recording to catch system initialization.
#endif
}
/*********************************************************************
*
* SEGGER_SYSVIEW_X_GetTimestamp()
*
* Function description
* Returns the current timestamp in cycles using the system tick
* count and the SysTick counter.
* All parameters of the SysTick have to be known and are set via
* configuration defines on top of the file.
*
* Return value
* The current timestamp.
*
* Additional information
* SEGGER_SYSVIEW_X_GetTimestamp is always called when interrupts are
* disabled.
* Therefore locking here is not required and OS_GetTime_Cycles() may
* be called.
*/
U32 SEGGER_SYSVIEW_X_GetTimestamp(void) {
U32 Time;
U32 Cnt;
Time = SEGGER_SYSVIEW_TickCnt;
Cnt = CMT0_CMCNT;
//
// Check if timer interrupt pending ...
//
if ((*(volatile U8*)(IRR_BASE_ADDR + OS_TIMER_VECT) & (1u << 0u)) != 0u) {
Cnt = CMT0_CMCNT; // Interrupt pending, re-read timer and adjust result
Time++;
}
return ((SYSVIEW_TIMESTAMP_FREQ/1000) * Time) + Cnt;
}
/*********************************************************************
*
* SEGGER_SYSVIEW_X_GetInterruptId()
*
* Function description
* Return the priority of the currently active interrupt.
*/
U32 SEGGER_SYSVIEW_X_GetInterruptId(void) {
U32 IntId;
#ifdef __RX // Renesas CCRX
IntId = (get_psw() & 0x0F000000) >> 24u;
#else
__asm volatile ("mvfc PSW, %0 \t\n" // Load current PSW
"and #0x0F000000, %0 \t\n" // Clear all except IPL ([27:24])
"shlr #24, %0 \t\n" // Shift IPL to [3:0]
: "=r" (IntId) // Output result
: // Input
: // Clobbered list
);
#endif
return IntId;
}
/*************************** End of file ****************************/

View File

@ -0,0 +1,124 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_Conf.h
Purpose : SEGGER SystemView configuration file.
Set defines which deviate from the defaults (see SEGGER_SYSVIEW_ConfDefaults.h) here.
Revision: $Rev: 17066 $
Additional information:
Required defines which must be set are:
SEGGER_SYSVIEW_GET_TIMESTAMP
SEGGER_SYSVIEW_GET_INTERRUPT_ID
For known compilers and cores, these might be set to good defaults
in SEGGER_SYSVIEW_ConfDefaults.h.
SystemView needs a (nestable) locking mechanism.
If not defined, the RTT locking mechanism is used,
which then needs to be properly configured.
*/
#ifndef SEGGER_SYSVIEW_CONF_H
#define SEGGER_SYSVIEW_CONF_H
/*********************************************************************
*
* Defines, configurable
*
**********************************************************************
*/
/*********************************************************************
*
* Defines, configurable
*
**********************************************************************
*/
#ifndef OS_FSYS
#define OS_FSYS (399900000u)
#endif
#ifndef OS_PCLK_TIMER
#define OS_PCLK_TIMER (OS_FSYS / 12)
#endif
#ifndef OS_TICK_FREQ
#define OS_TICK_FREQ (1000)
#endif
#ifndef OS_TIMER_RELOAD
#define OS_TIMER_RELOAD (OS_PCLK_TIMER / OS_TICK_FREQ)
#endif
// The application name to be displayed in SystemViewer
#define SEGGER_SYSVIEW_APP_NAME "embOS start project"
// The target device name
#define SEGGER_SYSVIEW_DEVICE_NAME "R7S721001"
// Frequency of the timestamp
#define SEGGER_SYSVIEW_TIMESTAMP_FREQ (OS_PCLK_TIMER)
// System Frequency. SystemcoreClock is used in most CMSIS compatible projects.
#define SEGGER_SYSVIEW_CPU_FREQ (OS_FSYS)
// Lowest Id reported by the Application.
#define SEGGER_SYSVIEW_ID_BASE (0x60000000)
#define SEGGER_SYSVIEW_SYSDESC0 "I#134=OS_ISR_Tick"
// Retrieve a system timestamp via user-defined function
#define SEGGER_SYSVIEW_GET_TIMESTAMP() SEGGER_SYSVIEW_X_GetTimestamp()
// Get the currently active interrupt Id from the user-provided function.
#define SEGGER_SYSVIEW_GET_INTERRUPT_ID() SEGGER_SYSVIEW_X_GetInterruptId()
#endif // SEGGER_SYSVIEW_CONF_H
/*************************** End of file ****************************/

View File

@ -0,0 +1,188 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_Config_embOS_RZA1.c
Purpose : Sample setup configuration of SystemView with embOS
on Renesas RZA1 devices.
Revision: $Rev: 12316 $
Additional information:
SEGGER_SYSVIEW_TickCnt must be incremented in the SysTick
handler before any SYSVIEW event is generated.
Example in embOS RTOSInit.c:
void SysTick_Handler(void) {
#if (OS_PROFILE != 0)
SEGGER_SYSVIEW_TickCnt++; // Increment SEGGER_SYSVIEW_TickCnt before calling OS_INT_EnterNestable().
#endif
OS_INT_EnterNestable();
OS_TICK_Handle();
OS_INT_LeaveNestable();
}
SEGGER_SYSVIEW_InterruptId has to be set in the IRQ handler
to identify the active interrupt.
*/
#include "RTOS.h"
#include "SEGGER_SYSVIEW.h"
#include "SEGGER_SYSVIEW_embOS.h"
/*********************************************************************
*
* Defines, fixed
*
**********************************************************************
*/
#define OSTM_CNT (*(volatile unsigned int*) 0xFCFEC004u)
#define OSTM_INT_ID (134)
#define TIMER_INTERRUPT_PENDING() (OS_GIC_IsPending(OSTM_INT_ID))
/*********************************************************************
*
* Local functions
*
**********************************************************************
*/
/*********************************************************************
*
* _cbSendSystemDesc()
*
* Function description
* Sends SystemView description strings.
*/
static void _cbSendSystemDesc(void) {
SEGGER_SYSVIEW_SendSysDesc("N=" SEGGER_SYSVIEW_APP_NAME ",O=embOS,D=" SEGGER_SYSVIEW_DEVICE_NAME );
#ifdef SEGGER_SYSVIEW_SYSDESC0
SEGGER_SYSVIEW_SendSysDesc(SEGGER_SYSVIEW_SYSDESC0);
#endif
#ifdef SEGGER_SYSVIEW_SYSDESC1
SEGGER_SYSVIEW_SendSysDesc(SEGGER_SYSVIEW_SYSDESC1);
#endif
#ifdef SEGGER_SYSVIEW_SYSDESC2
SEGGER_SYSVIEW_SendSysDesc(SEGGER_SYSVIEW_SYSDESC2);
#endif
}
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
/*********************************************************************
*
* SEGGER_SYSVIEW_Conf()
*
* Function description
* Configure and initialize SystemView and register it with embOS.
*
* Additional information
* If enabled, SEGGER_SYSVIEW_Conf() will also immediately start
* recording events with SystemView.
*/
void SEGGER_SYSVIEW_Conf(void) {
SEGGER_SYSVIEW_Init(SEGGER_SYSVIEW_TIMESTAMP_FREQ, SEGGER_SYSVIEW_CPU_FREQ,
&SYSVIEW_X_OS_TraceAPI, _cbSendSystemDesc);
OS_TRACE_SetAPI(&embOS_TraceAPI_SYSVIEW); // Configure embOS to use SYSVIEW.
#if SEGGER_SYSVIEW_START_ON_INIT
SEGGER_SYSVIEW_Start(); // Start recording to catch system initialization.
#endif
}
/*********************************************************************
*
* SEGGER_SYSVIEW_X_GetTimestamp()
*
* Function description
* Returns the current timestamp in cycles using the system tick
* count and the SysTick counter.
* All parameters of the SysTick have to be known and are set via
* configuration defines on top of the file.
*
* Return value
* The current timestamp.
*
* Additional information
* SEGGER_SYSVIEW_X_GetTimestamp is always called when interrupts are
* disabled. Therefore locking here is not required.
*/
U32 SEGGER_SYSVIEW_X_GetTimestamp(void) {
U32 TickCount;
U32 Cycles;
//
// Get the cycles of the current system tick.
// Sample timer is down-counting, subtract the current value from the number of cycles per tick.
//
Cycles = OS_TIMER_RELOAD - OSTM_CNT;
//
// Get the system tick count.
//
TickCount = SEGGER_SYSVIEW_TickCnt;
//
// If a SysTick interrupt is pending, re-read timer and adjust result
//
if (TIMER_INTERRUPT_PENDING() != 0) {
TickCount++;
Cycles = OS_TIMER_RELOAD - OSTM_CNT;
}
Cycles += TickCount * OS_TIMER_RELOAD;
return Cycles;
}
/*********************************************************************
*
* SEGGER_SYSVIEW_X_GetInterruptId()
*/
U32 SEGGER_SYSVIEW_X_GetInterruptId(void) {
return SEGGER_SYSVIEW_InterruptId;
}
/*************************** End of file ****************************/

View File

@ -0,0 +1,84 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_Win32.h
Purpose : System visualization API.
Revision: $Rev: 16723 $
*/
#ifndef SEGGER_SYSVIEW_WIN32_H
#define SEGGER_SYSVIEW_WIN32_H
/*********************************************************************
*
* #include Section
*
**********************************************************************
*/
#include "SEGGER_SYSVIEW.h"
/*********************************************************************
*
* Prototypes
*
**********************************************************************
*/
#ifdef __cplusplus
extern "C" {
#endif
void SEGGER_SYSVIEW_X_SetISRName(const char* sName);
#ifdef __cplusplus
}
#endif
#endif
/*************************** End of file ****************************/

View File

@ -0,0 +1,111 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_Conf.h
Purpose : SEGGER SystemView configuration file.
Set defines which deviate from the defaults (see SEGGER_SYSVIEW_ConfDefaults.h) here.
Revision: $Rev: 17066 $
Additional information:
Required defines which must be set are:
SEGGER_SYSVIEW_GET_TIMESTAMP
SEGGER_SYSVIEW_GET_INTERRUPT_ID
For known compilers and cores, these might be set to good defaults
in SEGGER_SYSVIEW_ConfDefaults.h.
SystemView needs a (nestable) locking mechanism.
If not defined, the RTT locking mechanism is used,
which then needs to be properly configured.
*/
#ifndef SEGGER_SYSVIEW_CONF_H
#define SEGGER_SYSVIEW_CONF_H
/*********************************************************************
*
* Defines, configurable
*
**********************************************************************
*/
// Largest cache line size (in bytes) in the current system. Needed in systems with cache to make sure that we align the SYSVIEW buffers accordingly
#define SEGGER_SYSVIEW_CPU_CACHE_LINE_SIZE (32)
// The RTT channel that SystemView will use. 0: Auto selection
#define SEGGER_SYSVIEW_RTT_CHANNEL 1
// The application name to be displayed in SystemViewer
#define SEGGER_SYSVIEW_APP_NAME "embOS start project"
// The target device name
#define SEGGER_SYSVIEW_DEVICE_NAME "Zynq 7010"
// System Frequency. SystemcoreClock is used in most CMSIS compatible projects.
#define SEGGER_SYSVIEW_CPU_FREQ (HW_OS_FSYS)
// Frequency of the timestamp
#define SEGGER_SYSVIEW_TIMESTAMP_FREQ (SEGGER_SYSVIEW_CPU_FREQ / 2) // HW timer used to generate tick runs at 1/2 CPU speed
// Number of bits to shift the Id to
#define SEGGER_SYSVIEW_ID_SHIFT 2
// Lowest Id reported by the Application.
#define SEGGER_SYSVIEW_ID_BASE (0x60000000)
#define SEGGER_SYSVIEW_SYSDESC0 "I#29=OS_ISR_Tick"
// Retrieve a system timestamp via user-defined function
#define SEGGER_SYSVIEW_GET_TIMESTAMP() SEGGER_SYSVIEW_X_GetTimestamp()
// Get the currently active interrupt Id from the user-provided function.
#define SEGGER_SYSVIEW_GET_INTERRUPT_ID() SEGGER_SYSVIEW_X_GetInterruptId()
#endif // SEGGER_SYSVIEW_CONF_H
/*************************** End of file ****************************/

View File

@ -0,0 +1,168 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_Config_embOS_Zynq7000.c
Purpose : Sample setup configuration of SystemView with embOS
on Xilinx Zynq 7010 devices.
Revision: $Rev: 12316 $
Additional information:
SEGGER_SYSVIEW_TickCnt must be incremented in the SysTick
handler before any SYSVIEW event is generated.
Example in embOS RTOSInit.c:
void SysTick_Handler(void) {
#if (OS_PROFILE != 0)
SEGGER_SYSVIEW_TickCnt++; // Increment SEGGER_SYSVIEW_TickCnt before calling OS_INT_EnterNestable().
#endif
OS_INT_EnterNestable();
OS_TICK_Handle();
OS_INT_LeaveNestable();
}
SEGGER_SYSVIEW_InterruptId has to be set in the IRQ handler
to identify the active interrupt.
*/
#include "RTOS.h"
#include "SEGGER_SYSVIEW.h"
#include "SEGGER_SYSVIEW_embOS.h"
/*********************************************************************
*
* Defines, fixed
*
**********************************************************************
*/
/*********************************************************************
*
* Local functions
*
**********************************************************************
*/
/*********************************************************************
*
* _cbSendSystemDesc()
*
* Function description
* Sends SystemView description strings.
*/
static void _cbSendSystemDesc(void) {
SEGGER_SYSVIEW_SendSysDesc("N=" SEGGER_SYSVIEW_APP_NAME ",O=embOS,D=" SEGGER_SYSVIEW_DEVICE_NAME );
#ifdef SEGGER_SYSVIEW_SYSDESC0
SEGGER_SYSVIEW_SendSysDesc(SEGGER_SYSVIEW_SYSDESC0);
#endif
#ifdef SEGGER_SYSVIEW_SYSDESC1
SEGGER_SYSVIEW_SendSysDesc(SEGGER_SYSVIEW_SYSDESC1);
#endif
#ifdef SEGGER_SYSVIEW_SYSDESC2
SEGGER_SYSVIEW_SendSysDesc(SEGGER_SYSVIEW_SYSDESC2);
#endif
}
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
/*********************************************************************
*
* SEGGER_SYSVIEW_Conf()
*
* Function description
* Configure and initialize SystemView and register it with embOS.
*
* Additional information
* If enabled, SEGGER_SYSVIEW_Conf() will also immediately start
* recording events with SystemView.
*/
void SEGGER_SYSVIEW_Conf(void) {
SEGGER_SYSVIEW_Init(SEGGER_SYSVIEW_TIMESTAMP_FREQ, SEGGER_SYSVIEW_CPU_FREQ,
&SYSVIEW_X_OS_TraceAPI, _cbSendSystemDesc);
OS_TRACE_SetAPI(&embOS_TraceAPI_SYSVIEW); // Configure embOS to use SYSVIEW.
#if SEGGER_SYSVIEW_START_ON_INIT
SEGGER_SYSVIEW_Start(); // Start recording to catch system initialization.
#endif
}
/*********************************************************************
*
* SEGGER_SYSVIEW_X_GetTimestamp()
*
* Function description
* Returns the current timestamp in cycles using the system tick
* count and the SysTick counter.
* All parameters of the SysTick have to be known and are set via
* configuration defines on top of the file.
*
* Return value
* The current timestamp.
*
* Additional information
* SEGGER_SYSVIEW_X_GetTimestamp is always called when interrupts are
* disabled. Therefore locking here is not required.
*/
U32 SEGGER_SYSVIEW_X_GetTimestamp(void) {
U32 Cycles;
Cycles = RTOSINIT__SYSVIEWGetTimerCycles();
return Cycles;
}
/*********************************************************************
*
* SEGGER_SYSVIEW_X_GetInterruptId()
*/
U32 SEGGER_SYSVIEW_X_GetInterruptId(void) {
return SEGGER_SYSVIEW_InterruptId;
}
/*************************** End of file ****************************/

View File

@ -0,0 +1,254 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_Config_embOS_iMX6.c
Purpose : Sample setup configuration of SystemView with embOS
on NXP i.MX6 devices.
Additional information:
SEGGER_SYSVIEW_TickCnt has to be declared in the module which handles
the system tick and must be incremented in the SysTick_Handler.
SEGGER_SYSVIEW_InterruptId has to be declared in the module which handles
interrupts and must be set to the current interrupt Id as soon as an
interrupt occurred.
*/
#include "RTOS.h"
#include "SEGGER_SYSVIEW.h"
#include "SEGGER_SYSVIEW_Conf.h"
#include "SEGGER_SYSVIEW_embOS.h"
//
// SEGGER_SYSVIEW_TickCnt has to be defined in the module which
// handles the SysTick and must be incremented in the System Tick
// handler before any SYSVIEW event is generated.
//
// Example in embOS RTOSInit.c:
//
// extern unsigned int SEGGER_SYSVIEW_TickCnt;
// void SysTick_Handler(void) {
// #if (OS_SUPPORT_PROFILE != 0)
// SEGGER_SYSVIEW_TickCnt++; // Increment SEGGER_SYSVIEW_TickCnt before calling OS_INT_EnterNestable().
// #endif
// OS_TICK_Handle();
// }
//
unsigned int SEGGER_SYSVIEW_TickCnt;
//
// SEGGER_SYSVIEW_InterruptId has to be set in the IRQ handler
// to identify the active interrupt.
//
unsigned int SEGGER_SYSVIEW_InterruptId;
/*********************************************************************
*
* Defines, configurable
*
**********************************************************************
*/
#ifndef OS_FSYS
#define OS_FSYS (792000000u)
#endif
#ifndef OS_PCLK_TIMER
#define OS_PCLK_TIMER (OS_FSYS / 2)
#endif
#ifndef OS_TICK_FREQ
#define OS_TICK_FREQ (1000)
#endif
#ifndef OS_TIMER_RELOAD
#define OS_TIMER_RELOAD (OS_PCLK_TIMER / OS_TICK_FREQ)
#endif
// The application name to be displayed in SystemViewer
#ifndef SYSVIEW_APP_NAME
#define SYSVIEW_APP_NAME "embOS start project"
#endif
// The target device name
#ifndef SYSVIEW_DEVICE_NAME
#define SYSVIEW_DEVICE_NAME "i.MX6"
#endif
// Frequency of the timestamp. Must match SEGGER_SYSVIEW_Conf.h
#ifndef SYSVIEW_TIMESTAMP_FREQ
#define SYSVIEW_TIMESTAMP_FREQ (OS_PCLK_TIMER)
#endif
// System Frequency. SystemcoreClock is used in most CMSIS compatible projects.
#ifndef SYSVIEW_CPU_FREQ
#define SYSVIEW_CPU_FREQ (OS_FSYS)
#endif
// The lowest RAM address used for IDs (pointers)
#ifndef SYSVIEW_RAM_BASE
#define SYSVIEW_RAM_BASE (0x10000000)
#endif
#ifndef SYSVIEW_SYSDESC0
#define SYSVIEW_SYSDESC0 "I#29=OS_ISR_Tick"
#endif
// Define as 1 to immediately start recording after initialization to catch system initialization.
#ifndef SYSVIEW_START_ON_INIT
#define SYSVIEW_START_ON_INIT 0
#endif
//#ifndef SYSVIEW_SYSDESC1
// #define SYSVIEW_SYSDESC1 ""
//#endif
//#ifndef SYSVIEW_SYSDESC2
// #define SYSVIEW_SYSDESC2 ""
//#endif
/*********************************************************************
*
* Defines, fixed
*
**********************************************************************
*/
//
// Core private timer
//
#define ARM_MP_BASE_ADDR (0x00A00000u)
#define CORE_PRIV_TIMER_BASE_ADDR (ARM_MP_BASE_ADDR + 0x0600u)
#define CORE_PRIV_TIMER_COUNT (*(volatile unsigned int*)(CORE_PRIV_TIMER_BASE_ADDR + 0x04u))
#define CORE_PRIV_TIMER_INT_ID (29u)
#define TIMER_INTERRUPT_PENDING() (OS_GIC_IsPending(CORE_PRIV_TIMER_INT_ID))
/*********************************************************************
*
* _cbSendSystemDesc()
*
* Function description
* Sends SystemView description strings.
*/
static void _cbSendSystemDesc(void) {
SEGGER_SYSVIEW_SendSysDesc("N=" SYSVIEW_APP_NAME ",O=embOS,D=" SYSVIEW_DEVICE_NAME );
#ifdef SYSVIEW_SYSDESC0
SEGGER_SYSVIEW_SendSysDesc(SYSVIEW_SYSDESC0);
#endif
#ifdef SYSVIEW_SYSDESC1
SEGGER_SYSVIEW_SendSysDesc(SYSVIEW_SYSDESC1);
#endif
#ifdef SYSVIEW_SYSDESC2
SEGGER_SYSVIEW_SendSysDesc(SYSVIEW_SYSDESC2);
#endif
}
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
void SEGGER_SYSVIEW_Conf(void) {
SEGGER_SYSVIEW_Init(SYSVIEW_TIMESTAMP_FREQ, SYSVIEW_CPU_FREQ,
&SYSVIEW_X_OS_TraceAPI, _cbSendSystemDesc);
SEGGER_SYSVIEW_SetRAMBase(SYSVIEW_RAM_BASE);
OS_TRACE_SetAPI(&embOS_TraceAPI_SYSVIEW); // Configure embOS to use SYSVIEW.
#if SYSVIEW_START_ON_INIT
SEGGER_SYSVIEW_Start(); // Start recording to catch system initialization.
#endif
}
/*********************************************************************
*
* SEGGER_SYSVIEW_X_GetTimestamp()
*
* Function description
* Returns the current timestamp in cycles using the system tick
* count and the SysTick counter.
* All parameters of the SysTick have to be known and are set via
* configuration defines on top of the file.
*
* Return value
* The current timestamp.
*
* Additional information
* SEGGER_SYSVIEW_X_GetTimestamp is always called when interrupts are
* disabled. Therefore locking here is not required.
*/
U32 SEGGER_SYSVIEW_X_GetTimestamp(void) {
U32 TickCount;
U32 Cycles;
//
// Get the cycles of the current system tick.
// Sample timer is down-counting, subtract the current value from the number of cycles per tick.
//
Cycles = OS_TIMER_RELOAD - CORE_PRIV_TIMER_COUNT;
//
// Get the system tick count.
//
TickCount = SEGGER_SYSVIEW_TickCnt;
//
// If a SysTick interrupt is pending, re-read timer and adjust result
//
if (TIMER_INTERRUPT_PENDING() != 0) {
TickCount++;
Cycles = OS_TIMER_RELOAD - CORE_PRIV_TIMER_COUNT;
}
Cycles += TickCount * OS_TIMER_RELOAD;
return Cycles;
}
/*********************************************************************
*
* SEGGER_SYSVIEW_X_GetInterruptId()
*/
U32 SEGGER_SYSVIEW_X_GetInterruptId(void) {
return SEGGER_SYSVIEW_InterruptId;
}
/*************************** End of file ****************************/

View File

@ -0,0 +1,102 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_Conf.h
Purpose : SEGGER SystemView configuration file.
Set defines which deviate from the defaults (see SEGGER_SYSVIEW_ConfDefaults.h) here.
Revision: $Rev: 17066 $
Additional information:
Required defines which must be set are:
SEGGER_SYSVIEW_GET_TIMESTAMP
SEGGER_SYSVIEW_GET_INTERRUPT_ID
For known compilers and cores, these might be set to good defaults
in SEGGER_SYSVIEW_ConfDefaults.h.
SystemView needs a (nestable) locking mechanism.
If not defined, the RTT locking mechanism is used,
which then needs to be properly configured.
*/
#ifndef SEGGER_SYSVIEW_CONF_H
#define SEGGER_SYSVIEW_CONF_H
/*********************************************************************
*
* Defines, configurable
*
**********************************************************************
*/
// The application name to be displayed in SystemViewer
#define SEGGER_SYSVIEW_APP_NAME "embOS start project"
// The target device name
#define SEGGER_SYSVIEW_DEVICE_NAME "nRF51"
//
// SystemCoreClock can be used in most CMSIS compatible projects.
// In non-CMSIS projects define SYSVIEW_CPU_FREQ directly.
//
extern unsigned int SystemCoreClock;
// Frequency of the timestamp
#define SEGGER_SYSVIEW_TIMESTAMP_FREQ (SystemCoreClock)
// System Frequency. SystemcoreClock is used in most CMSIS compatible projects.
#define SEGGER_SYSVIEW_CPU_FREQ (SystemCoreClock)
// The lowest RAM address used for IDs (pointers)
#define SEGGER_SYSVIEW_ID_BASE (0x20000000)
// Retrieve a system timestamp used for SystemView events.
#define SEGGER_SYSVIEW_GET_TIMESTAMP() SEGGER_SYSVIEW_X_GetTimestamp()
#endif // SEGGER_SYSVIEW_CONF_H
/*************************** End of file ****************************/

View File

@ -0,0 +1,164 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_Config_embOS_nRF51822.c
Purpose : Sample setup configuration of SystemView with embOS
on Nordic Semi nRF51 devices
which do neither have a cycle counter nor a SysTick.
Revision: $Rev: 12706 $
Additional information:
SEGGER_SYSVIEW_TickCnt must be incremented in the SysTick
handler before any SYSVIEW event is generated.
Example in embOS RTOSInit.c:
void SysTick_Handler(void) {
#if (OS_PROFILE != 0)
SEGGER_SYSVIEW_TickCnt++; // Increment SEGGER_SYSVIEW_TickCnt before calling OS_INT_EnterNestable().
#endif
OS_INT_EnterNestable();
OS_TICK_Handle();
OS_INT_LeaveNestable();
}
*/
#include "RTOS.h"
#include "SEGGER_SYSVIEW.h"
#include "SEGGER_SYSVIEW_embOS.h"
#include "nrf.h"
/*********************************************************************
*
* Local functions
*
**********************************************************************
*/
/*********************************************************************
*
* _cbSendSystemDesc()
*
* Function description
* Sends SystemView description strings.
*/
static void _cbSendSystemDesc(void) {
SEGGER_SYSVIEW_SendSysDesc("N=" SEGGER_SYSVIEW_APP_NAME ",O=embOS,D=" SEGGER_SYSVIEW_DEVICE_NAME );
#ifdef SEGGER_SYSVIEW_SYSDESC0
SEGGER_SYSVIEW_SendSysDesc(SEGGER_SYSVIEW_SYSDESC0);
#endif
#ifdef SEGGER_SYSVIEW_SYSDESC1
SEGGER_SYSVIEW_SendSysDesc(SEGGER_SYSVIEW_SYSDESC1);
#endif
#ifdef SEGGER_SYSVIEW_SYSDESC2
SEGGER_SYSVIEW_SendSysDesc(SEGGER_SYSVIEW_SYSDESC2);
#endif
}
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
/*********************************************************************
*
* SEGGER_SYSVIEW_Conf()
*
* Function description
* Configure and initialize SystemView and register it with embOS.
*
* Additional information
* If enabled, SEGGER_SYSVIEW_Conf() will also immediately start
* recording events with SystemView.
*/
void SEGGER_SYSVIEW_Conf(void) {
SEGGER_SYSVIEW_Init(SEGGER_SYSVIEW_TIMESTAMP_FREQ, SEGGER_SYSVIEW_CPU_FREQ,
&SYSVIEW_X_OS_TraceAPI, _cbSendSystemDesc);
OS_TRACE_SetAPI(&embOS_TraceAPI_SYSVIEW); // Configure embOS to use SYSVIEW.
#if SEGGER_SYSVIEW_START_ON_INIT
SEGGER_SYSVIEW_Start(); // Start recording to catch system initialization.
#endif
}
/*********************************************************************
*
* SEGGER_SYSVIEW_X_GetTimestamp()
*
* Function description
* Returns the current timestamp in cycles using the system tick
* count and the system timer counter.
* All parameters of the system timer have to be known and are set via
* configuration defines on top of the file.
*
* Return value
* The current timestamp.
*
* Additional information
* SEGGER_SYSVIEW_X_GetTimestamp is always called when interrupts are
* disabled. Therefore locking here is not required.
*/
U32 SEGGER_SYSVIEW_X_GetTimestamp(void) {
U32 TickCount;
U32 Cycles;
U32 CyclesPerTick;
CyclesPerTick = OS_INFO_GetTimerFreq() / OS_SysTimer_Settings.Config.IntFreq; // Int frequency and tick frequency are expected to be equal
TickCount = SEGGER_SYSVIEW_TickCnt;
//
// Get the cycles of the current system tick.
//
NRF_TIMER0->TASKS_CAPTURE[3] = 1;
Cycles = NRF_TIMER0->CC[3] - NRF_TIMER0->CC[0];
//
// Get the system tick count.
//
Cycles += TickCount * CyclesPerTick;
return Cycles;
}
/*************************** End of file ****************************/

View File

@ -0,0 +1,247 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_embOS.c
Purpose : Interface between embOS and System View.
Revision: $Rev: 22295 $
*/
#include "RTOS.h"
#include "SEGGER_SYSVIEW.h"
#include "SEGGER_RTT.h"
#include "SEGGER_SYSVIEW_embOS.h"
#if (OS_VERSION < 41201)
#error "SystemView is only supported in embOS V4.12a and later."
#endif
/*********************************************************************
*
* Local functions
*
**********************************************************************
*/
/*********************************************************************
*
* _cbSendTaskInfo()
*
* Function description
* Sends task information to SystemView
*/
static void _cbSendTaskInfo(const OS_TASK* pTask) {
SEGGER_SYSVIEW_TASKINFO Info;
OS_EnterRegion(); // No scheduling to make sure the task list does not change while we are transmitting it
memset(&Info, 0, sizeof(Info)); // Fill all elements with 0 to allow extending the structure in future version without breaking the code
Info.TaskID = (U32)pTask;
#if OS_TRACKNAME
Info.sName = pTask->Name;
#endif
Info.Prio = pTask->Priority;
#if OS_CHECKSTACK
Info.StackBase = (U32)pTask->pStackBot;
Info.StackSize = pTask->StackSize;
#endif
SEGGER_SYSVIEW_SendTaskInfo(&Info);
OS_LeaveRegion(); // No scheduling to make sure the task list does not change while we are transmitting it
}
/*********************************************************************
*
* _cbSendTaskList()
*
* Function description
* This function is part of the link between embOS and SYSVIEW.
* Called from SystemView when asked by the host, it uses SYSVIEW
* functions to send the entire task list to the host.
*/
static void _cbSendTaskList(void) {
OS_TASK* pTask;
OS_EnterRegion(); // No scheduling to make sure the task list does not change while we are transmitting it
for (pTask = OS_Global.pTask; pTask; pTask = pTask->pNext) {
_cbSendTaskInfo(pTask);
}
#if ((OS_VERSION >= 43800) && (OS_TRACKNAME != 0)) // Human readable object identifiers supported since embOS V4.38
{
OS_OBJNAME* p;
for (p = OS_pObjNameRoot; p != NULL; p = p->pNext) {
SEGGER_SYSVIEW_NameResource((OS_U32)p->pOSObjID, p->sName);
}
}
#endif
OS_LeaveRegion(); // No scheduling to make sure the task list does not change while we are transmitting it
}
/*********************************************************************
*
* _cbOnTaskCreate()
*
* Function description
* For embOS prior to V4.32 the cast to OS_U32 is necessary
*/
#if (OS_VERSION < 43200) // Work around different embOS Trace API function types prior to V4.32
static void _cbOnTaskCreate(unsigned int TaskId) {
SEGGER_SYSVIEW_OnTaskCreate((OS_U32)TaskId);
}
#else
#define _cbOnTaskCreate SEGGER_SYSVIEW_OnTaskCreate
#endif
/*********************************************************************
*
* _cbOnTaskStartExec()
*
* Function description
* For embOS prior to V4.32 the cast to OS_U32 is necessary
*/
#if (OS_VERSION < 43200) // Work around different embOS Trace API function types prior to V4.32
static void _cbOnTaskStartExec(unsigned int TaskId) {
SEGGER_SYSVIEW_OnTaskStartExec((OS_U32)TaskId);
}
#else
#define _cbOnTaskStartExec SEGGER_SYSVIEW_OnTaskStartExec
#endif
/*********************************************************************
*
* _cbOnTaskStartReady()
*
* Function description
* For embOS prior to V4.32 the cast to OS_U32 is necessary
*/
#if (OS_VERSION < 43200) // Work around different embOS Trace API function types prior to V4.32
static void _cbOnTaskStartReady(unsigned int TaskId) {
SEGGER_SYSVIEW_OnTaskStartReady((OS_U32)TaskId);
}
#else
#define _cbOnTaskStartReady SEGGER_SYSVIEW_OnTaskStartReady
#endif
/*********************************************************************
*
* _cbOnTaskStopReady()
*
* Function description
* For embOS prior to V4.32 the cast to OS_U32 is necessary
*/
#if (OS_VERSION < 43200) // Work around different embOS Trace API function types prior to V4.32
static void _cbOnTaskStopReady(unsigned int TaskId, unsigned int Reason) {
SEGGER_SYSVIEW_OnTaskStopReady((OS_U32)TaskId, Reason);
}
#else
#define _cbOnTaskStopReady SEGGER_SYSVIEW_OnTaskStopReady
#endif
/*********************************************************************
*
* _cbOnTaskTerminate()
*
* Function description
* For embOS prior to V4.32 the cast to OS_U32 is necessary
*/
#if (OS_VERSION < 43200) // Work around different embOS Trace API function types prior to V4.32
static void _cbOnTaskTerminate(unsigned int TaskId) {
SEGGER_SYSVIEW_OnTaskTerminate((OS_U32)TaskId);
}
#else
#define _cbOnTaskTerminate SEGGER_SYSVIEW_OnTaskTerminate
#endif
//
// embOS trace API that targets SYSVIEW
//
const OS_TRACE_API embOS_TraceAPI_SYSVIEW = {
//
// Specific Trace Events
//
SEGGER_SYSVIEW_RecordEnterISR, // void (*pfRecordEnterISR) (void);
SEGGER_SYSVIEW_RecordExitISR, // void (*pfRecordExitISR) (void);
SEGGER_SYSVIEW_RecordExitISRToScheduler, // void (*pfRecordExitISRToScheduler) (void);
_cbSendTaskInfo, // void (*pfRecordTaskInfo) (const OS_TASK* pTask);
_cbOnTaskCreate, // void (*pfRecordTaskCreate) (OS_U32 TaskId);
_cbOnTaskStartExec, // void (*pfRecordTaskStartExec) (OS_U32 TaskId);
SEGGER_SYSVIEW_OnTaskStopExec, // void (*pfRecordTaskStopExec) (void);
_cbOnTaskStartReady, // void (*pfRecordTaskStartReady) (OS_U32 TaskId);
_cbOnTaskStopReady, // void (*pfRecordTaskStopReady) (OS_U32 TaskId, unsigned Reason);
SEGGER_SYSVIEW_OnIdle, // void (*pfRecordIdle) (void);
//
// Generic Trace Event logging
//
SEGGER_SYSVIEW_RecordVoid, // void (*pfRecordVoid) (unsigned Id);
SEGGER_SYSVIEW_RecordU32, // void (*pfRecordU32) (unsigned Id, OS_U32 Para0);
SEGGER_SYSVIEW_RecordU32x2, // void (*pfRecordU32x2) (unsigned Id, OS_U32 Para0, OS_U32 Para1);
SEGGER_SYSVIEW_RecordU32x3, // void (*pfRecordU32x3) (unsigned Id, OS_U32 Para0, OS_U32 Para1, OS_U32 Para2);
SEGGER_SYSVIEW_RecordU32x4, // void (*pfRecordU32x4) (unsigned Id, OS_U32 Para0, OS_U32 Para1, OS_U32 Para2, OS_U32 Para3);
SEGGER_SYSVIEW_ShrinkId, // OS_U32 (*pfPtrToId) (OS_U32 Ptr);
#if (OS_VERSION >= 41400) // Tracing timer is supported since embOS V4.14
SEGGER_SYSVIEW_RecordEnterTimer, // void (*pfRecordEnterTimer) (OS_U32 TimerID);
SEGGER_SYSVIEW_RecordExitTimer, // void (*pfRecordExitTimer) (void);
#endif
#if (OS_VERSION >= 42400) // Tracing end of call supported since embOS V4.24
SEGGER_SYSVIEW_RecordEndCall, // void (*pfRecordEndCall) (unsigned int Id);
SEGGER_SYSVIEW_RecordEndCallU32, // void (*pfRecordEndCallReturnValue) (unsigned int Id, OS_U32 ReturnValue);
_cbOnTaskTerminate, // void (*pfRecordTaskTerminate) (OS_U32 TaskId);
SEGGER_SYSVIEW_RecordU32x5, // void (*pfRecordU32x5) (unsigned Id, OS_U32 Para0, OS_U32 Para1, OS_U32 Para2, OS_U32 Para3, OS_U32 Para4);
#endif
#if (OS_VERSION >= 43800) // Human readable object identifiers supported since embOS V4.38
SEGGER_SYSVIEW_NameResource, // void (*pfRecordObjName) (OS_U32 Id, OS_CONST_PTR char* Para0);
#endif
};
//
// Services provided to SYSVIEW by embOS
//
const SEGGER_SYSVIEW_OS_API SYSVIEW_X_OS_TraceAPI = {
OS_GetTime_us64,
_cbSendTaskList,
};
/*************************** End of file ****************************/

View File

@ -0,0 +1,69 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_embOS.h
Purpose : Interface between embOS and System View.
Revision: $Rev: 9599 $
*/
#ifndef SYSVIEW_EMBOS_H
#define SYSVIEW_EMBOS_H
#include "RTOS.h"
#include "SEGGER_SYSVIEW.h"
// embOS trace API that targets SYSVIEW
extern const OS_TRACE_API embOS_TraceAPI_SYSVIEW;
// Services provided to SYSVIEW by embOS
extern const SEGGER_SYSVIEW_OS_API SYSVIEW_X_OS_TraceAPI;
#endif
/*************************** End of file ****************************/

View File

@ -0,0 +1,116 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_Config_uCOSII.c
Purpose : Sample setup configuration of SystemView with Micrium
uC/OS-II.
Revision: $Rev: 9599 $
*/
#include "SEGGER_SYSVIEW.h"
#include "os.h"
#include "cpu_core.h"
#if (defined(OS_TRACE_EN) && (OS_TRACE_EN > 0u))
extern const SEGGER_SYSVIEW_OS_API SYSVIEW_X_OS_TraceAPI;
CPU_ERR local_err;
/*********************************************************************
*
* Defines, configurable
*
**********************************************************************
*/
// The application name to be displayed in SystemViewer
#define SYSVIEW_APP_NAME "ARM Cortex-M Demo"
// The target device name
#define SYSVIEW_DEVICE_NAME "Cortex-M Device"
// Frequency of the timestamp. Must match SEGGER_SYSVIEW_GET_TIMESTAMP in SEGGER_SYSVIEW_Conf.h
#define SYSVIEW_TIMESTAMP_FREQ (CPU_TS_TmrFreqGet(&local_err))
// System Frequency. SystemcoreClock is used in most CMSIS compatible projects.
#define SYSVIEW_CPU_FREQ (CPU_TS_TmrFreqGet(&local_err))
// The lowest RAM address used for IDs (pointers)
#define SYSVIEW_RAM_BASE (0x20000000)
/*********************************************************************
*
* _cbSendSystemDesc()
*
* Function description
* Sends SystemView description strings.
*/
static void _cbSendSystemDesc(void) {
SEGGER_SYSVIEW_SendSysDesc("N="SYSVIEW_APP_NAME",D="SYSVIEW_DEVICE_NAME",O=uCOS-II");
SEGGER_SYSVIEW_SendSysDesc("I#15=SysTick");
//
SYSVIEW_SendResourceList();
}
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
void SEGGER_SYSVIEW_Conf(void) {
SEGGER_SYSVIEW_Init(SYSVIEW_TIMESTAMP_FREQ, SYSVIEW_CPU_FREQ,
&SYSVIEW_X_OS_TraceAPI, _cbSendSystemDesc);
SEGGER_SYSVIEW_SetRAMBase(SYSVIEW_RAM_BASE);
}
#endif
/*************************** End of file ****************************/

View File

@ -0,0 +1,134 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_Config_uCOSII.c
Purpose : Sample setup configuration of SystemView with Micrium
uC/OS-II.
Revision: $Rev: 9599 $
*/
#include "SEGGER_SYSVIEW.h"
#include "os.h"
#include "cpu_core.h"
#include "bsp_sys.h"
#if (defined(OS_TRACE_EN) && (OS_TRACE_EN > 0u))
extern const SEGGER_SYSVIEW_OS_API SYSVIEW_X_OS_TraceAPI;
CPU_ERR local_err;
/*********************************************************************
*
* Defines, configurable
*
**********************************************************************
*/
// The application name to be displayed in SystemViewer
#define SYSVIEW_APP_NAME "Renesas RX Demo"
// The target device name
#define SYSVIEW_DEVICE_NAME "Renesas RX Device"
// Frequency of the timestamp. Must match SEGGER_SYSVIEW_GET_TIMESTAMP in SEGGER_SYSVIEW_Conf.h
#define SYSVIEW_TIMESTAMP_FREQ (CPU_TS_TmrFreqGet(&local_err))
// System Frequency. SystemcoreClock is used in most CMSIS compatible projects.
#define SYSVIEW_CPU_FREQ (BSP_SysPerClkFreqGet())
// The lowest RAM address used for IDs (pointers)
#define SYSVIEW_RAM_BASE (0)
U32 SEGGER_SYSVIEW_X_GetTimestamp(void) {
return (CPU_TS_Get32());
}
U32 SEGGER_SYSVIEW_X_GetInterruptId(void) {
U32 IntId;
__asm volatile ("mvfc PSW, %0 \t\n" // Load current PSW
"and #0x0F000000, %0 \t\n" // Clear all except IPL ([27:24])
"shlr #24, %0 \t\n" // Shift IPL to [3:0]
: "=r" (IntId) // Output result
: // Input
: // Clobbered list
);
return IntId;
}
/*********************************************************************
*
* _cbSendSystemDesc()
*
* Function description
* Sends SystemView description strings.
*/
static void _cbSendSystemDesc(void) {
SEGGER_SYSVIEW_SendSysDesc("N="SYSVIEW_APP_NAME",D="SYSVIEW_DEVICE_NAME",O=uCOS-II");
SEGGER_SYSVIEW_SendSysDesc("I#12=CMT0 Tmr IRQ (Tick)");
//
SYSVIEW_SendResourceList();
}
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
void SEGGER_SYSVIEW_Conf(void) {
SEGGER_SYSVIEW_Init(SYSVIEW_TIMESTAMP_FREQ, SYSVIEW_CPU_FREQ,
&SYSVIEW_X_OS_TraceAPI, _cbSendSystemDesc);
SEGGER_SYSVIEW_SetRAMBase(SYSVIEW_RAM_BASE);
}
#endif
/*************************** End of file ****************************/

View File

@ -0,0 +1,73 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
* ---------------
* uC/OS-II is provided in source form for FREE short-term evaluation, for educational use or
* for peaceful research. If you plan or intend to use uC/OS-II in a commercial application/
* product then, you need to contact Micrium to properly license uC/OS-II for its use in your
* application/product. We provide ALL the source code for your convenience and to help you
* experience uC/OS-II. The fact that the source is provided does NOT mean that you can use
* it commercially without paying a licensing fee.
*
* Knowledge of the source code may NOT be used to develop a similar product.
*
* Please help us continue to provide the embedded community with the finest software available.
* Your honesty is greatly appreciated.
*
* You can find our product's user manual, API reference, release notes and
* more information at https://doc.micrium.com.
* You can contact us at www.micrium.com.
************************************************************************************************************************
*/
#ifndef OS_CFG_TRACE_H
#define OS_CFG_TRACE_H
#define OS_CFG_TRACE_MAX_TASK 32u /* Maximum number of tasks to record. */
#define OS_CFG_TRACE_MAX_RESOURCES 128u /* Maximum number of combined kernel objects to record. */
#endif

View File

@ -0,0 +1,366 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_uCOSII.c
Purpose : Interface between Micrium uC/OS-II and SystemView.
Revision: $Rev: 9599 $
*/
#include <os_trace_events.h>
#ifndef SYSVIEW_MEMSET
#include <string.h>
#define SYSVIEW_MEMSET(p, v, n) memset(p, v, n)
#endif
#ifndef OS_CFG_TRACE_MAX_RESOURCES
#define OS_CFG_TRACE_MAX_RESOURCES 0
#endif
typedef struct SYSVIEW_UCOSII_TASK_STATUS SYSVIEW_UCOSII_TASK_STATUS;
struct SYSVIEW_UCOSII_TASK_STATUS {
U32 TaskID;
const char* OSTCBTaskName;
INT8U OSTCBPrio;
OS_STK* OSTCBStkBottom;
INT32U OSTCBStkSize;
};
typedef struct SYSVIEW_UCOSII_RESOURCE SYSVIEW_UCOSII_RESOURCE;
struct SYSVIEW_UCOSII_RESOURCE {
U32 ResourceId;
const char* sResource;
U32 Registered;
};
static SYSVIEW_UCOSII_TASK_STATUS _aTasks[OS_CFG_TRACE_MAX_TASK];
static unsigned _NumTasks;
#if OS_CFG_TRACE_MAX_RESOURCES > 0
static SYSVIEW_UCOSII_RESOURCE _aResources[OS_CFG_TRACE_MAX_RESOURCES];
static unsigned _NumResources;
#endif
/*********************************************************************
*
* _cbSendTaskList()
*
* Function description
* This function is part of the link between FreeRTOS and SYSVIEW.
* Called from SystemView when asked by the host, it uses SYSVIEW
* functions to send the entire task list to the host.
*/
static void _cbSendTaskList(void) {
unsigned n;
for (n = 0; n < _NumTasks; n++) {
SYSVIEW_SendTaskInfo((U32)_aTasks[n].TaskID, _aTasks[n].OSTCBTaskName, (unsigned)_aTasks[n].OSTCBPrio, (U32)_aTasks[n].OSTCBStkBottom, (unsigned)_aTasks[n].OSTCBStkSize);
}
}
/*********************************************************************
*
* _cbGetTime()
*
* Function description
* This function is part of the link between FreeRTOS and SYSVIEW.
* Called from SystemView when asked by the host, returns the
* current system time in micro seconds.
*/
static U64 _cbGetTime(void) {
INT32U Tick;
Tick = OSTimeGet();
return Tick * 1000;
}
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
/*********************************************************************
*
* SYSVIEW_TaskReady()
*
* Function description
* Record when a task is ready for execution.
*/
void SYSVIEW_TaskReady(U32 TaskID) {
if (TaskID != (U32)OSTCBPrioTbl[OS_TASK_IDLE_PRIO]) {
SEGGER_SYSVIEW_OnTaskStartReady(TaskID);
}
}
/*********************************************************************
*
* SYSVIEW_TaskSwitchedIn()
*
* Function description
* Record when a task starts/continues execution.
* If the idle task continues, record an on idle event.
*/
void SYSVIEW_TaskSwitchedIn(U32 TaskID) {
if (TaskID != (U32)OSTCBPrioTbl[OS_TASK_IDLE_PRIO]) {
SEGGER_SYSVIEW_OnTaskStartExec(TaskID);
} else {
SEGGER_SYSVIEW_OnIdle();
}
}
/*********************************************************************
*
* SYSVIEW_TaskSuspend()
*
* Function description
* Record when a task is suspended.
*/
void SYSVIEW_TaskSuspend(U32 TaskID) {
if (TaskID != (U32)OSTCBPrioTbl[OS_TASK_IDLE_PRIO]) {
SEGGER_SYSVIEW_OnTaskStopReady(TaskID, (1u << 2));
}
}
/*********************************************************************
*
* SYSVIEW_AddTask()
*
* Function description
* Add a task to the internal list and record its information.
*/
void SYSVIEW_AddTask(U32 TaskID, const char* OSTCBTaskName, INT8U OSTCBPrio, OS_STK* OSTCBStkBottom, INT32U OSTCBStkSize) {
if (TaskID != (U32)OSTCBPrioTbl[OS_TASK_IDLE_PRIO]) {
if (_NumTasks >= OS_CFG_TRACE_MAX_TASK) {
SEGGER_SYSVIEW_Warn("SYSTEMVIEW: Could not record task information. Maximum number of tasks reached.");
return;
}
_aTasks[_NumTasks].TaskID = TaskID;
_aTasks[_NumTasks].OSTCBTaskName = OSTCBTaskName;
_aTasks[_NumTasks].OSTCBPrio = OSTCBPrio;
_aTasks[_NumTasks].OSTCBStkBottom = OSTCBStkBottom;
_aTasks[_NumTasks].OSTCBStkSize = OSTCBStkSize;
_NumTasks++;
SYSVIEW_SendTaskInfo(TaskID, OSTCBTaskName, (unsigned)OSTCBPrio, (U32)OSTCBStkBottom, (unsigned)OSTCBStkSize);
}
}
/*********************************************************************
*
* SYSVIEW_UpdateTask()
*
* Function description
* Update a task in the internal list and record its information.
*/
void SYSVIEW_UpdateTask(U32 TaskID, const char* OSTCBTaskName, INT8U OSTCBPrio, OS_STK* OSTCBStkBottom, INT32U OSTCBStkSize) {
unsigned n;
if (TaskID != (U32)OSTCBPrioTbl[OS_TASK_IDLE_PRIO]) {
for (n = 0; n < _NumTasks; n++) {
if (_aTasks[n].TaskID == TaskID) {
break;
}
}
if (n < _NumTasks) {
_aTasks[n].OSTCBTaskName = OSTCBTaskName;
_aTasks[n].OSTCBPrio = OSTCBPrio;
_aTasks[n].OSTCBStkBottom = OSTCBStkBottom;
_aTasks[n].OSTCBStkSize = OSTCBStkSize;
SYSVIEW_SendTaskInfo(TaskID, OSTCBTaskName, (unsigned)OSTCBPrio, (U32)OSTCBStkBottom, (unsigned)OSTCBStkSize);
} else {
SYSVIEW_AddTask(TaskID, OSTCBTaskName, OSTCBPrio, OSTCBStkBottom, OSTCBStkSize);
}
}
}
/*********************************************************************
*
* SYSVIEW_SendTaskInfo()
*
* Function description
* Record task information.
*/
void SYSVIEW_SendTaskInfo(U32 TaskID, const char* sName, unsigned Prio, U32 StackBase, unsigned StackSize) {
SEGGER_SYSVIEW_TASKINFO TaskInfo;
//
// Fill all elements with 0 to allow extending the structure in future version without breaking the code
//
SYSVIEW_MEMSET(&TaskInfo, 0, sizeof(TaskInfo));
TaskInfo.TaskID = TaskID;
TaskInfo.sName = sName;
TaskInfo.Prio = Prio;
TaskInfo.StackBase = StackBase;
TaskInfo.StackSize = StackSize;
SEGGER_SYSVIEW_SendTaskInfo(&TaskInfo);
}
/*********************************************************************
*
* SYSVIEW_UpdateResource()
*
* Function description
* Update a kernel object in the internal list and record its information.
*/
void SYSVIEW_UpdateResource(U32 EventID, const char* OSEventName) {
unsigned n;
for (n = 0; n < _NumResources; n++) {
if (_aResources[n].ResourceId == EventID) {
break;
}
}
if (n < _NumResources) {
_aResources[n].sResource = OSEventName;
SEGGER_SYSVIEW_NameResource(_aResources[n].ResourceId, _aResources[n].sResource);
}
}
/*********************************************************************
*
* SYSVIEW_RecordU32x4()
*
* Function description
* Record an event with 4 parameters
*/
void SYSVIEW_RecordU32x4(unsigned Id, U32 Para0, U32 Para1, U32 Para2, U32 Para3) {
U8 aPacket[SEGGER_SYSVIEW_INFO_SIZE + 4 * SEGGER_SYSVIEW_QUANTA_U32];
U8* pPayload;
//
pPayload = SEGGER_SYSVIEW_PREPARE_PACKET(aPacket); // Prepare the packet for SystemView
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para0); // Add the first parameter to the packet
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para1); // Add the second parameter to the packet
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para2); // Add the third parameter to the packet
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para3); // Add the fourth parameter to the packet
//
SEGGER_SYSVIEW_SendPacket(&aPacket[0], pPayload, Id); // Send the packet
}
/*********************************************************************
*
* SYSVIEW_RecordU32x5()
*
* Function description
* Record an event with 5 parameters
*/
void SYSVIEW_RecordU32x5(unsigned Id, U32 Para0, U32 Para1, U32 Para2, U32 Para3, U32 Para4) {
U8 aPacket[SEGGER_SYSVIEW_INFO_SIZE + 5 * SEGGER_SYSVIEW_QUANTA_U32];
U8* pPayload;
//
pPayload = SEGGER_SYSVIEW_PREPARE_PACKET(aPacket); // Prepare the packet for SystemView
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para0); // Add the first parameter to the packet
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para1); // Add the second parameter to the packet
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para2); // Add the third parameter to the packet
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para3); // Add the fourth parameter to the packet
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para4); // Add the fifth parameter to the packet
//
SEGGER_SYSVIEW_SendPacket(&aPacket[0], pPayload, Id); // Send the packet
}
/*********************************************************************
*
* SYSVIEW_RecordU32Register()
*
* Function description
* Record an event with 1 parameter and register the resource to be
* sent in the system description.
*/
void SYSVIEW_RecordU32Register(unsigned EventId, U32 ResourceId, const char* sResource) {
SEGGER_SYSVIEW_NameResource(ResourceId, sResource);
SEGGER_SYSVIEW_RecordU32(EventId, SEGGER_SYSVIEW_ShrinkId(ResourceId));
#if OS_CFG_TRACE_MAX_RESOURCES > 0
if (_NumResources >= OS_CFG_TRACE_MAX_RESOURCES) {
SEGGER_SYSVIEW_Warn("SYSTEMVIEW: Could not register resource name. Maximum number of resources reached.");
return;
}
_aResources[_NumResources].ResourceId = ResourceId;
_aResources[_NumResources].sResource = sResource;
_aResources[_NumResources].Registered = 0;
_NumResources++;
#endif
}
void SYSVIEW_SendResourceList(void) {
#if OS_CFG_TRACE_MAX_RESOURCES > 0
unsigned int n;
for (n = 0; n < _NumResources; n++) {
if (_aResources[n].Registered == 0) {
SEGGER_SYSVIEW_NameResource(_aResources[n].ResourceId, _aResources[n].sResource);
_aResources[n].Registered = 1;
}
}
#endif
}
/*********************************************************************
*
* Public API structures
*
**********************************************************************
*/
// Callbacks provided to SYSTEMVIEW by FreeRTOS
const SEGGER_SYSVIEW_OS_API SYSVIEW_X_OS_TraceAPI = {
_cbGetTime,
_cbSendTaskList,
};
/*************************** End of file ****************************/

View File

@ -0,0 +1,505 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
* ---------------
* uC/OS-II is provided in source form for FREE short-term evaluation, for educational use or
* for peaceful research. If you plan or intend to use uC/OS-II in a commercial application/
* product then, you need to contact Micrium to properly license uC/OS-II for its use in your
* application/product. We provide ALL the source code for your convenience and to help you
* experience uC/OS-II. The fact that the source is provided does NOT mean that you can use
* it commercially without paying a licensing fee.
*
* Knowledge of the source code may NOT be used to develop a similar product.
*
* Please help us continue to provide the embedded community with the finest software available.
* Your honesty is greatly appreciated.
*
* You can find our product's user manual, API reference, release notes and
* more information at https://doc.micrium.com.
* You can contact us at www.micrium.com.
************************************************************************************************************************
*/
#include "SEGGER_SYSVIEW.h"
#include "ucos_ii.h"
#include "os_cfg_trace.h"
/*
************************************************************************************************************************
* uC/OS-II Trace Macros
************************************************************************************************************************
*/
#if (defined(OS_TRACE_EN) && (OS_TRACE_EN > 0u))
#define OS_TRACE_INIT() SEGGER_SYSVIEW_Conf()
#define OS_TRACE_START() SEGGER_SYSVIEW_Start()
#define OS_TRACE_STOP() SEGGER_SYSVIEW_Stop()
#else
#define OS_TRACE_INIT()
#define OS_TRACE_START()
#define OS_TRACE_STOP()
#endif
/*
************************************************************************************************************************
* uC/OS-II Trace fixed defines for SystemView
************************************************************************************************************************
*/
#if (defined(OS_TRACE_EN) && (OS_TRACE_EN > 0u))
#define OS_TRACE_ID_OFFSET (32u)
#define OS_TRACE_ID_TICK_INCREMENT ( 1u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_ISR_REGISTER ( 2u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_MBOX_CREATE ( 3u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_MBOX_DEL ( 4u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_MBOX_POST ( 5u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_MBOX_POST_OPT ( 6u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_MBOX_PEND ( 7u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_MUTEX_CREATE ( 8u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_MUTEX_DEL ( 9u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_MUTEX_POST (10u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_MUTEX_PEND (11u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_MUTEX_TASK_PRIO_INHERIT (12u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_MUTEX_TASK_PRIO_DISINHERIT (13u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_SEM_CREATE (14u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_SEM_DEL (15u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_SEM_POST (16u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_SEM_PEND (17u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_Q_CREATE (18u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_Q_DEL (19u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_Q_POST (20u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_Q_POST_FRONT (21u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_Q_POST_OPT (22u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_Q_PEND (23u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_FLAG_CREATE (24u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_FLAG_DEL (25u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_FLAG_POST (26u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_FLAG_PEND (27u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_MEM_CREATE (28u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_MEM_PUT (29u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_MEM_GET (30u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_TMR_CREATE (31u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_TMR_DEL (32u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_TMR_START (33u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_TMR_STOP (34u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_TMR_EXPIRED (35u + OS_TRACE_ID_OFFSET)
#endif
/*
************************************************************************************************************************
* uC/OS-II Trace Kernel-Related Macros
************************************************************************************************************************
*/
#if (defined(OS_TRACE_EN) && (OS_TRACE_EN > 0u))
#define OS_TRACE_TASK_CREATE(p_tcb) if (p_tcb != 0) { \
SEGGER_SYSVIEW_OnTaskCreate((U32)p_tcb); \
SYSVIEW_AddTask((U32)p_tcb, \
(const char *)(&(p_tcb->OSTCBTaskName[0])), \
p_tcb->OSTCBPrio, \
p_tcb->OSTCBStkBottom, \
p_tcb->OSTCBStkSize \
); \
}
#define OS_TRACE_TASK_NAME_SET(p_tcb) if (p_tcb != 0) { \
SYSVIEW_UpdateTask((U32)p_tcb, \
(const char *)(&(p_tcb->OSTCBTaskName[0])), \
p_tcb->OSTCBPrio, \
p_tcb->OSTCBStkBottom, \
p_tcb->OSTCBStkSize \
); \
}
#define OS_TRACE_TASK_READY(p_tcb) SYSVIEW_TaskReady((U32)p_tcb)
#define OS_TRACE_TASK_SWITCHED_IN(p_tcb) SYSVIEW_TaskSwitchedIn((U32)p_tcb)
#define OS_TRACE_TASK_DLY(dly_ticks)
#define OS_TRACE_TASK_SUSPEND(p_tcb)
#define OS_TRACE_TASK_SUSPENDED(p_tcb) SYSVIEW_TaskSuspend((U32)p_tcb)
#define OS_TRACE_TASK_RESUME(p_tcb) SYSVIEW_TaskReady((U32)p_tcb)
#define OS_TRACE_EVENT_NAME_SET(p_event, p_name) if (p_event != 0 && p_name != 0) { \
SYSVIEW_UpdateResource((U32)p_event, \
(const char *)(p_name)); \
}
#define OS_TRACE_ISR_BEGIN(isr_id)
#define OS_TRACE_ISR_END()
#define OS_TRACE_ISR_ENTER() SEGGER_SYSVIEW_RecordEnterISR()
#define OS_TRACE_ISR_EXIT() SEGGER_SYSVIEW_RecordExitISR()
#define OS_TRACE_ISR_EXIT_TO_SCHEDULER() SEGGER_SYSVIEW_RecordExitISRToScheduler()
/*
************************************************************************************************************************
* uC/OS-II Trace Simple Recorder Functions
************************************************************************************************************************
*/
#define OS_TRACE_TICK_INCREMENT(OSTime) SEGGER_SYSVIEW_RecordU32 (OS_TRACE_ID_TICK_INCREMENT, (U32)OSTime)
#define OS_TRACE_ISR_REGISTER(isr_id, isr_name, isr_prio) SEGGER_SYSVIEW_RecordU32x2(OS_TRACE_ID_ISR_REGISTER, (U32)isr_id, (U32)isr_prio)
#define OS_TRACE_MUTEX_TASK_PRIO_INHERIT(p_tcb, prio) SEGGER_SYSVIEW_RecordU32x2(OS_TRACE_ID_MUTEX_TASK_PRIO_INHERIT, SEGGER_SYSVIEW_ShrinkId((U32)p_tcb), (U32)prio);
#define OS_TRACE_MUTEX_TASK_PRIO_DISINHERIT(p_tcb, prio) SEGGER_SYSVIEW_RecordU32x2(OS_TRACE_ID_MUTEX_TASK_PRIO_DISINHERIT, SEGGER_SYSVIEW_ShrinkId((U32)p_tcb), (U32)prio);
#define OS_TRACE_TASK_DEL(p_tcb)
/*
************************************************************************************************************************
* uC/OS-II Trace Complex Recorder Functions
************************************************************************************************************************
*/
#define OS_TRACE_MBOX_CREATE(p_mbox, p_name) SYSVIEW_RecordU32Register(OS_TRACE_ID_MBOX_CREATE, ((U32)p_mbox), (const char *)p_name)
#define OS_TRACE_MUTEX_CREATE(p_mutex, p_name) SYSVIEW_RecordU32Register(OS_TRACE_ID_MUTEX_CREATE, ((U32)p_mutex), (const char *)p_name)
#define OS_TRACE_SEM_CREATE(p_sem, p_name) SYSVIEW_RecordU32Register(OS_TRACE_ID_SEM_CREATE, ((U32)p_sem), (const char *)p_name)
#define OS_TRACE_Q_CREATE(p_q, p_name) SYSVIEW_RecordU32Register(OS_TRACE_ID_Q_CREATE, ((U32)p_q), (const char *)p_name)
#define OS_TRACE_FLAG_CREATE(p_grp, p_name) SYSVIEW_RecordU32Register(OS_TRACE_ID_FLAG_CREATE, ((U32)p_grp), (const char *)p_name)
#define OS_TRACE_MEM_CREATE(p_mem) SYSVIEW_RecordU32Register(OS_TRACE_ID_MEM_CREATE, ((U32)p_mem), (const char *)"Mem Block")
#define OS_TRACE_TMR_CREATE(p_tmr, p_name) SYSVIEW_RecordU32Register(OS_TRACE_ID_TMR_CREATE, ((U32)p_tmr), (const char *)p_name)
/*
************************************************************************************************************************
* uC/OS-II Trace API Enter Functions
************************************************************************************************************************
*/
#if (defined(OS_TRACE_API_ENTER_EN) && (OS_TRACE_API_ENTER_EN > 0u))
#define OS_TRACE_MBOX_DEL_ENTER(p_mbox, opt) SEGGER_SYSVIEW_RecordU32x2(OS_TRACE_ID_MBOX_DEL, SEGGER_SYSVIEW_ShrinkId((U32)p_mbox), (U32)opt)
#define OS_TRACE_MBOX_POST_ENTER(p_mbox) SEGGER_SYSVIEW_RecordU32 (OS_TRACE_ID_MBOX_POST, SEGGER_SYSVIEW_ShrinkId((U32)p_mbox))
#define OS_TRACE_MBOX_POST_OPT_ENTER(p_mbox, opt) SEGGER_SYSVIEW_RecordU32x2(OS_TRACE_ID_MBOX_POST_OPT, SEGGER_SYSVIEW_ShrinkId((U32)p_mbox), (U32)opt)
#define OS_TRACE_MBOX_PEND_ENTER(p_mbox, timeout) SEGGER_SYSVIEW_RecordU32x2(OS_TRACE_ID_MBOX_PEND, SEGGER_SYSVIEW_ShrinkId((U32)p_mbox), (U32)timeout)
#define OS_TRACE_MUTEX_DEL_ENTER(p_mutex, opt) SEGGER_SYSVIEW_RecordU32x2(OS_TRACE_ID_MUTEX_DEL, SEGGER_SYSVIEW_ShrinkId((U32)p_mutex), (U32)opt)
#define OS_TRACE_MUTEX_POST_ENTER(p_mutex) SEGGER_SYSVIEW_RecordU32 (OS_TRACE_ID_MUTEX_POST, SEGGER_SYSVIEW_ShrinkId((U32)p_mutex))
#define OS_TRACE_MUTEX_PEND_ENTER(p_mutex, timeout) SEGGER_SYSVIEW_RecordU32x2(OS_TRACE_ID_MUTEX_PEND, SEGGER_SYSVIEW_ShrinkId((U32)p_mutex), (U32)timeout)
#define OS_TRACE_SEM_DEL_ENTER(p_sem, opt) SEGGER_SYSVIEW_RecordU32x2(OS_TRACE_ID_SEM_DEL, SEGGER_SYSVIEW_ShrinkId((U32)p_sem), (U32)opt)
#define OS_TRACE_SEM_POST_ENTER(p_sem) SEGGER_SYSVIEW_RecordU32 (OS_TRACE_ID_SEM_POST, SEGGER_SYSVIEW_ShrinkId((U32)p_sem))
#define OS_TRACE_SEM_PEND_ENTER(p_sem, timeout) SEGGER_SYSVIEW_RecordU32x2(OS_TRACE_ID_SEM_PEND, SEGGER_SYSVIEW_ShrinkId((U32)p_sem), (U32)timeout)
#define OS_TRACE_Q_DEL_ENTER(p_q, opt) SEGGER_SYSVIEW_RecordU32x2(OS_TRACE_ID_Q_DEL, SEGGER_SYSVIEW_ShrinkId((U32)p_q), (U32)opt)
#define OS_TRACE_Q_POST_ENTER(p_q) SEGGER_SYSVIEW_RecordU32 (OS_TRACE_ID_Q_POST, SEGGER_SYSVIEW_ShrinkId((U32)p_q))
#define OS_TRACE_Q_POST_FRONT_ENTER(p_q) SEGGER_SYSVIEW_RecordU32 (OS_TRACE_ID_Q_POST_FRONT, SEGGER_SYSVIEW_ShrinkId((U32)p_q))
#define OS_TRACE_Q_POST_OPT_ENTER(p_q, opt) SEGGER_SYSVIEW_RecordU32x2(OS_TRACE_ID_Q_POST_OPT, SEGGER_SYSVIEW_ShrinkId((U32)p_q), (U32)opt)
#define OS_TRACE_Q_PEND_ENTER(p_q, timeout) SEGGER_SYSVIEW_RecordU32x2(OS_TRACE_ID_Q_PEND, SEGGER_SYSVIEW_ShrinkId((U32)p_q), (U32)timeout)
#define OS_TRACE_FLAG_DEL_ENTER(p_grp, opt) SEGGER_SYSVIEW_RecordU32x2(OS_TRACE_ID_FLAG_DEL, SEGGER_SYSVIEW_ShrinkId((U32)p_grp), (U32)opt)
#define OS_TRACE_FLAG_POST_ENTER(p_grp, flags, opt) SEGGER_SYSVIEW_RecordU32x3(OS_TRACE_ID_FLAG_POST, SEGGER_SYSVIEW_ShrinkId((U32)p_grp), (U32)flags, (U32)opt)
#define OS_TRACE_FLAG_PEND_ENTER(p_grp, flags, timeout, opt) SYSVIEW_RecordU32x4 (OS_TRACE_ID_FLAG_PEND, SEGGER_SYSVIEW_ShrinkId((U32)p_grp), (U32)flags, (U32)timeout, (U32)opt)
#define OS_TRACE_MEM_PUT_ENTER(p_mem, p_blk) SEGGER_SYSVIEW_RecordU32x2(OS_TRACE_ID_MEM_PUT, SEGGER_SYSVIEW_ShrinkId((U32)p_mem), (U32)p_blk)
#define OS_TRACE_MEM_GET_ENTER(p_mem) SEGGER_SYSVIEW_RecordU32 (OS_TRACE_ID_MEM_GET, SEGGER_SYSVIEW_ShrinkId((U32)p_mem))
#define OS_TRACE_TMR_DEL_ENTER(p_tmr) SEGGER_SYSVIEW_RecordU32 (OS_TRACE_ID_TMR_DEL, SEGGER_SYSVIEW_ShrinkId((U32)p_tmr))
#define OS_TRACE_TMR_START_ENTER(p_tmr) SEGGER_SYSVIEW_RecordU32 (OS_TRACE_ID_TMR_START, SEGGER_SYSVIEW_ShrinkId((U32)p_tmr))
#define OS_TRACE_TMR_STOP_ENTER(p_tmr) SEGGER_SYSVIEW_RecordU32 (OS_TRACE_ID_TMR_STOP, SEGGER_SYSVIEW_ShrinkId((U32)p_tmr))
#define OS_TRACE_TMR_EXPIRED(p_tmr) SEGGER_SYSVIEW_RecordU32 (OS_TRACE_ID_TMR_EXPIRED, SEGGER_SYSVIEW_ShrinkId((U32)p_tmr))
#else
#define OS_TRACE_MBOX_DEL_ENTER(p_mbox, opt)
#define OS_TRACE_MBOX_POST_ENTER(p_mbox)
#define OS_TRACE_MBOX_POST_OPT_ENTER(p_mbox, opt)
#define OS_TRACE_MBOX_PEND_ENTER(p_mbox, timeout)
#define OS_TRACE_MUTEX_DEL_ENTER(p_mutex, opt)
#define OS_TRACE_MUTEX_POST_ENTER(p_mutex)
#define OS_TRACE_MUTEX_PEND_ENTER(p_mutex, timeout)
#define OS_TRACE_SEM_DEL_ENTER(p_sem, opt)
#define OS_TRACE_SEM_POST_ENTER(p_sem)
#define OS_TRACE_SEM_PEND_ENTER(p_sem, timeout)
#define OS_TRACE_Q_DEL_ENTER(p_q, opt)
#define OS_TRACE_Q_POST_ENTER(p_q)
#define OS_TRACE_Q_POST_FRONT_ENTER(p_q)
#define OS_TRACE_Q_POST_OPT_ENTER(p_q, opt)
#define OS_TRACE_Q_PEND_ENTER(p_q, timeout)
#define OS_TRACE_FLAG_DEL_ENTER(p_grp, opt)
#define OS_TRACE_FLAG_POST_ENTER(p_grp, flags, opt)
#define OS_TRACE_FLAG_PEND_ENTER(p_grp, flags, timeout, opt)
#define OS_TRACE_MEM_PUT_ENTER(p_mem, p_blk)
#define OS_TRACE_MEM_GET_ENTER(p_mem)
#define OS_TRACE_TMR_DEL_ENTER(p_tmr)
#define OS_TRACE_TMR_START_ENTER(p_tmr)
#define OS_TRACE_TMR_STOP_ENTER(p_tmr)
#define OS_TRACE_TMR_EXPIRED(p_tmr)
#endif
/*
************************************************************************************************************************
* uC/OS-II Trace API Exit Functions
************************************************************************************************************************
*/
#if (defined(OS_TRACE_API_EXIT_EN) && (OS_TRACE_API_EXIT_EN > 0u))
#define OS_TRACE_MBOX_DEL_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallU32(OS_TRACE_ID_MBOX_DEL, RetVal)
#define OS_TRACE_MBOX_POST_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallU32(OS_TRACE_ID_MBOX_POST, RetVal)
#define OS_TRACE_MBOX_POST_OPT_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallU32(OS_TRACE_ID_MBOX_POST_OPT, RetVal)
#define OS_TRACE_MBOX_PEND_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallU32(OS_TRACE_ID_MBOX_PEND, RetVal)
#define OS_TRACE_MUTEX_DEL_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallU32(OS_TRACE_ID_MUTEX_DEL, RetVal)
#define OS_TRACE_MUTEX_POST_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallU32(OS_TRACE_ID_MUTEX_POST, RetVal)
#define OS_TRACE_MUTEX_PEND_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallU32(OS_TRACE_ID_MUTEX_PEND, RetVal)
#define OS_TRACE_SEM_DEL_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallU32(OS_TRACE_ID_SEM_DEL, RetVal)
#define OS_TRACE_SEM_POST_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallU32(OS_TRACE_ID_SEM_POST, RetVal)
#define OS_TRACE_SEM_PEND_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallU32(OS_TRACE_ID_SEM_PEND, RetVal)
#define OS_TRACE_Q_DEL_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallU32(OS_TRACE_ID_Q_DEL, RetVal)
#define OS_TRACE_Q_POST_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallU32(OS_TRACE_ID_Q_POST, RetVal)
#define OS_TRACE_Q_POST_FRONT_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallU32(OS_TRACE_ID_Q_POST_FRONT, RetVal)
#define OS_TRACE_Q_POST_OPT_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallU32(OS_TRACE_ID_Q_POST_OPT, RetVal)
#define OS_TRACE_Q_PEND_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallU32(OS_TRACE_ID_Q_PEND, RetVal)
#define OS_TRACE_FLAG_DEL_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallU32(OS_TRACE_ID_FLAG_DEL, RetVal)
#define OS_TRACE_FLAG_POST_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallU32(OS_TRACE_ID_FLAG_POST, RetVal)
#define OS_TRACE_FLAG_PEND_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallU32(OS_TRACE_ID_FLAG_PEND, RetVal)
#define OS_TRACE_MEM_PUT_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallU32(OS_TRACE_ID_MEM_PUT, RetVal)
#define OS_TRACE_MEM_GET_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallU32(OS_TRACE_ID_MEM_GET, RetVal)
#define OS_TRACE_TMR_DEL_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallU32(OS_TRACE_ID_TMR_DEL, RetVal)
#define OS_TRACE_TMR_START_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallU32(OS_TRACE_ID_TMR_START, RetVal)
#define OS_TRACE_TMR_STOP_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallU32(OS_TRACE_ID_TMR_STOP, RetVal)
#else
#define OS_TRACE_MBOX_DEL_EXIT(RetVal)
#define OS_TRACE_MBOX_POST_EXIT(RetVal)
#define OS_TRACE_MBOX_POST_OPT_EXIT(RetVal)
#define OS_TRACE_MBOX_PEND_EXIT(RetVal)
#define OS_TRACE_MUTEX_DEL_EXIT(RetVal)
#define OS_TRACE_MUTEX_POST_EXIT(RetVal)
#define OS_TRACE_MUTEX_PEND_EXIT(RetVal)
#define OS_TRACE_SEM_DEL_EXIT(RetVal)
#define OS_TRACE_SEM_POST_EXIT(RetVal)
#define OS_TRACE_SEM_PEND_EXIT(RetVal)
#define OS_TRACE_Q_DEL_EXIT(RetVal)
#define OS_TRACE_Q_POST_EXIT(RetVal)
#define OS_TRACE_Q_POST_FRONT_EXIT(RetVal)
#define OS_TRACE_Q_POST_OPT_EXIT(RetVal)
#define OS_TRACE_Q_PEND_EXIT(RetVal)
#define OS_TRACE_FLAG_DEL_EXIT(RetVal)
#define OS_TRACE_FLAG_POST_EXIT(RetVal)
#define OS_TRACE_FLAG_PEND_EXIT(RetVal)
#define OS_TRACE_MEM_PUT_EXIT(RetVal)
#define OS_TRACE_MEM_GET_EXIT(RetVal)
#define OS_TRACE_TMR_DEL_EXIT(RetVal)
#define OS_TRACE_TMR_START_EXIT(RetVal)
#define OS_TRACE_TMR_STOP_EXIT(RetVal)
#endif
/*
************************************************************************************************************************
* uC/OS-II Trace Unused Macros (other recorders)
************************************************************************************************************************
*/
#define OS_TRACE_MUTEX_DEL(p_mutex)
#define OS_TRACE_MUTEX_POST(p_mutex)
#define OS_TRACE_MUTEX_PEND(p_mutex)
#define OS_TRACE_SEM_DEL(p_sem)
#define OS_TRACE_SEM_POST(p_sem)
#define OS_TRACE_SEM_PEND(p_sem)
#define OS_TRACE_Q_DEL(p_q)
#define OS_TRACE_Q_POST(p_q)
#define OS_TRACE_Q_PEND(p_q)
#define OS_TRACE_FLAG_DEL(p_grp)
#define OS_TRACE_FLAG_POST(p_grp)
#define OS_TRACE_FLAG_PEND(p_grp)
#define OS_TRACE_MEM_PUT(p_mem)
#define OS_TRACE_MEM_GET(p_mem)
#define OS_TRACE_MUTEX_POST_FAILED(p_mutex)
#define OS_TRACE_MUTEX_PEND_FAILED(p_mutex)
#define OS_TRACE_MUTEX_PEND_BLOCK(p_mutex)
#define OS_TRACE_TASK_CREATE_FAILED(p_tcb)
#define OS_TRACE_SEM_POST_FAILED(p_sem)
#define OS_TRACE_SEM_PEND_FAILED(p_sem)
#define OS_TRACE_SEM_PEND_BLOCK(p_sem)
#define OS_TRACE_Q_POST_FAILED(p_q)
#define OS_TRACE_Q_PEND_FAILED(p_q)
#define OS_TRACE_Q_PEND_BLOCK(p_q)
#define OS_TRACE_FLAG_POST_FAILED(p_grp)
#define OS_TRACE_FLAG_PEND_FAILED(p_grp)
#define OS_TRACE_FLAG_PEND_BLOCK(p_grp)
#define OS_TRACE_MEM_PUT_FAILED(p_mem)
#define OS_TRACE_MEM_GET_FAILED(p_mem)
#define OS_TRACE_TASK_PRIO_CHANGE(p_tcb, prio)
#else /* End of OS_TRACE_EN > 0 */
#define OS_TRACE_TICK_INCREMENT(OSTickCtr)
#define OS_TRACE_TASK_CREATE(p_tcb)
#define OS_TRACE_TASK_CREATE_FAILED(p_tcb)
#define OS_TRACE_TASK_DEL(p_tcb)
#define OS_TRACE_TASK_READY(p_tcb)
#define OS_TRACE_TASK_SWITCHED_IN(p_tcb)
#define OS_TRACE_TASK_DLY(dly_ticks)
#define OS_TRACE_TASK_SUSPEND(p_tcb)
#define OS_TRACE_TASK_SUSPENDED(p_tcb)
#define OS_TRACE_TASK_RESUME(p_tcb)
#define OS_TRACE_ISR_BEGIN(isr_id)
#define OS_TRACE_ISR_END()
#define OS_TRACE_ISR_ENTER()
#define OS_TRACE_ISR_EXIT()
#define OS_TRACE_ISR_EXIT_TO_SCHEDULER()
#define OS_TRACE_MUTEX_CREATE(p_mutex, p_name)
#define OS_TRACE_MUTEX_DEL(p_mutex)
#define OS_TRACE_MUTEX_POST(p_mutex)
#define OS_TRACE_MUTEX_POST_FAILED(p_mutex)
#define OS_TRACE_MUTEX_PEND(p_mutex)
#define OS_TRACE_MUTEX_PEND_FAILED(p_mutex)
#define OS_TRACE_MUTEX_PEND_BLOCK(p_mutex)
#define OS_TRACE_MUTEX_TASK_PRIO_INHERIT(p_tcb, prio)
#define OS_TRACE_MUTEX_TASK_PRIO_DISINHERIT(p_tcb, prio)
#define OS_TRACE_SEM_CREATE(p_sem, p_name)
#define OS_TRACE_SEM_DEL(p_sem)
#define OS_TRACE_SEM_POST(p_sem)
#define OS_TRACE_SEM_POST_FAILED(p_sem)
#define OS_TRACE_SEM_PEND(p_sem)
#define OS_TRACE_SEM_PEND_FAILED(p_sem)
#define OS_TRACE_SEM_PEND_BLOCK(p_sem)
#define OS_TRACE_Q_CREATE(p_q, p_name)
#define OS_TRACE_Q_DEL(p_q)
#define OS_TRACE_Q_POST(p_q)
#define OS_TRACE_Q_POST_FAILED(p_q)
#define OS_TRACE_Q_PEND(p_q)
#define OS_TRACE_Q_PEND_FAILED(p_q)
#define OS_TRACE_Q_PEND_BLOCK(p_q)
#define OS_TRACE_FLAG_CREATE(p_grp, p_name)
#define OS_TRACE_FLAG_DEL(p_grp)
#define OS_TRACE_FLAG_POST(p_grp)
#define OS_TRACE_FLAG_POST_FAILED(p_grp)
#define OS_TRACE_FLAG_PEND(p_grp)
#define OS_TRACE_FLAG_PEND_FAILED(p_grp)
#define OS_TRACE_FLAG_PEND_BLOCK(p_grp)
#define OS_TRACE_MEM_CREATE(p_mem)
#define OS_TRACE_MEM_PUT(p_mem)
#define OS_TRACE_MEM_PUT_FAILED(p_mem)
#define OS_TRACE_MEM_GET(p_mem)
#define OS_TRACE_MEM_GET_FAILED(p_mem)
#define OS_TRACE_TMR_CREATE(p_tmr, p_name)
#define OS_TRACE_TASK_PRIO_CHANGE(p_tcb, prio)
#define OS_TRACE_MBOX_DEL_ENTER(p_mbox, opt)
#define OS_TRACE_MBOX_POST_ENTER(p_mbox)
#define OS_TRACE_MBOX_POST_OPT_ENTER(p_mbox, opt)
#define OS_TRACE_MBOX_PEND_ENTER(p_mbox, timeout)
#define OS_TRACE_MUTEX_DEL_ENTER(p_mutex, opt)
#define OS_TRACE_MUTEX_POST_ENTER(p_mutex)
#define OS_TRACE_MUTEX_PEND_ENTER(p_mutex, timeout)
#define OS_TRACE_SEM_DEL_ENTER(p_sem, opt)
#define OS_TRACE_SEM_POST_ENTER(p_sem)
#define OS_TRACE_SEM_PEND_ENTER(p_sem, timeout)
#define OS_TRACE_Q_DEL_ENTER(p_q, opt)
#define OS_TRACE_Q_POST_ENTER(p_q)
#define OS_TRACE_Q_POST_FRONT_ENTER(p_q)
#define OS_TRACE_Q_POST_OPT_ENTER(p_q, opt)
#define OS_TRACE_Q_PEND_ENTER(p_q, timeout)
#define OS_TRACE_FLAG_DEL_ENTER(p_grp, opt)
#define OS_TRACE_FLAG_POST_ENTER(p_grp, flags, opt)
#define OS_TRACE_FLAG_PEND_ENTER(p_grp, flags, timeout, opt)
#define OS_TRACE_MEM_PUT_ENTER(p_mem, p_blk)
#define OS_TRACE_MEM_GET_ENTER(p_mem)
#define OS_TRACE_TMR_DEL_ENTER(p_tmr)
#define OS_TRACE_TMR_START_ENTER(p_tmr)
#define OS_TRACE_TMR_STOP_ENTER(p_tmr)
#define OS_TRACE_TMR_EXPIRED(p_tmr)
#define OS_TRACE_MBOX_DEL_EXIT(RetVal)
#define OS_TRACE_MBOX_POST_EXIT(RetVal)
#define OS_TRACE_MBOX_POST_OPT_EXIT(RetVal)
#define OS_TRACE_MBOX_PEND_EXIT(RetVal)
#define OS_TRACE_MUTEX_DEL_EXIT(RetVal)
#define OS_TRACE_MUTEX_POST_EXIT(RetVal)
#define OS_TRACE_MUTEX_PEND_EXIT(RetVal)
#define OS_TRACE_SEM_DEL_EXIT(RetVal)
#define OS_TRACE_SEM_POST_EXIT(RetVal)
#define OS_TRACE_SEM_PEND_EXIT(RetVal)
#define OS_TRACE_Q_DEL_EXIT(RetVal)
#define OS_TRACE_Q_POST_EXIT(RetVal)
#define OS_TRACE_Q_POST_FRONT_EXIT(RetVal)
#define OS_TRACE_Q_POST_OPT_EXIT(RetVal)
#define OS_TRACE_Q_PEND_EXIT(RetVal)
#define OS_TRACE_FLAG_DEL_EXIT(RetVal)
#define OS_TRACE_FLAG_POST_EXIT(RetVal)
#define OS_TRACE_FLAG_PEND_EXIT(RetVal)
#define OS_TRACE_MEM_PUT_EXIT(RetVal)
#define OS_TRACE_MEM_GET_EXIT(RetVal)
#define OS_TRACE_TMR_DEL_EXIT(RetVal)
#define OS_TRACE_TMR_START_EXIT(RetVal)
#define OS_TRACE_TMR_STOP_EXIT(RetVal)
#endif
/*
************************************************************************************************************************
* API Functions
************************************************************************************************************************
*/
#ifdef __cplusplus
extern "C" {
#endif
void SYSVIEW_TaskReady (U32 TaskID);
void SYSVIEW_TaskSwitchedIn (U32 TaskID);
void SYSVIEW_TaskSuspend (U32 TaskID);
void SYSVIEW_AddTask (U32 TaskID, const char* OSTCBTaskName, INT8U OSTCBPrio, OS_STK* OSTCBStkBottom, INT32U OSTCBStkSize);
void SYSVIEW_UpdateTask (U32 TaskID, const char* OSTCBTaskName, INT8U OSTCBPrio, OS_STK* OSTCBStkBottom, INT32U OSTCBStkSize);
void SYSVIEW_UpdateResource (U32 EventID, const char* OSEventName);
void SYSVIEW_SendTaskInfo (U32 TaskID, const char* sName, unsigned Prio, U32 StackBase, unsigned StackSize);
void SYSVIEW_RecordU32x4 (unsigned Id, U32 Para0, U32 Para1, U32 Para2, U32 Para3);
void SYSVIEW_RecordU32x5 (unsigned Id, U32 Para0, U32 Para1, U32 Para2, U32 Para3, U32 Para4);
void SYSVIEW_RecordU32Register(unsigned EventId, U32 ResourceId, const char* sResource);
void SYSVIEW_SendResourceList (void);
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,110 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_Config_uCOSIII.c
Purpose : Sample setup configuration of SystemView with Micrium
uC/OS-III.
Revision: $Rev: 9599 $
*/
#include "SEGGER_SYSVIEW.h"
#include "os.h"
#include "bsp_clock.h"
extern const SEGGER_SYSVIEW_OS_API SYSVIEW_X_OS_TraceAPI;
/*********************************************************************
*
* Defines, configurable
*
**********************************************************************
*/
// The application name to be displayed in SystemViewer
#define SYSVIEW_APP_NAME "ARM Cortex-M Demo"
// The target device name
#define SYSVIEW_DEVICE_NAME "Cortex-M Device"
// Frequency of the timestamp. Must match SEGGER_SYSVIEW_GET_TIMESTAMP in SEGGER_SYSVIEW_Conf.h
#define SYSVIEW_TIMESTAMP_FREQ (BSP_ClkFreqGet(BSP_CLK_ID_SYSCLK))
// System Frequency. SystemcoreClock is used in most CMSIS compatible projects.
#define SYSVIEW_CPU_FREQ (BSP_ClkFreqGet(BSP_CLK_ID_SYSCLK))
// The lowest RAM address used for IDs (pointers)
#define SYSVIEW_RAM_BASE (0x20000000)
/*********************************************************************
*
* _cbSendSystemDesc()
*
* Function description
* Sends SystemView description strings.
*/
static void _cbSendSystemDesc(void) {
SEGGER_SYSVIEW_SendSysDesc("N="SYSVIEW_APP_NAME",D="SYSVIEW_DEVICE_NAME",O=uCOS-III");
SEGGER_SYSVIEW_SendSysDesc("I#15=SysTick");
//
SYSVIEW_SendResourceList();
}
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
void SEGGER_SYSVIEW_Conf(void) {
SEGGER_SYSVIEW_Init(SYSVIEW_TIMESTAMP_FREQ, SYSVIEW_CPU_FREQ,
&SYSVIEW_X_OS_TraceAPI, _cbSendSystemDesc);
SEGGER_SYSVIEW_SetRAMBase(SYSVIEW_RAM_BASE);
}
/*************************** End of file ****************************/

View File

@ -0,0 +1,130 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_Config_uCOSIII.c
Purpose : Sample setup configuration of SystemView with Micrium
uC/OS-III.
Revision: $Rev: 9599 $
*/
#include "SEGGER_SYSVIEW.h"
#include "os.h"
#include "cpu.h"
#include "bsp_sys.h"
extern const SEGGER_SYSVIEW_OS_API SYSVIEW_X_OS_TraceAPI;
CPU_ERR local_err;
/*********************************************************************
*
* Defines, configurable
*
**********************************************************************
*/
// The application name to be displayed in SystemViewer
#define SYSVIEW_APP_NAME "Renesas RX Demo"
// The target device name
#define SYSVIEW_DEVICE_NAME "Renesas RX Device"
// Frequency of the timestamp. Must match SEGGER_SYSVIEW_GET_TIMESTAMP in SEGGER_SYSVIEW_Conf.h
#define SYSVIEW_TIMESTAMP_FREQ (CPU_TS_TmrFreqGet(&local_err))
// System Frequency. SystemcoreClock is used in most CMSIS compatible projects.
#define SYSVIEW_CPU_FREQ (BSP_SysPerClkFreqGet())
// The lowest RAM address used for IDs (pointers)
#define SYSVIEW_RAM_BASE (0)
U32 SEGGER_SYSVIEW_X_GetTimestamp(void) {
return (CPU_TS_Get32());
}
U32 SEGGER_SYSVIEW_X_GetInterruptId(void) {
U32 IntId;
__asm volatile ("mvfc PSW, %0 \t\n" // Load current PSW
"and #0x0F000000, %0 \t\n" // Clear all except IPL ([27:24])
"shlr #24, %0 \t\n" // Shift IPL to [3:0]
: "=r" (IntId) // Output result
: // Input
: // Clobbered list
);
return IntId;
}
/*********************************************************************
*
* _cbSendSystemDesc()
*
* Function description
* Sends SystemView description strings.
*/
static void _cbSendSystemDesc(void) {
SEGGER_SYSVIEW_SendSysDesc("N="SYSVIEW_APP_NAME",D="SYSVIEW_DEVICE_NAME",O=uCOS-III");
SEGGER_SYSVIEW_SendSysDesc("I#12=CMT0 Tmr IRQ (Tick)");
//
SYSVIEW_SendResourceList();
}
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
void SEGGER_SYSVIEW_Conf(void) {
SEGGER_SYSVIEW_Init(SYSVIEW_TIMESTAMP_FREQ, SYSVIEW_CPU_FREQ,
&SYSVIEW_X_OS_TraceAPI, _cbSendSystemDesc);
SEGGER_SYSVIEW_SetRAMBase(SYSVIEW_RAM_BASE);
}
/*************************** End of file ****************************/

View File

@ -0,0 +1,62 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : os_cfg_trace.h
Purpose : Minimal trace configuration file for Micrium uC/OS-III
with SystemView.
Revision: $Rev: 9599 $
*/
#ifndef OS_CFG_TRACE_H
#define OS_CFG_TRACE_H
#define OS_CFG_TRACE_MAX_TASK 16u
#define OS_CFG_TRACE_MAX_RESOURCES 16u
#endif // OS_CFG_TRACE_H

View File

@ -0,0 +1,345 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_uCOSIII.c
Purpose : Interface between Micrium uC/OS-III and SystemView.
Revision: $Rev: 9599 $
*/
#include <os_trace_events.h>
#ifndef SYSVIEW_MEMSET
#include <string.h>
#define SYSVIEW_MEMSET(p, v, n) memset(p, v, n)
#endif
#ifndef OS_CFG_TRACE_MAX_RESOURCES
#define OS_CFG_TRACE_MAX_RESOURCES 0
#endif
typedef struct SYSVIEW_UCOSIII_TASK_STATUS SYSVIEW_UCOSIII_TASK_STATUS;
struct SYSVIEW_UCOSIII_TASK_STATUS {
U32 TaskID;
const char* NamePtr;
OS_PRIO Prio;
CPU_STK* StkBasePtr;
CPU_STK_SIZE StkSize;
};
typedef struct SYSVIEW_UCOSIII_RESOURCE SYSVIEW_UCOSIII_RESOURCE;
struct SYSVIEW_UCOSIII_RESOURCE {
U32 ResourceId;
const char* sResource;
U32 Registered;
};
static SYSVIEW_UCOSIII_TASK_STATUS _aTasks[OS_CFG_TRACE_MAX_TASK];
static unsigned _NumTasks;
#if OS_CFG_TRACE_MAX_RESOURCES > 0
static SYSVIEW_UCOSIII_RESOURCE _aResources[OS_CFG_TRACE_MAX_RESOURCES];
static unsigned _NumResources;
#endif
/*********************************************************************
*
* _cbSendTaskList()
*
* Function description
* This function is part of the link between FreeRTOS and SYSVIEW.
* Called from SystemView when asked by the host, it uses SYSVIEW
* functions to send the entire task list to the host.
*/
static void _cbSendTaskList(void) {
unsigned n;
for (n = 0; n < _NumTasks; n++) {
SYSVIEW_SendTaskInfo((U32)_aTasks[n].TaskID, _aTasks[n].NamePtr, (unsigned)_aTasks[n].Prio, (U32)_aTasks[n].StkBasePtr, (unsigned)_aTasks[n].StkSize);
}
}
/*********************************************************************
*
* _cbGetTime()
*
* Function description
* This function is part of the link between FreeRTOS and SYSVIEW.
* Called from SystemView when asked by the host, returns the
* current system time in micro seconds.
*/
static U64 _cbGetTime(void) {
OS_ERR Err;
OS_TICK Tick;
Tick = OSTimeGet(&Err);
if (Err != OS_ERR_NONE) {
Tick = 0;
}
return Tick * 1000;
}
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
/*********************************************************************
*
* SYSVIEW_TaskReady()
*
* Function description
* Record when a task is ready for execution.
*/
void SYSVIEW_TaskReady(U32 TaskID) {
if (TaskID != (U32)&OSIdleTaskTCB) {
SEGGER_SYSVIEW_OnTaskStartReady(TaskID);
}
}
/*********************************************************************
*
* SYSVIEW_TaskSwitchedIn()
*
* Function description
* Record when a task starts/continues execution.
* If the idle task continues, record an on idle event.
*/
void SYSVIEW_TaskSwitchedIn(U32 TaskID) {
if (TaskID != (U32)&OSIdleTaskTCB) {
SEGGER_SYSVIEW_OnTaskStartExec(TaskID);
} else {
SEGGER_SYSVIEW_OnIdle();
}
}
/*********************************************************************
*
* SYSVIEW_TaskSuspend()
*
* Function description
* Record when a task is suspended.
*/
void SYSVIEW_TaskSuspend(U32 TaskID) {
if (TaskID != (U32)&OSIdleTaskTCB) {
SEGGER_SYSVIEW_OnTaskStopReady(TaskID, (1u << 2));
}
}
/*********************************************************************
*
* SYSVIEW_AddTask()
*
* Function description
* Add a task to the internal list and record its information.
*/
void SYSVIEW_AddTask(U32 TaskID, const char* NamePtr, OS_PRIO Prio, CPU_STK* StkBasePtr, CPU_STK_SIZE StkSize) {
if (TaskID != (U32)&OSIdleTaskTCB) {
if (_NumTasks >= OS_CFG_TRACE_MAX_TASK) {
SEGGER_SYSVIEW_Warn("SYSTEMVIEW: Could not record task information. Maximum number of tasks reached.");
return;
}
_aTasks[_NumTasks].TaskID = TaskID;
_aTasks[_NumTasks].NamePtr = NamePtr;
_aTasks[_NumTasks].Prio = Prio;
_aTasks[_NumTasks].StkBasePtr = StkBasePtr;
_aTasks[_NumTasks].StkSize = StkSize;
_NumTasks++;
SYSVIEW_SendTaskInfo(TaskID, NamePtr, (unsigned)Prio, (U32)StkBasePtr, (unsigned)StkSize);
}
}
/*********************************************************************
*
* SYSVIEW_UpdateTask()
*
* Function description
* Update a task in the internal list and record its information.
*/
void SYSVIEW_UpdateTask(U32 TaskID, const char* NamePtr, OS_PRIO Prio, CPU_STK* StkBasePtr, CPU_STK_SIZE StkSize) {
unsigned n;
if (TaskID != (U32)&OSIdleTaskTCB) {
for (n = 0; n < _NumTasks; n++) {
if (_aTasks[n].TaskID == TaskID) {
break;
}
}
if (n < _NumTasks) {
_aTasks[n].NamePtr = NamePtr;
_aTasks[n].Prio = Prio;
_aTasks[n].StkBasePtr = StkBasePtr;
_aTasks[n].StkSize = StkSize;
SYSVIEW_SendTaskInfo(TaskID, NamePtr, (unsigned)Prio, (U32)StkBasePtr, (unsigned)StkSize);
} else {
SYSVIEW_AddTask(TaskID, NamePtr, Prio, StkBasePtr, StkSize);
}
}
}
/*********************************************************************
*
* SYSVIEW_SendTaskInfo()
*
* Function description
* Record task information.
*/
void SYSVIEW_SendTaskInfo(U32 TaskID, const char* sName, unsigned Prio, U32 StackBase, unsigned StackSize) {
SEGGER_SYSVIEW_TASKINFO TaskInfo;
//
// Fill all elements with 0 to allow extending the structure in future version without breaking the code
//
SYSVIEW_MEMSET(&TaskInfo, 0, sizeof(TaskInfo));
TaskInfo.TaskID = TaskID;
TaskInfo.sName = sName;
TaskInfo.Prio = Prio;
TaskInfo.StackBase = StackBase;
TaskInfo.StackSize = StackSize;
SEGGER_SYSVIEW_SendTaskInfo(&TaskInfo);
}
/*********************************************************************
*
* SYSVIEW_RecordU32x4()
*
* Function description
* Record an event with 4 parameters
*/
void SYSVIEW_RecordU32x4(unsigned Id, U32 Para0, U32 Para1, U32 Para2, U32 Para3) {
U8 aPacket[SEGGER_SYSVIEW_INFO_SIZE + 4 * SEGGER_SYSVIEW_QUANTA_U32];
U8* pPayload;
//
pPayload = SEGGER_SYSVIEW_PREPARE_PACKET(aPacket); // Prepare the packet for SystemView
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para0); // Add the first parameter to the packet
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para1); // Add the second parameter to the packet
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para2); // Add the third parameter to the packet
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para3); // Add the fourth parameter to the packet
//
SEGGER_SYSVIEW_SendPacket(&aPacket[0], pPayload, Id); // Send the packet
}
/*********************************************************************
*
* SYSVIEW_RecordU32x5()
*
* Function description
* Record an event with 5 parameters
*/
void SYSVIEW_RecordU32x5(unsigned Id, U32 Para0, U32 Para1, U32 Para2, U32 Para3, U32 Para4) {
U8 aPacket[SEGGER_SYSVIEW_INFO_SIZE + 5 * SEGGER_SYSVIEW_QUANTA_U32];
U8* pPayload;
//
pPayload = SEGGER_SYSVIEW_PREPARE_PACKET(aPacket); // Prepare the packet for SystemView
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para0); // Add the first parameter to the packet
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para1); // Add the second parameter to the packet
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para2); // Add the third parameter to the packet
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para3); // Add the fourth parameter to the packet
pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para4); // Add the fifth parameter to the packet
//
SEGGER_SYSVIEW_SendPacket(&aPacket[0], pPayload, Id); // Send the packet
}
/*********************************************************************
*
* SYSVIEW_RecordU32Register()
*
* Function description
* Record an event with 1 parameter and register the resource to be
* sent in the system description.
*/
void SYSVIEW_RecordU32Register(unsigned EventId, U32 ResourceId, const char* sResource) {
SEGGER_SYSVIEW_NameResource(ResourceId, sResource);
SEGGER_SYSVIEW_RecordU32(EventId, SEGGER_SYSVIEW_ShrinkId(ResourceId));
#if OS_CFG_TRACE_MAX_RESOURCES > 0
if (_NumResources >= OS_CFG_TRACE_MAX_RESOURCES) {
SEGGER_SYSVIEW_Warn("SYSTEMVIEW: Could not register resource name. Maximum number of resources reached.");
return;
}
_aResources[_NumResources].ResourceId = ResourceId;
_aResources[_NumResources].sResource = sResource;
_aResources[_NumResources].Registered = 0;
_NumResources++;
#endif
}
void SYSVIEW_SendResourceList(void) {
#if OS_CFG_TRACE_MAX_RESOURCES > 0
unsigned int n;
for (n = 0; n < _NumResources; n++) {
if (_aResources[n].Registered == 0) {
SEGGER_SYSVIEW_NameResource(_aResources[n].ResourceId, _aResources[n].sResource);
_aResources[n].Registered = 1;
}
}
#endif
}
/*********************************************************************
*
* Public API structures
*
**********************************************************************
*/
// Callbacks provided to SYSTEMVIEW by FreeRTOS
const SEGGER_SYSVIEW_OS_API SYSVIEW_X_OS_TraceAPI = {
_cbGetTime,
_cbSendTaskList,
};
/*************************** End of file ****************************/

View File

@ -0,0 +1,460 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2021 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.30 *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : os_trace.h
Purpose : Interface header for Micrium uC/OS-III and SystemView.
Revision: $Rev: 9599 $
*/
#include "SEGGER_SYSVIEW.h"
#include "os.h"
#include "os_cfg_trace.h"
/*
************************************************************************************************************************
* uC/OS-III Trace Macros
************************************************************************************************************************
*/
#if (defined(OS_CFG_TRACE_EN) && (OS_CFG_TRACE_EN > 0u))
#define OS_TRACE_INIT() SEGGER_SYSVIEW_Conf()
#define OS_TRACE_START() SEGGER_SYSVIEW_Start()
#define OS_TRACE_STOP() SEGGER_SYSVIEW_Stop()
#else
#define OS_TRACE_INIT()
#define OS_TRACE_START()
#define OS_TRACE_STOP()
#endif
/*
************************************************************************************************************************
* uC/OS-III Trace fixed defines for SystemView
************************************************************************************************************************
*/
#if (defined(OS_CFG_TRACE_EN) && (OS_CFG_TRACE_EN > 0u))
#define OS_TRACE_ID_OFFSET (32u)
#define OS_TRACE_ID_TICK_INCREMENT ( 1u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_ISR_REGISTER ( 2u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_TASK_MSG_Q_CREATE ( 3u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_TASK_MSG_Q_POST ( 4u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_TASK_MSG_Q_PEND ( 5u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_TASK_SEM_CREATE ( 6u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_TASK_SEM_POST ( 7u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_TASK_SEM_PEND ( 8u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_MUTEX_CREATE ( 9u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_MUTEX_DEL (10u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_MUTEX_POST (11u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_MUTEX_PEND (12u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_MUTEX_TASK_PRIO_INHERIT (13u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_MUTEX_TASK_PRIO_DISINHERIT (14u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_SEM_CREATE (15u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_SEM_DEL (16u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_SEM_POST (17u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_SEM_PEND (18u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_Q_CREATE (19u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_Q_DEL (20u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_Q_POST (21u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_Q_PEND (22u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_FLAG_CREATE (23u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_FLAG_DEL (24u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_FLAG_POST (25u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_FLAG_PEND (26u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_MEM_CREATE (27u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_MEM_PUT (28u + OS_TRACE_ID_OFFSET)
#define OS_TRACE_ID_MEM_GET (29u + OS_TRACE_ID_OFFSET)
#endif
/*
************************************************************************************************************************
* uC/OS-III Trace Kernel-Related Macros
************************************************************************************************************************
*/
#if (defined(OS_CFG_TRACE_EN) && (OS_CFG_TRACE_EN > 0u))
#define OS_TRACE_TASK_CREATE(p_tcb) if (p_tcb != 0) { \
SEGGER_SYSVIEW_OnTaskCreate((U32)p_tcb); \
SYSVIEW_AddTask((U32)p_tcb, \
&(p_tcb->NamePtr[0]), \
p_tcb->Prio, \
p_tcb->StkBasePtr, \
p_tcb->StkSize \
); \
}
#define OS_TRACE_TASK_READY(p_tcb) SYSVIEW_TaskReady((U32)p_tcb)
#define OS_TRACE_TASK_SWITCHED_IN(p_tcb) SYSVIEW_TaskSwitchedIn((U32)p_tcb)
#define OS_TRACE_TASK_DLY(dly_ticks)
#define OS_TRACE_TASK_SUSPEND(p_tcb)
#define OS_TRACE_TASK_SUSPENDED(p_tcb) SYSVIEW_TaskSuspend((U32)p_tcb)
#define OS_TRACE_TASK_RESUME(p_tcb) SYSVIEW_TaskReady((U32)p_tcb)
#define OS_TRACE_ISR_BEGIN(isr_id)
#define OS_TRACE_ISR_END()
#define OS_TRACE_ISR_ENTER() SEGGER_SYSVIEW_RecordEnterISR()
#define OS_TRACE_ISR_EXIT() SEGGER_SYSVIEW_RecordExitISR()
#define OS_TRACE_ISR_EXIT_TO_SCHEDULER() SEGGER_SYSVIEW_RecordExitISRToScheduler()
/*
************************************************************************************************************************
* uC/OS-III Trace Simple Recorder Functions
************************************************************************************************************************
*/
#define OS_TRACE_TICK_INCREMENT(OSTickCtr) SEGGER_SYSVIEW_RecordU32 (OS_TRACE_ID_TICK_INCREMENT, (U32)OSTickCtr)
#define OS_TRACE_ISR_REGISTER(isr_id, isr_name, isr_prio) SEGGER_SYSVIEW_RecordU32x2(OS_TRACE_ID_ISR_REGISTER, (U32)isr_id, (U32)isr_prio)
#define OS_TRACE_MUTEX_TASK_PRIO_INHERIT(p_tcb, prio) SEGGER_SYSVIEW_RecordU32x2(OS_TRACE_ID_MUTEX_TASK_PRIO_INHERIT, SEGGER_SYSVIEW_ShrinkId((U32)p_tcb), (U32)prio);
#define OS_TRACE_MUTEX_TASK_PRIO_DISINHERIT(p_tcb, prio) SEGGER_SYSVIEW_RecordU32x2(OS_TRACE_ID_MUTEX_TASK_PRIO_DISINHERIT, SEGGER_SYSVIEW_ShrinkId((U32)p_tcb), (U32)prio);
#define OS_TRACE_TASK_DEL(p_tcb)
/*
************************************************************************************************************************
* uC/OS-III Trace Complex Recorder Functions
************************************************************************************************************************
*/
#define OS_TRACE_MUTEX_CREATE(p_mutex, p_name) SYSVIEW_RecordU32Register(OS_TRACE_ID_MUTEX_CREATE, ((U32)p_mutex), p_name)
#define OS_TRACE_TASK_MSG_Q_CREATE(p_msg_q, p_name) SYSVIEW_RecordU32Register(OS_TRACE_ID_TASK_MSG_Q_CREATE, ((U32)p_msg_q), p_name)
#define OS_TRACE_TASK_SEM_CREATE(p_tcb, p_name) SYSVIEW_RecordU32Register(OS_TRACE_ID_TASK_SEM_CREATE, ((U32)p_tcb), p_name)
#define OS_TRACE_SEM_CREATE(p_sem, p_name) SYSVIEW_RecordU32Register(OS_TRACE_ID_SEM_CREATE, ((U32)p_sem), p_name)
#define OS_TRACE_Q_CREATE(p_q, p_name) SYSVIEW_RecordU32Register(OS_TRACE_ID_Q_CREATE, ((U32)p_q), p_name)
#define OS_TRACE_FLAG_CREATE(p_grp, p_name) SYSVIEW_RecordU32Register(OS_TRACE_ID_FLAG_CREATE, ((U32)p_grp), p_name)
#define OS_TRACE_MEM_CREATE(p_mem, p_name) SYSVIEW_RecordU32Register(OS_TRACE_ID_MEM_CREATE, ((U32)p_mem), p_name)
/*
************************************************************************************************************************
* uC/OS-III Trace API Enter Functions
************************************************************************************************************************
*/
#if (defined(OS_CFG_TRACE_API_ENTER_EN) && (OS_CFG_TRACE_API_ENTER_EN > 0u))
#define OS_TRACE_MUTEX_DEL_ENTER(p_mutex, opt) SEGGER_SYSVIEW_RecordU32x2(OS_TRACE_ID_MUTEX_DEL, SEGGER_SYSVIEW_ShrinkId((U32)p_mutex), (U32)opt)
#define OS_TRACE_MUTEX_POST_ENTER(p_mutex, opt) SEGGER_SYSVIEW_RecordU32x2(OS_TRACE_ID_MUTEX_POST, SEGGER_SYSVIEW_ShrinkId((U32)p_mutex), (U32)opt)
#define OS_TRACE_MUTEX_PEND_ENTER(p_mutex, timeout, opt, p_ts) SEGGER_SYSVIEW_RecordU32x3(OS_TRACE_ID_MUTEX_PEND, SEGGER_SYSVIEW_ShrinkId((U32)p_mutex), (U32)timeout, (U32)opt)
#define OS_TRACE_TASK_MSG_Q_POST_ENTER(p_msg_q, p_void, msg_size, opt) SEGGER_SYSVIEW_RecordU32x3(OS_TRACE_ID_TASK_MSG_Q_POST, SEGGER_SYSVIEW_ShrinkId((U32)p_msg_q), (U32)msg_size, (U32)opt)
#define OS_TRACE_TASK_MSG_Q_PEND_ENTER(p_msg_q, timeout, opt, p_msg_size, p_ts) SEGGER_SYSVIEW_RecordU32x3(OS_TRACE_ID_TASK_MSG_Q_PEND, SEGGER_SYSVIEW_ShrinkId((U32)p_msg_q), (U32)timeout, (U32)opt)
#define OS_TRACE_TASK_SEM_POST_ENTER(p_tcb, opt) SEGGER_SYSVIEW_RecordU32x2(OS_TRACE_ID_TASK_SEM_POST, SEGGER_SYSVIEW_ShrinkId((U32)p_tcb), (U32)opt)
#define OS_TRACE_TASK_SEM_PEND_ENTER(p_tcb, timeout, opt, p_ts) SEGGER_SYSVIEW_RecordU32x3(OS_TRACE_ID_TASK_SEM_PEND, SEGGER_SYSVIEW_ShrinkId((U32)p_tcb), (U32)timeout, (U32)opt)
#define OS_TRACE_SEM_DEL_ENTER(p_sem, opt) SEGGER_SYSVIEW_RecordU32x2(OS_TRACE_ID_SEM_DEL, SEGGER_SYSVIEW_ShrinkId((U32)p_sem), (U32)opt)
#define OS_TRACE_SEM_POST_ENTER(p_sem, opt) SEGGER_SYSVIEW_RecordU32x2(OS_TRACE_ID_SEM_POST, SEGGER_SYSVIEW_ShrinkId((U32)p_sem), (U32)opt)
#define OS_TRACE_SEM_PEND_ENTER(p_sem, timeout, opt, p_ts) SEGGER_SYSVIEW_RecordU32x3(OS_TRACE_ID_SEM_PEND, SEGGER_SYSVIEW_ShrinkId((U32)p_sem), (U32)timeout, (U32)opt)
#define OS_TRACE_Q_DEL_ENTER(p_q, opt) SEGGER_SYSVIEW_RecordU32x2(OS_TRACE_ID_Q_DEL, SEGGER_SYSVIEW_ShrinkId((U32)p_q), (U32)opt)
#define OS_TRACE_Q_POST_ENTER(p_q, p_void, msg_size, opt) SEGGER_SYSVIEW_RecordU32x3(OS_TRACE_ID_Q_POST, SEGGER_SYSVIEW_ShrinkId((U32)p_q), (U32)msg_size, (U32)opt)
#define OS_TRACE_Q_PEND_ENTER(p_q, timeout, opt, p_msg_size, p_ts) SEGGER_SYSVIEW_RecordU32x3(OS_TRACE_ID_Q_PEND, SEGGER_SYSVIEW_ShrinkId((U32)p_q), (U32)timeout, (U32)opt)
#define OS_TRACE_FLAG_DEL_ENTER(p_grp, opt) SEGGER_SYSVIEW_RecordU32x2(OS_TRACE_ID_FLAG_DEL, SEGGER_SYSVIEW_ShrinkId((U32)p_grp), (U32)opt)
#define OS_TRACE_FLAG_POST_ENTER(p_grp, flags, opt) SEGGER_SYSVIEW_RecordU32x3(OS_TRACE_ID_FLAG_POST, SEGGER_SYSVIEW_ShrinkId((U32)p_grp), (U32)flags, (U32)opt)
#define OS_TRACE_FLAG_PEND_ENTER(p_grp, flags, timeout, opt, p_ts) SYSVIEW_RecordU32x4 (OS_TRACE_ID_FLAG_PEND, SEGGER_SYSVIEW_ShrinkId((U32)p_grp), (U32)flags, (U32)timeout, (U32)opt)
#define OS_TRACE_MEM_PUT_ENTER(p_mem, p_blk) SEGGER_SYSVIEW_RecordU32x2(OS_TRACE_ID_MEM_PUT, SEGGER_SYSVIEW_ShrinkId((U32)p_mem), (U32)p_blk)
#define OS_TRACE_MEM_GET_ENTER(p_mem) SEGGER_SYSVIEW_RecordU32 (OS_TRACE_ID_MEM_GET, SEGGER_SYSVIEW_ShrinkId((U32)p_mem))
#else
#define OS_TRACE_MUTEX_DEL_ENTER(p_mutex, opt)
#define OS_TRACE_MUTEX_POST_ENTER(p_mutex, opt)
#define OS_TRACE_MUTEX_PEND_ENTER(p_mutex, timeout, opt, p_ts)
#define OS_TRACE_TASK_MSG_Q_POST_ENTER(p_msg_q, p_void, msg_size, opt)
#define OS_TRACE_TASK_MSG_Q_PEND_ENTER(p_msg_q, timeout, opt, p_msg_size, p_ts)
#define OS_TRACE_TASK_SEM_POST_ENTER(p_tcb, opt)
#define OS_TRACE_TASK_SEM_PEND_ENTER(p_tcb, timeout, opt, p_ts)
#define OS_TRACE_SEM_DEL_ENTER(p_sem, opt)
#define OS_TRACE_SEM_POST_ENTER(p_sem, opt)
#define OS_TRACE_SEM_PEND_ENTER(p_sem, timeout, opt, p_ts)
#define OS_TRACE_Q_DEL_ENTER(p_q, opt)
#define OS_TRACE_Q_POST_ENTER(p_q, p_void, msg_size, opt)
#define OS_TRACE_Q_PEND_ENTER(p_q, timeout, opt, p_msg_size, p_ts)
#define OS_TRACE_FLAG_DEL_ENTER(p_grp, opt)
#define OS_TRACE_FLAG_POST_ENTER(p_grp, flags, opt)
#define OS_TRACE_FLAG_PEND_ENTER(p_grp, flags, timeout, opt, p_ts)
#define OS_TRACE_MEM_PUT_ENTER(p_mem, p_blk)
#define OS_TRACE_MEM_GET_ENTER(p_mem)
#endif
/*
************************************************************************************************************************
* uC/OS-III Trace API Exit Functions
************************************************************************************************************************
*/
#if (defined(OS_CFG_TRACE_API_EXIT_EN) && (OS_CFG_TRACE_API_EXIT_EN > 0u))
#define OS_TRACE_MUTEX_DEL_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallU32(OS_TRACE_ID_MUTEX_DEL, RetVal)
#define OS_TRACE_MUTEX_POST_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallU32(OS_TRACE_ID_MUTEX_POST, RetVal)
#define OS_TRACE_MUTEX_PEND_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallU32(OS_TRACE_ID_MUTEX_PEND, RetVal)
#define OS_TRACE_TASK_MSG_Q_POST_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallU32(OS_TRACE_ID_TASK_MSG_Q_POST, RetVal)
#define OS_TRACE_TASK_MSG_Q_PEND_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallU32(OS_TRACE_ID_TASK_MSG_Q_PEND, RetVal)
#define OS_TRACE_TASK_SEM_POST_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallU32(OS_TRACE_ID_TASK_SEM_POST, RetVal)
#define OS_TRACE_TASK_SEM_PEND_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallU32(OS_TRACE_ID_TASK_SEM_PEND, RetVal)
#define OS_TRACE_SEM_DEL_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallU32(OS_TRACE_ID_SEM_DEL, RetVal)
#define OS_TRACE_SEM_POST_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallU32(OS_TRACE_ID_SEM_POST, RetVal)
#define OS_TRACE_SEM_PEND_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallU32(OS_TRACE_ID_SEM_PEND, RetVal)
#define OS_TRACE_Q_DEL_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallU32(OS_TRACE_ID_Q_DEL, RetVal)
#define OS_TRACE_Q_POST_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallU32(OS_TRACE_ID_Q_POST, RetVal)
#define OS_TRACE_Q_PEND_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallU32(OS_TRACE_ID_Q_PEND, RetVal)
#define OS_TRACE_FLAG_DEL_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallU32(OS_TRACE_ID_FLAG_DEL, RetVal)
#define OS_TRACE_FLAG_POST_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallU32(OS_TRACE_ID_FLAG_POST, RetVal)
#define OS_TRACE_FLAG_PEND_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallU32(OS_TRACE_ID_FLAG_PEND, RetVal)
#define OS_TRACE_MEM_PUT_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallU32(OS_TRACE_ID_MEM_PUT, RetVal)
#define OS_TRACE_MEM_GET_EXIT(RetVal) SEGGER_SYSVIEW_RecordEndCallU32(OS_TRACE_ID_MEM_GET, RetVal)
#else
#define OS_TRACE_MUTEX_DEL_EXIT(RetVal)
#define OS_TRACE_MUTEX_POST_EXIT(RetVal)
#define OS_TRACE_MUTEX_PEND_EXIT(RetVal)
#define OS_TRACE_TASK_MSG_Q_POST_EXIT(RetVal)
#define OS_TRACE_TASK_MSG_Q_PEND_EXIT(RetVal)
#define OS_TRACE_TASK_SEM_POST_EXIT(RetVal)
#define OS_TRACE_TASK_SEM_PEND_EXIT(RetVal)
#define OS_TRACE_SEM_DEL_EXIT(RetVal)
#define OS_TRACE_SEM_POST_EXIT(RetVal)
#define OS_TRACE_SEM_PEND_EXIT(RetVal)
#define OS_TRACE_Q_DEL_EXIT(RetVal)
#define OS_TRACE_Q_POST_EXIT(RetVal)
#define OS_TRACE_Q_PEND_EXIT(RetVal)
#define OS_TRACE_FLAG_DEL_EXIT(RetVal)
#define OS_TRACE_FLAG_POST_EXIT(RetVal)
#define OS_TRACE_FLAG_PEND_EXIT(RetVal)
#define OS_TRACE_MEM_PUT_EXIT(RetVal)
#define OS_TRACE_MEM_GET_EXIT(RetVal)
#endif
/*
************************************************************************************************************************
* uC/OS-III Trace Unused Macros (other recorders)
************************************************************************************************************************
*/
#define OS_TRACE_MUTEX_DEL(p_mutex)
#define OS_TRACE_MUTEX_POST(p_mutex)
#define OS_TRACE_MUTEX_PEND(p_mutex)
#define OS_TRACE_TASK_MSG_Q_POST(p_msg_q)
#define OS_TRACE_TASK_MSG_Q_PEND(p_msg_q)
#define OS_TRACE_TASK_SEM_POST(p_tcb)
#define OS_TRACE_TASK_SEM_PEND(p_tcb)
#define OS_TRACE_SEM_DEL(p_sem)
#define OS_TRACE_SEM_POST(p_sem)
#define OS_TRACE_SEM_PEND(p_sem)
#define OS_TRACE_Q_DEL(p_q)
#define OS_TRACE_Q_POST(p_q)
#define OS_TRACE_Q_PEND(p_q)
#define OS_TRACE_FLAG_DEL(p_grp)
#define OS_TRACE_FLAG_POST(p_grp)
#define OS_TRACE_FLAG_PEND(p_grp)
#define OS_TRACE_MEM_PUT(p_mem)
#define OS_TRACE_MEM_GET(p_mem)
#define OS_TRACE_MUTEX_POST_FAILED(p_mutex)
#define OS_TRACE_MUTEX_PEND_FAILED(p_mutex)
#define OS_TRACE_MUTEX_PEND_BLOCK(p_mutex)
#define OS_TRACE_TASK_CREATE_FAILED(p_tcb)
#define OS_TRACE_TASK_MSG_Q_POST_FAILED(p_msg_q)
#define OS_TRACE_TASK_MSG_Q_PEND_FAILED(p_msg_q)
#define OS_TRACE_TASK_MSG_Q_PEND_BLOCK(p_msg_q)
#define OS_TRACE_TASK_SEM_POST_FAILED(p_tcb)
#define OS_TRACE_TASK_SEM_PEND_FAILED(p_tcb)
#define OS_TRACE_TASK_SEM_PEND_BLOCK(p_tcb)
#define OS_TRACE_SEM_POST_FAILED(p_sem)
#define OS_TRACE_SEM_PEND_FAILED(p_sem)
#define OS_TRACE_SEM_PEND_BLOCK(p_sem)
#define OS_TRACE_Q_POST_FAILED(p_q)
#define OS_TRACE_Q_PEND_FAILED(p_q)
#define OS_TRACE_Q_PEND_BLOCK(p_q)
#define OS_TRACE_FLAG_POST_FAILED(p_grp)
#define OS_TRACE_FLAG_PEND_FAILED(p_grp)
#define OS_TRACE_FLAG_PEND_BLOCK(p_grp)
#define OS_TRACE_MEM_PUT_FAILED(p_mem)
#define OS_TRACE_MEM_GET_FAILED(p_mem)
#define OS_TRACE_TASK_PRIO_CHANGE(p_tcb, prio)
#else /* End of OS_CFG_TRACE_EN > 0 */
#define OS_TRACE_TICK_INCREMENT(OSTickCtr)
#define OS_TRACE_TASK_CREATE(p_tcb)
#define OS_TRACE_TASK_CREATE_FAILED(p_tcb)
#define OS_TRACE_TASK_DEL(p_tcb)
#define OS_TRACE_TASK_READY(p_tcb)
#define OS_TRACE_TASK_SWITCHED_IN(p_tcb)
#define OS_TRACE_TASK_DLY(dly_ticks)
#define OS_TRACE_TASK_SUSPEND(p_tcb)
#define OS_TRACE_TASK_SUSPENDED(p_tcb)
#define OS_TRACE_TASK_RESUME(p_tcb)
#define OS_TRACE_ISR_BEGIN(isr_id)
#define OS_TRACE_ISR_END()
#define OS_TRACE_ISR_ENTER()
#define OS_TRACE_ISR_EXIT()
#define OS_TRACE_ISR_EXIT_TO_SCHEDULER()
#define OS_TRACE_TASK_MSG_Q_CREATE(p_msg_q, p_name)
#define OS_TRACE_TASK_MSG_Q_POST(p_msg_q)
#define OS_TRACE_TASK_MSG_Q_POST_FAILED(p_msg_q)
#define OS_TRACE_TASK_MSG_Q_PEND(p_msg_q)
#define OS_TRACE_TASK_MSG_Q_PEND_FAILED(p_msg_q)
#define OS_TRACE_TASK_MSG_Q_PEND_BLOCK(p_msg_q)
#define OS_TRACE_TASK_SEM_CREATE(p_tcb, p_name)
#define OS_TRACE_TASK_SEM_POST(p_tcb)
#define OS_TRACE_TASK_SEM_POST_FAILED(p_tcb)
#define OS_TRACE_TASK_SEM_PEND(p_tcb)
#define OS_TRACE_TASK_SEM_PEND_FAILED(p_tcb)
#define OS_TRACE_TASK_SEM_PEND_BLOCK(p_tcb)
#define OS_TRACE_MUTEX_CREATE(p_mutex, p_name)
#define OS_TRACE_MUTEX_DEL(p_mutex)
#define OS_TRACE_MUTEX_POST(p_mutex)
#define OS_TRACE_MUTEX_POST_FAILED(p_mutex)
#define OS_TRACE_MUTEX_PEND(p_mutex)
#define OS_TRACE_MUTEX_PEND_FAILED(p_mutex)
#define OS_TRACE_MUTEX_PEND_BLOCK(p_mutex)
#define OS_TRACE_MUTEX_TASK_PRIO_INHERIT(p_tcb, prio)
#define OS_TRACE_MUTEX_TASK_PRIO_DISINHERIT(p_tcb, prio)
#define OS_TRACE_SEM_CREATE(p_sem, p_name)
#define OS_TRACE_SEM_DEL(p_sem)
#define OS_TRACE_SEM_POST(p_sem)
#define OS_TRACE_SEM_POST_FAILED(p_sem)
#define OS_TRACE_SEM_PEND(p_sem)
#define OS_TRACE_SEM_PEND_FAILED(p_sem)
#define OS_TRACE_SEM_PEND_BLOCK(p_sem)
#define OS_TRACE_Q_CREATE(p_q, p_name)
#define OS_TRACE_Q_DEL(p_q)
#define OS_TRACE_Q_POST(p_q)
#define OS_TRACE_Q_POST_FAILED(p_q)
#define OS_TRACE_Q_PEND(p_q)
#define OS_TRACE_Q_PEND_FAILED(p_q)
#define OS_TRACE_Q_PEND_BLOCK(p_q)
#define OS_TRACE_FLAG_CREATE(p_grp, p_name)
#define OS_TRACE_FLAG_DEL(p_grp)
#define OS_TRACE_FLAG_POST(p_grp)
#define OS_TRACE_FLAG_POST_FAILED(p_grp)
#define OS_TRACE_FLAG_PEND(p_grp)
#define OS_TRACE_FLAG_PEND_FAILED(p_grp)
#define OS_TRACE_FLAG_PEND_BLOCK(p_grp)
#define OS_TRACE_MEM_CREATE(p_mem, p_name)
#define OS_TRACE_MEM_PUT(p_mem)
#define OS_TRACE_MEM_PUT_FAILED(p_mem)
#define OS_TRACE_MEM_GET(p_mem)
#define OS_TRACE_MEM_GET_FAILED(p_mem)
#define OS_TRACE_TASK_PRIO_CHANGE(p_tcb, prio)
#define OS_TRACE_MUTEX_DEL_ENTER(p_mutex, opt)
#define OS_TRACE_MUTEX_POST_ENTER(p_mutex, opt)
#define OS_TRACE_MUTEX_PEND_ENTER(p_mutex, timeout, opt, p_ts)
#define OS_TRACE_TASK_MSG_Q_POST_ENTER(p_msg_q, p_void, msg_size, opt)
#define OS_TRACE_TASK_MSG_Q_PEND_ENTER(p_msg_q, timeout, opt, p_msg_size, p_ts)
#define OS_TRACE_TASK_SEM_POST_ENTER(p_tcb, opt)
#define OS_TRACE_TASK_SEM_PEND_ENTER(p_tcb, timeout, opt, p_ts)
#define OS_TRACE_SEM_DEL_ENTER(p_sem, opt)
#define OS_TRACE_SEM_POST_ENTER(p_sem, opt)
#define OS_TRACE_SEM_PEND_ENTER(p_sem, timeout, opt, p_ts)
#define OS_TRACE_Q_DEL_ENTER(p_q, opt)
#define OS_TRACE_Q_POST_ENTER(p_q, p_void, msg_size, opt)
#define OS_TRACE_Q_PEND_ENTER(p_q, timeout, opt, p_msg_size, p_ts)
#define OS_TRACE_FLAG_DEL_ENTER(p_grp, opt)
#define OS_TRACE_FLAG_POST_ENTER(p_grp, flags, opt)
#define OS_TRACE_FLAG_PEND_ENTER(p_grp, flags, timeout, opt, p_ts)
#define OS_TRACE_MEM_PUT_ENTER(p_mem, p_blk)
#define OS_TRACE_MEM_GET_ENTER(p_mem)
#define OS_TRACE_MUTEX_DEL_EXIT(RetVal)
#define OS_TRACE_MUTEX_POST_EXIT(RetVal)
#define OS_TRACE_MUTEX_PEND_EXIT(RetVal)
#define OS_TRACE_TASK_MSG_Q_POST_EXIT(RetVal)
#define OS_TRACE_TASK_MSG_Q_PEND_EXIT(RetVal)
#define OS_TRACE_TASK_SEM_POST_EXIT(RetVal)
#define OS_TRACE_TASK_SEM_PEND_EXIT(RetVal)
#define OS_TRACE_SEM_DEL_EXIT(RetVal)
#define OS_TRACE_SEM_POST_EXIT(RetVal)
#define OS_TRACE_SEM_PEND_EXIT(RetVal)
#define OS_TRACE_Q_DEL_EXIT(RetVal)
#define OS_TRACE_Q_POST_EXIT(RetVal)
#define OS_TRACE_Q_PEND_EXIT(RetVal)
#define OS_TRACE_FLAG_DEL_EXIT(RetVal)
#define OS_TRACE_FLAG_POST_EXIT(RetVal)
#define OS_TRACE_FLAG_PEND_EXIT(RetVal)
#define OS_TRACE_MEM_PUT_EXIT(RetVal)
#define OS_TRACE_MEM_GET_EXIT(RetVal)
#endif
/*
************************************************************************************************************************
* API Functions
************************************************************************************************************************
*/
#ifdef __cplusplus
extern "C" {
#endif
void SYSVIEW_TaskReady (U32 TaskID);
void SYSVIEW_TaskSwitchedIn (U32 TaskID);
void SYSVIEW_TaskSuspend (U32 TaskID);
void SYSVIEW_AddTask (U32 TaskID, const char* NamePtr, OS_PRIO Prio, CPU_STK* StkBasePtr, CPU_STK_SIZE StkSize);
void SYSVIEW_UpdateTask (U32 TaskID, const char* NamePtr, OS_PRIO Prio, CPU_STK* StkBasePtr, CPU_STK_SIZE StkSize);
void SYSVIEW_SendTaskInfo (U32 TaskID, const char* sName, unsigned Prio, U32 StackBase, unsigned StackSize);
void SYSVIEW_RecordU32x4 (unsigned Id, U32 Para0, U32 Para1, U32 Para2, U32 Para3);
void SYSVIEW_RecordU32x5 (unsigned Id, U32 Para0, U32 Para1, U32 Para2, U32 Para3, U32 Para4);
void SYSVIEW_RecordU32Register(unsigned EventId, U32 ResourceId, const char* sResource);
void SYSVIEW_SendResourceList (void);
#ifdef __cplusplus
}
#endif

View File

@ -177,6 +177,13 @@ SECTIONS
. = ALIGN(8); . = ALIGN(8);
} >DTCMRAM } >DTCMRAM
.dma_ram (NOLOAD) :
{
. = ALIGN(4);
*(.dma_ram)
*(.dma_ram.*)
} >RAM_D2
/* Remove information from the standard libraries */ /* Remove information from the standard libraries */

View File

@ -61,7 +61,26 @@ Dma.MEMTOMEM.0.SyncPolarity=HAL_DMAMUX_SYNC_NO_EVENT
Dma.MEMTOMEM.0.SyncRequestNumber=1 Dma.MEMTOMEM.0.SyncRequestNumber=1
Dma.MEMTOMEM.0.SyncSignalID=NONE Dma.MEMTOMEM.0.SyncSignalID=NONE
Dma.Request0=MEMTOMEM Dma.Request0=MEMTOMEM
Dma.RequestsNb=1 Dma.Request1=USART1_TX
Dma.RequestsNb=2
Dma.USART1_TX.1.Direction=DMA_MEMORY_TO_PERIPH
Dma.USART1_TX.1.EventEnable=DISABLE
Dma.USART1_TX.1.FIFOMode=DMA_FIFOMODE_DISABLE
Dma.USART1_TX.1.Instance=DMA1_Stream1
Dma.USART1_TX.1.MemDataAlignment=DMA_MDATAALIGN_BYTE
Dma.USART1_TX.1.MemInc=DMA_MINC_ENABLE
Dma.USART1_TX.1.Mode=DMA_NORMAL
Dma.USART1_TX.1.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
Dma.USART1_TX.1.PeriphInc=DMA_PINC_DISABLE
Dma.USART1_TX.1.Polarity=HAL_DMAMUX_REQ_GEN_RISING
Dma.USART1_TX.1.Priority=DMA_PRIORITY_LOW
Dma.USART1_TX.1.RequestNumber=1
Dma.USART1_TX.1.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode,SignalID,Polarity,RequestNumber,SyncSignalID,SyncPolarity,SyncEnable,EventEnable,SyncRequestNumber
Dma.USART1_TX.1.SignalID=NONE
Dma.USART1_TX.1.SyncEnable=DISABLE
Dma.USART1_TX.1.SyncPolarity=HAL_DMAMUX_SYNC_NO_EVENT
Dma.USART1_TX.1.SyncRequestNumber=1
Dma.USART1_TX.1.SyncSignalID=NONE
FMC.CASLatency1=FMC_SDRAM_CAS_LATENCY_2 FMC.CASLatency1=FMC_SDRAM_CAS_LATENCY_2
FMC.ColumnBitsNumber1=FMC_SDRAM_COLUMN_BITS_NUM_9 FMC.ColumnBitsNumber1=FMC_SDRAM_COLUMN_BITS_NUM_9
FMC.ExitSelfRefreshDelay1=9 FMC.ExitSelfRefreshDelay1=9
@ -235,6 +254,7 @@ MxCube.Version=6.2.0
MxDb.Version=DB.6.0.20 MxDb.Version=DB.6.0.20
NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
NVIC.DMA1_Stream0_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true NVIC.DMA1_Stream0_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true
NVIC.DMA1_Stream1_IRQn=true\:5\:0\:false\:false\:true\:true\:false\:true
NVIC.DMA2D_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true NVIC.DMA2D_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true
NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
NVIC.FLASH_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true NVIC.FLASH_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true
@ -580,7 +600,7 @@ ProjectManager.PreviousToolchain=
ProjectManager.ProjectBuild=false ProjectManager.ProjectBuild=false
ProjectManager.ProjectFileName=STM32H750XB_Hello.ioc ProjectManager.ProjectFileName=STM32H750XB_Hello.ioc
ProjectManager.ProjectName=STM32H750XB_Hello ProjectManager.ProjectName=STM32H750XB_Hello
ProjectManager.RegisterCallBack=DMA2D ProjectManager.RegisterCallBack=DMA2D,UART
ProjectManager.StackSize=0x400 ProjectManager.StackSize=0x400
ProjectManager.TargetToolchain=Makefile ProjectManager.TargetToolchain=Makefile
ProjectManager.ToolChainLocation= ProjectManager.ToolChainLocation=