RW612 SDK - WiFi stack header files lack C++ guards

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

RW612 SDK - WiFi stack header files lack C++ guards

650 次查看
dmarks_ls
Senior Contributor II

I'm currently building a C++ application on the RW612.  I tried defining vApplicationTickHook() in my application but got a message that it was already defined in wifi/port/osa/osa_freertos.c.  OK, that's fine... I can see you provide an API function OSA_SetupTickFunction() to add custom tick functions.  So I add the following code to my C++ module:

#include <osa.h>
extern "C" {

void Program_ApplicationTickHook(void) {
  Clock_Update(os_get_ticks());
}

} // extern "C"

namespace ls {

AppInitResult Program::Stage1Init(void) {
  OSA_SetupTickFunction(&Program_ApplicationTickHook);
  return AppInitResult::kOk;
}

} // namespace ls

And that compiles just fine.  But then the linker throws an error:

C:\NXP\workspace\my_project\Debug/../source/program.cpp:45:(.text._ZN2ls7Program10Stage1InitEv+0xa): undefined reference to `OSA_SetupTickFunction(void (*)())'

Wait, what?  I can see that function in osa_freertos.c.  Then I check something... there are no C++ guards in your Wi-Fi stack software, anywhere.  I change my code to read:

extern "C" {
#include <osa.h>
}

And now the code links correctly, because the C++ compiler knows not to mangle the names of plain C functions.

It is unacceptable for a vendor to provide SDK C code that is not C++ ready.  Please fix this issue in your Wi-Fi stack code, and all other NXP SDK components.  (And be sure to properly surround type declarations and externs as well, not just function declarations.)  Thank you.

Dana M.

标记 (2)
0 项奖励
回复
1 回复

606 次查看
DanielRuvalcaba
NXP TechSupport
NXP TechSupport

Hi,

I'm sorry for the inconvenience.
I'll pass your comments to the corresponding team.

Regards,

Daniel.