There is fsl_common in the drivers of KW41Z SDK and at looks like it is missing a linker script. The InstallIRQHandler is using external references to things like __RAM_VECTOR_TABLE_SIZE_BYTES. Apparently they are supposed to be declared in the linker script. I would expect the script to be somewhere in the drivers folder to use in my application but I cannot find it anywhere. How to create a linker script to make fsl_common compilable. Without the linker script it gives " undefined reference to" error.
I need more information about your issue.
Could you please tell me if you used an MCUXpresso SDK example as a base for your project?
Could you let me know what are you trying to do so I can provide the best solution, like some more information about what error did you encounter, or if you did any modifications to the project?
Also could you please let me know the steps you follow to create your project?
Initially I encountered the issue when I was trying to move Dimmer Switch zigbee example from C to an empty C++ project. That probably will be long to explain and difficult to replicate but I have a very simply step by step instructions how to replicate that issue in an abstract example.
MCUXpresso IDE v11.1.1 [Build 3241] [2020-03-02]
Then you go and create a new C++ project:
1. Click New -> Project
2. Select Create a new MCUXpresso IDE C/C++ project.
Then on the first wizard page select frdmkw41z SDK
Then on the second wizard page check:
2. Keep the selected by default driver checks, make sure "common" is checked.
3. Select project type: C++ project
Then click finish and after that add the following call to the main C++ page anywhere to the main() function
Build the project and observe
c:/nxp/mcuxpressoide_11.1.1_3241/ide/plugins/com.nxp.mcuxpresso.tools.win32_188.8.131.52001081728/tools/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/ld.exe: ./drivers/fsl_common.o: in function `InstallIRQHandler':
SRAM: 8780 B 128 KB 6.70%
C:\nxp\Workspace2\SmartSwitch\Debug/../drivers/fsl_common.c:114: undefined reference to `__RAM_VECTOR_TABLE_SIZE_BYTES'
c:/nxp/mcuxpressoide_11.1.1_3241/ide/plugins/com.nxp.mcuxpresso.tools.win32_184.108.40.206001081728/tools/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/ld.exe: C:\nxp\Workspace2\SmartSwitch\Debug/../drivers/fsl_common.c:114: undefined reference to `__VECTOR_RAM'
c:/nxp/mcuxpressoide_11.1.1_3241/ide/plugins/com.nxp.mcuxpresso.tools.win32_220.127.116.11001081728/tools/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/ld.exe: C:\nxp\Workspace2\SmartSwitch\Debug/../drivers/fsl_common.c:114: undefined reference to `__VECTOR_TABLE'
Thanks for the detailed steps, I was able to replicate your issue.
Could you please try to use one of the MCUXpresso SDK examples as the basis for your project? The linker script from a new created project is different from the used in the MCUXpresso SDK wireless examples. That is why __VECTOR_TABLE, __VECTOR_RAM, and __RAM_VECTOR_TABLE_SIZE_BYTES are not defined in the linker script of your new project.
Unfortunately, these examples are only supported in C. Could you please provide more details about your project? I would like to know what are the functions that you want to use that requires to be in C++. I could provide a better solution or recommendations for the applications you are developing.
Sorry for the inconvenience this may cause you.
To me is seems that the SDK is not complete. I wonder if the work on SDK continues and when these issues are going to be resolved? Basically, I cannot create a new project and expect that all functions from the headers will compile, I'm not even talking yet about working but at least compiling. By the way, it doesn't even matter if the project is C++ or C. If you create a new project and try to invoke that function in your code you get that linking error. That is sort of frustrating.
The examples could be too complicated. Their linker scripts have many things and I don't understand many of those. I don't want blindly copy the linker script. I want to know that if I use that driver I have to add these N lines to the linker script, if I want to to use another driver I have to add other N lines to the linker script and it would be better to have a detailed explanation.
Or even better those linker scripts to be created automatically when a driver is checked when a project is created.
Anyway, if there is no easy solution to it apparently I'll have to dig if I can comprehend the examples and reassemble what I need out of them but all that makes me thinking I probably better look into other direction, other IDE, MCU, etc. where the SDK is complete and ready to be used.
Sorry for the inconvenience this might cause you, but we do not recommend the creation of a project from scratch for the Wireless Connectivity Products.
We recommend the usage of the current examples as a base and change only the application level of the examples. This is as the stack is pre-certified, it saves money and time for customers.
If you use one of the basic examples linker files as a base, the linker file structure for those examples will be different from the wireless ones.
We can recommend you to check the Connectivity Framework Reference Manual and the BLE Application Developer's Guide for some guidance of the linker file management, still, that would be the best we can help you.
Also, I was informed by one of my pears that you were dealing with the C++ project's topic internally. Could you please refer the comments on this topic to the respective case?
Please let me know if you do not receive an update.