Look for an env var to help find the MSP430 library

This commit is contained in:
Daniel O'Connor 2018-08-15 13:42:21 +09:30
parent f017df6781
commit 65c0e5a440
1 changed files with 11 additions and 1 deletions

View File

@ -17,6 +17,8 @@
*/
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#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());