RW612 SDK - Config Tools creates C prototypes without C++ guards

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

RW612 SDK - Config Tools creates C prototypes without C++ guards

跳至解决方案
2,764 次查看
dmarks_ls
Senior Contributor II

I'm currently writing a C++-based program for the RW612.  I have integrated some of the functions in the original board.c into my own Board object, which has a .CPP source file.  I have properly declared the functions inside my own header file:

#ifdef __cplusplus
extern "C" {
#endif

/* Configures static voltage compensation and sensors, and in XIP case, change
 * FlexSPI clock to a stable source before clock tree (such as PLL and Main
 * clock) update. */
void BOARD_ClockPreConfig(void);
/* Updates FlexSPI clock source and set flash to full speed. */
void BOARD_ClockPostConfig(void);
/* Configure FlexSPI clock source and divider when using XIP flash.  Must run
 * in RAM. */
AT_QUICKACCESS_SECTION_CODE(void BOARD_SetFlexspiClock(FLEXSPI_Type *base, uint32_t src, uint32_t divider));
/* De-initializes XIP flash.  Must run in RAM. */
AT_QUICKACCESS_SECTION_CODE(void BOARD_DeinitFlash(FLEXSPI_Type *base));
/* Initializes XIP flash.  Must run in RAM. */
AT_QUICKACCESS_SECTION_CODE(void BOARD_InitFlash(FLEXSPI_Type *base));

#ifdef __cplusplus
}  // extern "C"
#endif

However, when I compile, I get an error that both BOARD_ClockPreConfig() and BOARD_ClockPostConfig() have previously been defined with C++ linkage:

Errors showing conflicting C/C++ linkageErrors showing conflicting C/C++ linkage

I examined clock_config.h to locate the prototypes for those two functions:

Function prototypes in clock_config.hFunction prototypes in clock_config.h

The problem is that those two prototypes (and the AVPLL config extern declaration) are not placed inside an extern "C" { } declaration.  Several things in clock_config.h do appear within an extern "C" { }, but those items do not, and it throws off the compiler.  This is additionally frustrating because clock_config.h is automatically generated by MCU Config Tools, so I have to either disable re-generation of clock_config.h or manually edit in an extern "C" { } declaration each time I re-generate code.

Please fix this defect in MCU Config Tools for the RW612.  Thank you.

Dana M.

标记 (2)
0 项奖励
回复
1 解答
2,676 次查看
weidong_sun
NXP TechSupport
NXP TechSupport

Dear @dmarks_ls ,

 

Good job! and thanks for you sharing!

I will report the issue to internal team.

Anyway, fortunately, this did not affect the continuation of your project!
In the current situation, you can only proceed according to the method you have adopted.

 

Thanks!

Regards,

weidong

 

在原帖中查看解决方案

3 回复数
2,677 次查看
weidong_sun
NXP TechSupport
NXP TechSupport

Dear @dmarks_ls ,

 

Good job! and thanks for you sharing!

I will report the issue to internal team.

Anyway, fortunately, this did not affect the continuation of your project!
In the current situation, you can only proceed according to the method you have adopted.

 

Thanks!

Regards,

weidong

 

2,728 次查看
weidong_sun
NXP TechSupport
NXP TechSupport

Dear @dmarks_ls ,

 

After   editing in an extern "C" { } in config_clock.h,  Are there any compilation errors in the code?

 

Thanks!

Regards,

weidong

 

0 项奖励
回复
2,714 次查看
dmarks_ls
Senior Contributor II

No, the compilation issues are resolved because the declarations in the header file are recognized as having C binding in all locations.  I've attached the original header file and my fixed version of the header file.  Please review the Config Tools for RW612 and make sure that any extern declarations, type declarations, and function prototypes are enclosed by an extern "C" { } declaration, thanks.

Dana M.

0 项奖励
回复