Fork from inav at github. Modified for some special functions needs.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
680 B

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