FreeCalypso > hg > fc-tourmaline
annotate helpers/build-date.c @ 275:79cfefc1e2b4
audio mode load: gracefully handle mode files of wrong AEC version
Unfortunately our change of enabling L1_NEW_AEC (which is necessary
in order to bring our Calypso ARM fw into match with the underlying
DSP reality) brings along a change in the audio mode file binary
format and file size - all those new tunable AEC parameters do need
to be stored somewhere, after all. But we already have existing
mode files in the old format, and setting AEC config to garbage when
loading old audio modes (which is what would happen without the
present change) is not an appealing proposition.
The solution implemented in the present change is as follows: the
audio mode loading code checks the file size, and if it differs
from the active version of T_AUDIO_MODE, the T_AUDIO_AEC_CFG structure
is cleared - set to the default (disabled AEC) for the compiled type
of AEC. We got lucky in that this varying T_AUDIO_AEC_CFG structure
sits at the end of T_AUDIO_MODE!
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 30 Jul 2021 02:55:48 +0000 |
parents | 775dba605f33 |
children |
rev | line source |
---|---|
9
1fb47f5b597a
helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
1fb47f5b597a
helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * This program runs at firmware build time to produce a C file for the |
1fb47f5b597a
helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * fw build that includes the build date and time stamp. |
1fb47f5b597a
helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 */ |
1fb47f5b597a
helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 |
1fb47f5b597a
helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 #include <stdio.h> |
1fb47f5b597a
helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <stdlib.h> |
1fb47f5b597a
helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <string.h> |
1fb47f5b597a
helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <strings.h> |
1fb47f5b597a
helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include <time.h> |
1fb47f5b597a
helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 |
1fb47f5b597a
helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 main(argc, argv) |
1fb47f5b597a
helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 char **argv; |
1fb47f5b597a
helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 { |
1fb47f5b597a
helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 time_t now; |
1fb47f5b597a
helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 struct tm *tm; |
1fb47f5b597a
helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 |
1fb47f5b597a
helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 if (argc < 2 || argc > 4) { |
1fb47f5b597a
helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 fprintf(stderr, |
1fb47f5b597a
helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 "usage: %s config_name target_name src_version\n", |
1fb47f5b597a
helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 argv[0]); |
1fb47f5b597a
helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 exit(1); |
1fb47f5b597a
helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 } |
1fb47f5b597a
helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 time(&now); |
1fb47f5b597a
helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 tm = gmtime(&now); |
1fb47f5b597a
helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 printf("const char firmware_version_str[] =\n"); |
1fb47f5b597a
helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 if (argc >= 3) |
10
775dba605f33
helpers: we are FC Tourmaline
Mychaela Falconia <falcon@freecalypso.org>
parents:
9
diff
changeset
|
28 printf("\"FreeCalypso Tourmaline %s (%s), ", argv[1], argv[2]); |
9
1fb47f5b597a
helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 else |
10
775dba605f33
helpers: we are FC Tourmaline
Mychaela Falconia <falcon@freecalypso.org>
parents:
9
diff
changeset
|
30 printf("\"FreeCalypso Tourmaline %s, ", argv[1]); |
9
1fb47f5b597a
helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 if (argc >= 4 && strcmp(argv[3], "unknown")) |
1fb47f5b597a
helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 printf("source version %s, ", argv[3]); |
1fb47f5b597a
helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 printf("build date %d-%02d-%02dT%02d:%02d:%02dZ\";\n", |
1fb47f5b597a
helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday, |
1fb47f5b597a
helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 tm->tm_hour, tm->tm_min, tm->tm_sec); |
1fb47f5b597a
helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 exit(0); |
1fb47f5b597a
helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 } |