updated command line 802.15.4 checksum calculator and added serClose to GoodFET to...
[goodfet] / firmware / gen_apps
1 #!/usr/bin/env python
2
3 import sys
4
5 def main():
6     fout = open("include/apps.h", "w+")
7     print >> fout, "#ifndef APPS_H"
8     print >> fout, "#define APPS_H"
9     print >> fout, "#include \"app.h\""
10     for app in sys.argv[1:]:
11         print >> fout, '#include "%s"' % app
12     print >> fout, "#endif"
13     fout.close()
14
15     cout = open("lib/apps.c", "w+")
16     print >> cout, "#include <stdint.h>"
17     print >> cout, "#include \"app.h\""
18     print >> cout, "#include \"apps.h\""
19     print >> cout, "app_t const * const apps[] = {"
20     for app in sys.argv[1:]:
21         print >> cout, "#ifdef %s_H" % app.split('.')[0].upper()
22         print >> cout, "\t&%s_app," % app.split('.')[0]
23         print >> cout, "#endif"
24     print >> cout, "};"
25     print >> cout, "int const num_apps = sizeof(apps) / sizeof(app_t*);"
26     cout.close()
27
28     return 0
29
30 if __name__ == "__main__":
31         sys.exit(main())