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.