Page 1 of 1

KEIL compilation problem

Posted: Mon Jan 20, 2020 3:28 pm
by alexblack
Hi.
I tried current trunk and found problems with compile the project for STM32 MCU.
The projects usesC++ KEIL compiler, CH_CFG_ST_TIMEDELTA = 2, STM32_ST_USE_TIMER = 2:

Code: Select all

..\lib\ChibiOS\os\hal\include\hal_st.h(71): error:  #337: linkage specification is incompatible with previous "stStartAlarm"  (declared at line 69 of "..\lib\ChibiOS\os\common\ports\ARMCMx\chcore_timer.h")
    void stStartAlarm(systime_t abstime);
..\lib\ChibiOS\os\hal\include\hal_st.h(72): error:  #337: linkage specification is incompatible with previous "stStopAlarm"  (declared at line 80 of "..\lib\ChibiOS\os\common\ports\ARMCMx\chcore_timer.h")
    void stStopAlarm(void);
..\lib\ChibiOS\os\hal\include\hal_st.h(73): error:  #337: linkage specification is incompatible with previous "stSetAlarm"  (declared at line 93 of "..\lib\ChibiOS\os\common\ports\ARMCMx\chcore_timer.h")
    void stSetAlarm(systime_t abstime);
..\lib\ChibiOS\os\hal\include\hal_st.h(74): error:  #337: linkage specification is incompatible with previous "stGetAlarm"  (declared at line 119 of "..\lib\ChibiOS\os\common\ports\ARMCMx\chcore_timer.h")
    systime_t stGetAlarm(void);
..\lib\ChibiOS\os\hal\include\hal_st.h(75): error:  #337: linkage specification is incompatible with previous "stGetCounter"  (declared at line 106 of "..\lib\ChibiOS\os\common\ports\ARMCMx\chcore_timer.h")
    systime_t stGetCounter(void);

On stable.19.1.x the project compilled ok.

Re: KEIL compilation problem

Posted: Mon Jan 20, 2020 3:42 pm
by alexblack
Note: this problem is related only for C++ files.

Re: KEIL compilation problem

Posted: Sat Feb 08, 2020 10:15 am
by Giovanni
Hi,

I removed the "extern" keyword in prototypes in chcore_timer.h, this is the only difference I can see, could you confirm?

Giovanni

Re: KEIL compilation problem

Posted: Mon Feb 10, 2020 6:38 am
by alexblack
Hi. Your changes not helped.
The problem is in the file "chcore_timer.h" - static inline functions use stStartAlarm and others. This file must be linked with extern "C" also. I tried it and it works.
But now I have another troubles:

Code: Select all

compiling hal_lld.c...
..\lib\ChibiOS\os\hal\ports\STM32\STM32G4xx\hal_lld.c(119): error:  #20: identifier "STM32_PLS_LEV0" is undefined
    PWR->CR2 = STM32_PWR_CR2;
..\lib\ChibiOS\os\hal\ports\STM32\STM32G4xx\hal_lld.c(119): error:  #20: identifier "STM32_PVDE_DISABLED" is undefined
    PWR->CR2 = STM32_PWR_CR2;
..\lib\ChibiOS\os\hal\ports\STM32\STM32G4xx\hal_lld.c(156): error:  #20: identifier "STM32_PLS_LEV0" is undefined
    PWR->CR2 = STM32_PWR_CR2;
..\lib\ChibiOS\os\hal\ports\STM32\STM32G4xx\hal_lld.c(156): error:  #20: identifier "STM32_PVDE_DISABLED" is undefined
    PWR->CR2 = STM32_PWR_CR2;
..\lib\ChibiOS\os\hal\ports\STM32\STM32G4xx\hal_lld.c: 0 warnings, 4 errors

Re: KEIL compilation problem

Posted: Mon Feb 10, 2020 8:38 am
by Giovanni
Hi,

I will update the timer file. Those errors are caused by enhancements in G4 mcuconf.h files, please take the file from the latest demo.

Giovanni

Re: KEIL compilation problem

Posted: Tue Feb 25, 2020 10:50 am
by atomiclama
Thanks alexblack this saved me a lot of time searching for the problem.

alexblack wrote:The problem is in the file "chcore_timer.h" - static inline functions use stStartAlarm and others. This file must be linked with extern "C" also.
[/code]


Giovanni Looking forward to the update of the file.

Re: KEIL compilation problem

Posted: Tue Feb 25, 2020 1:48 pm
by Giovanni
Forgot about this, it should be fine now.

Giovanni

Re: KEIL compilation problem

Posted: Tue Feb 25, 2020 2:49 pm
by atomiclama
Fantastic thank you.