!defined unknown to uvision4 for ARM?

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
Guanahani
Posts: 3
Joined: Sun Jun 05, 2011 4:21 pm

!defined unknown to uvision4 for ARM?

Post by Guanahani »

Hello Giovanni,
i am trying to rebuild the example : ARMCM3-STM32F103 for Keil using ChibiOS 2.2.4
Target is an Olimex STM32-H107. I have customized the files in OLIMEX_STM32_P103 into
a new OLIMEX_STM32-H107 subdir in boards.
Copied the ARMCM3-STM32F103 into a new project folder and adapted
- halconf.h
- mcuconf.h
to my needs. I am planning to use all 3 SPI and USARTS 2 and 3 of the STM32F107VC.
Also changed the path to the board subdir in the Keil project.

All things went easy, so far.

Using the demo version of the Keil compiler i have tried to compile the project and first
found the problem with the clock generation and corrected it as proposed in the forum.
When i try to compile now i am getting following warnings :
..\..\..\os\hal\platforms\STM32\uart_lld.h(86): warning: #47-D: incompatible redefinition of macro "STM32_UART_USART1_IRQ_PRIORITY" (declared at line 124 of "..\mcuconf.h")
..\..\..\os\hal\platforms\STM32\uart_lld.h(93): warning: #47-D: incompatible redefinition of macro "STM32_UART_USART2_IRQ_PRIORITY" (declared at line 125 of "..\mcuconf.h")
..\..\..\os\hal\platforms\STM32\uart_lld.h(100): warning: #47-D: incompatible redefinition of macro "STM32_UART_USART3_IRQ_PRIORITY" (declared at line 126 of "..\mcuconf.h")
Project build/rebuild aborted.

I have changed the USART irq to 11, which should be OK because i do not using CAN.

Following this warnings i have consulted the Keil Manual and made some tests finding that the preprocessor
does not allow the syntax :
#if !defined(STM32_UART_USART1_IRQ_PRIO) || defined(__DOXYGEN__)
The preprocessor just misinterprets the line which is always not true, so the warning
is generated because default irq in uart_lld.h is 12.
I have found 256 occurrences of the !defined in the code.
Keil manual describes only #ifdef and #ifndef statements, so all occurances mut be replaced by nested
#ifdef and #ifndef.

Thank you for your help.
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: !defined unknown to uvision4 for ARM?

Post by Giovanni »

Hi,

The first problem has been fixed in 2.2.5, the other problem is not because the defined() (which is standard and perfectly fine) but because an error in uart_lld.h:

#if !defined(STM32_UART_USART2_IRQ_PRIO) || defined(__DOXYGEN__)
#define STM32_UART_USART2_IRQ_PRIORITY 12
#endif

Note that the check is performed on a different name, "PRIO" instead of "PRIORITY". I'll fix this in 2.2.6, in the meanwhile you can manually fix uart_lld.h by putting the correct macro names inside the !defined().

Thanks for finding this problem.

Giovanni
Post Reply