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());