Current hla driver supports two "layout": stlink and ti-icdi.
The configure script allows to independently enable/disable the
the two layout. But in reality by selecting only one of them the
whole hla driver is built, including both "layouts".
This is currently not a big issue because the dependencies of the
two layout are the same (libusb), so we are sure that selecting
one of them would permit to build both.
This is going to change with the merge of a third "layout" for
Nuvoton Nu-Link, because it would be based on hidapi.
We need, at least, to decouple the build of libusb and hidapi
"layouts". A full decouple of each "layout" is also welcome to
match the selection done during configure.
Introduce a new automake macro for each of the two "layout" and
use them to conditionally build the "layout" files.
Use the existing autoconf macros to conditionally compile the code
that depends by the "layout".
Change-Id: Ia20da7a260002a8d2af883425aa401b8920d3f36
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5719
Tested-by: jenkins
AS_IF([test "x$enable_stlink" != "xno" -o "x$enable_ti_icdi" != "xno"], [
AC_DEFINE([BUILD_HLADAPTER], [1], [1 if you want the High Level JTAG driver.])
+ AM_CONDITIONAL([HLADAPTER], [true])
], [
AC_DEFINE([BUILD_HLADAPTER], [0], [0 if you want the High Level JTAG driver.])
+ AM_CONDITIONAL([HLADAPTER], [false])
])
-AM_CONDITIONAL([HLADAPTER], [test "x$enable_stlink" != "xno" -o "x$enable_ti_icdi" != "xno"])
+AM_CONDITIONAL([HLADAPTER_STLINK], [test "x$enable_stlink" != "xno"])
+AM_CONDITIONAL([HLADAPTER_ICDI], [test "x$enable_ti_icdi" != "xno"])
AS_IF([test "x$enable_jlink" != "xno"], [
AS_IF([test "x$use_internal_libjaylink" = "xyes"], [
if REMOTE_BITBANG
DRIVERFILES += %D%/remote_bitbang.c
endif
-if HLADAPTER
+if HLADAPTER_STLINK
DRIVERFILES += %D%/stlink_usb.c
+endif
+if HLADAPTER_ICDI
DRIVERFILES += %D%/ti_icdi_usb.c
endif
if RSHIM
}
static const struct hl_layout hl_layouts[] = {
+#if BUILD_HLADAPTER_STLINK
{
.name = "stlink",
.open = hl_layout_open,
.close = hl_layout_close,
.api = &stlink_usb_layout_api,
},
+#endif
+#if BUILD_HLADAPTER_ICDI
{
.name = "ti-icdi",
.open = hl_layout_open,
.close = hl_layout_close,
.api = &icdi_usb_layout_api,
},
+#endif
{.name = NULL, /* END OF TABLE */ },
};
#if BUILD_XDS110 == 1
extern struct adapter_driver xds110_adapter_driver;
#endif
-#if BUILD_HLADAPTER == 1
+#if BUILD_HLADAPTER_STLINK == 1
extern struct adapter_driver stlink_dap_adapter_driver;
#endif
#if BUILD_RSHIM == 1
#if BUILD_XDS110 == 1
&xds110_adapter_driver,
#endif
-#if BUILD_HLADAPTER == 1
+#if BUILD_HLADAPTER_STLINK == 1
&stlink_dap_adapter_driver,
#endif
#if BUILD_RSHIM == 1