Baremetal code examples using FRDM-K64F

Showing results for 
Search instead for 
Did you mean: 

Baremetal code examples using FRDM-K64F

Baremetal code examples using FRDM-K64F

For those of you interested in starting up designs with K64 and KDS here you will find basic baremetal examples with detailed step by step guides explaining which registers to configure, they also include Reference Manual extracts to make it easier to understand and learn how to do so for those unfamiliar with Kinetis devices.


The rar files include document and code example. I hope all  you find them useful.



  • K64F-GPIO
  • K64F-Interurpt
  • K64F-UART
  • K64F-ADC
  • K64F-PWM
Labels (1)

GREAT!  Do You have a code example for I2C ?

Very interesting.

I am using FRDM_K64F.

Where can I find same examples created with KDS, Processor Expert and KSDK bean (fsl_...).??

I am searching for an example instancing interruption with PE.

Hello Pedro,

1. Is it possible to have a PWM frequency of 5KHz or Greater and have a variable PWM output of 0-100% duty with a resolution of greater than 12bits

2. Using your example, how would implement it?

3. If not possible in item# 1 please advise steps to implement it.



hiii pedro,

i was debug the .elf with KDS2 using segger k64F, but can't done. it was appeared "problem occured, 'launching FRDMK64F debug' has encountered a problem. error in  services launch sequence.


the problem clear. i must fill the name of processor.

once more question pedro, can u give me an example the uart to sending a value variable from ADC. unfornatelly, i can't find "put(...)" for variable data at FRDMK64F

Excellent !!!

Thanks for this information.

Best regards from Panama.


Hi...please excuse me. Full on youngling here about this board...using it for a project of mine in Uni.

So far, I have used this board to switch between the RGB LED when the interrupt switch is pressed, I understand how this works and what needs to be done to create this project....what gpio to include and also to include the interrupt and setup the different modules.

My next step is to use PWM to increase/decrease the brightness of the on-board Blue LED. I have gone through your FRDM-K64F PWM file, with the pdf doc and also opened the project in KDS...Now, I kinda understand whats going on, but how do I integrate your idea/code/project into mine to use PWM to increase/decrease the brightness of the on-board blue LED ? I'm just drawing a blank...

Can someone help me please?

Thank you in advance for taking the time to help me....

Hi Sanjeev,

Attached above in original post is KDS/KSDK PE baremetal project for frdm-k64f that uses two PWM channels (

One PWM is connected to Green LED and other to a pin on J2-pin 10.  They are inverse of one another and ramp from 0-100 % duty cycle.



I've tried to clean/rebuild the GPIO example in KDS with SDK 1.2.0 and I get an error:

Building target: FRDMK64F GPIO.elf

Invoking: Cross ARM C++ Linker

arm-none-eabi-g++ -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections  -g3 -T "MK64FN1M0xxx12_flash.ld" -Xlinker --gc-sections -L"C:/Dev/TKS/NXP/GPIO/FRDMK64F GPIO/Project_Settings/Linker_Files" -Wl,-Map,"FRDMK64F" --specs=nano.specs -o "FRDMK64F GPIO.elf"  ./Sources/main.o  ./Project_Settings/Startup_Code/startup_MK64F12.o ./Project_Settings/Startup_Code/system_MK64F12.o  

c:/freescale/kds_v3/toolchain/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/lib/armv7e-m/fpu\libg_s.a(lib_a-exit.o): In function `exit':

exit.c:(.text.exit+0x1a): undefined reference to `_exit'

collect2.exe: error: ld returned 1 exit status

makefile:52: recipe for target 'FRDMK64F GPIO.elf' failed

make: *** [FRDMK64F GPIO.elf] Error 1

Can you help me with this, please? (I've changed th G++ linker option from -nanolibc to --specs=nano.specs)


Hi olivier,

Just did quick test.

The GPIO demo is standalone (not dependent on KSDK) and was build and compiled using the KDS_2.0.  If you have the "old" KDS_2.0 it will compile cleanly.

I don't know if author is going to update these to most recent KDS or not.



Hi David,

Thanks for your help. Actually I don't really any specific example. I just need one "bare metal" that is working with KDS 3.2.0. Perhaps you know where I can find one? Anyway I'll try to build something form scratch.



I am having real problems loading these examples using KDS 3.2.0. on SuSE Linux leap 42.1

I can download and run all the KDSK projects no problem, but when I try to import these (specifically the interrupt one) into a blank workspace all goes well until I try to debug using openOcd cmsis-dap, which I was using in the KDSK examples.  It tells me the program is missing.,  Yes, it does not appear in the debug configurations listing.

Anybody have any idea how to rectify this?  It is the only way I have of debugging, no P&E or segger debug tools.



nothing in any app note on how to get flash writes to ACTUALLY WORK.  NOTHING in the documentation to tell me why my flash writes FAIL with ACCERR.  Cannot write, CANNOT erase but can do both with the debugger.

can i do mutithreaded  progaramming in K60 programming.

I am new to the Bare metal programming..

i have TWR K60 board with me,IAR setup  done in my pc

how to talk to board,what drivers i need to install,

help me how to start,develop the code..

kindly please help me.

Version history
Revision #:
1 of 1
Last update:
‎10-10-2014 08:39 AM
Updated by: