Skip to content

Commit bb59d27

Browse files
committed
Fix module compilation.
1 parent a84a16a commit bb59d27

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

shared/atomicity.h

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,23 @@
1111
#define ASSERT_IRQS_DISABLED() __ASSERT((__get_PRIMASK() != 0) || (__get_BASEPRI() != 0), "irqs are enabled")
1212
#else
1313
#include "fsl_common.h"
14+
#include "device.h"
1415

1516
// Soft assert: reports the failure into the status buffer and continues
1617
// (a failed hard assert() would end in newlib's silent _exit hang).
1718
// Only the first failure is printed - SOFT_ASSERT may fire from hot ISR
18-
// paths. Defined in right/src/debug.c.
19-
#ifdef __cplusplus
20-
extern "C" void SoftAssertFailed(const char* file, int line);
19+
// paths. The reporter lives in right/src/debug.c, so the module firmwares
20+
// (which share this header) compile it out.
21+
#if DEVICE_IS_MASTER
22+
#ifdef __cplusplus
23+
extern "C" void SoftAssertFailed(const char* file, int line);
24+
#else
25+
void SoftAssertFailed(const char* file, int line);
26+
#endif
27+
#define SOFT_ASSERT(COND) do { if (!(COND)) { SoftAssertFailed(__FILE__, __LINE__); } } while (0)
2128
#else
22-
void SoftAssertFailed(const char* file, int line);
29+
#define SOFT_ASSERT(COND) ((void)0)
2330
#endif
24-
#define SOFT_ASSERT(COND) do { if (!(COND)) { SoftAssertFailed(__FILE__, __LINE__); } } while (0)
2531

2632
// __enable_irq() is unconditional, so nested DISABLE_IRQ sections would silently
2733
// re-enable irqs at the inner ENABLE_IRQ; softassert against such nesting.

0 commit comments

Comments
 (0)