diff --git a/blink-cmake/CMakeLists.txt b/blink-cmake/CMakeLists.txt
index de8c9d051405f9ce63589888bad7b7f4df3bad09..2c219ddaa4693b807e519cd72d5be4862192e2e3 100644
--- a/blink-cmake/CMakeLists.txt
+++ b/blink-cmake/CMakeLists.txt
@@ -5,17 +5,27 @@ set(CMAKE_SYSTEM_NAME Generic)
 set(CMAKE_SYSTEM_PROCESSOR arm)
 set(CMAKE_CROSSCOMPILING 1)
 set(CMAKE_C_COMPILER "arm-none-eabi-gcc")
-#set(CMAKE_C_LINKER "arm-none-eabi-gcc")
+set(CMAKE_CXX_COMPILER "arm-none-eabi-g++")
+set(CMAKE_AR "arm-none-eabi-ar")
+set(CMAKE_RANLIB "arm-none-eabi-ranlib")
+set(CMAKE_C_FLAGS "")
 set(CMAKE_C_LINK_FLAGS "")
 
+# search for programs in the build host directories
+SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+# for libraries and headers in the target directories
+SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+SET(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
+
 set(MCU_DEFINE "__SAMD51J19A__")
 
 if(NOT CMAKE_BUILD_TYPE)
-    set(CMAKE_BUILD_TYPE "Debug")
+    set(CMAKE_BUILD_TYPE "Release")
 endif()
 message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
 
-add_library(asf
+add_library(asf OBJECT
     samd51/startup/startup_samd51.c
     samd51/startup/system_samd51.c
 )
@@ -29,7 +39,7 @@ target_link_libraries(asf m)
 target_link_options(asf PUBLIC
     -mthumb
     -mabi=aapcs-linux
-    #-mlong-calls
+    -mlong-calls
     -mcpu=cortex-m4
     -mfpu=fpv4-sp-d16
     -mfloat-abi=softfp
@@ -53,7 +63,7 @@ target_compile_options(asf PUBLIC
     -std=gnu99
     -mthumb # use T32 instruction set instead of A32 (don't know if this matters)
     -mabi=aapcs-linux
-    #-mlong-calls # changes how functions are called
+    -mlong-calls # changes how functions are called
     -mcpu=cortex-m4
     -mfpu=fpv4-sp-d16
     -mfloat-abi=softfp # this flag specifies whether to use software or hardware float operations
diff --git a/blink-cmake/openocd.cfg b/blink-cmake/openocd.cfg
new file mode 100644
index 0000000000000000000000000000000000000000..8760b7ded5b1d810148b265890789c34a0ec1e77
--- /dev/null
+++ b/blink-cmake/openocd.cfg
@@ -0,0 +1,7 @@
+# Atmel-ICE JTAG/SWD in-circuit debugger.
+interface cmsis-dap
+transport select swd
+
+# Chip info
+set CHIPNAME at91samd51j18
+source [find target/atsame5x.cfg]