Skip to content

Commit 569b9b2

Browse files
authored
Merge pull request #437 from henrygab/Segger_RTT_3
Update Segger SysView files to v3.10
2 parents c7d9e2f + 7c990c4 commit 569b9b2

22 files changed

+1814
-407
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,7 @@
1616
.DS_Store
1717
*.swp
1818
/Output
19+
20+
# Ignore local overrides of platform.txt and boards.txt,
21+
/boards.local.txt
22+
/platform.local.txt

cores/nRF5/Uart.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ size_t Uart::write(const uint8_t *buffer, size_t size)
225225
do
226226
{
227227
size_t remaining = size - sent;
228-
size_t txSize = min(remaining, SERIAL_BUFFER_SIZE);
228+
size_t txSize = min(remaining, (size_t)SERIAL_BUFFER_SIZE);
229229

230230
xSemaphoreTake(_mutex, portMAX_DELAY);
231231

cores/nRF5/freertos/Source/include/FreeRTOS.h

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,10 @@ extern "C" {
156156
#define INCLUDE_uxTaskGetStackHighWaterMark 0
157157
#endif
158158

159+
#ifndef INCLUDE_pxTaskGetStackStart
160+
#define INCLUDE_pxTaskGetStackStart 0
161+
#endif
162+
159163
#ifndef INCLUDE_eTaskGetState
160164
#define INCLUDE_eTaskGetState 0
161165
#endif
@@ -392,6 +396,22 @@ extern "C" {
392396
#define tracePOST_MOVED_TASK_TO_READY_STATE( pxTCB )
393397
#endif
394398

399+
#ifndef traceREADDED_TASK_TO_READY_STATE
400+
#define traceREADDED_TASK_TO_READY_STATE( pxTCB ) traceMOVED_TASK_TO_READY_STATE( pxTCB )
401+
#endif
402+
403+
#ifndef traceMOVED_TASK_TO_DELAYED_LIST
404+
#define traceMOVED_TASK_TO_DELAYED_LIST()
405+
#endif
406+
407+
#ifndef traceMOVED_TASK_TO_OVERFLOW_DELAYED_LIST
408+
#define traceMOVED_TASK_TO_OVERFLOW_DELAYED_LIST()
409+
#endif
410+
411+
#ifndef traceMOVED_TASK_TO_SUSPENDED_LIST
412+
#define traceMOVED_TASK_TO_SUSPENDED_LIST( pxTCB )
413+
#endif
414+
395415
#ifndef traceQUEUE_CREATE
396416
#define traceQUEUE_CREATE( pxNewQueue )
397417
#endif
@@ -636,6 +656,18 @@ extern "C" {
636656
#define traceTASK_NOTIFY_GIVE_FROM_ISR()
637657
#endif
638658

659+
#ifndef traceISR_EXIT_TO_SCHEDULER
660+
#define traceISR_EXIT_TO_SCHEDULER()
661+
#endif
662+
663+
#ifndef traceISR_EXIT
664+
#define traceISR_EXIT()
665+
#endif
666+
667+
#ifndef traceISR_ENTER
668+
#define traceISR_ENTER()
669+
#endif
670+
639671
#ifndef traceSTREAM_BUFFER_CREATE_FAILED
640672
#define traceSTREAM_BUFFER_CREATE_FAILED( xIsMessageBuffer )
641673
#endif

cores/nRF5/freertos/Source/include/task.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1421,6 +1421,25 @@ TaskHandle_t xTaskGetHandle( const char *pcNameToQuery ) PRIVILEGED_FUNCTION; /*
14211421
*/
14221422
UBaseType_t uxTaskGetStackHighWaterMark( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
14231423

1424+
/**
1425+
* task.h
1426+
* <PRE>uint8_t* pxTaskGetStackStart( TaskHandle_t xTask);</PRE>
1427+
*
1428+
* INCLUDE_pxTaskGetStackStart must be set to 1 in FreeRTOSConfig.h for
1429+
* this function to be available.
1430+
*
1431+
* Returns the start of the stack associated with xTask. That is,
1432+
* the highest stack memory address on architectures where the stack grows down
1433+
* from high memory, and the lowest memory address on architectures where the
1434+
* stack grows up from low memory.
1435+
*
1436+
* @param xTask Handle of the task associated with the stack returned.
1437+
* Set xTask to NULL to return the stack of the calling task.
1438+
*
1439+
* @return A pointer to the start of the stack.
1440+
*/
1441+
uint8_t* pxTaskGetStackStart( TaskHandle_t xTask) PRIVILEGED_FUNCTION;
1442+
14241443
/* When using trace macros it is sometimes necessary to include task.h before
14251444
FreeRTOS.h. When this is done TaskHookFunction_t will not yet have been defined,
14261445
so the following two prototypes will cause a compilation error. This can be

cores/nRF5/freertos/Source/tasks.c

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,19 @@ count overflows. */
239239
tracePOST_MOVED_TASK_TO_READY_STATE( pxTCB )
240240
/*-----------------------------------------------------------*/
241241

242+
/*
243+
* Place the task represented by pxTCB which has been in a ready list before
244+
* into the appropriate ready list for the task.
245+
* It is inserted at the end of the list.
246+
*/
247+
#define prvReaddTaskToReadyList( pxTCB ) \
248+
traceREADDED_TASK_TO_READY_STATE( pxTCB ); \
249+
taskRECORD_READY_PRIORITY( ( pxTCB )->uxPriority ); \
250+
vListInsertEnd( &( pxReadyTasksLists[ ( pxTCB )->uxPriority ] ), &( ( pxTCB )->xStateListItem ) ); \
251+
tracePOST_MOVED_TASK_TO_READY_STATE( pxTCB )
252+
/*-----------------------------------------------------------*/
253+
254+
242255
/*
243256
* Several functions take an TaskHandle_t parameter that can optionally be NULL,
244257
* where NULL is used to indicate that the handle of the currently executing
@@ -1598,7 +1611,7 @@ static void prvAddNewTaskToReadyList( TCB_t *pxNewTCB )
15981611
{
15991612
mtCOVERAGE_TEST_MARKER();
16001613
}
1601-
prvAddTaskToReadyList( pxTCB );
1614+
prvReaddTaskToReadyList( pxTCB );
16021615
}
16031616
else
16041617
{
@@ -1660,6 +1673,7 @@ static void prvAddNewTaskToReadyList( TCB_t *pxNewTCB )
16601673
mtCOVERAGE_TEST_MARKER();
16611674
}
16621675

1676+
traceMOVED_TASK_TO_SUSPENDED_LIST(pxTCB);
16631677
vListInsertEnd( &xSuspendedTaskList, &( pxTCB->xStateListItem ) );
16641678

16651679
#if( configUSE_TASK_NOTIFICATIONS == 1 )
@@ -3671,6 +3685,20 @@ static void prvCheckTasksWaitingTermination( void )
36713685
#endif /* INCLUDE_uxTaskGetStackHighWaterMark */
36723686
/*-----------------------------------------------------------*/
36733687

3688+
#if (INCLUDE_pxTaskGetStackStart == 1)
3689+
uint8_t* pxTaskGetStackStart( TaskHandle_t xTask)
3690+
{
3691+
TCB_t *pxTCB;
3692+
UBaseType_t uxReturn;
3693+
(void)uxReturn;
3694+
3695+
pxTCB = prvGetTCBFromHandle( xTask );
3696+
return ( uint8_t * ) pxTCB->pxStack;
3697+
}
3698+
#endif /* INCLUDE_pxTaskGetStackStart */
3699+
/*-----------------------------------------------------------*/
3700+
3701+
36743702
#if ( INCLUDE_vTaskDelete == 1 )
36753703

36763704
static void prvDeleteTCB( TCB_t *pxTCB )
@@ -3840,7 +3868,7 @@ TCB_t *pxTCB;
38403868

38413869
/* Inherit the priority before being moved into the new list. */
38423870
pxMutexHolderTCB->uxPriority = pxCurrentTCB->uxPriority;
3843-
prvAddTaskToReadyList( pxMutexHolderTCB );
3871+
prvReaddTaskToReadyList( pxMutexHolderTCB );
38443872
}
38453873
else
38463874
{
@@ -3930,7 +3958,7 @@ TCB_t *pxTCB;
39303958
any other purpose if this task is running, and it must be
39313959
running to give back the mutex. */
39323960
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. */
3933-
prvAddTaskToReadyList( pxTCB );
3961+
prvReaddTaskToReadyList( pxTCB );
39343962

39353963
/* Return true to indicate that a context switch is required.
39363964
This is only actually required in the corner case whereby
@@ -4943,6 +4971,7 @@ const TickType_t xConstTickCount = xTickCount;
49434971
/* Add the task to the suspended task list instead of a delayed task
49444972
list to ensure it is not woken by a timing event. It will block
49454973
indefinitely. */
4974+
traceMOVED_TASK_TO_SUSPENDED_LIST(pxCurrentTCB);
49464975
vListInsertEnd( &xSuspendedTaskList, &( pxCurrentTCB->xStateListItem ) );
49474976
}
49484977
else
@@ -4959,12 +4988,14 @@ const TickType_t xConstTickCount = xTickCount;
49594988
{
49604989
/* Wake time has overflowed. Place this item in the overflow
49614990
list. */
4991+
traceMOVED_TASK_TO_OVERFLOW_DELAYED_LIST();
49624992
vListInsert( pxOverflowDelayedTaskList, &( pxCurrentTCB->xStateListItem ) );
49634993
}
49644994
else
49654995
{
49664996
/* The wake time has not overflowed, so the current block list
49674997
is used. */
4998+
traceMOVED_TASK_TO_DELAYED_LIST();
49684999
vListInsert( pxDelayedTaskList, &( pxCurrentTCB->xStateListItem ) );
49695000

49705001
/* If the task entering the blocked state was placed at the
@@ -4994,11 +5025,13 @@ const TickType_t xConstTickCount = xTickCount;
49945025
if( xTimeToWake < xConstTickCount )
49955026
{
49965027
/* Wake time has overflowed. Place this item in the overflow list. */
5028+
traceMOVED_TASK_TO_OVERFLOW_DELAYED_LIST();
49975029
vListInsert( pxOverflowDelayedTaskList, &( pxCurrentTCB->xStateListItem ) );
49985030
}
49995031
else
50005032
{
50015033
/* The wake time has not overflowed, so the current block list is used. */
5034+
traceMOVED_TASK_TO_DELAYED_LIST();
50025035
vListInsert( pxDelayedTaskList, &( pxCurrentTCB->xStateListItem ) );
50035036

50045037
/* If the task entering the blocked state was placed at the head of the

cores/nRF5/freertos/portable/CMSIS/nrf52/port_cmsis_systick.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454

5555
void xPortSysTickHandler( void )
5656
{
57+
traceISR_ENTER();
5758
#if configUSE_TICKLESS_IDLE == 1
5859
nrf_rtc_event_clear(portNRF_RTC_REG, NRF_RTC_EVENT_COMPARE_0);
5960
#endif
@@ -89,11 +90,16 @@ void xPortSysTickHandler( void )
8990
/* Increment the RTOS tick as usual which checks if there is a need for rescheduling */
9091
if ( switch_req != pdFALSE )
9192
{
93+
traceISR_EXIT_TO_SCHEDULER();
9294
/* A context switch is required. Context switching is performed in
9395
the PendSV interrupt. Pend the PendSV interrupt. */
9496
SCB->ICSR = SCB_ICSR_PENDSVSET_Msk;
9597
__SEV();
9698
}
99+
else
100+
{
101+
traceISR_EXIT();
102+
}
97103

98104
portCLEAR_INTERRUPT_MASK_FROM_ISR( isrstate );
99105
}

cores/nRF5/freertos/portable/CMSIS/nrf52/portmacro_cmsis.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,14 @@ typedef unsigned long UBaseType_t;
9797
__ISB(); \
9898
}while (0)
9999

100-
#define portEND_SWITCHING_ISR( xSwitchRequired ) if ( (xSwitchRequired) != pdFALSE ) portYIELD()
100+
#define portEND_SWITCHING_ISR( xSwitchRequired ) do { \
101+
if( xSwitchRequired != pdFALSE ) { \
102+
traceISR_EXIT_TO_SCHEDULER(); \
103+
portYIELD(); \
104+
} else { \
105+
traceISR_EXIT(); \
106+
} \
107+
} while (0)
101108
#define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
102109
/*-----------------------------------------------------------*/
103110

cores/nRF5/sysview/Config/Global.h

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/*********************************************************************
2-
* SEGGER Microcontroller GmbH & Co. KG *
2+
* SEGGER Microcontroller GmbH *
33
* The Embedded Experts *
44
**********************************************************************
55
* *
6-
* (c) 2015 - 2017 SEGGER Microcontroller GmbH & Co. KG *
6+
* (c) 1995 - 2019 SEGGER Microcontroller GmbH *
77
* *
88
* www.segger.com Support: support@segger.com *
99
* *
@@ -17,24 +17,14 @@
1717
* *
1818
* SEGGER strongly recommends to not make any changes *
1919
* to or modify the source code of this software in order to stay *
20-
* compatible with the RTT protocol and J-Link. *
20+
* compatible with the SystemView and RTT protocol, and J-Link. *
2121
* *
2222
* Redistribution and use in source and binary forms, with or *
2323
* without modification, are permitted provided that the following *
24-
* conditions are met: *
24+
* condition is met: *
2525
* *
2626
* o Redistributions of source code must retain the above copyright *
27-
* notice, this list of conditions and the following disclaimer. *
28-
* *
29-
* o Redistributions in binary form must reproduce the above *
30-
* copyright notice, this list of conditions and the following *
31-
* disclaimer in the documentation and/or other materials provided *
32-
* with the distribution. *
33-
* *
34-
* o Neither the name of SEGGER Microcontroller GmbH & Co. KG *
35-
* nor the names of its contributors may be used to endorse or *
36-
* promote products derived from this software without specific *
37-
* prior written permission. *
27+
* notice, this condition and the following disclaimer. *
3828
* *
3929
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
4030
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
@@ -52,17 +42,10 @@
5242
* *
5343
**********************************************************************
5444
* *
55-
* SystemView version: V2.52d *
45+
* SystemView version: 3.10 *
5646
* *
5747
**********************************************************************
58-
----------------------------------------------------------------------
59-
File : Global.h
60-
Purpose : Global types
61-
In case your application already has a Global.h, you should
62-
merge the files. In order to use Segger code, the types
63-
U8, U16, U32, I8, I16, I32 need to be defined in Global.h;
64-
additional definitions do not hurt.
65-
---------------------------END-OF-HEADER------------------------------
48+
-------------------------- END-OF-HEADER -----------------------------
6649
*/
6750

6851
#ifndef GLOBAL_H // Guard against multiple inclusion

0 commit comments

Comments
 (0)