FreeCalypso > hg > freecalypso-tools
annotate loadtools/secondprog.c @ 995:74024eb17e04
fc-loadtool help: improve language regarding 16 MiB flash chips
In FC project history, 16 MiB flash originally meant Pirelli DP-L10.
Then we got FCDEV3B with the same flash (our own design), but now we are
discovering more Calypso devices that used such large flash, both late
Calypso era (Sony Ericsson K2x0) as well as much earlier ones (FIC FLUID
devices.txt file with 2004 dates, Leonardo+ rev 5). Hence we need to
migrate to more generic or neutral language in associated documentation,
without giving elevated status to specific examples that drove our
early project history.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 03 Dec 2023 21:11:12 +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 } |