diff options
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/intel-quark-d2000.toolchain.cmake | 31 | ||||
-rw-r--r-- | cmake/intel/d2000.cmake | 11 | ||||
-rw-r--r-- | cmake/intel/gdb.cmake | 4 | ||||
-rw-r--r-- | cmake/intel/openocd.cmake | 6 |
4 files changed, 48 insertions, 4 deletions
diff --git a/cmake/intel-quark-d2000.toolchain.cmake b/cmake/intel-quark-d2000.toolchain.cmake index 16f12f5..3537551 100644 --- a/cmake/intel-quark-d2000.toolchain.cmake +++ b/cmake/intel-quark-d2000.toolchain.cmake @@ -19,6 +19,10 @@ endif () get_filename_component(toolchain_dir "${CMAKE_TOOLCHAIN_FILE}" DIRECTORY) +macro(export_variable NAME) + set(${NAME} "${${NAME}}" PARENT_SCOPE) +endmacro() + set(CMAKE_SYSTEM_NAME Generic) set(CMAKE_SYSTEM_PROCESSOR intel) set(CMAKE_CROSSCOMPILING 1) @@ -52,11 +56,14 @@ list(APPEND includes "${ISSM_DIR}/firmware/bsp/1.0/board/drivers") list(APPEND includes "${ISSM_DIR}/firmware/bsp/1.0/drivers/bmc150") if (INTEL_QUARK_CHIP STREQUAL D2000) - list(APPEND includes "${ISSM_DIR}/firmware/bsp/1.0/soc/quark_d2000/include") - set(ld_file "${ISSM_DIR}/firmware/bsp/1.0/soc/quark_d2000/quark_d2000.ld") + include("${toolchain_dir}/intel/d2000.cmake") + d2000_init() + + include("${toolchain_dir}/intel/openocd.cmake") + openocd_init() - list(APPEND mcu_text_areas 0x00180000:20k) - list(APPEND mcu_data_areas 0x00280000:5k) + include("${toolchain_dir}/intel/gdb.cmake") + gdb_init() elseif (INTEL_QUARK_CHIP STREQUAL SE) list(APPEND includes "${ISSM_DIR}/firmware/bsp/1.0/soc/quark_se/include") endif () @@ -216,4 +223,20 @@ function(add_extra_commands target_name) add_custom_command(TARGET ${target_name} DEPENDS elfinfo POST_BUILD COMMAND "${ELFINFO_INSTALL_DIR}/bin/elfinfo" -f ${target_name} ${text_segments} ${data_segments}) + + add_custom_target(${target_name}-openocd + DEPENDS ${target_name} + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" + COMMAND ${openocd_bin} -s ${openocd_scripts} -f board/quark_d2000_onboard.cfg) + + add_custom_target(${target_name}-gdb + DEPENDS ${target_name} + COMMAND ${gdb_bin} + -ex "target remote localhost:3333" + -ex "monitor gdb_breakpoint_override hard" + -ex "set remotetimeout 30" + -ex "monitor clk32M" + -ex "monitor reset halt" + ${target_name} + ) endfunction() diff --git a/cmake/intel/d2000.cmake b/cmake/intel/d2000.cmake new file mode 100644 index 0000000..2ddca80 --- /dev/null +++ b/cmake/intel/d2000.cmake @@ -0,0 +1,11 @@ +function(d2000_init) + list(APPEND includes "${ISSM_DIR}/firmware/bsp/1.0/soc/quark_d2000/include") + set(includes "${includes}" PARENT_SCOPE) + set(ld_file "${ISSM_DIR}/firmware/bsp/1.0/soc/quark_d2000/quark_d2000.ld" PARENT_SCOPE) + + list(APPEND mcu_text_areas 0x00180000:20k) + export_variable(mcu_text_areas) + + list(APPEND mcu_data_areas 0x00280000:5k) + export_variable(mcu_data_areas) +endfunction() diff --git a/cmake/intel/gdb.cmake b/cmake/intel/gdb.cmake new file mode 100644 index 0000000..b6840cb --- /dev/null +++ b/cmake/intel/gdb.cmake @@ -0,0 +1,4 @@ +function(gdb_init) + set(gdb_bin "${ISSM_DIR}/tools/debugger/gdb/gdb-ia") + export_variable(gdb_bin) +endfunction() diff --git a/cmake/intel/openocd.cmake b/cmake/intel/openocd.cmake new file mode 100644 index 0000000..e7ce892 --- /dev/null +++ b/cmake/intel/openocd.cmake @@ -0,0 +1,6 @@ +function(openocd_init) + set(openocd_bin "${ISSM_DIR}/tools/debugger/openocd/bin/openocd") + export_variable(openocd_bin) + set(openocd_scripts "${ISSM_DIR}/tools/debugger/openocd/scripts") + export_variable(openocd_scripts) +endfunction() |