annotate scripts/ti/make_cmd.pl @ 78:c632896652ba

mfw/ti1_key.c: properly initialize notified_keys array The code in this ti1_key.c layer needs to call kpd_subscribe() and kpd_define_key_notification() functions in order to register with the KPD driver. The original code passed KPD_NB_PHYSICAL_KEYS in nb_notified_keys - this constant is defined to 24 in kpd_cfg.h on all platforms of interest to us - but it only filled the first 23 slots in the notified_keys array, resulting in stack garbage being passed to KPD API functions. The fix consists of initializing the last missed array slot to KPD_KEY_RECORD, the key ID for the right side button on the D-Sample handset. On our current hw targets this "Record" button exists as the EXTRA button on our Luna keypad board and as the camera button on the Pirelli DP-L10. There is no support whatsoever for this button in current BMI+MFW, we have no plans of doing anything with Pirelli's camera button even if we do get our UI fw running on that phone, and the Mother's dream of building our own FreeCalypso handset with the same button arrangement as D-Sample (including the right side button) is currently very nebulous - but let us nonetheless handle the full set of buttons on the KPD to MFW interface, and let upper layers weed out unsupported buttons.
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 25 Oct 2020 23:41:01 +0000
parents 021ac9f5a765
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 #!perl
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 # generate a dynamic Linker command file
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 # PARAMETER ARE:
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 # 0 : Name of the file with the parameters
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 # 1 : Name of the Linker command file (output)
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 # 2 : value of the TOOL_CHOICE variable
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 # 3 : Name of the Linker command file template
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 # 4 - (n-1) : Name of the libraries
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 #$argcount = @ARGV;
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 my $lnk_opt_file=$ARGV[0];
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 my $cmd_file=$ARGV[1];
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 my $toolchoice_type = $ARGV[2];
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 my $cmd_file_temp=$ARGV[3];
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 my %section;
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 open (TMP,$lnk_opt_file)||die "can't open file\n";
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 # parse the parameter file and construct replacement strings
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 #
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 # the file contains entries of the following form
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 # (BSS_LIBS (.bss))
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 # or
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 # (BSS_LIBS (.bss) CONST_LIBS (.text, .const))
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 # or
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 # (BSS_LIBS (.bss)) (BSS_LIBS (.bss) CONST_LIBS (.text, .const))
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 #
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 # the syntax is as follows, white space and line breaks are not significant
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 # <ENTRY> := <lp> <PAIR><lp>
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 # <PAIR> := <name> <SECTION>
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 # <SECTION> := <lp><free_text><lp>
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 # <lp> := (
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 # <rp> := )
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 # <name> := [A-Za-z_]+
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 # <free_text> := [^()]+
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 #
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 # each entry will be linked with one library passed on the command line
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 my $line;
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 my $count;
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 while ($line=<TMP>) {
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 # find <ENTRY>
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 while ($line =~ /\((\s*\w+\s*\([^\(\)]+\))+\)/) {
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 $line = $';
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 $match = $&;
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 # find <PAIR>
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 while ($match =~ /\s*(\w+)\s*(\([^\(\)]+\))/ ) {
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 $match = $';
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 $section{"$1"} .= "$ARGV[$count+4] $2\n";
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 }
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 $count++;
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 }
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 }
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 open (TMP1, ">$cmd_file");
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 open (TMP,$cmd_file_temp);
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 while ($line=<TMP>) {
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 my $replaced = 0;
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 foreach $key (keys(%section)) {
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 if ($line =~ /\($key\)/g) {
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 # insert the Libs
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 $line = $section{$key};
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 $replaced = 1;
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 }
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 }
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 # NEW COMPILER MANAGEMENT
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 # If use of VISUAL LINKER, needs to manage trampoline download.
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 # Case of:
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 # - TOOL_CHOICE == 0 => compiler v1.22e with vlinker v1.9902
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 # - TOOL_CHOICE == 3 => compiler & linker v2.54
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75 if ($toolchoice_type == 0) {
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76 $line =~ s(COMMENT1START)(/*);
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 $line =~ s(COMMENT1END)(*/);
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78 $line =~ s(COMMENT2START)();
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79 $line =~ s(COMMENT2END)();
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
80 } else {
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
81 $line =~ s(COMMENT1START)();
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82 $line =~ s(COMMENT1END)();
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
83 $line =~ s(COMMENT2START)(/*);
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
84 $line =~ s(COMMENT2END)(*/);
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
85 }
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
86
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
87 if ($replaced || !($line =~ /^\s*\$\(\s*\w+\s*\)\s*$/ )) {
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
88 print TMP1 $line;
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
89 }
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
90 }
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
91 close TMP;
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
92 close TMP1;
021ac9f5a765 scripts/ti/make_cmd.pl: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
93 unlink $tmp_file;