KEIL compilation problem Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
Post Reply
alexblack
Posts: 277
Joined: Mon Sep 24, 2012 3:52 pm
Been thanked: 33 times

KEIL compilation problem

Post 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.
alexblack
Posts: 277
Joined: Mon Sep 24, 2012 3:52 pm
Been thanked: 33 times

Re: KEIL compilation problem

Post by alexblack »

Note: this problem is related only for C++ files.
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: KEIL compilation problem

Post 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
alexblack
Posts: 277
Joined: Mon Sep 24, 2012 3:52 pm
Been thanked: 33 times

Re: KEIL compilation problem

Post 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
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: KEIL compilation problem

Post 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
atomiclama
Posts: 12
Joined: Fri Oct 18, 2019 3:54 pm
Has thanked: 3 times

Re: KEIL compilation problem

Post 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.
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: KEIL compilation problem

Post by Giovanni »

Forgot about this, it should be fine now.

Giovanni
atomiclama
Posts: 12
Joined: Fri Oct 18, 2019 3:54 pm
Has thanked: 3 times

Re: KEIL compilation problem

Post by atomiclama »

Fantastic thank you.
Post Reply