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
This commit is contained in:
Antonio Borneo 2020-06-10 16:08:41 +02:00
parent 327d18220f
commit 6a81bad3b9
4 changed files with 13 additions and 4 deletions

View File

@ -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"], [

View File

@ -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

View File

@ -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 */ },
};

View File

@ -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