You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Zero-init RTT control block fields if not in BSS, don't init it twice
If SEGGER_RTT_SECTION is defined, the RTT control block is not in BSS
and zero-initialization is needed for not initialized fields.
Moreover, it the control block is already initialized with the expected
SEGGER ID signature, the initialization is skipped to allow seamless
logging between programs that share it.
Typical use case: bootloader and application.
Signed-off-by: Giancarlo Stasi <[email protected]>
pRing= (SEGGER_RTT_BUFFER_UP*)((char*)&_SEGGER_RTT.aUp[BufferIndex] +SEGGER_RTT_UNCACHED_OFF); // Access uncached to make sure we see changes made by the J-Link side and all of our changes go into HW directly
pRing= (SEGGER_RTT_BUFFER_DOWN*)((char*)&_SEGGER_RTT.aDown[BufferIndex] +SEGGER_RTT_UNCACHED_OFF); // Access uncached to make sure we see changes made by the J-Link side and all of our changes go into HW directly
Status=SEGGER_RTT_WriteNoLock(BufferIndex, pBuffer, NumBytes); // Call the non-locking write function
1195
1246
SEGGER_RTT_UNLOCK();
@@ -1304,7 +1355,7 @@ unsigned SEGGER_RTT_PutCharSkip(unsigned BufferIndex, char c) {
1304
1355
//
1305
1356
// Prepare
1306
1357
//
1307
-
INIT();
1358
+
Init();
1308
1359
SEGGER_RTT_LOCK();
1309
1360
//
1310
1361
// Get "to-host" ring buffer.
@@ -1363,7 +1414,7 @@ unsigned SEGGER_RTT_PutChar(unsigned BufferIndex, char c) {
1363
1414
//
1364
1415
// Prepare
1365
1416
//
1366
-
INIT();
1417
+
Init();
1367
1418
SEGGER_RTT_LOCK();
1368
1419
//
1369
1420
// Get "to-host" ring buffer.
@@ -1474,7 +1525,7 @@ int SEGGER_RTT_HasKey(void) {
1474
1525
unsignedRdOff;
1475
1526
intr;
1476
1527
1477
-
INIT();
1528
+
Init();
1478
1529
pRing= (SEGGER_RTT_BUFFER_DOWN*)((char*)&_SEGGER_RTT.aDown[0] +SEGGER_RTT_UNCACHED_OFF); // Access uncached to make sure we see changes made by the J-Link side and all of our changes go into HW directly
pRTTCB= (volatileSEGGER_RTT_CB*)((unsigned char*)&_SEGGER_RTT+SEGGER_RTT_UNCACHED_OFF); // Access RTTCB uncached to make sure we see changes made by the J-Link side and all of our changes go into HW directly
pRTTCB= (volatileSEGGER_RTT_CB*)((unsigned char*)&_SEGGER_RTT+SEGGER_RTT_UNCACHED_OFF); // Access RTTCB uncached to make sure we see changes made by the J-Link side and all of our changes go into HW directly
pRTTCB= (volatileSEGGER_RTT_CB*)((unsigned char*)&_SEGGER_RTT+SEGGER_RTT_UNCACHED_OFF); // Access RTTCB uncached to make sure we see changes made by the J-Link side and all of our changes go into HW directly
1658
1709
if (BufferIndex<SEGGER_RTT_MAX_NUM_UP_BUFFERS) {
1659
1710
SEGGER_RTT_LOCK();
@@ -1704,7 +1755,7 @@ int SEGGER_RTT_ConfigDownBuffer(unsigned BufferIndex, const char* sName, void* p
1704
1755
volatileSEGGER_RTT_CB*pRTTCB;
1705
1756
volatileSEGGER_RTT_BUFFER_DOWN*pDown;
1706
1757
1707
-
INIT();
1758
+
Init();
1708
1759
pRTTCB= (volatileSEGGER_RTT_CB*)((unsigned char*)&_SEGGER_RTT+SEGGER_RTT_UNCACHED_OFF); // Access RTTCB uncached to make sure we see changes made by the J-Link side and all of our changes go into HW directly
1709
1760
if (BufferIndex<SEGGER_RTT_MAX_NUM_DOWN_BUFFERS) {
pRTTCB= (volatileSEGGER_RTT_CB*)((unsigned char*)&_SEGGER_RTT+SEGGER_RTT_UNCACHED_OFF); // Access RTTCB uncached to make sure we see changes made by the J-Link side and all of our changes go into HW directly
pRTTCB= (volatileSEGGER_RTT_CB*)((unsigned char*)&_SEGGER_RTT+SEGGER_RTT_UNCACHED_OFF); // Access RTTCB uncached to make sure we see changes made by the J-Link side and all of our changes go into HW directly
1787
1838
if (BufferIndex<SEGGER_RTT_MAX_NUM_DOWN_BUFFERS) {
1788
1839
SEGGER_RTT_LOCK();
@@ -1817,7 +1868,7 @@ int SEGGER_RTT_SetFlagsUpBuffer(unsigned BufferIndex, unsigned Flags) {
1817
1868
volatileSEGGER_RTT_CB*pRTTCB;
1818
1869
volatileSEGGER_RTT_BUFFER_UP*pUp;
1819
1870
1820
-
INIT();
1871
+
Init();
1821
1872
pRTTCB= (volatileSEGGER_RTT_CB*)((unsigned char*)&_SEGGER_RTT+SEGGER_RTT_UNCACHED_OFF); // Access RTTCB uncached to make sure we see changes made by the J-Link side and all of our changes go into HW directly
1822
1873
if (BufferIndex<SEGGER_RTT_MAX_NUM_UP_BUFFERS) {
1823
1874
SEGGER_RTT_LOCK();
@@ -1852,7 +1903,7 @@ int SEGGER_RTT_SetFlagsDownBuffer(unsigned BufferIndex, unsigned Flags) {
1852
1903
volatileSEGGER_RTT_CB*pRTTCB;
1853
1904
volatileSEGGER_RTT_BUFFER_DOWN*pDown;
1854
1905
1855
-
INIT();
1906
+
Init();
1856
1907
pRTTCB= (volatileSEGGER_RTT_CB*)((unsigned char*)&_SEGGER_RTT+SEGGER_RTT_UNCACHED_OFF); // Access RTTCB uncached to make sure we see changes made by the J-Link side and all of our changes go into HW directly
1857
1908
if (BufferIndex<SEGGER_RTT_MAX_NUM_DOWN_BUFFERS) {
1858
1909
SEGGER_RTT_LOCK();
@@ -1876,7 +1927,7 @@ int SEGGER_RTT_SetFlagsDownBuffer(unsigned BufferIndex, unsigned Flags) {
0 commit comments