1 # This is called from the targets that build the
3 if(NOT CMAKE_ARGC EQUAL 6)
4 message(FATAL_ERROR "usage: cmake -P openocd_cfg.cmake <target> <interface> <output>")
7 set(OPENOCD_TARGET ${CMAKE_ARGV3})
8 set(OPENOCD_INTERFACE ${CMAKE_ARGV4})
9 set(OUTPUT ${CMAKE_ARGV5})
12 list(APPEND openocd_cfg "source [find interface/${OPENOCD_INTERFACE}.cfg]")
13 list(APPEND openocd_cfg "source [find target/${OPENOCD_TARGET}.cfg]")
14 list(APPEND openocd_cfg "init")
15 list(APPEND openocd_cfg "arm semihosting enable")
16 list(APPEND openocd_cfg "reset halt")
17 list(JOIN openocd_cfg "\n" contents)
18 set(contents "${contents}\n")
20 file(WRITE ${OUTPUT} ${contents})