Send commitlog mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.openmoko.org/mailman/listinfo/commitlog
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of commitlog digest..."
Today's Topics:

   1. r5821 - trunk/gta02-core/bom ([email protected])
   2. r5822 - in trunk/gta02-core: . bom docs/ecn
      ([email protected])
   3. r5823 - in trunk/gta02-core: . bom ([email protected])
   4. r5824 - trunk/gta02-core/bom ([email protected])
--- Begin Message ---
Author: werner
Date: 2010-02-06 15:21:16 +0100 (Sat, 06 Feb 2010)
New Revision: 5821

Added:
   trunk/gta02-core/bom/CHARACTERISTICS
Log:
Added draft document describing some concepts and fields used for
characteristics. This is more to provide the background, not a straight
manual to follow.

This was written before I made any characteristics files for real
components, so some things differ. (E.g., there's no DSC field,
tolerances can also be absolute, etc.)



Added: trunk/gta02-core/bom/CHARACTERISTICS
===================================================================
--- trunk/gta02-core/bom/CHARACTERISTICS                                (rev 0)
+++ trunk/gta02-core/bom/CHARACTERISTICS        2010-02-06 14:21:16 UTC (rev 
5821)
@@ -0,0 +1,140 @@
+*** This is an older draft of the concept - differs sometimes from the way
+    things are done in gta02-core. ***
+
+
+BOM matching
+============
+
+BOMs are matched with inventories in the following way:
+
+- a .lst file with the BOM is generated by KiCad
+
+- using a ruleset, component characteristics are translated to a
+  canonical format and default values may be used for unspecified
+  characteristics
+
+- part catalogs are searched for matches with the canonical component
+  descriptions. This yields a list of supplier-specific part numbers
+  for each component.
+
+  Parts can be characterized by either specifying their properties or
+  by equating them to another part. E.g., a Digi-Key part may be
+  defined as an NXP part which in turn is equivalent to a TI part.
+
+- this list is then matched against inventories, using a suitable
+  optimization strategy (e.g., prioritize inventories and try to
+  pick as many suitable components as possible higher priority ones
+  before moving to lower priority ones)
+
+  E.g., local stock could be the first-level inventory, followed by
+  more distant warehouses, followed by distributors, followed by
+  manufacturers.
+
+  Inventories could also include pricing information.
+
+- TBD: it would be good if parameters gathered in the matching process
+  could be fed back into KiCad (as some sort of annotations, similar
+  to the expanded view of schematic symbols), such that under-specifed
+  parts yielding mismatches can be spotted by manual review.
+
+
+Catalog
+=======
+
+A catalog contains part characteristics and the reference number(s)
+assigned to them.
+
+
+Basic syntax
+------------
+
+Catalog entries consist of "words" in the sense that each word does
+not contain any whitespace and words are separated from each other by
+whitespace. Whitespace can be included in a word if it is enclosed in
+double quotes.
+
+Each entry begins in the first column of a line. If an entry needs
+more than one line, the words on the continuation line(s) must be
+indented by whitespace.
+
+Trailing whitespace is ignored, and so are comments beginning with a
+hash mark. Blank lines end any entry and are also ignored.
+
+Each catalog entry begins with the part number followed by a part type
+designator. 
+
+Characteristics have the form <field>=<value>, where
+the fields follow the pattern outlined below. The value is some
+description of the value of that characteristic, typically a number
+and a unit (e.g., 4.7uF) or a name (e.g., X5R).
+
+Numbers use a decimal point where necessary. Mantissas are normalized
+such that they fall into the range 1 <= n < 1000. E.g., instead of
+0.1uF, write 100nF. There is no space between number and unit. The
+Omega of Ohm is written as "R".
+
+
+Fields
+------
+
+Each 
+
+General fields
+- - - - - - -
+
+FP     Footprint
+H      Height (overrides any height implied by footprint)
+TOL    Tolerance, with percent sign. Split tolerances are indicated as n/m%
+DSC    Free-format description
+
+
+Resistors
+- - - - -
+
+RES    Part type designator
+R      Resistance, with unit
+P      Maximum power dissipation
+V      Maximum volatage
+
+
+Capacitors
+- - - - -
+
+CAP    Part type designator
+C      Capacitance, with unit
+M      Material, e.g., TANT, NP0, X5R, etc.
+V      Maximum voltage
+ESR    ESR, with unit
+
+
+Inductors
+-- - - -
+
+Diodes
+- - -
+
+DIODE  Regular diode
+STKY   Schottky diode
+
+Vf     Maximum forward voltage
+Vr     Maximum reverse voltage
+If     Maximum forward current
+Ir     Maximum reverse current
+C      Capacitance
+
+LED    Ligh-emitting diode
+
+COL    Color, multiple colors are separated by /, e.g., blue/red
+ARRAY  If multiple diodes form an array, this parameter describes
+       its structure: CA = common anode, CC = common cathode,
+       SEQ = tap-A-C-tap-A-C-tap sequence
+
+ZENER  Zener diode
+
+Vz     Zener voltage
+
+TVS    Transient voltage suppressor
+
+Vac    Working voltage, AC
+Vdc    Working voltage, DC
+E      Energy




--- End Message ---
--- Begin Message ---
Author: werner
Date: 2010-02-07 01:13:43 +0100 (Sun, 07 Feb 2010)
New Revision: 5822

Modified:
   trunk/gta02-core/audio.sch
   trunk/gta02-core/bom/README
   trunk/gta02-core/bom/gta02-core.sub
   trunk/gta02-core/bom/misc.chr
   trunk/gta02-core/docs/ecn/ecn0032.txt
Log:
Corrected "impossible" varistors and fixed substitution rules.

- bom/README: started to write an introduction with examples
- bom/misc.chr: since all KEV* with Vdc=9V have Vac=6.5V, it's safe to assume
  that KEV040209151A does as well
- bom/gta02-core.sub: fixed rule to detect TVS (F was used in SI-like style, 
  not schematic style)
- bom/gta02-core.sub (TVS): corrected nonsensical Vac rule and added Vdc rule
- audio.sch: changed D3001, D3002, D4105, D4106, D4301, D4302, and D4402 
  through D4405 from incorrect 5.6 Vac to 6.5 Vac
- docs/ecn/ecn0032.txt: "same as D4402" means 6.5 Vac, not 5.6 Vac



Modified: trunk/gta02-core/audio.sch
===================================================================
--- trunk/gta02-core/audio.sch  2010-02-06 14:21:16 UTC (rev 5821)
+++ trunk/gta02-core/audio.sch  2010-02-07 00:13:43 UTC (rev 5822)
@@ -1,5 +1,5 @@
-EESchema Schematic File Version 2  date Sat 28 Nov 2009 02:26:03 PM CST
-LIBS:power,device,conn,gta02-core
+EESchema Schematic File Version 2  date Sat Feb  6 21:08:59 2010
+LIBS:power,device,conn,gta02-core,gta02-core-cache
 EELAYER 24  0
 EELAYER END
 $Descr A3 16535 11700
@@ -923,7 +923,7 @@
 F 0 "D4404" V 12250 7950 60  0000 C CNN
 F 1 "150pF" V 12350 7950 60  0000 C CNN
 F 2 "0402" H 12290 7910 60  0001 C CNN
-F 4 "5.6Vac" V 12450 7950 60  0000 C CNN "AC-Voltage"
+F 4 "6.5Vac" V 12450 7950 60  0000 C CNN "AC-Voltage"
        1    12350 7700
        0    -1   1    0   
 $EndComp
@@ -952,7 +952,7 @@
 F 0 "D4405" V 12950 7950 60  0000 C CNN
 F 1 "150pF" V 13050 7950 60  0000 C CNN
 F 2 "0402" H 12990 7910 60  0001 C CNN
-F 4 "5.6Vac" V 13150 7950 60  0000 C CNN "AC-Voltage"
+F 4 "6.5Vac" V 13150 7950 60  0000 C CNN "AC-Voltage"
        1    13050 7700
        0    1    1    0   
 $EndComp
@@ -963,7 +963,7 @@
 F 0 "D4403" V 14100 9800 60  0000 C CNN
 F 1 "150pF" V 14200 9800 60  0000 C CNN
 F 2 "0402" H 14140 9760 60  0001 C CNN
-F 4 "5.6Vac" V 14300 9800 60  0000 C CNN "AC-Voltage"
+F 4 "6.5Vac" V 14300 9800 60  0000 C CNN "AC-Voltage"
        1    14200 9550
        0    1    1    0   
 $EndComp
@@ -1016,7 +1016,7 @@
 F 0 "D3002" V 12350 2450 60  0000 C CNN
 F 1 "150pF" V 12450 2450 60  0000 C CNN
 F 2 "0402" H 12390 2910 60  0001 C CNN
-F 4 "5.6Vac" V 12550 2450 60  0000 C CNN "AC-Voltage"
+F 4 "6.5Vac" V 12550 2450 60  0000 C CNN "AC-Voltage"
        1    12450 2700
        0    -1   1    0   
 $EndComp
@@ -1027,7 +1027,7 @@
 F 0 "D3001" V 12350 3650 60  0000 C CNN
 F 1 "150pF" V 12450 3650 60  0000 C CNN
 F 2 "0402" H 12390 4110 60  0001 C CNN
-F 4 "5.6Vac" V 12550 3650 60  0000 C CNN "AC-Voltage"
+F 4 "6.5Vac" V 12550 3650 60  0000 C CNN "AC-Voltage"
        1    12450 3900
        0    -1   1    0   
 $EndComp
@@ -1107,7 +1107,7 @@
 F 0 "D4106" V 14650 4450 60  0000 C CNN
 F 1 "150pF" V 14750 4450 60  0000 C CNN
 F 2 "0402" H 14690 4910 60  0001 C CNN
-F 4 "5.6Vac" V 14850 4450 60  0000 C CNN "AC-Voltage"
+F 4 "6.5Vac" V 14850 4450 60  0000 C CNN "AC-Voltage"
        1    14750 4700
        0    -1   1    0   
 $EndComp
@@ -1118,7 +1118,7 @@
 F 0 "D4105" V 14650 6150 60  0000 C CNN
 F 1 "150pF" V 14750 6150 60  0000 C CNN
 F 2 "0402" H 14690 6610 60  0001 C CNN
-F 4 "5.6Vac" V 14850 6150 60  0000 C CNN "AC-Voltage"
+F 4 "6.5Vac" V 14850 6150 60  0000 C CNN "AC-Voltage"
        1    14750 6400
        0    1    1    0   
 $EndComp
@@ -1161,7 +1161,7 @@
        1    0    0    -1  
 $EndComp
 $Comp
-L C C4122
+L C C4121
 U 1 1 4A41AD3E
 P 13500 6400
 F 0 "C4121" H 13550 6500 50  0000 L CNN
@@ -1356,7 +1356,7 @@
 F 0 "D4302" V 2150 7850 60  0000 C CNN
 F 1 "150pF" V 2050 7850 60  0000 C CNN
 F 2 "0402" H 1990 7810 60  0001 C CNN
-F 4 "5.6Vac" V 1950 7850 60  0000 C CNN "AC-Voltage"
+F 4 "6.5Vac" V 1950 7850 60  0000 C CNN "AC-Voltage"
        1    2050 7600
        0    -1   -1   0   
 $EndComp
@@ -1367,7 +1367,7 @@
 F 0 "D4301" V 1950 9650 60  0000 C CNN
 F 1 "150pF" V 2050 9650 60  0000 C CNN
 F 2 "0402" H 1990 9610 60  0001 C CNN
-F 4 "5.6Vac" V 2150 9650 60  0000 C CNN "AC-Voltage"
+F 4 "6.5Vac" V 2150 9650 60  0000 C CNN "AC-Voltage"
        1    2050 9400
        0    -1   1    0   
 $EndComp
@@ -1396,7 +1396,7 @@
 F 0 "D4402" V 13250 9800 60  0000 C CNN
 F 1 "150pF" V 13350 9800 60  0000 C CNN
 F 2 "0402" H 13290 9760 60  0001 C CNN
-F 4 "5.6Vac" V 13450 9800 60  0000 C CNN "AC-Voltage"
+F 4 "6.5Vac" V 13450 9800 60  0000 C CNN "AC-Voltage"
        1    13350 9550
        0    -1   1    0   
 $EndComp

Modified: trunk/gta02-core/bom/README
===================================================================
--- trunk/gta02-core/bom/README 2010-02-06 14:21:16 UTC (rev 5821)
+++ trunk/gta02-core/bom/README 2010-02-07 00:13:43 UTC (rev 5822)
@@ -1,11 +1,110 @@
+The BOM processing system
+=========================
+
+The BOM processing system takes a bill of material generated by
+KiCad and converts it in various steps into a "shopping list"
+that can be used to order from various providers.
+
+
+Introduction
+============
+
+The following sections describe how to use the basic elements of
+the BOM processing system.
+
+
+A simple BOM translation
+------------------------
+
+KiCad identifies components by a so-called component reference,
+e.g., R1001, U5, etc. In addition to this, each component can have
+various parameters, such as a "value", its footprint, and further
+user-defined items. These parameters can be shown in the schematics
+(e.g., the value usually is) or they can be hidden (e.g., the
+footprint).
+
+At the end of the process, we want a "shopping list" that can be
+used to order items or to find them in an inventory or catalog.
+Components in the shopping list are identified by a part number.
+
 ...
-- namespace
-- equivalences
+- BOM
+- inventory
 - ID matching
-- characteristics matching
-- inventory
 
 
+Equivalences
+------------
+
+A single component can be associated with multiple part numbers.
+For example, a chip its manufacturer calls "XYZ-R1" may be listed in
+a distributor's catalog with a completely different order number,
+such as "20-1234-8". The BOM processing system therefore
+distinguishes multiple so-called name spaces. A name space is
+identified by a (unique) name and a part number is generally
+qualified by the name of the name space.
+
+E.g., if the manufacturer is called "ACME" and the distributor of
+electronical components calls itself "DIST-EL", the part in our
+example may have the equivalent names "ACME XYZ-R1" and "DIST-EL
+20-1234-8".
+
+...
+- revise .inv
+
+example.equ:
+
+#INV
+DIST-EL 20-1234-8
+#EQU
+ACME XYZ-R1 DIST-EL 20-1234-8
+
+
+Adding stock and cost
+---------------------
+
+- .inv, more fields
+- quanta
+
+Substituting component names
+----------------------------
+
+- intro to .sub
+- ad-hoc fixes
+
+
+Selecting characteristics
+-------------------------
+
+- .sub
+- .chr
+...
+
+
+Generating characteristics
+--------------------------
+
+- .gen
+
+
+Advanced topics
+===============
+
+- generating .inv files
+- different presentations (e.g., CT, TR, ...)
+- component substitution (one-way equivalence)
+- problem reports
+- hiding known problems (while sourcing)
+
+
+File formats
+============
+
+The BOM processing system uses a large number of different files to
+store information retrieved from the BOM, inventories, intermediate
+results, etc. The following sections describe the various formats.
+
+
 Part characteristics (.chr)
 ---------------------------
 

Modified: trunk/gta02-core/bom/gta02-core.sub
===================================================================
--- trunk/gta02-core/bom/gta02-core.sub 2010-02-06 14:21:16 UTC (rev 5821)
+++ trunk/gta02-core/bom/gta02-core.sub 2010-02-07 00:13:43 UTC (rev 5822)
@@ -35,10 +35,11 @@
 
 D[0-9]* {
     -> T=D
-    VAL=$F {   # heuristic to detect TVS
+    VAL=*F {   # heuristic to detect TVS
        -> M=TVS
-       VAL=$F -> C=$VAL
-       F1=$Vac -> Vac=$F1
+       VAL=*F -> C=$VAL
+       F1=(*V)ac -> Vac=$F1:1
+       F1=(*V)dc -> Vdc=$F1:1
     }
 }
 

Modified: trunk/gta02-core/bom/misc.chr
===================================================================
--- trunk/gta02-core/bom/misc.chr       2010-02-06 14:21:16 UTC (rev 5821)
+++ trunk/gta02-core/bom/misc.chr       2010-02-07 00:13:43 UTC (rev 5822)
@@ -7,7 +7,7 @@
 
 KARMAX KEV040205331A   T=D     M=TVS   Vac=4V  Vdc=5.6V        C=330pF FP=0402
 # unlisted
-KARMAX KEV040209151A   T=D     M=TVS           Vdc=9V          C=150pF FP=0402
+KARMAX KEV040209151A   T=D     M=TVS   Vac=6.5V Vdc=9V         C=150pF FP=0402
 
 # KARMAX KLB
 

Modified: trunk/gta02-core/docs/ecn/ecn0032.txt
===================================================================
--- trunk/gta02-core/docs/ecn/ecn0032.txt       2010-02-06 14:21:16 UTC (rev 
5821)
+++ trunk/gta02-core/docs/ecn/ecn0032.txt       2010-02-07 00:13:43 UTC (rev 
5822)
@@ -10,7 +10,7 @@
 based on Joerg's proposal!
 
 ESD protection
-- add varistors (D4403/4404/4405) 5.6Vac to all headset jack signal pins
+- add varistors (D4403/4404/4405) 6.5Vac to all headset jack signal pins
   (same as D4402)
 
 EMI protection 




--- End Message ---
--- Begin Message ---
Author: werner
Date: 2010-02-07 06:39:27 +0100 (Sun, 07 Feb 2010)
New Revision: 5823

Modified:
   trunk/gta02-core/bom/Makefile
   trunk/gta02-core/bom/README
   trunk/gta02-core/bom/gta02-core.sub
   trunk/gta02-core/bom/match.pl
   trunk/gta02-core/pmu.sch
Log:
Field substitution got a lot more flexible with "wildcard" field FN. 
Resolved problems of matching inductors.

- bom/match.pl, bom/README: "FN" can be used as a shorthand for "all fields"
- bom/gta02-core.sub: replace all uses of F1, F2, F3 with FN
- bom/gta02-core.sub (L): the maximum current can now be specified
- bom/pardup.pl: script to show multiple choices in the parts list
- bom/Makefile: new target show-dup to show entries in the parts list where
  multiple choices are possible (which is suspicious in our case)
- pmu.sch: added footprint and current rating for L1701 through L1704
- gta02-core.sub (R): commented out 5% tolerance default for now since it
  causes problems matching components and picking the "wrong" component doesn't
  do much harm



Modified: trunk/gta02-core/bom/Makefile
===================================================================
--- trunk/gta02-core/bom/Makefile       2010-02-07 00:13:43 UTC (rev 5822)
+++ trunk/gta02-core/bom/Makefile       2010-02-07 05:39:27 UTC (rev 5823)
@@ -6,7 +6,7 @@
 INV=fic/fic.inv gta02-core.inv dummy.inv fic/missing.inv digi-key.inv
 CHR=darfon.chr ralec.chr avx.chr acx.chr misc.chr
 
-.PHONY:                all spotless upload show-missing show-dk
+.PHONY:                all spotless upload show-dup show-missing show-dk
 # mark them as phony since we have incomplete dependencies in this Makefile
 .PHONY:                fic/fic.equ fic/fic.inv fic/missing.equ
 
@@ -57,6 +57,9 @@
                $(MAKE) -C fic spotless
                rm -f gta02-core.par gta02-core.ord darfon.chr ralec.chr
 
+show-dup:      pardup.pl gta02-core.par
+               perl ./pardup.pl gta02-core.par
+
 show-missing:  $(EQU) fic/fic.dsc
                (echo '#ORD'; grep MISSING gta02-core.ord ; ) | \
                  ./prettyord - $(EQU) fic/fic.dsc

Modified: trunk/gta02-core/bom/README
===================================================================
--- trunk/gta02-core/bom/README 2010-02-07 00:13:43 UTC (rev 5822)
+++ trunk/gta02-core/bom/README 2010-02-07 05:39:27 UTC (rev 5823)
@@ -150,6 +150,11 @@
 Note that fields with a user-defined name currently still only appear
 as F1, F2, etc.
 
+The special field name FN can be used to look for a match in all of
+F1, F2, ... This way, it's sufficient to use a consistent syntax for
+additional parameters, without having to assign also a fixed location
+for them. If more than one field matches, the first match is taken.
+
 Field names are case-insensitive.
 
 The pattern is uses a notation similar to filename globbing. There
@@ -179,7 +184,7 @@
 
 This rule translates the values of all resistors to SI notation.
 
-D* F1=(*)Vdc -> T=TSV Vdc=F1:1
+D* FN=(*)Vdc -> T=TSV Vdc=FN:1
 
 This rule sets the parameters T and Vdc for Zeners acting as TSVs.
 

Modified: trunk/gta02-core/bom/gta02-core.sub
===================================================================
--- trunk/gta02-core/bom/gta02-core.sub 2010-02-07 00:13:43 UTC (rev 5822)
+++ trunk/gta02-core/bom/gta02-core.sub 2010-02-07 05:39:27 UTC (rev 5823)
@@ -5,8 +5,8 @@
 R[0-9P]* {     # also handle RP...
     -> T=R
     VAL=$R -> R=$VAL
-    -> TOL=5%
-    F1=$% -> TOL=$F1
+#    -> TOL=5%
+    FN=$% -> TOL=$FN
 }
 
 RP[0-9]* {
@@ -23,14 +23,15 @@
 L[0-9]* {
     -> T=L
     VAL=$H -> L=$VAL
+    FN=*A -> I=$FN
 }
 
 B[0-9]* {
     -> T=FILTER M=BEAD
     VAL=$R -> R=$VAL
-    F2=*A -> I=$F2
-    F3=*R -> Rdc=$F3
-    F3=0.45R -> Rdc=450mR      # hack
+    FN=*A -> I=$FN
+    FN=*R -> Rdc=$FN
+    FN=0.45R -> Rdc=450mR      # hack
 }
 
 D[0-9]* {
@@ -38,8 +39,8 @@
     VAL=*F {   # heuristic to detect TVS
        -> M=TVS
        VAL=*F -> C=$VAL
-       F1=(*V)ac -> Vac=$F1:1
-       F1=(*V)dc -> Vdc=$F1:1
+       FN=(*V)ac -> Vac=$FN:1
+       FN=(*V)dc -> Vdc=$FN:1
     }
 }
 

Modified: trunk/gta02-core/bom/match.pl
===================================================================
--- trunk/gta02-core/bom/match.pl       2010-02-07 00:13:43 UTC (rev 5822)
+++ trunk/gta02-core/bom/match.pl       2010-02-07 05:39:27 UTC (rev 5823)
@@ -163,19 +163,25 @@
     RULE: for (my $i = 0; $i <= $#match; $i++) {
        print STDERR "RULE #$i\n" if $debug;
        %found = %field;
-       for (keys %{ $match[$i] }) {
-           print STDERR "  MATCH $_=$match[$i]{$_}[0] " if $debug;
-           if (!defined $found{$_}) {
-               print STDERR "NO FIELD\n" if $debug;
-               next RULE;
+       FIELD: for my $f (keys %{ $match[$i] }) {
+           my @f = $f ne "FN" ? ($f) :
+             ("F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9");
+           for (@f) {
+               print STDERR "  MATCH $_=$match[$i]{$f}[0] " if $debug;
+               if (!defined $found{$_}) {
+                   print STDERR "NO FIELD\n" if $debug;
+                   next;
+               }
+               print STDERR "FIELD $found{$_} " if $debug;
+               if (!defined &sub_match($found{$_}, $f,
+                 $match[$i]{$f}[1], $match[$i]{$f}[2])) {
+                   print STDERR "MISS\n" if $debug;
+                   next;
+               }
+               print STDERR "MATCH\n" if $debug;
+               next FIELD;
            }
-           print STDERR "FIELD $found{$_} " if $debug;
-           if (!defined &sub_match($found{$_}, $_,
-             $match[$i]{$_}[1], $match[$i]{$_}[2])) {
-               print STDERR "MISS\n" if $debug;
-               next RULE;
-           }
-           print STDERR "MATCH\n" if $debug;
+           next RULE;
        }
        for (keys %{ $action[$i] }) {
            my $s = &sub_expand($action[$i]{$_});

Modified: trunk/gta02-core/pmu.sch
===================================================================
--- trunk/gta02-core/pmu.sch    2010-02-07 00:13:43 UTC (rev 5822)
+++ trunk/gta02-core/pmu.sch    2010-02-07 05:39:27 UTC (rev 5823)
@@ -1,4 +1,4 @@
-EESchema Schematic File Version 2  date Sat Jan 30 19:05:11 2010
+EESchema Schematic File Version 2  date Sun Feb  7 02:31:05 2010
 LIBS:power,device,conn,gta02-core,gta02-core-cache
 EELAYER 24  0
 EELAYER END
@@ -1237,6 +1237,8 @@
 P 11100 4650
 F 0 "L1701" V 11050 4650 50  0000 C CNN
 F 1 "2u2" V 11200 4650 50  0000 C CNN
+F 2 "1210" H 11100 4650 60  0001 C CNN
+F 4 "1.6A" V 11200 4850 50  0000 C CNN "I"
        1    11100 4650
        0    1    1    0   
 $EndComp
@@ -2094,6 +2096,8 @@
 P 11200 6550
 F 0 "L1704" V 11150 6400 50  0000 C CNN
 F 1 "2u2" V 11150 6650 50  0000 C CNN
+F 2 "0805" H 11200 6550 60  0001 C CNN
+F 4 "800mA" V 11150 6900 50  0000 C CNN "I"
        1    11200 6550
        0    1    1    0   
 $EndComp
@@ -2103,6 +2107,8 @@
 P 11100 6050
 F 0 "L1702" V 11050 5900 50  0000 C CNN
 F 1 "4u7" V 11050 6150 50  0000 C CNN
+F 2 "0805" H 11100 6050 60  0001 C CNN
+F 4 "560mA" V 11050 6400 50  0000 C CNN "I"
        1    11100 6050
        0    1    1    0   
 $EndComp
@@ -2112,6 +2118,8 @@
 P 11100 5550
 F 0 "L1703" V 11050 5400 50  0000 C CNN
 F 1 "4u7" V 11050 5650 50  0000 C CNN
+F 2 "0805" H 11100 5550 60  0001 C CNN
+F 4 "560mA" V 11050 5900 50  0000 C CNN "I"
        1    11100 5550
        0    1    1    0   
 $EndComp




--- End Message ---
--- Begin Message ---
Author: werner
Date: 2010-02-07 09:27:45 +0100 (Sun, 07 Feb 2010)
New Revision: 5824

Added:
   trunk/gta02-core/bom/annotate
Modified:
   trunk/gta02-core/bom/Makefile
   trunk/gta02-core/bom/parser.pl
Log:
Working on annotation.

- bom/Makefile: trim the output of show-missing and show-dk like I did manually
  when posting these lists
- bom/parser.pl: added parsing of EESchema schematics
- bom/annotate: back-annotate schematics with part selection (in progress)
- bom/Makefile: target "ann" to annotate pmu.sch



Modified: trunk/gta02-core/bom/Makefile
===================================================================
--- trunk/gta02-core/bom/Makefile       2010-02-07 05:39:27 UTC (rev 5823)
+++ trunk/gta02-core/bom/Makefile       2010-02-07 08:27:45 UTC (rev 5824)
@@ -62,8 +62,14 @@
 
 show-missing:  $(EQU) fic/fic.dsc
                (echo '#ORD'; grep MISSING gta02-core.ord ; ) | \
-                 ./prettyord - $(EQU) fic/fic.dsc
+                 ./prettyord - $(EQU) fic/fic.dsc | \
+                 sed 's/^...  \(.\{,78\}\).*/\1/'
 
 show-dk:
                (echo '#ORD'; grep DIGI-KEY gta02-core.ord ; ) | \
-                 ./prettyord - digi-key.dsc
+                 ./prettyord - digi-key.dsc | \
+                 sed 's/^...  //'
+
+ann:           annotate ../pmu.sch fic/fic.dsc gta02-core.par $(EQU)
+               perl ./annotate ../pmu.sch fic/fic.dsc gta02-core.par $(EQU) \
+                 >try.sch

Added: trunk/gta02-core/bom/annotate
===================================================================
--- trunk/gta02-core/bom/annotate                               (rev 0)
+++ trunk/gta02-core/bom/annotate       2010-02-07 08:27:45 UTC (rev 5824)
@@ -0,0 +1,148 @@
+#!/usr/bin/perl
+
+require "parser.pl";
+require "misc.pl";
+
+
+&parse;
+
+
+$H = 50;       # character height
+$W = $H*0.9;   # character width
+$L = $H+20;    # line skip
+
+
+sub normalize
+{
+    my @t = @_;
+
+    # convert from (x0, y0, w, h) to (x0, y0, x1, y1)
+    $t[2] += $t[0];
+    $t[3] += $t[1];
+    return @t;
+}
+
+
+sub block
+{
+    push(@block, [ &normalize(@_) ]);
+}
+
+
+sub pass
+{
+    my @t = &normalize(@_);
+
+    for (@block) {
+       my @b = @{ $_ };
+       next if $t[0] > $b[2];
+       next if $t[2] < $b[0];
+       next if $t[1] > $b[3];
+       next if $t[3] < $b[1];
+       return 0;
+    }
+    return 1;
+}
+
+
+sub put
+{
+    local ($x0, $y0, $rot, @s) = @_;
+
+    my $h = @s*$H;
+    my $w = 0;
+    for (@s) {
+       my $t = $W*length $_;
+       $w = $t if $t > $w;
+    }
+    my $a = 270;
+    my $r = 100;
+    my $x, $y;
+    $y0 -= $h-$H/2;
+    for ($i = 0; $i != 128; $i++) {
+       $x = int($x0+$r*cos($a/180*3.14159));
+       $y = int($y0+$r*sin($a/180*3.14159));
+       last if &pass($x, $y, $w, $h);
+       $a += 22.5;
+       $r += $L/8;
+    }
+    warn "no place found for \"$s[0]\"" if $i == 128;
+
+    &block($x, $y, $w, $h);
+    my $n = 10;
+    for (reverse @s) {
+       my $hv = $rot ? "V" : "H";
+       print "F $n \"$_\" $hv $x $y $H  0000 L CNN\n";
+       $y += $L;
+       $n++;
+    }
+}
+
+
+#
+# pass 1: find the orientation of all parts
+#
+
+for (@eeschema) {
+    $ref = $1 if /^L \S+ (\S+)/;
+    undef $ref if /^\$EndComp/;
+    $rot{$ref} = 1 if /^\s+0\s+1\s+1\s+0\s*$/ || /^\s+0\s+-1\s+-1\s+0\s*$/;
+}
+
+
+#
+# pass 2: block the spaces occupied by fields
+#
+
+for (@eeschema) {
+    my $ref = $1 if /^L \S+ (\S+)/;
+    next unless /^F /;
+    die "$_" unless
+      /^F \d+ "([^"]*)" ([HV]) (\d+) (\d+) (\d+) +(\d+) ([LC]) C/;
+    ($s, $hv, $x, $y, $size, $flag, $hj, $vj) =
+      ($1, $2, $3, $4, $5, $6, $7, $8);
+    next if $flag != 0;
+    $w = $size*0.8*length $s;
+    if ($hv eq "H") {
+       &block($hj eq "L" ? $x : $x-$w/2, $y-$size/2, $w, $size);
+    } else {
+       &block($x-$size/2, $hj eq "L" ? $y : $y-$w/2, $size, $w);
+    }
+}
+
+#
+# pass 3:
+#
+
+for (@eeschema) {
+    undef @f if /^\$Comp/;
+    if (/^L \S+ (\S+)/) {
+       $ref = $1;
+       my @p = @{ $parts{$ref} };
+       while (@p) {
+           my @id = splice(@p, 0, 2);
+           my $id = "$id[0] $id[1]";
+           for ($id, &eq($id)) {
+               next unless defined $dsc{$_};
+               push(@f, $dsc{$_});
+               last;
+           }
+       }
+    }
+    if (/^P (\d+) (\d+)/) {
+       $x = $1;
+       $y = $2;
+    }
+    if (/^\s+/) {
+       my %seen;
+       my @u = ();
+       for (@f) {
+           next if $seen{$_};
+           push(@u, $_);
+           $seen{$_} = 1;
+       }
+       undef @f;
+       &put($x, $y, $rot{$ref}, @u) if !$rot{$ref};
+    }
+    print "$_\n";
+}


Property changes on: trunk/gta02-core/bom/annotate
___________________________________________________________________
Name: svn:executable
   + *

Modified: trunk/gta02-core/bom/parser.pl
===================================================================
--- trunk/gta02-core/bom/parser.pl      2010-02-07 05:39:27 UTC (rev 5823)
+++ trunk/gta02-core/bom/parser.pl      2010-02-07 08:27:45 UTC (rev 5824)
@@ -308,6 +308,23 @@
 }
 
 
+#
+# "eeschema" populates the following global variable:
+#
+# $eeschema[] = line
+#
+
+
+sub eeschema
+{
+    push(@eeschema, $_[0]);
+    if ($_[0] =~ /^\$EndSCHEMATIC/) {
+       $mode = *skip;
+       undef $raw;
+    }
+}
+
+
 sub parse
 {
     $mode = *skip;
@@ -325,6 +342,13 @@
            $mode = *skip;
            next;
        }
+       if (/^EESchema Schematic/) {
+           $mode = *eeschema;
+           $raw = 1;
+           die "only one schematic allowed" if defined @eeschema;
+           &eeschema($_);
+           next;
+       }
        if (/^#EQU\b/) {
            $mode = *equ;
            next;
@@ -357,8 +381,10 @@
            $mode = *dsc;
            next;
        }
-       s/#.*//;
-       next if /^\s*$/;
+       if (!$raw) {
+           s/#.*//;
+           next if /^\s*$/;
+       }
        &$mode($_);
     }
 }




--- End Message ---
_______________________________________________
commitlog mailing list
[email protected]
http://lists.openmoko.org/mailman/listinfo/commitlog

Reply via email to