replace Makefile with Rakefile
This commit is contained in:
parent
18a8c9ff14
commit
d76576afca
@ -1,105 +0,0 @@
|
||||
# base name of schematic/layout
|
||||
TARGET=usb_cable_tester
|
||||
# path to qEDA
|
||||
QEDA=../qeda/bin/qeda
|
||||
# path to elements
|
||||
ELEMENTS=library/ic_mcu_st_stm32f103xc.yaml
|
||||
ELEMENTS+=library/connector_usb-a-3.0_fci_10117835.yaml
|
||||
ELEMENTS+=library/connector_usb-b-3.0_amphenol_gsb4211.yaml
|
||||
ELEMENTS+=library/connector_usb-mini-b_edac_690-005-299-043.yaml
|
||||
ELEMENTS+=library/connector_usb-micro-b-3.0_gct_usb3110.yaml
|
||||
ELEMENTS+=library/connector_usb-micro-b-2.0_ali_32910334970.yaml
|
||||
ELEMENTS+=library/connector_usb-c_hro_type-c-31-m-04.yaml
|
||||
ELEMENTS+=library/connector_lightning_iphone5.yaml
|
||||
ELEMENTS+=library/vreg_ldo_torex_xc6206.yaml
|
||||
ELEMENTS+=library/connector_battery_18650.yaml
|
||||
ELEMENTS+=library/display_lcd_lcm1602.yaml
|
||||
ELEMENTS+=library/display_lcd_i2cadapter.yaml
|
||||
ELEMENTS+=library/display_oled_0.96in.yaml
|
||||
ELEMENTS+=library/vreg_pmic_tpower_tp4056.yaml
|
||||
ELEMENTS+=library/transistor_pmos_nxp_bss84.yaml
|
||||
ELEMENTS+=library/mechanical_button_6mm.yaml
|
||||
ELEMENTS+=library/connector_xh-2.54-2p.yaml
|
||||
|
||||
netlist: $(TARGET).tdx
|
||||
|
||||
schematic: $(TARGET).ar.sch $(TARGET).sch.pdf
|
||||
|
||||
board: $(TARGET).brd-top.png $(TARGET).brd-bottom.png $(TARGET).brd.ps $(TARGET).brd.zip
|
||||
|
||||
#export netlist from schematic
|
||||
%.tdx: %.sch
|
||||
lepton-netlist -g tEDAx -o $@ $<
|
||||
|
||||
# export schematic as pdf
|
||||
%.sch.pdf: %.sch
|
||||
# export schematic
|
||||
lepton-cli export --color --paper iso_a4 --layout landscape --color --output $@ $<
|
||||
# rotate as it should be
|
||||
pdftk $@ rotate 1-endleft output $@.tmp
|
||||
mv $@.tmp $@
|
||||
|
||||
# create archive schematic
|
||||
%.ar.sch: %.sch
|
||||
cp $< $@
|
||||
lepton-embed --embed $@
|
||||
|
||||
# export board as photorealistic preview (top side)
|
||||
%.brd-top.png: %.lht
|
||||
pcb-rnd -x png --dpi 1200 --photo-mode --outfile $@ $<
|
||||
|
||||
# export board as photorealistic preview (bottom side)
|
||||
%.brd-bottom.png: %.lht
|
||||
pcb-rnd -x png --dpi 1200 --photo-mode --photo-flip-y --outfile $@ $<
|
||||
|
||||
# export gerber from board (JLC_PCB naming style)
|
||||
$(TARGET).brd.zip: $(TARGET).lht
|
||||
pcb-rnd -x cam gerber:JLC_PCB --outfile $(TARGET).brd $<
|
||||
zip $@ $(TARGET).brd.asb $(TARGET).brd.ast $(TARGET).brd.gbl $(TARGET).brd.gbo $(TARGET).brd.gbp $(TARGET).brd.gbs $(TARGET).brd.gko $(TARGET).brd.gtl $(TARGET).brd.gto $(TARGET).brd.gtp $(TARGET).brd.gts $(TARGET).brd.xln
|
||||
|
||||
# export all layers of the board in as ps document
|
||||
%.brd.ps: %.lht
|
||||
pcb-rnd -x ps --psfile $@ $<
|
||||
|
||||
# generate symbols and footprints from part definitions
|
||||
geda/symbols/lib/ coraleda/subc/lib lib: library ${ELEMENTS}
|
||||
# reset
|
||||
$(QEDA) reset
|
||||
# configure
|
||||
$(QEDA) config pattern.preferManufacturer false
|
||||
$(QEDA) config pattern.densityLevel M
|
||||
$(QEDA) config pattern.smoothPadCorners true
|
||||
# add local files
|
||||
$(QEDA) add ic_mcu_st_stm32f103xc@LQFP144
|
||||
$(QEDA) add connector_usb-a-3.0_fci_10117835
|
||||
$(QEDA) add connector_usb-b-3.0_amphenol_gsb4211
|
||||
$(QEDA) add connector_usb-mini-b_edac_690-005-299-043
|
||||
$(QEDA) add connector_usb-micro-b-3.0_gct_usb3110
|
||||
$(QEDA) add connector_usb-micro-b-2.0_ali_32910334970
|
||||
$(QEDA) add connector_usb-c_hro_type-c-31-m-04
|
||||
$(QEDA) add connector_lightning_iphone5
|
||||
$(QEDA) add vreg_ldo_torex_xc6206
|
||||
$(QEDA) add connector_battery_18650
|
||||
$(QEDA) add display_lcd_lcm1602
|
||||
$(QEDA) add display_lcd_i2cadapter
|
||||
$(QEDA) add display_oled_0.96in
|
||||
$(QEDA) add vreg_pmic_tpower_tp4056
|
||||
$(QEDA) add transistor_pmos_nxp_bss84
|
||||
$(QEDA) add mechanical_button_6mm
|
||||
$(QEDA) add connector_XH-2.54-2P
|
||||
# from github library
|
||||
$(QEDA) add ecs/csm-7
|
||||
$(QEDA) add capacitor/c0603
|
||||
$(QEDA) add resistor/r0603
|
||||
$(QEDA) add diode/led0603
|
||||
# generate outputs
|
||||
$(QEDA) config output geda
|
||||
$(QEDA) generate .
|
||||
$(QEDA) config output coraleda
|
||||
$(QEDA) generate .
|
||||
|
||||
clean:
|
||||
rm $(TARGET).brd-top.png $(TARGET).brd-bottom.png $(TARGET).brd.ps $(TARGET).brd.asb $(TARGET).brd.ast $(TARGET).brd.gbl $(TARGET).brd.gbo $(TARGET).brd.gbp $(TARGET).brd.gbs $(TARGET).brd.gko $(TARGET).brd.gtl $(TARGET).brd.gto $(TARGET).brd.gtp $(TARGET).brd.gts $(TARGET).brd.xln
|
||||
|
||||
dist-clean: clean
|
||||
rm $(TARGET).tdx $(TARGET).sch.pdf $(TARGET).brd.zip
|
@ -41,7 +41,7 @@ here the number of USB signals required (including 3.0 data lines, shield and in
|
||||
- total USB: 105
|
||||
- MCU USB: 2 (to flash and get detailed report/advanced testing)
|
||||
- SWD: 2 (to flash and debug the MCU)
|
||||
- I2C: 2 (to display the cable test result)
|
||||
- I²C: 2 (to display the cable test result)
|
||||
- display control: 1 (to power off display at the end)
|
||||
- total: 112
|
||||
|
||||
@ -93,6 +93,16 @@ the switch next to the USB port is used to select which power source to use to p
|
||||
it also allows to completely disconnect the battery from the circuit, by selecting the USB port as power input, preventing even the tiny stand-by current draw.
|
||||
the USB cable tester will shut down after 5 minutes to save battery.
|
||||
|
||||
requirements
|
||||
============
|
||||
|
||||
to be able to generate the outputs you need following software:
|
||||
- rake: the central script taking care of generating the output files (Makefile is too cumbersome to parse files)
|
||||
- [QEDA](http://qeda.org/): to generate footprints for the parts
|
||||
- [QEDA library](https://doc.qeda.org/library/): for the schematic capture
|
||||
- [pcb-rnd](http://repo.hu/projects/pcb-rnd/): for the board layout
|
||||
the output generation is automatized.
|
||||
|
||||
schematic
|
||||
=========
|
||||
|
||||
@ -117,7 +127,7 @@ sudo npm install --global
|
||||
|
||||
to generate the parts:
|
||||
~~~
|
||||
make lib
|
||||
rake library
|
||||
~~~
|
||||
|
||||
this will use the parts definition (.yaml files) in the `library` to generate [gEDA gschem](http://wiki.geda-project.org/geda:gaf)/[Lepton EDA](https://github.com/lepton-eda/lepton-eda) symbols (.sym files) in the `geda/symbols` folder, and [coralEDA pcb-rnd](http://repo.hu/projects/pcb-rnd/) footprints (.lht files) in the `coraleda/subc` folder.
|
||||
@ -137,12 +147,12 @@ all other symbols are generated by QEDA as described above.
|
||||
|
||||
to export the netlist (in tEDAx format):
|
||||
~~~
|
||||
make netlist
|
||||
rake netlist
|
||||
~~~
|
||||
|
||||
to export archive (with symbols included in schematic) and pdf:
|
||||
~~~
|
||||
make schematic
|
||||
rake print
|
||||
~~~
|
||||
|
||||
board
|
||||
@ -156,9 +166,9 @@ it uses the symbols from the `coraleda/subc/` folder.
|
||||
it been generated from https://oshwlogo.cuvoodoo.info/.
|
||||
all other symbols are generated by QEDA as described above.
|
||||
|
||||
to export gerber file for PCB manufacturer (and photo preview + overview document):
|
||||
to export gerber files for PCB manufacturer (and photo preview + overview document):
|
||||
~~~
|
||||
make board
|
||||
rake fabrication
|
||||
~~~
|
||||
|
||||
fabrication
|
||||
|
136
hardware/Rakefile
Normal file
136
hardware/Rakefile
Normal file
@ -0,0 +1,136 @@
|
||||
# encoding: utf-8
|
||||
# ruby: 2.1.0
|
||||
=begin
|
||||
Rakefile to manage hardware projects
|
||||
|
||||
uses Lepton EDA for schematic and pcb-rnd for board layouts.
|
||||
Rakefile instead of Makefile for better text file parsing capabilities.
|
||||
=end
|
||||
require 'rake/clean'
|
||||
|
||||
# =================
|
||||
# project variables
|
||||
# =================
|
||||
|
||||
# common name used for file names
|
||||
name = "usb_cable_tester"
|
||||
# local QEDA parts
|
||||
parts_local = []
|
||||
parts_local << "ic_mcu_st_stm32f103xc@LQFP144"
|
||||
parts_local << "connector_usb-a-3.0_fci_10117835"
|
||||
parts_local << "connector_usb-b-3.0_amphenol_gsb4211"
|
||||
parts_local << "connector_usb-mini-b_edac_690-005-299-043"
|
||||
parts_local << "connector_usb-micro-b-3.0_gct_usb3110"
|
||||
parts_local << "connector_usb-micro-b-2.0_ali_32910334970"
|
||||
parts_local << "connector_usb-c_hro_type-c-31-m-04"
|
||||
parts_local << "connector_lightning_iphone5"
|
||||
parts_local << "vreg_ldo_torex_xc6206"
|
||||
parts_local << "connector_battery_18650"
|
||||
parts_local << "display_lcd_lcm1602"
|
||||
parts_local << "display_lcd_i2cadapter"
|
||||
parts_local << "display_oled_0.96in"
|
||||
parts_local << "vreg_pmic_tpower_tp4056"
|
||||
parts_local << "transistor_pmos_nxp_bss84"
|
||||
parts_local << "mechanical_button_6mm"
|
||||
parts_local << "connector_XH-2.54-2P"
|
||||
# the corresponding files
|
||||
library = parts_local.collect {|part| "library/#{part.split('@')[0].downcase}.yaml"}
|
||||
# github QEDA parts
|
||||
parts_github = []
|
||||
parts_github << "ecs/csm-7"
|
||||
parts_github << "capacitor/c0603"
|
||||
parts_github << "resistor/r0603"
|
||||
parts_github << "diode/led0603"
|
||||
# path to qeda"
|
||||
qeda = "../qeda/bin/qeda"
|
||||
# ==========
|
||||
# main tasks
|
||||
# ==========
|
||||
|
||||
desc "main building task"
|
||||
task :default => [:print, :fabrication]
|
||||
|
||||
desc "print schematic and layout (as pdf)"
|
||||
prints = [ "#{name}.sch.pdf", "#{name}.brd.ps", "#{name}.brd-top.png", "#{name}.brd-bottom.png" ]
|
||||
task :print => prints
|
||||
CLOBBER.include(prints)
|
||||
|
||||
desc "generate fabrication gerbers (as archive)"
|
||||
gerbers = [ "#{name}.brd.asb", "#{name}.brd.ast", "#{name}.brd.gbl", "#{name}.brd.gbo", "#{name}.brd.gbp", "#{name}.brd.gbs", "#{name}.brd.gko", "#{name}.brd.gtl", "#{name}.brd.gto", "#{name}.brd.gtp", "#{name}.brd.gts", "#{name}.brd.xln" ]
|
||||
fab = [ "#{name}.brd.zip" ]
|
||||
task :fabrication => fab
|
||||
CLEAN.include(gerbers)
|
||||
CLOBBER.include(fab)
|
||||
|
||||
desc "generate footprints from parts"
|
||||
task :library => library do
|
||||
# reset
|
||||
sh "#{qeda} reset"
|
||||
# configure
|
||||
sh "#{qeda} config pattern.preferManufacturer false"
|
||||
sh "#{qeda} config pattern.densityLevel M"
|
||||
sh "#{qeda} config pattern.smoothPadCorners true"
|
||||
# add local files
|
||||
parts_local.each do |part|
|
||||
sh "#{qeda} add #{part}"
|
||||
end
|
||||
# from github library
|
||||
parts_github.each do |part|
|
||||
sh "#{qeda} add #{part}"
|
||||
end
|
||||
# generate outputs
|
||||
sh "#{qeda} config output geda"
|
||||
sh "#{qeda} generate ."
|
||||
sh "#{qeda} config output coraleda"
|
||||
sh "#{qeda} generate ."
|
||||
end
|
||||
|
||||
desc "export netlist from schematic"
|
||||
net = [ "#{name}.tdx" ]
|
||||
task :netlist => net
|
||||
CLOBBER.include(net)
|
||||
|
||||
# ===============
|
||||
# file generation
|
||||
# ===============
|
||||
|
||||
desc "generate printable version (PDF) of schematic"
|
||||
rule ".sch.pdf" => ".standalone.sch" do |t|
|
||||
sh "lepton-cli export --color --paper iso_a4 --layout landscape --color --output #{t.name} #{t.source} 2> /dev/null"
|
||||
end
|
||||
|
||||
desc "generate printable version (PostScript) of board layout"
|
||||
rule ".brd.ps" => ".lht" do |t|
|
||||
sh "pcb-rnd -x ps --psfile #{t.name} #{t.source} 2> /dev/null"
|
||||
end
|
||||
|
||||
desc "generate photo realistic picture from layout (top side)"
|
||||
rule ".brd-top.png" => ".lht" do |t|
|
||||
sh "pcb-rnd -x png --dpi 1200 --photo-mode --outfile #{t.name} #{t.source} 2> /dev/null"
|
||||
end
|
||||
|
||||
desc "generate photo realistic picture from layout (bottom side)"
|
||||
rule ".brd-bottom.png" => ".lht" do |t|
|
||||
sh "pcb-rnd -x png --dpi 1200 --photo-mode --photo-flip-y --outfile #{t.name} #{t.source} 2> /dev/null"
|
||||
end
|
||||
|
||||
desc "generate schematic with all symbols embedded"
|
||||
rule ".standalone.sch" => ".sch" do |t|
|
||||
sh "cp #{t.source} #{t.name}"
|
||||
sh "lepton-embed --embed #{t.name} 2> /dev/null"
|
||||
end
|
||||
|
||||
desc "archive gerbers"
|
||||
rule ".brd.zip" => ".lht" do |t|
|
||||
base = File.basename(t.source, ".lht")
|
||||
sh "pcb-rnd -x cam gerber:JLC_PCB --outfile #{base}.brd #{t.source} 2> /dev/null"
|
||||
gerbers = [ "#{base}.brd.asb", "#{base}.brd.ast", "#{base}.brd.gbl", "#{base}.brd.gbo", "#{base}.brd.gbp", "#{base}.brd.gbs", "#{base}.brd.gko", "#{base}.brd.gtl", "#{base}.brd.gto", "#{base}.brd.gtp", "#{base}.brd.gts", "#{base}.brd.xln" ]
|
||||
fab = [ "#{name}.brd.zip" ]
|
||||
sh "zip --quiet #{t.name} #{gerbers.join(' ')}"
|
||||
end
|
||||
|
||||
desc "export netlist from schematic"
|
||||
rule ".tdx" => ".sch" do |t|
|
||||
sh "lepton-netlist -g tEDAx -o #{t.name} #{t.source} 2> /dev/null"
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user