FreeCalypso > hg > freecalypso-tools
annotate loadtools/secondprog.c @ 505:7bf0d909c87e
fc-loadtool flash ID check: change of reset after the check logic
This change only affects those flash configurations that have ID checks
enabled. The logic for resetting the flash after the ID check has been
changed as follows:
1) If the check fails, we return without attempting to reset the flash.
2) If the check is successful, we reset the flash using the configured
method (could be AMD or Intel or Intel W30) instead of always doing an
AMD flash reset as the original code did.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 27 May 2019 19:58:01 +0000 |
parents | 064d4eedb3a6 |
children |
rev | line source |
---|---|
204
064d4eedb3a6
loadtools: second program invokation support added to fc-iram like in fc-xram
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
064d4eedb3a6
loadtools: second program invokation support added to fc-iram like in fc-xram
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * This module contains the code for passing the serial channel to a |
064d4eedb3a6
loadtools: second program invokation support added to fc-iram like in fc-xram
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * second program, used by fc-iram and fc-xram. |
064d4eedb3a6
loadtools: second program invokation support added to fc-iram like in fc-xram
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 */ |
064d4eedb3a6
loadtools: second program invokation support added to fc-iram like in fc-xram
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 |
064d4eedb3a6
loadtools: second program invokation support added to fc-iram like in fc-xram
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 #include <stdio.h> |
064d4eedb3a6
loadtools: second program invokation support added to fc-iram like in fc-xram
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <stdlib.h> |
064d4eedb3a6
loadtools: second program invokation support added to fc-iram like in fc-xram
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <unistd.h> |
064d4eedb3a6
loadtools: second program invokation support added to fc-iram like in fc-xram
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 |
064d4eedb3a6
loadtools: second program invokation support added to fc-iram like in fc-xram
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 extern char **passon_argv; |
064d4eedb3a6
loadtools: second program invokation support added to fc-iram like in fc-xram
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 extern int passon_argc; |
064d4eedb3a6
loadtools: second program invokation support added to fc-iram like in fc-xram
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 |
064d4eedb3a6
loadtools: second program invokation support added to fc-iram like in fc-xram
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 exec_2nd_prog() |
064d4eedb3a6
loadtools: second program invokation support added to fc-iram like in fc-xram
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 { |
064d4eedb3a6
loadtools: second program invokation support added to fc-iram like in fc-xram
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 char **execp_argv; |
064d4eedb3a6
loadtools: second program invokation support added to fc-iram like in fc-xram
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 char **sp, **dp; |
064d4eedb3a6
loadtools: second program invokation support added to fc-iram like in fc-xram
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 extern int target_fd; |
064d4eedb3a6
loadtools: second program invokation support added to fc-iram like in fc-xram
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 char desc_arg[16]; |
064d4eedb3a6
loadtools: second program invokation support added to fc-iram like in fc-xram
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 |
064d4eedb3a6
loadtools: second program invokation support added to fc-iram like in fc-xram
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 sprintf(desc_arg, "-d%d", target_fd); |
064d4eedb3a6
loadtools: second program invokation support added to fc-iram like in fc-xram
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 execp_argv = (char **) malloc(sizeof(char *) * (passon_argc + 2)); |
064d4eedb3a6
loadtools: second program invokation support added to fc-iram like in fc-xram
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 if (!execp_argv) { |
064d4eedb3a6
loadtools: second program invokation support added to fc-iram like in fc-xram
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 perror("malloc argv for execvp"); |
064d4eedb3a6
loadtools: second program invokation support added to fc-iram like in fc-xram
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 exit(1); |
064d4eedb3a6
loadtools: second program invokation support added to fc-iram like in fc-xram
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 } |
064d4eedb3a6
loadtools: second program invokation support added to fc-iram like in fc-xram
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 sp = passon_argv; |
064d4eedb3a6
loadtools: second program invokation support added to fc-iram like in fc-xram
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 dp = execp_argv; |
064d4eedb3a6
loadtools: second program invokation support added to fc-iram like in fc-xram
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 *dp++ = *sp++; |
064d4eedb3a6
loadtools: second program invokation support added to fc-iram like in fc-xram
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 *dp++ = desc_arg; |
064d4eedb3a6
loadtools: second program invokation support added to fc-iram like in fc-xram
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 while (*sp) |
064d4eedb3a6
loadtools: second program invokation support added to fc-iram like in fc-xram
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 *dp++ = *sp++; |
064d4eedb3a6
loadtools: second program invokation support added to fc-iram like in fc-xram
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 *dp = NULL; |
064d4eedb3a6
loadtools: second program invokation support added to fc-iram like in fc-xram
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 execvp(execp_argv[0], execp_argv); |
064d4eedb3a6
loadtools: second program invokation support added to fc-iram like in fc-xram
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 fprintf(stderr, "Unable to execvp %s\n", passon_argv[0]); |
064d4eedb3a6
loadtools: second program invokation support added to fc-iram like in fc-xram
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 exit(1); |
064d4eedb3a6
loadtools: second program invokation support added to fc-iram like in fc-xram
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 } |