Feb 03, 2017
01:39 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Feb 03, 2017
01:39 AM
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 )
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:
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 )
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:
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 );
}
- Tags:
- IFX
7 Replies
Feb 05, 2017
11:13 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Feb 05, 2017
11:13 PM
Hi.
I've test the same with Symbols, without any success.
I add a symbols for the compiler and the same for the assembler ( UNIT_TEST 😞
A #ifdef UNIT_TEST block, won't be compiled!!!
Any idea to compile conditional????????
I've test the same with Symbols, without any success.
I add a symbols for the compiler and the same for the assembler ( UNIT_TEST 😞
A #ifdef UNIT_TEST block, won't be compiled!!!
Any idea to compile conditional????????
Feb 09, 2017
01:08 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Feb 09, 2017
01:08 AM
Hi.
Is really no one here who has ever tried conditional compile with dave?
Has no one any idea to set up a "Conditional compile" with dave?
How do you do unit tests ? ????
Do the test functions always remain active and only a test is executed instead of a program run in your project (because no conditional compile possible??) ???
?
Is really no one here who has ever tried conditional compile with dave?
Has no one any idea to set up a "Conditional compile" with dave?
How do you do unit tests ? ????
Do the test functions always remain active and only a test is executed instead of a program run in your project (because no conditional compile possible??) ???
?
Attachments are accessible only for community members.
Feb 09, 2017
12:27 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Feb 09, 2017
12:27 PM
Hi,
You are looking for setting preprocessor symbols.
Go to the Properties of your project and click on C/C++ Build>Settings>ARM-GCC C Compiler>Preprocessor.
On how to use the XMC_ASSERT have a look to the attached example included in XMClib examples/XMC4500_series/UART/UART_PRINTF
Regards,
Jesus
You are looking for setting preprocessor symbols.
Go to the Properties of your project and click on C/C++ Build>Settings>ARM-GCC C Compiler>Preprocessor.
On how to use the XMC_ASSERT have a look to the attached example included in XMClib examples/XMC4500_series/UART/UART_PRINTF
Regards,
Jesus
Feb 16, 2017
02:31 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Feb 16, 2017
02:31 AM
Hi jferreira.
Thanks for you reply.
But this is NOT working in combination with a additional Build-Configuration.
Let me explain.
I have 3 build-configurations:
- Debug
- Release
- Test (for unit-test's)
If i work in Debug-configuration and add a preprocessor-symbol "UNIT_TEST" ( in Properties of my project C/C++ Build>Settings>ARM-GCC C Compiler>Preprocessor)
the compiler knows the symbol if defined -> . #if defined(UNIT_TEST) is working
If i work in Release-configuration and add a preprocessor-symbol "UNIT_TEST" ( in Properties of my project C/C++ Build>Settings>ARM-GCC C Compiler>Preprocessor)
the compiler knows the symbol if defined -> . #if defined(UNIT_TEST) is working
But, if i add a preprocessor-symbol "UNIT_TEST" only in Build-configuration Test ( and delete the symbol in config Debug and Release)
the compiler doesn't know the define: #if defined(UNIT_TEST) is not working
I set configuration Debug as active -> symbol UNIT_TEST unknown -> correct
I set configuration Release as active -> symbol UNIT_TEST unknown -> correct
I set configuration Test as active -> symbol UNIT_TEST unknown -> bug / failure !!! The code-block is greyed out -> see picture below
I used BuildConfiguration -> Set Active -> Test
and i used BuildConfiguration -> Manage: choose Test and -> Set Active
to switch between the 3 Build-Configurations.
Is this a Bug in Dave?
The code-block is greyed out:
Thanks for you reply.
But this is NOT working in combination with a additional Build-Configuration.
Let me explain.
I have 3 build-configurations:
- Debug
- Release
- Test (for unit-test's)
If i work in Debug-configuration and add a preprocessor-symbol "UNIT_TEST" ( in Properties of my project C/C++ Build>Settings>ARM-GCC C Compiler>Preprocessor)
the compiler knows the symbol if defined -> . #if defined(UNIT_TEST) is working
If i work in Release-configuration and add a preprocessor-symbol "UNIT_TEST" ( in Properties of my project C/C++ Build>Settings>ARM-GCC C Compiler>Preprocessor)
the compiler knows the symbol if defined -> . #if defined(UNIT_TEST) is working
But, if i add a preprocessor-symbol "UNIT_TEST" only in Build-configuration Test ( and delete the symbol in config Debug and Release)
the compiler doesn't know the define: #if defined(UNIT_TEST) is not working
I set configuration Debug as active -> symbol UNIT_TEST unknown -> correct
I set configuration Release as active -> symbol UNIT_TEST unknown -> correct
I set configuration Test as active -> symbol UNIT_TEST unknown -> bug / failure !!! The code-block is greyed out -> see picture below
I used BuildConfiguration -> Set Active -> Test
and i used BuildConfiguration -> Manage: choose Test and -> Set Active
to switch between the 3 Build-Configurations.
Is this a Bug in Dave?
The code-block is greyed out:
Feb 17, 2017
06:10 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Feb 17, 2017
06:10 AM
Hi,
For me it is working. I created a third configuration, named Test, as a copy of the Debug one.
In the properties of the project, in the preprocessor macros I added UNIT_TEST.
For the Debug and Release configurations, the macro is not defined and therefore the code is grayed out.
For the Test configuration the macro is defined and therefore the code is not grayed out.
Please check the setting in the indexer
Sometime also helps to rebuild the index.
Regards,
Jesus
For me it is working. I created a third configuration, named Test, as a copy of the Debug one.
In the properties of the project, in the preprocessor macros I added UNIT_TEST.
For the Debug and Release configurations, the macro is not defined and therefore the code is grayed out.
For the Test configuration the macro is defined and therefore the code is not grayed out.
Please check the setting in the indexer
Sometime also helps to rebuild the index.
Regards,
Jesus
Sep 22, 2021
10:10 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sep 22, 2021
10:10 AM
I have run into the exact same problem today, I have a new build configuration where I have added the macro ROUND_CASE.
It all seems fine when looking at the IDE, the section of code that is dependent on that macro to be defined is greyed out when I am NOT in my new build configuration. When I am in my new build configuration then the code is enabled and it all "looks" good.
The problem is that the actual code does not get executed at run time.
I reach my breakpoint at line 59 and then step through the code but line 62 is never executed, it just goes straight into line 65 (not seen in the snippet, no need for that). My test variable in the code is never assigned the 0xAA value.
Can someone please try this with an actual target and step through the code to see if it works at run time?
Thanks in advance.
-Howard
It all seems fine when looking at the IDE, the section of code that is dependent on that macro to be defined is greyed out when I am NOT in my new build configuration. When I am in my new build configuration then the code is enabled and it all "looks" good.
The problem is that the actual code does not get executed at run time.
I reach my breakpoint at line 59 and then step through the code but line 62 is never executed, it just goes straight into line 65 (not seen in the snippet, no need for that). My test variable in the code is never assigned the 0xAA value.
Can someone please try this with an actual target and step through the code to see if it works at run time?
Thanks in advance.
-Howard
Sep 23, 2021
10:24 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sep 23, 2021
10:24 AM
Never mind, this works just fine, turns out I made a mistake when creating my new build configuration (I did not copy the settings from the Debug version so the debugger was not happy).
Thanks to my local Infineon's FAE, he came to the rescue fairly quickly.
Thanks to my local Infineon's FAE, he came to the rescue fairly quickly.