Skip to content

Commit

Permalink
#493 fix (hopefully, untested)
Browse files Browse the repository at this point in the history
  • Loading branch information
rokath committed Sep 5, 2024
1 parent 9a7a2ee commit 72bd744
Show file tree
Hide file tree
Showing 20 changed files with 96 additions and 86 deletions.
1 change: 0 additions & 1 deletion src/tcobsv1Decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include <stdint.h>
#include <stddef.h>
#include <string.h> // memcpy
#include "triceConfig.h"
#include "tcobs.h"
#include "tcobsv1Internal.h"
// clang-format on
Expand Down
1 change: 0 additions & 1 deletion src/tcobsv1Encode.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
// clang-format off
#include <stdint.h>
#include <stddef.h>
#include "triceConfig.h"
#include "tcobs.h"
#include "tcobsv1Internal.h"
// clang-format on
Expand Down
10 changes: 7 additions & 3 deletions src/trice.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include "tcobs.h"
#include "xtea.h"

#if TRICE_OFF == 0

// check configuration:

#ifndef TRICE_DATA_OFFSET
Expand Down Expand Up @@ -825,8 +827,8 @@ unsigned TriceOutDepth(void) {
return depth;
}

#if defined(TRICE_CLEAN) && TRICE_CLEAN == 1
#else // #if defined(TRICE_CLEAN) && TRICE_CLEAN == 1
#if TRICE_OFF == 1 || TRICE_CLEAN == 1
#else // #if TRICE_OFF == 1 || TRICE_CLEAN == 1

//! TRICE_ASSERT writes trice data as fast as possible in a buffer.
//! \param tid is a 16 bit Trice id in upper 2 bytes of a 32 bit value
Expand Down Expand Up @@ -878,7 +880,7 @@ unsigned TriceOutDepth(void) {
}
}

#endif // #else // #if defined(TRICE_CLEAN) && TRICE_CLEAN == 1
#endif // #else // #if TRICE_OFF == 1 || TRICE_CLEAN == 1

#ifdef TRICE_N

Expand Down Expand Up @@ -1007,3 +1009,5 @@ unsigned TriceOutDepth(void) {
}

#endif // #ifdef TRICE_N

#endif // #if TRICE_OFF == 0
22 changes: 11 additions & 11 deletions src/trice.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
// lint -emacro( 717, DCOPY, SCOPY )
// lint -emacro( 732, DCOPY )

#if TRICE_OFF == 1 // Do not generate trice code for files defining TRICE_OFF to 1 before including "trice.h".
#if TRICE_OFF == 1 || TRICE_CLEAN == 1 // Do not generate trice code for files defining TRICE_OFF to 1 before including "trice.h".

#define TRICE_ENTER
#define TRICE_LEAVE
Expand All @@ -60,7 +60,7 @@
#define TRICE_S(id, p, s) // do{ ((void)(id)); ((void)(p)); ((void)(s)); }while(0)
#define TRICE_N(id, p, s, n) // do{ ((void)(id)); ((void)(p)); ((void)(s)); ((void)(n)); }while(0)

#endif // #if TRICE_OFF == 1
#endif // #if TRICE_OFF == 1 || TRICE_CLEAN == 1

// helper macros (the numbers are 32-bit random values)

Expand Down Expand Up @@ -570,19 +570,19 @@ extern int TriceDataOffsetDepthMax;
//! TRICE_VARIABLE_ARGUMENTS concatenates TRICE_ with the result of TRICE_COUNT_ARGUMENTS to produce something like TRICE_2 which takes a printf-format and two arguments.
#define TRICE(tid, fmt, ...) TRICE_CONCAT2(TRICE_, TRICE_COUNT_ARGUMENTS(__VA_ARGS__))(tid, fmt, ##__VA_ARGS__)

#if defined(TRICE_CLEAN) && TRICE_CLEAN == 1
#if TRICE_OFF == 1 || TRICE_CLEAN == 1

#define TRice(fmt, ...)
#define Trice(fmt, ...)
#define trice(fmt, ...)

#else // #if defined(TRICE_CLEAN) && TRICE_CLEAN == 1
#else // #if TRICE_OFF == 1 || TRICE_CLEAN == 1

#define TRice(tid, fmt, ...) TRICE_CONCAT2(TRice_, TRICE_COUNT_ARGUMENTS(__VA_ARGS__))(tid, fmt, ##__VA_ARGS__)
#define Trice(tid, fmt, ...) TRICE_CONCAT2(Trice_, TRICE_COUNT_ARGUMENTS(__VA_ARGS__))(tid, fmt, ##__VA_ARGS__)
#define trice(tid, fmt, ...) TRICE_CONCAT2(trice_, TRICE_COUNT_ARGUMENTS(__VA_ARGS__))(tid, fmt, ##__VA_ARGS__)

#endif // #else // #if defined(TRICE_CLEAN) && TRICE_CLEAN == 1
#endif // #else // #if TRICE_OFF == 1 || TRICE_CLEAN == 1

//
///////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -810,15 +810,15 @@ static inline uint64_t aDouble(double x) {
TRICE_CNTC(0); \
TRICE_LEAVE

#if defined(TRICE_CLEAN) && TRICE_CLEAN == 1
#if TRICE_OFF == 1 || TRICE_CLEAN == 1

// clang-format off
TRICE_INLINE void TRice0( const char * pFmt ){TRICE_UNUSED(pFmt)}
TRICE_INLINE void Trice0( const char * pFmt ){TRICE_UNUSED(pFmt)}
TRICE_INLINE void trice0( const char * pFmt ){TRICE_UNUSED(pFmt)}
// clang-format on

#else // #if defined(TRICE_CLEAN) && TRICE_CLEAN == 1
#else // #if TRICE_OFF == 1 || TRICE_CLEAN == 1

TRICE_INLINE void TRice0(uint16_t tid, const char* pFmt) {
TRice32m_0(tid);
Expand All @@ -835,7 +835,7 @@ static inline uint64_t aDouble(double x) {
TRICE_UNUSED(pFmt)
}

#endif // #else // #if defined(TRICE_CLEAN) && TRICE_CLEAN == 1
#endif // #else // #if TRICE_OFF == 1 || TRICE_CLEAN == 1

#if TRICE_TRANSFER_ORDER_IS_NOT_MCU_ENDIAN == 1

Expand All @@ -859,7 +859,7 @@ static inline uint64_t aDouble(double x) {

#endif // #else // #if TRICE_TRANSFER_ORDER_IS_NOT_MCU_ENDIAN == 1

#if defined(TRICE_CLEAN) && TRICE_CLEAN == 1
#if TRICE_OFF == 1 || TRICE_CLEAN == 1

// clang-format off
TRICE_INLINE void triceAssertTrue( int idN, char* msg, int flag ){TRICE_UNUSED(idN) TRICE_UNUSED(msg) TRICE_UNUSED(pFmt)}
Expand All @@ -871,7 +871,7 @@ TRICE_INLINE void TriceAssertFalse( int idN, char* msg, int flag ){TRICE_UNUSED(
TRICE_INLINE void TRiceAssertFalse( int idN, char* msg, int flag ){TRICE_UNUSED(idN) TRICE_UNUSED(msg) TRICE_UNUSED(pFmt)}
// clang-format on

#else // #if defined(TRICE_CLEAN) && TRICE_CLEAN == 1
#else // #if TRICE_OFF == 1 || TRICE_CLEAN == 1

void triceAssertTrue(int idN, char* msg, int flag);
void TriceAssertTrue(int idN, char* msg, int flag);
Expand All @@ -881,7 +881,7 @@ TRICE_INLINE void TRiceAssertFalse( int idN, char* msg, int flag ){TRICE_UNUSED(
void TriceAssertFalse(int idN, char* msg, int flag);
void TRiceAssertFalse(int idN, char* msg, int flag);

#endif // #else // #if defined(TRICE_CLEAN) && TRICE_CLEAN == 1
#endif // #else // #if TRICE_OFF == 1 || TRICE_CLEAN == 1

typedef void (*Write8AuxiliaryFn_t)(const uint8_t* enc, size_t encLen);
extern Write8AuxiliaryFn_t UserNonBlockingDirectWrite8AuxiliaryFn;
Expand Down
4 changes: 2 additions & 2 deletions src/trice16.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// lint -e529 Warning 529: Symbol '_SEGGER_RTT__LockState' not subsequently referenced
// lint -e701 Info 701: Shift left of signed quantity (int)

#if TRICE_16_BIT_SUPPORT == 1
#if TRICE_16_BIT_SUPPORT == 1 && TRICE_OFF == 0

// no-stamp 16-bit values functions
#ifndef ENABLE_trice16fn_0
Expand Down Expand Up @@ -557,4 +557,4 @@
}
#endif

#endif // #if TRICE_16_BIT_SUPPORT == 1
#endif // #if TRICE_16_BIT_SUPPORT == 1 && TRICE_OFF == 0
24 changes: 12 additions & 12 deletions src/trice16.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@

#define TRICE16(tid, fmt, ...) TRICE_CONCAT2(TRICE16_, TRICE_COUNT_ARGUMENTS(__VA_ARGS__))(tid, fmt, ##__VA_ARGS__)

#if defined(TRICE_CLEAN) && TRICE_CLEAN == 1
#if TRICE_OFF == 1 || TRICE_CLEAN == 1

#define trice16(fmt, ...)
#define Trice16(fmt, ...)
#define TRice16(fmt, ...)

#else // #if defined(TRICE_CLEAN) && TRICE_CLEAN == 1
#else // #if TRICE_OFF == 1 || TRICE_CLEAN == 1

#define trice16(tid, fmt, ...) TRICE_CONCAT2(trice16_, TRICE_COUNT_ARGUMENTS(__VA_ARGS__))(tid, fmt, ##__VA_ARGS__)
#define Trice16(tid, fmt, ...) TRICE_CONCAT2(Trice16_, TRICE_COUNT_ARGUMENTS(__VA_ARGS__))(tid, fmt, ##__VA_ARGS__)
#define TRice16(tid, fmt, ...) TRICE_CONCAT2(TRice16_, TRICE_COUNT_ARGUMENTS(__VA_ARGS__))(tid, fmt, ##__VA_ARGS__)

#endif // #else // #if defined(TRICE_CLEAN) && TRICE_CLEAN == 1
#endif // #else // #if TRICE_OFF == 1 || TRICE_CLEAN == 1

//! TRICE16_B expects inside pFmt only one format specifier, which is used n times by using pFmt n times.
//! It is usable for showing n 16-bit values.
Expand Down Expand Up @@ -293,7 +293,7 @@
TRICE_PUT16_12(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) \
TRICE_LEAVE

#if defined(TRICE_CLEAN) && TRICE_CLEAN == 1
#if TRICE_OFF == 1 || TRICE_CLEAN == 1

#define trice16_0(fmt) //!< trice16_1 is a macro calling a function to reduce code size.
#define trice16_1(fmt, v0) //!< trice16_1 is a macro calling a function to reduce code size.
Expand All @@ -309,7 +309,7 @@
#define trice16_11(fmt, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10) //!< trice16_11 is a macro calling a function to reduce code size.
#define trice16_12(fmt, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) //!< trice16_12 is a macro calling a function to reduce code size.

#else // #if defined(TRICE_CLEAN) && TRICE_CLEAN == 1
#else // #if TRICE_OFF == 1 || TRICE_CLEAN == 1

#define trice16_0(tid, fmt) trice16fn_0(tid) //!< trice16_0 is a macro calling a function to reduce code size.
#define trice16_1(tid, fmt, v0) trice16fn_1(tid, (uint16_t)(v0)) //!< trice16_1 is a macro calling a function to reduce code size.
Expand Down Expand Up @@ -339,7 +339,7 @@
void trice16fn_11(uint16_t tid, uint16_t v0, uint16_t v1, uint16_t v2, uint16_t v3, uint16_t v4, uint16_t v5, uint16_t v6, uint16_t v7, uint16_t v8, uint16_t v9, uint16_t v10);
void trice16fn_12(uint16_t tid, uint16_t v0, uint16_t v1, uint16_t v2, uint16_t v3, uint16_t v4, uint16_t v5, uint16_t v6, uint16_t v7, uint16_t v8, uint16_t v9, uint16_t v10, uint16_t v11);

#endif // #else // #if defined(TRICE_CLEAN) && TRICE_CLEAN == 1
#endif // #else // #if TRICE_OFF == 1 || TRICE_CLEAN == 1

#define Trice16m_0(tid) \
TRICE_ENTER \
Expand Down Expand Up @@ -447,7 +447,7 @@
TRICE_PUT16_12(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) \
TRICE_LEAVE

#if defined(TRICE_CLEAN) && TRICE_CLEAN == 1
#if TRICE_OFF == 1 || TRICE_CLEAN == 1

#define Trice16_0(fmt) //!< Trice16_1 is a macro calling a function to reduce code size.
#define Trice16_1(fmt, v0) //!< Trice16_1 is a macro calling a function to reduce code size.
Expand All @@ -463,7 +463,7 @@
#define Trice16_11(fmt, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10) //!< Trice16_11 is a macro calling a function to reduce code size.
#define Trice16_12(fmt, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) //!< Trice16_12 is a macro calling a function to reduce code size.

#else // #if defined(TRICE_CLEAN) && TRICE_CLEAN == 1
#else // #if TRICE_OFF == 1 || TRICE_CLEAN == 1

#define Trice16_0(tid, fmt) Trice16fn_0(tid) //!< Trice16_0 is a macro calling a function to reduce code size.
#define Trice16_1(tid, fmt, v0) Trice16fn_1(tid, (uint16_t)(v0)) //!< Trice16_1 is a macro calling a function to reduce code size.
Expand Down Expand Up @@ -493,7 +493,7 @@
void Trice16fn_11(uint16_t tid, uint16_t v0, uint16_t v1, uint16_t v2, uint16_t v3, uint16_t v4, uint16_t v5, uint16_t v6, uint16_t v7, uint16_t v8, uint16_t v9, uint16_t v10);
void Trice16fn_12(uint16_t tid, uint16_t v0, uint16_t v1, uint16_t v2, uint16_t v3, uint16_t v4, uint16_t v5, uint16_t v6, uint16_t v7, uint16_t v8, uint16_t v9, uint16_t v10, uint16_t v11);

#endif // #else // #if defined(TRICE_CLEAN) && TRICE_CLEAN == 1
#endif // #else // #if TRICE_OFF == 1 || TRICE_CLEAN == 1

#define TRice16m_0(tid) \
TRICE_ENTER \
Expand Down Expand Up @@ -601,7 +601,7 @@
TRICE_PUT16_12(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) \
TRICE_LEAVE

#if defined(TRICE_CLEAN) && TRICE_CLEAN == 1
#if TRICE_OFF == 1 || TRICE_CLEAN == 1

#define TRice16_0(fmt) //!< TRice16_1 is a macro calling a function to reduce code size.
#define TRice16_1(fmt, v0) //!< TRice16_1 is a macro calling a function to reduce code size.
Expand All @@ -617,7 +617,7 @@
#define TRice16_11(fmt, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10) //!< TRice16_11 is a macro calling a function to reduce code size.
#define TRice16_12(fmt, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) //!< TRice16_12 is a macro calling a function to reduce code size.

#else // #if defined(TRICE_CLEAN) && TRICE_CLEAN == 1
#else // #if TRICE_OFF == 1 || TRICE_CLEAN == 1

#define TRice16_0(tid, fmt) TRice16fn_0(tid) //!< TRice16_0 is a macro calling a function to reduce code size.
#define TRice16_1(tid, fmt, v0) TRice16fn_1(tid, (uint16_t)(v0)) //!< TRice16_1 is a macro calling a function to reduce code size.
Expand Down Expand Up @@ -647,7 +647,7 @@
void TRice16fn_11(uint16_t tid, uint16_t v0, uint16_t v1, uint16_t v2, uint16_t v3, uint16_t v4, uint16_t v5, uint16_t v6, uint16_t v7, uint16_t v8, uint16_t v9, uint16_t v10);
void TRice16fn_12(uint16_t tid, uint16_t v0, uint16_t v1, uint16_t v2, uint16_t v3, uint16_t v4, uint16_t v5, uint16_t v6, uint16_t v7, uint16_t v8, uint16_t v9, uint16_t v10, uint16_t v11);

#endif // #else // #if defined(TRICE_CLEAN) && TRICE_CLEAN == 1
#endif // #else // #if TRICE_OFF == 1 || TRICE_CLEAN == 1

///////////////////////////////////////////////////////////////////////////////
//
Expand Down
4 changes: 2 additions & 2 deletions src/trice32.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// lint -e529 Warning 529: Symbol '_SEGGER_RTT__LockState' not subsequently referenced
// lint -e701 Info 701: Shift left of signed quantity (int)

#if TRICE_32_BIT_SUPPORT == 1
#if TRICE_32_BIT_SUPPORT == 1 && TRICE_OFF == 0

// no-stamp 32-bit-values functions
#ifndef ENABLE_trice32fn_0
Expand Down Expand Up @@ -557,4 +557,4 @@
}
#endif

#endif // #if TRICE_32_BIT_SUPPORT == 1
#endif // #if TRICE_32_BIT_SUPPORT == 1 && TRICE_OFF == 0
Loading

0 comments on commit 72bd744

Please sign in to comment.