diff --git a/.gitmodules b/.gitmodules
index 4ac0a72..8b84d0a 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -4,3 +4,6 @@
[submodule "lib/KSDK_1.3_FRDM-KL03Z"]
path = lib/KSDK_1.3_FRDM-KL03Z
url = git@github.com:UltimateHackingKeyboard/KSDK_1.3_FRDM-KL03Z.git
+[submodule "lib/KSDK_2.0_MKL03Z8xxx4"]
+ path = lib/KSDK_2.0_MKL03Z8xxx4
+ url = git@github.com:UltimateHackingKeyboard/KSDK_2.0_MKL03Z8xxx4.git
diff --git a/left/build/README.md b/left/build/README.md
deleted file mode 100644
index c2bd979..0000000
--- a/left/build/README.md
+++ /dev/null
@@ -1,3 +0,0 @@
-# Build environments
-
-This directory contains the environments that are supported to easily build the firmware.
diff --git a/left/build/armgcc/CMakeLists.txt b/left/build/armgcc/CMakeLists.txt
index 6ec8cde..9af7857 100644
--- a/left/build/armgcc/CMakeLists.txt
+++ b/left/build/armgcc/CMakeLists.txt
@@ -18,122 +18,181 @@ SET(CMAKE_EXECUTABLE_LIBRARY_PREFIX)
SET(CMAKE_EXECUTABLE_LIBRARY_SUFFIX)
# CURRENT DIRECTORY
-SET(SrcDir "${CMAKE_CURRENT_SOURCE_DIR}/../..")
-SET(KsdkDir "${SrcDir}/../lib/KSDK_1.3_FRDM-KL03Z")
-SET(IncludeDir "${SrcDir}/../include")
+SET(SrcDir "${CMAKE_CURRENT_SOURCE_DIR}/../../src")
+SET(KsdkDir "${SrcDir}/../../lib/KSDK_2.0_MKL03Z8xxx4")
+SET(ProjDirPath ${CMAKE_CURRENT_SOURCE_DIR})
-# DEBUG LINK FILE
-set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -T${KsdkDir}/platform/devices/MKL03Z4/linker/gcc/MKL03Z32xxx4_flash.ld -static")
+SET(CMAKE_ASM_FLAGS_DEBUG "${CMAKE_ASM_FLAGS_DEBUG} -DDEBUG")
+SET(CMAKE_ASM_FLAGS_DEBUG "${CMAKE_ASM_FLAGS_DEBUG} -D__STARTUP_CLEAR_BSS")
+SET(CMAKE_ASM_FLAGS_DEBUG "${CMAKE_ASM_FLAGS_DEBUG} -g")
+SET(CMAKE_ASM_FLAGS_DEBUG "${CMAKE_ASM_FLAGS_DEBUG} -flto")
+SET(CMAKE_ASM_FLAGS_DEBUG "${CMAKE_ASM_FLAGS_DEBUG} -mcpu=cortex-m0plus")
+SET(CMAKE_ASM_FLAGS_DEBUG "${CMAKE_ASM_FLAGS_DEBUG} -Wall")
+SET(CMAKE_ASM_FLAGS_DEBUG "${CMAKE_ASM_FLAGS_DEBUG} -mfloat-abi=soft")
+SET(CMAKE_ASM_FLAGS_DEBUG "${CMAKE_ASM_FLAGS_DEBUG} -mthumb")
+SET(CMAKE_ASM_FLAGS_DEBUG "${CMAKE_ASM_FLAGS_DEBUG} -fno-common")
+SET(CMAKE_ASM_FLAGS_DEBUG "${CMAKE_ASM_FLAGS_DEBUG} -ffunction-sections")
+SET(CMAKE_ASM_FLAGS_DEBUG "${CMAKE_ASM_FLAGS_DEBUG} -fdata-sections")
+SET(CMAKE_ASM_FLAGS_DEBUG "${CMAKE_ASM_FLAGS_DEBUG} -ffreestanding")
+SET(CMAKE_ASM_FLAGS_DEBUG "${CMAKE_ASM_FLAGS_DEBUG} -fno-builtin")
+SET(CMAKE_ASM_FLAGS_DEBUG "${CMAKE_ASM_FLAGS_DEBUG} -mapcs")
+SET(CMAKE_ASM_FLAGS_DEBUG "${CMAKE_ASM_FLAGS_DEBUG} -std=gnu99")
-# RELEASE LINK FILE
-set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -T${KsdkDir}/platform/devices/MKL03Z4/linker/gcc/MKL03Z32xxx4_flash.ld -static")
+SET(CMAKE_ASM_FLAGS_RELEASE "${CMAKE_ASM_FLAGS_RELEASE} -D__STARTUP_CLEAR_BSS")
+SET(CMAKE_ASM_FLAGS_RELEASE "${CMAKE_ASM_FLAGS_RELEASE} -flto")
+SET(CMAKE_ASM_FLAGS_RELEASE "${CMAKE_ASM_FLAGS_RELEASE} -mcpu=cortex-m0plus")
+SET(CMAKE_ASM_FLAGS_RELEASE "${CMAKE_ASM_FLAGS_RELEASE} -Wall")
+SET(CMAKE_ASM_FLAGS_RELEASE "${CMAKE_ASM_FLAGS_RELEASE} -mfloat-abi=soft")
+SET(CMAKE_ASM_FLAGS_RELEASE "${CMAKE_ASM_FLAGS_RELEASE} -mthumb")
+SET(CMAKE_ASM_FLAGS_RELEASE "${CMAKE_ASM_FLAGS_RELEASE} -fno-common")
+SET(CMAKE_ASM_FLAGS_RELEASE "${CMAKE_ASM_FLAGS_RELEASE} -ffunction-sections")
+SET(CMAKE_ASM_FLAGS_RELEASE "${CMAKE_ASM_FLAGS_RELEASE} -fdata-sections")
+SET(CMAKE_ASM_FLAGS_RELEASE "${CMAKE_ASM_FLAGS_RELEASE} -ffreestanding")
+SET(CMAKE_ASM_FLAGS_RELEASE "${CMAKE_ASM_FLAGS_RELEASE} -fno-builtin")
+SET(CMAKE_ASM_FLAGS_RELEASE "${CMAKE_ASM_FLAGS_RELEASE} -mapcs")
+SET(CMAKE_ASM_FLAGS_RELEASE "${CMAKE_ASM_FLAGS_RELEASE} -std=gnu99")
-# DEBUG ASM FLAGS
-SET(CMAKE_ASM_FLAGS_DEBUG "${CMAKE_ASM_FLAGS_DEBUG} -g -mcpu=cortex-m0plus -mthumb -Wall -fno-common -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -mapcs -std=gnu99")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DCPU_MKL03Z32VFK4")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DPRINTF_FLOAT_ENABLE=0")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSCANF_FLOAT_ENABLE=0")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DPRINTF_ADVANCED_ENABLE=0")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSCANF_ADVANCED_ENABLE=0")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DFRDM_KL03Z")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DFREEDOM")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -flto")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -mcpu=cortex-m0plus")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -mfloat-abi=soft")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -mthumb")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -MMD")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -MP")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -fno-common")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -ffunction-sections")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -fdata-sections")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -ffreestanding")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -fno-builtin")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -mapcs")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -std=gnu99")
-# DEBUG C FLAGS
-SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g -O0 -mcpu=cortex-m0plus -mthumb -MMD -MP -Wall -fno-common -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -mapcs -std=gnu99")
+SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNDEBUG")
+SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DCPU_MKL03Z32VFK4")
+SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DPRINTF_FLOAT_ENABLE=0")
+SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DSCANF_FLOAT_ENABLE=0")
+SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DPRINTF_ADVANCED_ENABLE=0")
+SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DSCANF_ADVANCED_ENABLE=0")
+SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DFRDM_KL03Z")
+SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DFREEDOM")
+SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Os")
+SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -flto")
+SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -mcpu=cortex-m0plus")
+SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Wall")
+SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -mfloat-abi=soft")
+SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -mthumb")
+SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -MMD")
+SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -MP")
+SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fno-common")
+SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -ffunction-sections")
+SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fdata-sections")
+SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -ffreestanding")
+SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fno-builtin")
+SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -mapcs")
+SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -std=gnu99")
-# DEBUG LD FLAGS
-SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -g --specs=nano.specs -lm -Wall -fno-common -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -mthumb -mapcs -Xlinker --gc-sections -Xlinker -static -Xlinker -z -Xlinker muldefs -Xlinker --defsym=__stack_size__=0x300 -Xlinker --defsym=__heap_size__=0x200")
+SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -flto")
+SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -mcpu=cortex-m0plus")
+SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -Wall")
+SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -mfloat-abi=soft")
+SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} --specs=nano.specs")
+SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -fno-common")
+SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -ffunction-sections")
+SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -fdata-sections")
+SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -ffreestanding")
+SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -fno-builtin")
+SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -mthumb")
+SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -mapcs")
+SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -Xlinker")
+SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} --gc-sections")
+SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -Xlinker")
+SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -static")
+SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -Xlinker")
+SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -z")
+SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -Xlinker")
+SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} muldefs")
-# RELEASE ASM FLAGS
-SET(CMAKE_ASM_FLAGS_RELEASE "${CMAKE_ASM_FLAGS_RELEASE} -mcpu=cortex-m0plus -mthumb -Wall -fno-common -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -mapcs -std=gnu99")
+SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -g")
+SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -flto")
+SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -mcpu=cortex-m0plus")
+SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -Wall")
+SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -mfloat-abi=soft")
+SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} --specs=nano.specs")
+SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -fno-common")
+SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -ffunction-sections")
+SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -fdata-sections")
+SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -ffreestanding")
+SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -fno-builtin")
+SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -mthumb")
+SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -mapcs")
+SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -Xlinker")
+SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} --gc-sections")
+SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -Xlinker")
+SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -static")
+SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -Xlinker")
+SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -z")
+SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -Xlinker")
+SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} muldefs")
-# RELEASE C FLAGS
-SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Os -mcpu=cortex-m0plus -mthumb -MMD -MP -Wall -fno-common -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -mapcs -std=gnu99")
+include_directories(${KsdkDir}/CMSIS/Include)
+include_directories(${ProjDirPath}/../../../../../devices)
+include_directories(${KsdkDir}/devices/MKL03Z4/drivers)
+include_directories(${ProjDirPath}/..)
+include_directories(${ProjDirPath}/../../../../../devices/MKL03Z4/utilities)
+include_directories(${ProjDirPath}/../../..)
+include_directories(${KsdkDir}/devices/MKL03Z4)
+include_directories(${ProjDirPath}/../../../../../CMSIS/Include)
+include_directories(${ProjDirPath}/../../../../../devices)
+include_directories(${ProjDirPath}/../../../../../devices/MKL03Z4/drivers)
+include_directories(${ProjDirPath}/..)
+include_directories(${ProjDirPath}/../../../../../devices/MKL03Z4/utilities)
+include_directories(${ProjDirPath}/../../..)
+include_directories(${ProjDirPath}/../../../../../devices/MKL03Z4)
-# RELEASE LD FLAGS
-SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} --specs=nano.specs -lm -Wall -fno-common -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -mthumb -mapcs -Xlinker --gc-sections -Xlinker -static -Xlinker -z -Xlinker muldefs -Xlinker --defsym=__stack_size__=0x300 -Xlinker --defsym=__heap_size__=0x200")
-
-# ASM MACRO
-SET(CMAKE_ASM_FLAGS_DEBUG "${CMAKE_ASM_FLAGS_DEBUG} -DDEBUG")
-
-# C MACRO
-SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG")
-SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DCPU_MKL03Z32VFK4")
-SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DFRDM_KL03Z")
-SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DFREEDOM")
-SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNDEBUG")
-SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DCPU_MKL03Z32VFK4")
-SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DFRDM_KL03Z")
-SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DFREEDOM")
-
-# CXX MACRO
-
-# INCLUDE_DIRECTORIES
-IF(CMAKE_BUILD_TYPE MATCHES Debug)
- INCLUDE_DIRECTORIES(${KsdkDir}/platform/osa/inc)
- INCLUDE_DIRECTORIES(${KsdkDir}/platform/utilities/inc)
- INCLUDE_DIRECTORIES(${KsdkDir}/platform/CMSIS/Include)
- INCLUDE_DIRECTORIES(${KsdkDir}/platform/devices)
- INCLUDE_DIRECTORIES(${KsdkDir}/platform/devices/MKL03Z4/include)
- INCLUDE_DIRECTORIES(${KsdkDir}/platform/devices/MKL03Z4/startup)
- INCLUDE_DIRECTORIES(${KsdkDir}/platform/hal/inc)
- INCLUDE_DIRECTORIES(${KsdkDir}/platform/drivers/inc)
- INCLUDE_DIRECTORIES(${KsdkDir}/platform/system/inc)
- INCLUDE_DIRECTORIES(${KsdkDir}/platform/drivers/src/gpio)
- INCLUDE_DIRECTORIES(${KsdkDir}/examples)
- INCLUDE_DIRECTORIES(${KsdkDir}/examples/frdmkl03z)
- INCLUDE_DIRECTORIES(${KsdkDir})
- INCLUDE_DIRECTORIES(${IncludeDir})
-ELSEIF(CMAKE_BUILD_TYPE MATCHES Release)
- INCLUDE_DIRECTORIES(${KsdkDir}/platform/osa/inc)
- INCLUDE_DIRECTORIES(${KsdkDir}/platform/utilities/inc)
- INCLUDE_DIRECTORIES(${KsdkDir}/platform/CMSIS/Include)
- INCLUDE_DIRECTORIES(${KsdkDir}/platform/devices)
- INCLUDE_DIRECTORIES(${KsdkDir}/platform/devices/MKL03Z4/include)
- INCLUDE_DIRECTORIES(${KsdkDir}/platform/devices/MKL03Z4/startup)
- INCLUDE_DIRECTORIES(${KsdkDir}/platform/hal/inc)
- INCLUDE_DIRECTORIES(${KsdkDir}/platform/drivers/inc)
- INCLUDE_DIRECTORIES(${KsdkDir}/platform/system/inc)
- INCLUDE_DIRECTORIES(${KsdkDir}/platform/drivers/src/gpio)
- INCLUDE_DIRECTORIES(${KsdkDir}/examples)
- INCLUDE_DIRECTORIES(${KsdkDir}/examples/frdmkl03z)
- INCLUDE_DIRECTORIES(${KsdkDir})
- INCLUDE_DIRECTORIES(${IncludeDir})
-ENDIF()
-
-# ADD_EXECUTABLE
-ADD_EXECUTABLE(uhk-left
- "${KsdkDir}/platform/utilities/src/fsl_misc_utilities.c"
- "${KsdkDir}/platform/devices/MKL03Z4/startup/gcc/startup_MKL03Z4.S"
- "${SrcDir}/main.c"
- "${KsdkDir}/examples/frdmkl03z/gpio_pins.c"
- "${KsdkDir}/examples/frdmkl03z/gpio_pins.h"
- "${KsdkDir}/examples/frdmkl03z/pin_mux.c"
- "${KsdkDir}/examples/frdmkl03z/pin_mux.h"
- "${KsdkDir}/examples/frdmkl03z/board.c"
- "${KsdkDir}/examples/frdmkl03z/board.h"
- "${KsdkDir}/platform/utilities/src/fsl_debug_console.c"
- "${KsdkDir}/platform/utilities/inc/fsl_debug_console.h"
- "${KsdkDir}/platform/utilities/src/print_scan.c"
- "${KsdkDir}/platform/utilities/src/print_scan.h"
- "${KsdkDir}/platform/devices/MKL03Z4/startup/system_MKL03Z4.c"
- "${KsdkDir}/platform/devices/startup.c"
- "${KsdkDir}/platform/devices/startup.h"
+add_executable(uhk-left.elf
+"${KsdkDir}/devices/MKL03Z4/gcc/startup_MKL03Z4.S"
+#"${ProjDirPath}/../../../../../devices/MKL03Z4/drivers/fsl_lpuart.h"
+#"${ProjDirPath}/../../../../../devices/MKL03Z4/drivers/fsl_lpuart.c"
+"${KsdkDir}/devices/MKL03Z4/drivers/fsl_port.h"
+"${SrcDir}/main.c"
+"${SrcDir}/clock_config.c"
+"${SrcDir}/clock_config.h"
+#"${KsdkDir}/devices/MKL03Z4/drivers/fsl_common.h"
+#"${KsdkDir}/devices/MKL03Z4/drivers/fsl_common.c"
+#"${ProjDirPath}/../../../../../devices/MKL03Z4/utilities/fsl_debug_console.c"
+#"${ProjDirPath}/../../../../../devices/MKL03Z4/utilities/fsl_debug_console.h"
+"${KsdkDir}/devices/MKL03Z4/system_MKL03Z4.c"
+"${KsdkDir}/devices/MKL03Z4/system_MKL03Z4.h"
+"${KsdkDir}/devices/MKL03Z4/drivers/fsl_gpio.h"
+"${KsdkDir}/devices/MKL03Z4/drivers/fsl_gpio.c"
+#"${KsdkDir}/../clock_config.c"
+#"${rojDirPath}/../clock_config.h"
+"${KsdkDir}/devices/MKL03Z4/drivers/fsl_smc.h"
+"${KsdkDir}/devices/MKL03Z4/drivers/fsl_smc.c"
+"${KsdkDir}/devices/MKL03Z4/drivers/fsl_clock.h"
+"${KsdkDir}/devices/MKL03Z4/drivers/fsl_clock.c"
)
-SET_TARGET_PROPERTIES(uhk-left PROPERTIES OUTPUT_NAME "uhk-left.elf")
-TARGET_LINK_LIBRARIES(uhk-left -Wl,--start-group)
-# LIBRARIES
-IF(CMAKE_BUILD_TYPE MATCHES Debug)
- TARGET_LINK_LIBRARIES(uhk-left ${KsdkDir}/lib/ksdk_platform_lib/armgcc/KL03Z4/debug/libksdk_platform.a)
-ELSEIF(CMAKE_BUILD_TYPE MATCHES Release)
- TARGET_LINK_LIBRARIES(uhk-left ${KsdkDir}/lib/ksdk_platform_lib/armgcc/KL03Z4/release/libksdk_platform.a)
-ENDIF()
+set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -T${KsdkDir}/devices/MKL03Z4/gcc/MKL03Z32xxx4_flash.ld -static")
+set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -T${KsdkDir}/devices/MKL03Z4/gcc/MKL03Z32xxx4_flash.ld -static")
-# SYSTEM LIBRARIES
-TARGET_LINK_LIBRARIES(uhk-left m)
-TARGET_LINK_LIBRARIES(uhk-left c)
-TARGET_LINK_LIBRARIES(uhk-left gcc)
-TARGET_LINK_LIBRARIES(uhk-left nosys)
-TARGET_LINK_LIBRARIES(uhk-left -Wl,--end-group)
-
-# MAP FILE
-SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -Xlinker -Map=debug/uhk-left.map")
-SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -Xlinker -Map=release/uhk-left.map")
-
-# BIN AND HEX
-ADD_CUSTOM_COMMAND(TARGET uhk-left POST_BUILD COMMAND ${CMAKE_OBJCOPY} -Oihex ${EXECUTABLE_OUTPUT_PATH}/uhk-left.elf ${EXECUTABLE_OUTPUT_PATH}/uhk-left.hex)
-ADD_CUSTOM_COMMAND(TARGET uhk-left POST_BUILD COMMAND ${CMAKE_OBJCOPY} -Obinary ${EXECUTABLE_OUTPUT_PATH}/uhk-left.elf ${EXECUTABLE_OUTPUT_PATH}/uhk-left.bin)
+TARGET_LINK_LIBRARIES(uhk-left.elf -Wl,--start-group)
+target_link_libraries(uhk-left.elf debug m)
+target_link_libraries(uhk-left.elf debug c)
+target_link_libraries(uhk-left.elf debug gcc)
+target_link_libraries(uhk-left.elf debug nosys)
+target_link_libraries(uhk-left.elf optimized m)
+target_link_libraries(uhk-left.elf optimized c)
+target_link_libraries(uhk-left.elf optimized gcc)
+target_link_libraries(uhk-left.elf optimized nosys)
+TARGET_LINK_LIBRARIES(uhk-left.elf -Wl,--end-group)
diff --git a/left/build/armgcc/README.md b/left/build/armgcc/README.md
deleted file mode 100644
index 6b95809..0000000
--- a/left/build/armgcc/README.md
+++ /dev/null
@@ -1,4 +0,0 @@
-# ARM GCC build environment
-
-This build environment is set up for command line use. Given that the development dependencies are
-installed on your system you can use the available scripts to build the firmware with ARM GCC.
diff --git a/left/build/armgcc/ksdk_dir.sh b/left/build/armgcc/ksdk_dir.sh
index f0b437f..809b8dc 100644
--- a/left/build/armgcc/ksdk_dir.sh
+++ b/left/build/armgcc/ksdk_dir.sh
@@ -1,2 +1,2 @@
#!/bin/sh
-export KSDK_DIR=/../../../lib/KSDK_1.3_FRDM-KL03Z/
+export KSDK_DIR=/../../../lib/KSDK_2.0_MKL03Z8xxx4/
diff --git a/left/build/kds/.cproject b/left/build/kds/.cproject
index 33addd7..9bd0246 100644
--- a/left/build/kds/.cproject
+++ b/left/build/kds/.cproject
@@ -14,9 +14,9 @@
-
+
-
+
@@ -40,95 +40,103 @@
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
-
+
+
-
+
-
-
-
+
+
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -138,7 +146,7 @@
-
+
@@ -146,7 +154,6 @@
-
@@ -188,88 +195,95 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
+
+
+
+
-
-
-
+
+
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -305,7 +319,7 @@
-
+
@@ -315,5 +329,4 @@
-
diff --git a/left/build/kds/.gitignore b/left/build/kds/.gitignore
new file mode 100644
index 0000000..34eb4d4
--- /dev/null
+++ b/left/build/kds/.gitignore
@@ -0,0 +1,2 @@
+/debug/
+/release/
diff --git a/left/build/kds/.project b/left/build/kds/.project
index 989df2a..7129608 100644
--- a/left/build/kds/.project
+++ b/left/build/kds/.project
@@ -26,12 +26,13 @@
com.freescale.processorexpert.core.expertprojectnature
org.eclipse.cdt.core.cnature
+ org.eclipse.cdt.core.ccnature
org.eclipse.cdt.managedbuilder.core.managedBuildNature
org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
- board
+ drivers
2
virtual:/virtual
@@ -41,9 +42,9 @@
PARENT-3-PROJECT_LOC/shared
- source
+ src
2
- virtual:/virtual
+ PARENT-2-PROJECT_LOC/src
startup
@@ -51,99 +52,54 @@
virtual:/virtual
- utilities
- 2
- virtual:/virtual
+ drivers/fsl_clock.c
+ 1
+ PARENT-3-PROJECT_LOC/lib/KSDK_2.0_MKL03Z8xxx4/devices/MKL03Z4/drivers/fsl_clock.c
- board/board.c
+ drivers/fsl_clock.h
1
- PARENT-3-PROJECT_LOC/lib/KSDK_1.3_FRDM-KL03Z/examples/frdmkl03z/board.c
+ PARENT-3-PROJECT_LOC/lib/KSDK_2.0_MKL03Z8xxx4/devices/MKL03Z4/drivers/fsl_clock.h
- board/board.h
+ drivers/fsl_gpio.c
1
- PARENT-3-PROJECT_LOC/lib/KSDK_1.3_FRDM-KL03Z/examples/frdmkl03z/board.h
+ PARENT-3-PROJECT_LOC/lib/KSDK_2.0_MKL03Z8xxx4/devices/MKL03Z4/drivers/fsl_gpio.c
- board/gpio_pins.c
+ drivers/fsl_gpio.h
1
- PARENT-3-PROJECT_LOC/lib/KSDK_1.3_FRDM-KL03Z/examples/frdmkl03z/gpio_pins.c
+ PARENT-3-PROJECT_LOC/lib/KSDK_2.0_MKL03Z8xxx4/devices/MKL03Z4/drivers/fsl_gpio.h
- board/gpio_pins.h
+ drivers/fsl_port.h
1
- PARENT-3-PROJECT_LOC/lib/KSDK_1.3_FRDM-KL03Z/examples/frdmkl03z/gpio_pins.h
+ PARENT-3-PROJECT_LOC/lib/KSDK_2.0_MKL03Z8xxx4/devices/MKL03Z4/drivers/fsl_port.h
- board/pin_mux.c
+ drivers/fsl_smc.c
1
- PARENT-3-PROJECT_LOC/lib/KSDK_1.3_FRDM-KL03Z/examples/frdmkl03z/pin_mux.c
+ PARENT-3-PROJECT_LOC/lib/KSDK_2.0_MKL03Z8xxx4/devices/MKL03Z4/drivers/fsl_smc.c
- board/pin_mux.h
+ drivers/fsl_smc.h
1
- PARENT-3-PROJECT_LOC/lib/KSDK_1.3_FRDM-KL03Z/examples/frdmkl03z/pin_mux.h
-
-
- source/i2c.h
- 1
- PARENT-3-PROJECT_LOC/shared/i2c.h
-
-
- source/main.c
- 1
- PARENT-2-PROJECT_LOC/main.c
-
-
- source/main.h
- 1
- PARENT-2-PROJECT_LOC/main.h
-
-
- startup/startup.c
- 1
- PARENT-3-PROJECT_LOC/lib/KSDK_1.3_FRDM-KL03Z/platform/devices/startup.c
-
-
- startup/startup.h
- 1
- PARENT-3-PROJECT_LOC/lib/KSDK_1.3_FRDM-KL03Z/platform/devices/startup.h
+ PARENT-3-PROJECT_LOC/lib/KSDK_2.0_MKL03Z8xxx4/devices/MKL03Z4/drivers/fsl_smc.h
startup/startup_MKL03Z4.S
1
- PARENT-3-PROJECT_LOC/lib/KSDK_1.3_FRDM-KL03Z/platform/devices/MKL03Z4/startup/gcc/startup_MKL03Z4.S
+ PARENT-3-PROJECT_LOC/lib/KSDK_2.0_MKL03Z8xxx4/devices/MKL03Z4/gcc/startup_MKL03Z4.S
startup/system_MKL03Z4.c
1
- PARENT-3-PROJECT_LOC/lib/KSDK_1.3_FRDM-KL03Z/platform/devices/MKL03Z4/startup/system_MKL03Z4.c
+ PARENT-3-PROJECT_LOC/lib/KSDK_2.0_MKL03Z8xxx4/devices/MKL03Z4/system_MKL03Z4.c
- utilities/fsl_debug_console.c
+ startup/system_MKL03Z4.h
1
- PARENT-3-PROJECT_LOC/lib/KSDK_1.3_FRDM-KL03Z/platform/utilities/src/fsl_debug_console.c
-
-
- utilities/fsl_debug_console.h
- 1
- PARENT-3-PROJECT_LOC/lib/KSDK_1.3_FRDM-KL03Z/platform/utilities/inc/fsl_debug_console.h
-
-
- utilities/fsl_misc_utilities.c
- 1
- PARENT-3-PROJECT_LOC/lib/KSDK_1.3_FRDM-KL03Z/platform/utilities/src/fsl_misc_utilities.c
-
-
- utilities/print_scan.c
- 1
- PARENT-3-PROJECT_LOC/lib/KSDK_1.3_FRDM-KL03Z/platform/utilities/src/print_scan.c
-
-
- utilities/print_scan.h
- 1
- PARENT-3-PROJECT_LOC/lib/KSDK_1.3_FRDM-KL03Z/platform/utilities/src/print_scan.h
+ PARENT-3-PROJECT_LOC/lib/KSDK_2.0_MKL03Z8xxx4/devices/MKL03Z4/system_MKL03Z4.h
diff --git a/left/build/kds/.settings/com.processorexpert.core.ide.newprojectwizard.prefs b/left/build/kds/.settings/com.processorexpert.core.ide.newprojectwizard.prefs
deleted file mode 100644
index d6c0e7e..0000000
--- a/left/build/kds/.settings/com.processorexpert.core.ide.newprojectwizard.prefs
+++ /dev/null
@@ -1,2 +0,0 @@
-eclipse.preferences.version=1
-versionGenerated/versionGenerated=1.8.4.RT7_b1550-0615
diff --git a/left/build/kds/.settings/language.settings.xml b/left/build/kds/.settings/language.settings.xml
index 2bf9d2d..8a3e35d 100644
--- a/left/build/kds/.settings/language.settings.xml
+++ b/left/build/kds/.settings/language.settings.xml
@@ -5,7 +5,7 @@
-
+
@@ -16,7 +16,7 @@
-
+
diff --git a/left/build/kds/README.md b/left/build/kds/README.md
deleted file mode 100644
index 3cd5e6d..0000000
--- a/left/build/kds/README.md
+++ /dev/null
@@ -1,7 +0,0 @@
-# KDS build environment
-
-This build environment is set up to be used with
-[Kinetis Design Studio](http://www.nxp.com/products/software-and-tools/run-time-software/kinetis-software-and-tools/ides-for-kinetis-mcus/kinetis-design-studio-integrated-development-environment-ide:KDS_IDE).
-You can simply import the project into KDS by choosing
-*File* -> *Import...* -> *General* -> *Existing Projects into Workspace*,
-then select this directory, and click the *Finish* button.
diff --git a/left/main.h b/left/main.h
deleted file mode 100644
index 354e870..0000000
--- a/left/main.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef __MAIN_H__
-#define __MAIN_H__
-
-#define I2C_DATA_LENGTH 2
-
-#endif
diff --git a/left/src/clock_config.c b/left/src/clock_config.c
new file mode 100644
index 0000000..b18c078
--- /dev/null
+++ b/left/src/clock_config.c
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2015, Freescale Semiconductor, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * o Redistributions of source code must retain the above copyright notice, this list
+ * of conditions and the following disclaimer.
+ *
+ * o Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "fsl_common.h"
+#include "fsl_smc.h"
+#include "clock_config.h"
+
+/*******************************************************************************
+ * Definitions
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Variables
+ ******************************************************************************/
+/* System clock frequency. */
+extern uint32_t SystemCoreClock;
+
+/*******************************************************************************
+ * Code
+ ******************************************************************************/
+/*
+ * How to setup clock using clock driver functions:
+ *
+ * 1. CLOCK_SetSimSafeDivs, to make sure core clock, bus clock, flexbus clock
+ * and flash clock are in allowed range during clock mode switch.
+ *
+ * 2. Call CLOCK_SetMcgliteConfig to set MCG_Lite configuration.
+ *
+ * 3. Call CLOCK_SetSimConfig to set the clock configuration in SIM.
+ */
+
+void BOARD_BootClockVLPR(void)
+{
+ /*
+ * Core clock: 2MHz
+ * Bus clock: 1MHz
+ */
+ const mcglite_config_t mcgliteConfig = {
+ .outSrc = kMCGLITE_ClkSrcLirc,
+ .irclkEnableMode = kMCGLITE_IrclkEnable,
+ .ircs = kMCGLITE_Lirc2M,
+ .fcrdiv = kMCGLITE_LircDivBy1,
+ .lircDiv2 = kMCGLITE_LircDivBy1,
+ .hircEnableInNotHircMode = false,
+ };
+
+ const sim_clock_config_t simConfig =
+ {
+#if (defined(FSL_FEATURE_SIM_OPT_HAS_OSC32K_SELECTION) && FSL_FEATURE_SIM_OPT_HAS_OSC32K_SELECTION)
+ .er32kSrc = 0U, /* SIM_SOPT1[OSC32KSEL]. */
+#endif
+ .clkdiv1 = 0x00010000U, /* SIM_CLKDIV1. */
+ };
+
+ CLOCK_SetSimSafeDivs();
+
+ CLOCK_SetMcgliteConfig(&mcgliteConfig);
+
+ CLOCK_SetSimConfig(&simConfig);
+
+ SystemCoreClock = 2000000U;
+
+ SMC_SetPowerModeProtection(SMC, kSMC_AllowPowerModeAll);
+ SMC_SetPowerModeVlpr(SMC);
+ while (SMC_GetPowerModeState(SMC) != kSMC_PowerStateVlpr)
+ {
+ }
+}
+
+void BOARD_BootClockRUN(void)
+{
+ /*
+ * Core clock: 48MHz
+ * Bus clock: 24MHz
+ */
+ const mcglite_config_t mcgliteConfig = {
+ .outSrc = kMCGLITE_ClkSrcHirc,
+ .irclkEnableMode = 0U,
+ .ircs = kMCGLITE_Lirc8M,
+ .fcrdiv = kMCGLITE_LircDivBy1,
+ .lircDiv2 = kMCGLITE_LircDivBy1,
+ .hircEnableInNotHircMode = true,
+ };
+
+ const sim_clock_config_t simConfig =
+ {
+#if (defined(FSL_FEATURE_SIM_OPT_HAS_OSC32K_SELECTION) && FSL_FEATURE_SIM_OPT_HAS_OSC32K_SELECTION)
+ .er32kSrc = 0U, /* SIM_SOPT1[OSC32KSEL]. */
+#endif
+ .clkdiv1 = 0x00010000U, /* SIM_CLKDIV1. */
+ };
+
+ CLOCK_SetSimSafeDivs();
+
+ CLOCK_SetMcgliteConfig(&mcgliteConfig);
+
+ CLOCK_SetSimConfig(&simConfig);
+
+ SystemCoreClock = 48000000U;
+}
+
+void BOARD_InitOsc0(void)
+{
+ const osc_config_t oscConfig = {.freq = BOARD_XTAL0_CLK_HZ,
+ .capLoad = 0U,
+ .workMode = kOSC_ModeOscLowPower,
+ .oscerConfig = {
+ .enableMode = kOSC_ErClkEnable,
+#if (defined(FSL_FEATURE_OSC_HAS_EXT_REF_CLOCK_DIVIDER) && FSL_FEATURE_OSC_HAS_EXT_REF_CLOCK_DIVIDER)
+ .erclkDiv = 0U,
+#endif
+ }};
+
+ CLOCK_InitOsc0(&oscConfig);
+
+ /* Passing the XTAL0 frequency to clock driver. */
+ CLOCK_SetXtal0Freq(BOARD_XTAL0_CLK_HZ);
+}
diff --git a/left/src/clock_config.h b/left/src/clock_config.h
new file mode 100644
index 0000000..34bc983
--- /dev/null
+++ b/left/src/clock_config.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2015, Freescale Semiconductor, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * o Redistributions of source code must retain the above copyright notice, this list
+ * of conditions and the following disclaimer.
+ *
+ * o Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef _CLOCK_CONFIG_H_
+#define _CLOCK_CONFIG_H_
+
+/*******************************************************************************
+ * DEFINITION
+ ******************************************************************************/
+#define BOARD_XTAL0_CLK_HZ 32768U
+#define BOARD_XTAL32K_CLK_HZ 0U
+
+/*******************************************************************************
+ * API
+ ******************************************************************************/
+#if defined(__cplusplus)
+extern "C" {
+#endif /* __cplusplus*/
+
+void BOARD_BootClockVLPR(void);
+void BOARD_BootClockRUN(void);
+void BOARD_InitOsc0(void);
+
+#if defined(__cplusplus)
+}
+#endif /* __cplusplus*/
+
+#endif /* _CLOCK_CONFIG_H_ */
diff --git a/left/main.c b/left/src/main.c
similarity index 78%
rename from left/main.c
rename to left/src/main.c
index b15333c..259afa1 100644
--- a/left/main.c
+++ b/left/src/main.c
@@ -1,3 +1,35 @@
+#include "fsl_gpio.h"
+#include "clock_config.h"
+
+#define TEST_LED_GPIO GPIOA
+#define TEST_LED_PORT PORTA
+#define TEST_LED_CLOCK kCLOCK_PortA
+#define TEST_LED_PIN 12
+
+#define TEST_LED_INIT(output) GPIO_PinInit(TEST_LED_GPIO, TEST_LED_PIN, \
+ &(gpio_pin_config_t){kGPIO_DigitalOutput, (output)})
+#define TEST_LED_ON() GPIO_ClearPinsOutput(TEST_LED_GPIO, 1U << TEST_LED_PIN)
+#define TEST_LED_OFF() GPIO_SetPinsOutput(TEST_LED_GPIO, 1U << TEST_LED_PIN)
+
+int main(void)
+{
+ CLOCK_EnableClock(TEST_LED_CLOCK);
+ TEST_LED_INIT(0);
+ BOARD_BootClockRUN();
+ while (1)
+ {
+ for (uint32_t i=0; i<500000; i++) {
+ TEST_LED_ON();
+ }
+ for (uint32_t i=0; i<500000; i++) {
+ TEST_LED_OFF();
+ }
+ }
+}
+
+/*
+#define I2C_DATA_LENGTH 2
+
#include "board.h"
#include "fsl_clock_manager.h"
#include "fsl_i2c_slave_driver.h"
@@ -38,13 +70,6 @@ static void i2c_slave_callback(uint8_t instance, i2c_slave_event_t i2cEvent, voi
int main(void)
{
- // Initialize clock.
-
- CLOCK_SYS_EnablePortClock(PORTA_IDX);
- CLOCK_SYS_EnablePortClock(PORTB_IDX);
-
- BOARD_ClockInit();
-
// Initialize GPIO.
gpio_input_pin_user_config_t inputPin[] =
@@ -113,3 +138,4 @@ int main(void)
GPIO_DRV_WritePinOutput(kGpioLED3, isSw3Pressed);
}
}
+*/
diff --git a/lib/KSDK_2.0_MKL03Z8xxx4 b/lib/KSDK_2.0_MKL03Z8xxx4
new file mode 160000
index 0000000..183142d
--- /dev/null
+++ b/lib/KSDK_2.0_MKL03Z8xxx4
@@ -0,0 +1 @@
+Subproject commit 183142d66782990e5aac98d6bd30d9344f3b1afc