Date:2012-11-07 21:54:59 (11 years 4 months ago)
Author:Werner Almesberger
Commit:404211cea3df6ac4588610929cf540c5316f9766
Message:fw/pcb/: Makefile and mkmk for PCB making (forgot to add them)

Files: hw/pcb/Makefile (1 diff)
hw/pcb/mkmk (1 diff)

Change Details

hw/pcb/Makefile
1#MKMK=../../../cae-tools/cameo/templates/mkmk-simple
2MKMK=./mkmk
3
4NAME=antorcha
5
6# 11.5, 0
7
8#BOARD = X0=12.5mm Y0=1mm BOARD_Z=1.6mm CLEARANCE=3mm
9BOARD = X0=5mm Y0=1mm BOARD_Z=1.6mm CLEARANCE=3mm
10
11# drill: 12.5-13.5 mil
12# in: 35 mil endmill; pretend it is smaller, to compensate for
13# tool/board deflections
14# out: 35 mil endmill, 11 mil deflection
15#
16TOOLS = DRILL=7mil,15mil MILL_IN=12mil MILL_OUT=50mil
17TOOLS = DRILL=7mil,15mil MILL_IN=35mil MILL_OUT=35mil ANY=any
18
19#FAB = ROT=90 X=0 Y=1 XN=1 YN=2
20FAB = ROT=90 X=0 Y=0 XN=1 YN=1
21
22.PHONY: all clean
23
24all: Makefile.mkmk
25
26Makefile.mkmk: $(MKMK) ../$(NAME).drl ../$(NAME)-PCB_Edges.gbr Makefile
27        $(MKMK) NAME=$(NAME) $(BOARD) $(TOOLS) $(FAB)
28
29../$(NAME).drl: ../$(NAME).brd
30        pcbnew --drill `pwd`/../$(NAME).brd
31        touch $@
32
33../$(NAME)-PCB_Edges.gbr: ../$(NAME).brd
34        pcbnew --plot=gerber --layers=PCB_Edges `pwd`/../$(NAME).brd
35
36-include Makefile.mkmk
37
38clean::
39        rm -f Makefile.mkmk
hw/pcb/mkmk
1#!/bin/sh
2PATH=$PATH:/home/qi/cae-tools/cameo
3PATH=$PATH:/home/qi/cae-tools/gp2rml
4
5#
6# Parameters:
7#
8# NAME KiCad project name, required
9# X0, Y0 lower left corner of raw board, default: 0mm 0mm
10# X, Y position in array, default: 0 0
11# XN, YN number of boards in X/Y direction, default: 1 1
12# ROT board rotation, default: 0 degrees
13# DRILL drill diameter range, default: 13mil,14mil
14# MILL_IN diameter of mill for work inside the board, default: 35mil
15# MILL_OUT diameter of mill for board edge, default: 35mil
16# BOARD_Z board tickness, default: 0.8 mm
17# ANY set to "any" to use all remaining paths for milling,
18# irrespective of tool size. Default: unset / empty string.
19# CLEARANCE tool clearance above PCB surface, default: 2mm
20#
21
22while [ "$1" ]; do
23    eval "$1"
24    shift
25done
26
27if ! [ "$NAME" ]; then
28    echo "NAME is required" 1>&2
29    exit 1
30fi
31: ${X0:=0} ${Y0:=0}
32: ${X:=0} ${Y:=0}
33: ${XN:=1} ${YN:=1}
34: ${DRILL:="13mil 14mil"}
35: ${MILL_IN:=35mil}
36: ${MILL_OUT:=35mil}
37: ${BOARD_Z:=0.8mm}
38: ${CLEARANCE:=2mm}
39
40rot=
41if [ "$ROT" ]; then
42    rot="rotate $ROT"
43fi
44
45write=write
46yi=0
47while [ $yi -lt $YN ]; do
48    xi=0
49    while [ $xi -lt $XN ]; do
50
51    cameo <<EOF || exit
52mm
53
54gerber 35mil ../$NAME-PCB_Edges.gbr
55$rot
56align 1 $X0 $Y0 # align relative to board corner
57translate 4mm 4mm # move to PCB zone assigned to project
58array +3mm +3mm `expr $X + $xi` `expr $Y + $yi`
59z 0 -58.9mm # board surface (tool fully retracted)
60z 1.5mm # slack for extending the tool
61z -$BOARD_Z # board thickness
62z -0.5mm # tool extra depth
63clear
64
65excellon ../$NAME.drl
66drill $DRILL
67optimize
68$write drill.gp
69
70remainder
71mill $ANY $MILL_IN 0.01mm
72$write mill.gp
73
74remainder
75empty
76
77gerber $MILL_OUT ../$NAME-PCB_Edges.gbr
78outside
79offset
80append mill.gp
81EOF
82
83    write=append
84    xi=`expr $xi + 1`
85    done
86    yi=`expr $yi + 1`
87done
88
89gp2rml $CLEARANCE 0.5 0.5 mill.gp >mill.rml || exit
90gp2rml $CLEARANCE 0.1 0.5 drill.gp >drill.rml || exit
91
92
93cat <<EOF >Makefile.mkmk
94SPOOL=/home/moko/svn.openmoko.org/developers/werner/cncmap/spool/spool
95CNGT=/home/qi/cae-tools/cngt/cngt
96
97.PHONY: mill drill cng plot dplot
98
99mill:
100        PORT=/dev/ttyUSB0 \$(SPOOL) mill.rml
101
102drill:
103        PORT=/dev/ttyUSB0 \$(SPOOL) drill.rml
104
105cng:
106        \$(CNGT) -57.4 20 mill.gp
107
108plot:
109        echo 'plot "drill.gp" with points, "mill.gp" with lines' | \\
110          gnuplot -persist
111
112dplot:
113        echo 'plot "< sed /^\$\$/d drill.gp" with linespoints' | \\
114          gnuplot -persist
115
116clean::
117        rm -f mill.gp mill.rml drill.gp drill.rml
118EOF

Archive Download the corresponding diff file

Branches:
master
tornado-v1



interactive