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 string, 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
1240
SEGGER_RTT_UNLOCK();
@@ -1304,7 +1349,7 @@ unsigned SEGGER_RTT_PutCharSkip(unsigned BufferIndex, char c) {
1304
1349
//
1305
1350
// Prepare
1306
1351
//
1307
-
INIT();
1352
+
Init();
1308
1353
SEGGER_RTT_LOCK();
1309
1354
//
1310
1355
// Get "to-host" ring buffer.
@@ -1363,7 +1408,7 @@ unsigned SEGGER_RTT_PutChar(unsigned BufferIndex, char c) {
1363
1408
//
1364
1409
// Prepare
1365
1410
//
1366
-
INIT();
1411
+
Init();
1367
1412
SEGGER_RTT_LOCK();
1368
1413
//
1369
1414
// Get "to-host" ring buffer.
@@ -1474,7 +1519,7 @@ int SEGGER_RTT_HasKey(void) {
1474
1519
unsignedRdOff;
1475
1520
intr;
1476
1521
1477
-
INIT();
1522
+
Init();
1478
1523
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
1703
if (BufferIndex<SEGGER_RTT_MAX_NUM_UP_BUFFERS) {
1659
1704
SEGGER_RTT_LOCK();
@@ -1704,7 +1749,7 @@ int SEGGER_RTT_ConfigDownBuffer(unsigned BufferIndex, const char* sName, void* p
1704
1749
volatileSEGGER_RTT_CB*pRTTCB;
1705
1750
volatileSEGGER_RTT_BUFFER_DOWN*pDown;
1706
1751
1707
-
INIT();
1752
+
Init();
1708
1753
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
1754
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
1832
if (BufferIndex<SEGGER_RTT_MAX_NUM_DOWN_BUFFERS) {
1788
1833
SEGGER_RTT_LOCK();
@@ -1817,7 +1862,7 @@ int SEGGER_RTT_SetFlagsUpBuffer(unsigned BufferIndex, unsigned Flags) {
1817
1862
volatileSEGGER_RTT_CB*pRTTCB;
1818
1863
volatileSEGGER_RTT_BUFFER_UP*pUp;
1819
1864
1820
-
INIT();
1865
+
Init();
1821
1866
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
1867
if (BufferIndex<SEGGER_RTT_MAX_NUM_UP_BUFFERS) {
1823
1868
SEGGER_RTT_LOCK();
@@ -1852,7 +1897,7 @@ int SEGGER_RTT_SetFlagsDownBuffer(unsigned BufferIndex, unsigned Flags) {
1852
1897
volatileSEGGER_RTT_CB*pRTTCB;
1853
1898
volatileSEGGER_RTT_BUFFER_DOWN*pDown;
1854
1899
1855
-
INIT();
1900
+
Init();
1856
1901
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
1902
if (BufferIndex<SEGGER_RTT_MAX_NUM_DOWN_BUFFERS) {
1858
1903
SEGGER_RTT_LOCK();
@@ -1876,7 +1921,7 @@ int SEGGER_RTT_SetFlagsDownBuffer(unsigned BufferIndex, unsigned Flags) {
0 commit comments