1 On Windows, c30_device.info is presumably installed alongside the
2 binary. On Debian we don't necessarily have c30_device.info at all. If
3 we do have it, it should go in /usr/share/pic30-support.
5 --- ./bfd/cpu-pic30.c.orig 2007-02-02 22:49:02.000000000 +0100
6 +++ ./bfd/cpu-pic30.c 2009-01-28 07:09:24.000000000 +0100
9 const bfd_arch_info_type * global_PROCESSOR = NULL;
11 -static char *pic30_resource_file = 0;
12 +static char *pic30_resource_file = "/usr/pic30/c30_device.info";
15 #define ARCH(machine, printable_name, default_machine, next, flags) \
18 #define QUOTE(X) QUOTE2(X)
20 -/* stupid prototype */ static void get_resource_path(const char *resource);
21 -static void get_resource_path(const char *resource) {
23 - char *tool_name = (char *) resource;
27 - ** In some command shells, no path information
28 - ** is provided as part of argv[0].
30 - if (!IS_DIR_SEPARATOR(resource[0]))
33 - ** No DOS path information for the program:
34 - ** search for the executable using the
35 - ** PATH environment variable.
45 - tool_name = xmalloc(strlen(resource) + 4 + 40);
46 - sprintf(tool_name, "%s", resource);
47 - tool_len = strlen(tool_name);
49 - fprintf(stderr,"tool_name: %s\n", tool_name);
51 -#if defined(HAVE_DOS_BASED_FILE_SYSTEM)
53 - ** Append ".exe" to the executable name, if necessary
55 - if ((tolower(tool_name[tool_len-1]) != 'e') ||
56 - (tolower(tool_name[tool_len-2]) != 'x') ||
57 - (tolower(tool_name[tool_len-3]) != 'e') ||
58 - ( (tool_name[tool_len-4]) != '.'))
60 - strcat(tool_name, ".exe");
65 - ** Get the current PATH
67 - PATH = getenv("PATH");
70 - * stupid gnu will print (null) to the string if PATH==0
72 - dosPATH = xcalloc(1, strlen(PATH) + 3);
73 - sprintf(dosPATH,"%s%c.",PATH, PATH_SEPARATOR);
79 - fprintf(stderr,"PATH=%s\n", PATH);
82 - command = xmalloc(len);
86 - separator = strchr(PATH, PATH_SEPARATOR);
87 - path_len = separator ? (unsigned)(separator-PATH) : strlen(PATH);
88 - if ((path_len + tool_len + 2) > len) {
89 - len = path_len + tool_len + 80;
91 - command = xmalloc(len);
94 - strncpy(command, PATH, path_len);
95 - command[path_len] = 0;
96 - if (!IS_DIR_SEPARATOR(command[path_len-1])) {
97 - strcat(command, DIR_SEPARATOR_STR);
99 - strcat(command, tool_name);
101 - fprintf(stderr,"dir=%s\n",command);
103 - if (stat(command, &fs) == 0) break;
105 - } while (separator && (PATH = separator+1));
106 - if (dosPATH) free(dosPATH);
107 - if (PATH) tool_name = command;
109 - pic30_resource_file = xmalloc(strlen(tool_name) +
110 - sizeof("/c30_device.info") + 1);
111 - sprintf(pic30_resource_file,"%s", tool_name);
112 - for (c = pic30_resource_file + strlen(pic30_resource_file);
113 - !IS_DIR_SEPARATOR(*c); c--);
115 - strcat(pic30_resource_file,"/c30_device.info");
118 void pic30_update_resource(const char *resource) {
119 /* The tool_version is defined in the string MCHP_VERSION */
122 version_part2 = Microchip+1;
125 - get_resource_path(resource);
126 process_resource_file(ARCH_TABLE, 0, 0);