annotate helpers/build-date.c @ 82:6afaa5cb7392

linker script for gcc fw build: initial version put together
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 20 Jul 2018 17:33:14 +0000
parents e825175be40d
children f8fb2995eb3f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11
b493d3857f4e helpers: initial import from Magnetite (pruned)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
b493d3857f4e helpers: initial import from Magnetite (pruned)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This program runs at firmware build time to produce a C file for the
b493d3857f4e helpers: initial import from Magnetite (pruned)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * fw build that includes the build date and time stamp.
b493d3857f4e helpers: initial import from Magnetite (pruned)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 */
b493d3857f4e helpers: initial import from Magnetite (pruned)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5
b493d3857f4e helpers: initial import from Magnetite (pruned)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include <stdio.h>
b493d3857f4e helpers: initial import from Magnetite (pruned)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include <stdlib.h>
b493d3857f4e helpers: initial import from Magnetite (pruned)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include <time.h>
b493d3857f4e helpers: initial import from Magnetite (pruned)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9
b493d3857f4e helpers: initial import from Magnetite (pruned)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 main(argc, argv)
b493d3857f4e helpers: initial import from Magnetite (pruned)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 char **argv;
b493d3857f4e helpers: initial import from Magnetite (pruned)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 {
b493d3857f4e helpers: initial import from Magnetite (pruned)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 time_t now;
b493d3857f4e helpers: initial import from Magnetite (pruned)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 struct tm *tm;
b493d3857f4e helpers: initial import from Magnetite (pruned)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15
b493d3857f4e helpers: initial import from Magnetite (pruned)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 if (argc != 2) {
b493d3857f4e helpers: initial import from Magnetite (pruned)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 fprintf(stderr, "usage: %s config_name\n", argv[0]);
b493d3857f4e helpers: initial import from Magnetite (pruned)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 exit(1);
b493d3857f4e helpers: initial import from Magnetite (pruned)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 }
b493d3857f4e helpers: initial import from Magnetite (pruned)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 time(&now);
b493d3857f4e helpers: initial import from Magnetite (pruned)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 tm = gmtime(&now);
b493d3857f4e helpers: initial import from Magnetite (pruned)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 printf("const char firmware_version_str[] =\n");
12
e825175be40d helpers: s/Magnetite/Selenite/
Mychaela Falconia <falcon@freecalypso.org>
parents: 11
diff changeset
23 printf("\"FreeCalypso Selenite %s, ", argv[1]);
11
b493d3857f4e helpers: initial import from Magnetite (pruned)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 printf("build date %d-%02d-%02dT%02d:%02d:%02dZ\";\n",
b493d3857f4e helpers: initial import from Magnetite (pruned)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday,
b493d3857f4e helpers: initial import from Magnetite (pruned)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 tm->tm_hour, tm->tm_min, tm->tm_sec);
b493d3857f4e helpers: initial import from Magnetite (pruned)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 exit(0);
b493d3857f4e helpers: initial import from Magnetite (pruned)
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 }