From 65c0e5a440e5ba4d03f444e60875aad90c28dd7b Mon Sep 17 00:00:00 2001 From: Daniel O'Connor Date: Wed, 15 Aug 2018 13:42:21 +0930 Subject: [PATCH] Look for an env var to help find the MSP430 library --- drivers/tilib_api.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/tilib_api.c b/drivers/tilib_api.c index bc16bf6..4e12465 100644 --- a/drivers/tilib_api.c +++ b/drivers/tilib_api.c @@ -17,6 +17,8 @@ */ #include +#include +#include #include #include "util/output.h" #include "tilib_api.h" @@ -759,8 +761,16 @@ static int init_old_api(void) int tilib_api_init(void) { int ret; + char *path, *libpath; + + if ((path = getenv("MSP430_PATH")) == NULL) + asprintf(&libpath, "%s", tilib_filename); + else + asprintf(&libpath, "%s/%s", path, tilib_filename); + + lib_handle = dynload_open(libpath); + free(libpath); - lib_handle = dynload_open(tilib_filename); if (!lib_handle) { printc_err("tilib_api: can't find %s: %s\n", tilib_filename, dynload_error());