- So I built dev audio generator for k22F - put it on my custom built PCB / Device. It works.
- I copy the exact same files and structure into a new project - including fsl_misc_utilities.c, which causes build errors (Why is a mystery to me, since I have followed the USB application directions - in fact I'm almost exactly copying a project?)
- Leaving out fsl_misc_utilities.c allows it to compile and run, but crashes into default IRQ handler after post_init. The initialization process of the hardware is identical to the working function above that runs.
- What is missing? The only difference I can find are the compiler flags?
DEV AUDIO GENERATOR FLAGS :
-Xlinker -z -Xlinker muldefs -Xlinker --defsym=__ram_vector_table__=1 --specs=nano.specs -Wall -fno-common -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -Os -mapcs -Xlinker -static -Xlinker --defsym=__stack_size__=0x1000 -Xlinker --defsym=__heap_size__=0x0400
My Projects Flags :
-specs=nosys.specs -specs=nano.specs
Any suggestions? Any links to where can I find more information on compiler flags?
Hello Donald:
You should replicate the compiler and linker flags to your new project so it behaves the same as the audio generator example. Some GNU GCC toolchain documentation (compiler/linker, etc) can be found with your KDS installation, in this path:
C:\Freescale\KDS_3.0.0\toolchain\share\doc\gcc-arm-none-eabi\pdf
And you can also find GCC ARM documentation by searching online. It's a very complex toolchain and so is the documentation, then do not expect to understand everything at first.
Now, in your particular case, I think the problem is that inline assembly instructions (asm) are not recognized, so try changing the compiler language to GNU ISO C99, like below picture:
Then the build errors should be solved.
Let me know if you have further issues.
Regards!
Jorge Gonzalez
So, problem #1 solved with fsl_misc_utilities. Thank you!
Unfortunately, I still get a malfunctioning device...
One of the issues is that I'd love to replicate the exact settings in the dev audio generator - however when I build a new KDS project I get a C and a C++ compiler with all of the options, whereas the example project is purely written in C/ASM. If I build a C project from scratch, would that potentially fix anything?
Hello Donald:
As instructed by colleague Erich Styger in this post: Compiling C Files with GNU ARM G++ | MCU on Eclipse I used the next code to detect the compiler used in a new Project with KDS v3.0.0:
#ifdef __cplusplus
#warning main.c compiled as C++
#else
#warning main.c compiled as C
#endif
For main.c the code above threw "warning main.c compiled as C". Then it seems to me that even though you have C++ compiler options, the .c files are compiled by default in C mode, so there should be no difference between your project and the example. This post has also very good information regarding KDS and C++: C++ with Kinetis Design Studio | MCU on Eclipse
About the "malfunctioning device", what do you mean? Does it crash? Are you able to debug and see the point where it crashes?
Regards!
Jorge Gonzalez
During post_init it dumps to defaultIRQ, and Windows says it couldn't recognize the device.