update segger rtt to fix cast align
This commit is contained in:
@@ -306,7 +306,7 @@ static unsigned char _ActiveTerminal;
|
||||
#define INIT() \
|
||||
do { \
|
||||
volatile SEGGER_RTT_CB* pRTTCBInit; \
|
||||
pRTTCBInit = (volatile SEGGER_RTT_CB*)((char*)&_SEGGER_RTT + SEGGER_RTT_UNCACHED_OFF); \
|
||||
pRTTCBInit = (volatile SEGGER_RTT_CB*)((uintptr_t)&_SEGGER_RTT + SEGGER_RTT_UNCACHED_OFF); \
|
||||
if (pRTTCBInit->acID[0] != 'S') { \
|
||||
_DoInit(); \
|
||||
} \
|
||||
@@ -319,7 +319,7 @@ static void _DoInit(void) {
|
||||
//
|
||||
// Initialize control block
|
||||
//
|
||||
p = (volatile SEGGER_RTT_CB*)((char*)&_SEGGER_RTT + SEGGER_RTT_UNCACHED_OFF); // Access control block uncached so that nothing in the cache ever becomes dirty and all changes are visible in HW directly
|
||||
p = (volatile SEGGER_RTT_CB*)((uintptr_t)&_SEGGER_RTT + SEGGER_RTT_UNCACHED_OFF); // Access control block uncached so that nothing in the cache ever becomes dirty and all changes are visible in HW directly
|
||||
memset((SEGGER_RTT_CB*)p, 0, sizeof(_SEGGER_RTT)); // Make sure that the RTT CB is always zero initialized.
|
||||
p->MaxNumUpBuffers = SEGGER_RTT_MAX_NUM_UP_BUFFERS;
|
||||
p->MaxNumDownBuffers = SEGGER_RTT_MAX_NUM_DOWN_BUFFERS;
|
||||
@@ -581,7 +581,7 @@ unsigned SEGGER_RTT_ReadUpBufferNoLock(unsigned BufferIndex, void* pData, unsign
|
||||
volatile char* pSrc;
|
||||
|
||||
INIT();
|
||||
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_UP*)((uintptr_t)&_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
|
||||
pBuffer = (unsigned char*)pData;
|
||||
RdOff = pRing->RdOff;
|
||||
WrOff = pRing->WrOff;
|
||||
@@ -673,7 +673,7 @@ unsigned SEGGER_RTT_ReadNoLock(unsigned BufferIndex, void* pData, unsigned Buffe
|
||||
volatile char* pSrc;
|
||||
//
|
||||
INIT();
|
||||
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
|
||||
pRing = (SEGGER_RTT_BUFFER_DOWN*)((uintptr_t)&_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
|
||||
pBuffer = (unsigned char*)pData;
|
||||
RdOff = pRing->RdOff;
|
||||
WrOff = pRing->WrOff;
|
||||
@@ -840,7 +840,7 @@ void SEGGER_RTT_WriteWithOverwriteNoLock(unsigned BufferIndex, const void* pBuff
|
||||
// Get "to-host" ring buffer and copy some elements into local variables.
|
||||
//
|
||||
pData = (const char *)pBuffer;
|
||||
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_UP*)((uintptr_t)&_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
|
||||
//
|
||||
// Check if we will overwrite data and need to adjust the RdOff.
|
||||
//
|
||||
@@ -1033,7 +1033,7 @@ unsigned SEGGER_RTT_WriteDownBufferNoLock(unsigned BufferIndex, const void* pBuf
|
||||
// It is save to cast that to a "to-host" buffer. Up and Down buffer differ in volatility of offsets that might be modified by J-Link.
|
||||
//
|
||||
pData = (const char *)pBuffer;
|
||||
pRing = (SEGGER_RTT_BUFFER_UP*)((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
|
||||
pRing = (SEGGER_RTT_BUFFER_UP*)((uintptr_t)&_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
|
||||
//
|
||||
// How we output depends upon the mode...
|
||||
//
|
||||
@@ -1107,7 +1107,7 @@ unsigned SEGGER_RTT_WriteNoLock(unsigned BufferIndex, const void* pBuffer, unsig
|
||||
// Get "to-host" ring buffer.
|
||||
//
|
||||
pData = (const char *)pBuffer;
|
||||
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_UP*)((uintptr_t)&_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
|
||||
//
|
||||
// How we output depends upon the mode...
|
||||
//
|
||||
@@ -1271,7 +1271,7 @@ unsigned SEGGER_RTT_PutCharSkipNoLock(unsigned BufferIndex, char c) {
|
||||
//
|
||||
// Get "to-host" ring buffer.
|
||||
//
|
||||
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_UP*)((uintptr_t)&_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
|
||||
//
|
||||
// Get write position and handle wrap-around if necessary
|
||||
//
|
||||
@@ -1326,7 +1326,7 @@ unsigned SEGGER_RTT_PutCharSkip(unsigned BufferIndex, char c) {
|
||||
//
|
||||
// Get "to-host" ring buffer.
|
||||
//
|
||||
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_UP*)((uintptr_t)&_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
|
||||
//
|
||||
// Get write position and handle wrap-around if necessary
|
||||
//
|
||||
@@ -1385,7 +1385,7 @@ unsigned SEGGER_RTT_PutChar(unsigned BufferIndex, char c) {
|
||||
//
|
||||
// Get "to-host" ring buffer.
|
||||
//
|
||||
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_UP*)((uintptr_t)&_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
|
||||
//
|
||||
// Get write position and handle wrap-around if necessary
|
||||
//
|
||||
@@ -1492,7 +1492,7 @@ int SEGGER_RTT_HasKey(void) {
|
||||
int r;
|
||||
|
||||
INIT();
|
||||
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
|
||||
pRing = (SEGGER_RTT_BUFFER_DOWN*)((uintptr_t)&_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
|
||||
RdOff = pRing->RdOff;
|
||||
if (RdOff != pRing->WrOff) {
|
||||
r = 1;
|
||||
@@ -1518,7 +1518,7 @@ unsigned SEGGER_RTT_HasData(unsigned BufferIndex) {
|
||||
SEGGER_RTT_BUFFER_DOWN* pRing;
|
||||
unsigned v;
|
||||
|
||||
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
|
||||
pRing = (SEGGER_RTT_BUFFER_DOWN*)((uintptr_t)&_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
|
||||
v = pRing->WrOff;
|
||||
return v - pRing->RdOff;
|
||||
}
|
||||
@@ -1539,7 +1539,7 @@ unsigned SEGGER_RTT_HasDataUp(unsigned BufferIndex) {
|
||||
SEGGER_RTT_BUFFER_UP* pRing;
|
||||
unsigned v;
|
||||
|
||||
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_UP*)((uintptr_t)&_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
|
||||
v = pRing->RdOff;
|
||||
return pRing->WrOff - v;
|
||||
}
|
||||
@@ -1570,7 +1570,7 @@ int SEGGER_RTT_AllocDownBuffer(const char* sName, void* pBuffer, unsigned Buffer
|
||||
|
||||
INIT();
|
||||
SEGGER_RTT_LOCK();
|
||||
pRTTCB = (volatile SEGGER_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 = (volatile SEGGER_RTT_CB*)((uintptr_t)&_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
|
||||
BufferIndex = 0;
|
||||
do {
|
||||
if (pRTTCB->aDown[BufferIndex].pBuffer == NULL) {
|
||||
@@ -1619,7 +1619,7 @@ int SEGGER_RTT_AllocUpBuffer(const char* sName, void* pBuffer, unsigned BufferSi
|
||||
|
||||
INIT();
|
||||
SEGGER_RTT_LOCK();
|
||||
pRTTCB = (volatile SEGGER_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 = (volatile SEGGER_RTT_CB*)((uintptr_t)&_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
|
||||
BufferIndex = 0;
|
||||
do {
|
||||
if (pRTTCB->aUp[BufferIndex].pBuffer == NULL) {
|
||||
@@ -1674,7 +1674,7 @@ int SEGGER_RTT_ConfigUpBuffer(unsigned BufferIndex, const char* sName, void* pBu
|
||||
volatile SEGGER_RTT_BUFFER_UP* pUp;
|
||||
|
||||
INIT();
|
||||
pRTTCB = (volatile SEGGER_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 = (volatile SEGGER_RTT_CB*)((uintptr_t)&_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
|
||||
if (BufferIndex < SEGGER_RTT_MAX_NUM_UP_BUFFERS) {
|
||||
SEGGER_RTT_LOCK();
|
||||
pUp = &pRTTCB->aUp[BufferIndex];
|
||||
@@ -1726,7 +1726,7 @@ int SEGGER_RTT_ConfigDownBuffer(unsigned BufferIndex, const char* sName, void* p
|
||||
volatile SEGGER_RTT_BUFFER_DOWN* pDown;
|
||||
|
||||
INIT();
|
||||
pRTTCB = (volatile SEGGER_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 = (volatile SEGGER_RTT_CB*)((uintptr_t)&_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
|
||||
if (BufferIndex < SEGGER_RTT_MAX_NUM_DOWN_BUFFERS) {
|
||||
SEGGER_RTT_LOCK();
|
||||
pDown = &pRTTCB->aDown[BufferIndex];
|
||||
@@ -1769,7 +1769,7 @@ int SEGGER_RTT_SetNameUpBuffer(unsigned BufferIndex, const char* sName) {
|
||||
volatile SEGGER_RTT_BUFFER_UP* pUp;
|
||||
|
||||
INIT();
|
||||
pRTTCB = (volatile SEGGER_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 = (volatile SEGGER_RTT_CB*)((uintptr_t)&_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
|
||||
if (BufferIndex < SEGGER_RTT_MAX_NUM_UP_BUFFERS) {
|
||||
SEGGER_RTT_LOCK();
|
||||
pUp = &pRTTCB->aUp[BufferIndex];
|
||||
@@ -1804,7 +1804,7 @@ int SEGGER_RTT_SetNameDownBuffer(unsigned BufferIndex, const char* sName) {
|
||||
volatile SEGGER_RTT_BUFFER_DOWN* pDown;
|
||||
|
||||
INIT();
|
||||
pRTTCB = (volatile SEGGER_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 = (volatile SEGGER_RTT_CB*)((uintptr_t)&_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
|
||||
if (BufferIndex < SEGGER_RTT_MAX_NUM_DOWN_BUFFERS) {
|
||||
SEGGER_RTT_LOCK();
|
||||
pDown = &pRTTCB->aDown[BufferIndex];
|
||||
@@ -1840,7 +1840,7 @@ int SEGGER_RTT_SetFlagsUpBuffer(unsigned BufferIndex, unsigned Flags) {
|
||||
volatile SEGGER_RTT_BUFFER_UP* pUp;
|
||||
|
||||
INIT();
|
||||
pRTTCB = (volatile SEGGER_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 = (volatile SEGGER_RTT_CB*)((uintptr_t)&_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
|
||||
if (BufferIndex < SEGGER_RTT_MAX_NUM_UP_BUFFERS) {
|
||||
SEGGER_RTT_LOCK();
|
||||
pUp = &pRTTCB->aUp[BufferIndex];
|
||||
@@ -1876,7 +1876,7 @@ int SEGGER_RTT_SetFlagsDownBuffer(unsigned BufferIndex, unsigned Flags) {
|
||||
volatile SEGGER_RTT_BUFFER_DOWN* pDown;
|
||||
|
||||
INIT();
|
||||
pRTTCB = (volatile SEGGER_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 = (volatile SEGGER_RTT_CB*)((uintptr_t)&_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
|
||||
if (BufferIndex < SEGGER_RTT_MAX_NUM_DOWN_BUFFERS) {
|
||||
SEGGER_RTT_LOCK();
|
||||
pDown = &pRTTCB->aDown[BufferIndex];
|
||||
@@ -1930,7 +1930,7 @@ int SEGGER_RTT_SetTerminal (unsigned char TerminalId) {
|
||||
ac[0] = 0xFFu;
|
||||
if (TerminalId < sizeof(_aTerminalId)) { // We only support a certain number of channels
|
||||
ac[1] = _aTerminalId[TerminalId];
|
||||
pRing = (SEGGER_RTT_BUFFER_UP*)((char*)&_SEGGER_RTT.aUp[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
|
||||
pRing = (SEGGER_RTT_BUFFER_UP*)((uintptr_t)&_SEGGER_RTT.aUp[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
|
||||
SEGGER_RTT_LOCK(); // Lock to make sure that no other task is writing into buffer, while we are and number of free bytes in buffer does not change downwards after checking and before writing
|
||||
if ((pRing->Flags & SEGGER_RTT_MODE_MASK) == SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL) {
|
||||
_ActiveTerminal = TerminalId;
|
||||
@@ -1982,7 +1982,7 @@ int SEGGER_RTT_TerminalOut (unsigned char TerminalId, const char* s) {
|
||||
//
|
||||
// Get "to-host" ring buffer.
|
||||
//
|
||||
pRing = (SEGGER_RTT_BUFFER_UP*)((char*)&_SEGGER_RTT.aUp[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
|
||||
pRing = (SEGGER_RTT_BUFFER_UP*)((uintptr_t)&_SEGGER_RTT.aUp[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
|
||||
//
|
||||
// Need to be able to change terminal, write data, change back.
|
||||
// Compute the fixed and variable sizes.
|
||||
@@ -2059,7 +2059,7 @@ int SEGGER_RTT_TerminalOut (unsigned char TerminalId, const char* s) {
|
||||
unsigned SEGGER_RTT_GetAvailWriteSpace (unsigned BufferIndex) {
|
||||
SEGGER_RTT_BUFFER_UP* pRing;
|
||||
|
||||
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_UP*)((uintptr_t)&_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
|
||||
return _GetAvailWriteSpace(pRing);
|
||||
}
|
||||
|
||||
@@ -2086,7 +2086,7 @@ unsigned SEGGER_RTT_GetBytesInBuffer(unsigned BufferIndex) {
|
||||
// Avoid warnings regarding volatile access order. It's not a problem
|
||||
// in this case, but dampen compiler enthusiasm.
|
||||
//
|
||||
pRTTCB = (volatile SEGGER_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 = (volatile SEGGER_RTT_CB*)((uintptr_t)&_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
|
||||
RdOff = pRTTCB->aUp[BufferIndex].RdOff;
|
||||
WrOff = pRTTCB->aUp[BufferIndex].WrOff;
|
||||
if (RdOff <= WrOff) {
|
||||
|
||||
Reference in New Issue
Block a user