This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

header file "MKL25Z4.h" not found for FRDM-KL25Z128xxx4

I am using Keil MDK-ARM version for FRDM-KL25Z128xxx4 board. I have downloaded all the required packages using the pack installer.

  

When I create a new project and build the following code, I get the following error even though I have it included:


Build started: Project: SampleProj
*** Using Compiler 'V6.16', folder: 'C:\Keil_v5\ARM\ARMCLANG\Bin'
Build target 'Target 1'
RTE/Device/MKL25Z128xxx4/system_MKL25Z4.c(100): error: 'MKL25Z4.h' file not found
#include "MKL25Z4.h"
^~~~~~~~~~~
1 error generated.
compiling system_MKL25Z4.c...
"Sample.s", line 1 (column 3): Error: A1137E: Unexpected characters at end of line
1 00000000 #include <MKL25Z4.h>
^
1 Error, 0 Warnings
assembling Sample.s...
".\Objects\SampleProj.axf" - 1 Error(s), 0 Warning(s).
Target not created.


The code is in assembly language (.s):

		area sample, code, readonly
				export __main
					
__main

		mov r1,r2
		mov r3,r2
		end
The following is the screenshot of the error and the code:
So what can be done to resolve this?
  • I quickly have generated a corresponding project for a FRDM-KL25Z128xxx4.

    Building this project results in 0 errors and 0 warnings.

    Software Packs in use -> see attached screenshot

  • Hi MaharshiP,

    Why did you modify the source code, so that it does not match the error anymore? So your screenshots are just confusing and make helping you difficult.

    But ok, the assembler (armasm in this case) does not understand the C preprocessor syntax on its own. So, you get this error.  So, remove it.

    Then it is generally not a good idea to use the label "__main" in your code, because this is already used in the Arm runtime library. You should start your program at "main" unless you want to put your code already in the reset handler.

    So, I suggest the following for your "Sample.s":

          area sample, code, readonly
          import __ARM_use_no_argv
          export main
    
    main PROC
      mov r1,r2
      mov r3,r2
      ENDP
      end
    

    You see 3 changes to your version:

    1. I renamed "__main" to "main".

    2. As you have main() in assembler, the compiler can't see, that it takes no arguments. That's why you manually need to reference the __ARM_use_no_argv symbol to prevent some unwanted code to be pulled in.

    3. added PROC/ENDP to make the debugger aware of this function. Otherwise, you could not step the code in your assembler source.

    With this, your program should run to main() and you can single step from thereon. Hope this helps.