Quantcast
Channel: Infineon Forums
Viewing all articles
Browse latest Browse all 9892

Conditional compile over Build-Configurations

$
0
0
Hi.

Is there a way to compile a project conditional?

I set up a new Build Configuration : TEST.
Only in this configuration, i want to compile the Uart modules to serve the XMC_ASSERT() to a uart output.

To implement this solution, i add a new Build Variables "TEST_ACTIVE" Type:String Val:"0" to the TEST configuration.
( -> Properties for My Project, -> C/C++ Build -> Build Variables; Configuration: TEST )

Attachment 2767
In the source code i place a : #ifdef TEST_ACTIVE (Code between) #endif

I set Configuration TEST active, but the compiler doesn't know the Variable "TEST_ACTIVE".

How can i solve this, or isn't it possible to set up a Configuration for this?

And how to implement and activate the XMC_AssertHandler?

If i define a XMC_AssertHandler() over Uart, the problem will be: during init from the Uart, XMC_AssertHandler is called, but uart is not working at this time.
Then the cat bites into the tail.
What is there before: the egg or the chicken?

And how can i enable XMC_AssertHandler() for my user-output?
I define XMC_ASSERT_ENABLE in xmc_common.h, but this doesn't work.....

My Handler looks like this:

Code:

void XMC_AssertHandler(const char *const msg, const char *const file, uint32_t line)
{
        uint8_t cBuffer[256];
        uint16_t iLen=0;

        iLen = sprintf( cBuffer, "%s %s %d",msg, file, line );
        UART_Transmit(&UART_1 , cBuffer,  iLen );
}

?????

Viewing all articles
Browse latest Browse all 9892