diff options
author | Antonio Borneo <borneo.antonio@gmail.com> | 2020-06-10 16:08:41 +0200 |
---|---|---|
committer | Antonio Borneo <borneo.antonio@gmail.com> | 2020-07-08 22:07:21 +0100 |
commit | 6a81bad3b973e54ce68496d22750d643741afb32 (patch) | |
tree | 6258e46a23d2c800490862463993e089d26441e7 | |
parent | 327d18220ffb005884a742992657b6b5a4be2232 (diff) | |
download | openocd-jz4730-6a81bad3b973e54ce68496d22750d643741afb32.tar.gz |
configure: split build of hla layouts
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
-rw-r--r-- | configure.ac | 5 | ||||
-rw-r--r-- | src/jtag/drivers/Makefile.am | 4 | ||||
-rw-r--r-- | src/jtag/hla/hla_layout.c | 4 | ||||
-rw-r--r-- | src/jtag/interfaces.c | 4 |
4 files changed, 13 insertions, 4 deletions
diff --git a/configure.ac b/configure.ac index a6bda8856..382a00b6e 100644 --- a/configure.ac +++ b/configure.ac @@ -683,10 +683,13 @@ AS_IF([test "x$build_openjtag" = "xyes"], [ 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"], [ diff --git a/src/jtag/drivers/Makefile.am b/src/jtag/drivers/Makefile.am index 07824f678..b03f560b3 100644 --- a/src/jtag/drivers/Makefile.am +++ b/src/jtag/drivers/Makefile.am @@ -129,8 +129,10 @@ endif 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 diff --git a/src/jtag/hla/hla_layout.c b/src/jtag/hla/hla_layout.c index c5e35182d..686e6f5b2 100644 --- a/src/jtag/hla/hla_layout.c +++ b/src/jtag/hla/hla_layout.c @@ -57,18 +57,22 @@ static int hl_layout_close(struct hl_interface_s *adapter) } 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 */ }, }; diff --git a/src/jtag/interfaces.c b/src/jtag/interfaces.c index 7d3f8a8ca..87ea95822 100644 --- a/src/jtag/interfaces.c +++ b/src/jtag/interfaces.c @@ -138,7 +138,7 @@ extern struct adapter_driver imx_gpio_adapter_driver; #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 @@ -252,7 +252,7 @@ struct adapter_driver *adapter_drivers[] = { #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 |