cmake: targets: support overriding puncover host and port

Allow overriding puncover default host and port. Using
PUNCOVER_HOST/PUNCOVER_PORT it is possible now to set the host and port
to something else other than the default.

example:

export PUNCOVER_HOST=10.0.1.1
export PUNCOVER_PORT=8088

will start puncover on 10.0.1.1:8088 and make it available over the
local network.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
diff --git a/cmake/reports/CMakeLists.txt b/cmake/reports/CMakeLists.txt
index 41c1b70..fbb4df3 100644
--- a/cmake/reports/CMakeLists.txt
+++ b/cmake/reports/CMakeLists.txt
@@ -87,6 +87,15 @@
 find_program(PUNCOVER puncover)
 
 if(NOT ${PUNCOVER} STREQUAL PUNCOVER-NOTFOUND)
+  set(PUNCOVER_ARGS "")
+  zephyr_get(PUNCOVER_PORT)
+  zephyr_get(PUNCOVER_HOST)
+  if(DEFINED PUNCOVER_PORT)
+    list(APPEND PUNCOVER_ARGS "--port=${PUNCOVER_PORT}")
+  endif()
+  if(DEFINED PUNCOVER_HOST)
+    list(APPEND PUNCOVER_ARGS "--host=${PUNCOVER_HOST}")
+  endif()
   add_custom_target(
     puncover
     ${PUNCOVER}
@@ -94,6 +103,7 @@
     --gcc_tools_base ${CROSS_COMPILE}
     --src_root       ${ZEPHYR_BASE}
     --build_dir      ${CMAKE_BINARY_DIR}
+    ${PUNCOVER_ARGS}
     DEPENDS ${logical_target_for_zephyr_elf}
             $<TARGET_PROPERTY:zephyr_property_target,${report}_DEPENDENCIES>
     WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
diff --git a/doc/develop/optimizations/tools.rst b/doc/develop/optimizations/tools.rst
index 5c330a9..d34443b 100644
--- a/doc/develop/optimizations/tools.rst
+++ b/doc/develop/optimizations/tools.rst
@@ -186,6 +186,9 @@
     :board: reel_board
     :goals: puncover
 
+The ``puncover`` target will start a local web server on ``localhost:5000`` by default.
+The host IP and port the HTTP server runs on can be changed by setting the environment
+variables ``PUNCOVER_HOST`` and ``PUNCOVER_PORT``.
 
 To view worst-case stack usage analysis, build this with the
 :kconfig:option:`CONFIG_STACK_USAGE` enabled.