From 8eb51b5aa9cd77494fe99516f66923c70eb54f63 Mon Sep 17 00:00:00 2001 From: jedi Date: Mon, 12 Jul 2021 20:51:38 +0200 Subject: [PATCH] create gerber files in CI pipeline --- .build.yml | 8 +--- Makefile | 30 +++++++----- docker/{ => firmware}/Dockerfile | 0 docker/pcb/Dockerfile | 7 +++ pcb/.gitignore | 2 +- pcb/Makefile | 56 ++++++++++++++++++++-- pcb/fiatlux.kiplot.yaml | 79 ++++++++++++++++++++++++++++++-- 7 files changed, 157 insertions(+), 25 deletions(-) rename docker/{ => firmware}/Dockerfile (100%) create mode 100644 docker/pcb/Dockerfile diff --git a/.build.yml b/.build.yml index 4ccdf4a..849107e 100644 --- a/.build.yml +++ b/.build.yml @@ -23,13 +23,6 @@ steps: commands: - apt update - apt install -y make zip - - cd pcb - - kibot -d gen -c fiatlux.kiplot.yaml -s update_xml,run_drc -i - - kibot -d gen -c fiatlux.kiplot.yaml -s update_xml,run_erc -i - - kibot -d gen -c fiatlux.kiplot.yaml -s run_drc,run_erc print_sch - - kibot -d gen -c fiatlux.kiplot.yaml -s all print_front gerbers - - ls -lA - - cd - - make pcb -j$(nproc) - name: case @@ -64,6 +57,7 @@ steps: base_url: https://git.neulandlabor.de/ files: - firmware/firmware/fiatlux.bin + - pcb/pcb.zip checksum: - sha512 - md5 diff --git a/Makefile b/Makefile index 2257790..8fafbe1 100644 --- a/Makefile +++ b/Makefile @@ -6,17 +6,6 @@ all: firmware case pcb firmware: +@make -C firmware html all -clean: - +@make -C firmware clean - -firmware_docker: - sh -c "docker build -t fiatlux_env docker" - sh -c "docker run --volume "$$(pwd)"/firmware:/app/firmware fiatlux_env make -C firmware all" - -clean_docker: - sh -c "docker build -t fiatlux_env docker" - sh -c "docker run --volume "$$(pwd)"/firmware:/app/firmware fiatlux_env make -C firmware clean" - flash: +@make -C firmware flash @@ -25,3 +14,22 @@ case: pcb: +@make -C pcb all + +clean: + +@make -C firmware clean + +@make -C pcb clean + +firmware_docker: + sh -c "docker build -t fiatlux_firmware_env docker/firmware" + sh -c "docker run --volume "$$(pwd)"/firmware:/app/firmware fiatlux_firmware_env make -C firmware all" + +pcb_docker: + sh -c "docker build -t fiatlux_pcb_env docker/pcb" + sh -c "docker run --volume "$$(pwd)"/pcb:/app/pcb fiatlux_pcb_env make -C pcb all" + +clean_docker: + sh -c "docker build -t fiatlux_firmware_env docker/firmware" + sh -c "docker build -t fiatlux_pcb_env docker/pcb" + sh -c "docker run --volume "$$(pwd)"/firmware:/app/firmware fiatlux_firmware_env make -C firmware clean" + sh -c "docker run --volume "$$(pwd)"/pcb:/app/pcb fiatlux_pcb_env make -C pcb clean" + diff --git a/docker/Dockerfile b/docker/firmware/Dockerfile similarity index 100% rename from docker/Dockerfile rename to docker/firmware/Dockerfile diff --git a/docker/pcb/Dockerfile b/docker/pcb/Dockerfile new file mode 100644 index 0000000..24535d5 --- /dev/null +++ b/docker/pcb/Dockerfile @@ -0,0 +1,7 @@ +# syntax=docker/dockerfile:1 +FROM setsoft/kicad_auto +RUN apt update && apt install -y make zip; mkdir /app; chown 1000:1000 /app; cd /app; useradd user +RUN mkdir -p /home/user; cp -r /root/.config /home/user/.config; chown 1000:1000 -R /home/user +RUN ls -la /home/user/.config +USER 1000 +WORKDIR /app \ No newline at end of file diff --git a/pcb/.gitignore b/pcb/.gitignore index b2abd3a..5d83bb6 100644 --- a/pcb/.gitignore +++ b/pcb/.gitignore @@ -33,4 +33,4 @@ fp-info-cache *-bak gen/ -gen.zip +pcb.zip diff --git a/pcb/Makefile b/pcb/Makefile index 181d4fb..610317c 100644 --- a/pcb/Makefile +++ b/pcb/Makefile @@ -1,4 +1,54 @@ -all: +.NOTPARALLEL: gen/fab/fiatlux-F_Cu.gbr gen/fab/fiatlux-B_Cu.gbr gen/fab/fiatlux-F_Mask.gbr gen/fab/fiatlux-B_Mask.gbr gen/fab/fiatlux-F_Paste.gbr gen/fab/fiatlux-B_Paste.gbr gen/fab/fiatlux-F_SilkS.gbr gen/fab/fiatlux-B_SilkS.gbr + +all: test fab doc pcb.zip + +pcb.zip: fab doc @mkdir -p gen - @touch gen/foo - @cd gen; zip ../gen.zip * + @cd gen; zip -r ../pcb.zip fab.zip fiatlux.csv fiatlux-top-pos.csv fiatlux-front.svg fiatlux-back.svg fiatlux.pdf + @cd gen; zip -r ../debug.zip . + +test: gen/fiatlux-drc.txt gen/fiatlux-erc.txt + +doc: gen/fiatlux.pdf gen/fiatlux-front.svg gen/fiatlux-back.svg + +fab: test gen/fab.zip gen/fiatlux.csv gen/fiatlux-top-pos.csv + +gen/fab.zip: gen/fab/fiatlux-F_Cu.gbr gen/fab/fiatlux-B_Cu.gbr gen/fab/fiatlux-F_Mask.gbr gen/fab/fiatlux-B_Mask.gbr +gen/fab.zip: gen/fab/fiatlux-F_Paste.gbr gen/fab/fiatlux-B_Paste.gbr gen/fab/fiatlux-F_SilkS.gbr gen/fab/fiatlux-B_SilkS.gbr + @mkdir -p gen/fab + @cd gen/fab; zip -r ../fab.zip *.gbr + +gen/fiatlux-erc.txt: fiatlux.kiplot.yaml fiatlux.pro fiatlux.kicad_pcb + @mkdir -p gen + kibot -d gen -c fiatlux.kiplot.yaml -s update_xml,run_drc -i + +gen/fiatlux-drc.txt: fiatlux.kiplot.yaml fiatlux.pro fiatlux.sch + @mkdir -p gen + kibot -d gen -c fiatlux.kiplot.yaml -s update_xml,run_erc -i + +gen/fab/%.gbr: fiatlux.kiplot.yaml fiatlux.pro fiatlux.kicad_pcb + @mkdir -p gen + kibot -d gen -c fiatlux.kiplot.yaml -s all print_front gerbers + +gen/fiatlux-top-pos.csv: fiatlux.kiplot.yaml fiatlux.pro fiatlux.kicad_pcb + @mkdir -p gen + kibot -d gen -c fiatlux.kiplot.yaml -s all print_front position + +gen/fiatlux.csv: fiatlux.kiplot.yaml fiatlux.pro fiatlux.kicad_pcb + @mkdir -p gen + kibot -d gen -c fiatlux.kiplot.yaml -s all print_front bom + +gen/fiatlux.pdf: fiatlux.kiplot.yaml fiatlux.pro fiatlux.sch + @mkdir -p gen + kibot -d gen -c fiatlux.kiplot.yaml -s run_drc,run_erc print_sch + +gen/fiatlux-front.svg: fiatlux.kicad_pcb + @mkdir -p gen + pcbdraw --libs default $< $@ + +gen/fiatlux-back.svg: fiatlux.kicad_pcb + @mkdir -p gen + pcbdraw --libs default --back $< $@ + +clean: + @rm -rf gen \ No newline at end of file diff --git a/pcb/fiatlux.kiplot.yaml b/pcb/fiatlux.kiplot.yaml index 2921d61..a035fc6 100644 --- a/pcb/fiatlux.kiplot.yaml +++ b/pcb/fiatlux.kiplot.yaml @@ -13,20 +13,39 @@ preflight: # kiauto_wait_start: 60 # kiauto_time_out_scale: 2 +filters: + - name: fix_rotation + comment: 'Adjust rotation for JLC' + type: rot_footprint + + - name: only_jlc_parts + comment: 'Only parts with JLC code' + type: generic + include_only: + - column: 'LCSC#' + regex: '^C\d+' + +variants: + - name: rotated + comment: 'Just a place holder for the rotation filter' + type: kibom + variant: rotated + pre_transform: fix_rotation + outputs: - name: 'print_sch' comment: "Print schematic (PDF)" type: pdf_sch_print dir: . options: - output: Schematic.pdf + output: fiatlux.pdf - name: 'print_front' comment: "Print F.Cu+Dwgs.User" type: pdf_pcb_print dir: . options: - output_name: PCB_Top.pdf + output_name: fiatlux-top.pdf layers: - layer: B.Cu - layer: F.SilkS @@ -34,7 +53,7 @@ outputs: - name: 'gerbers' comment: "Gerbers for the board house" type: gerber - dir: Gerbers + dir: fab options: # generic layer options exclude_edge_layer: true @@ -56,11 +75,65 @@ outputs: use_gerber_net_attributes: true layers: + - layer: F.Cu + suffix: F_Cu - layer: B.Cu suffix: B_Cu - layer: F.SilkS suffix: F_SilkS + - layer: B.SilkS + suffix: B_SilkS + - layer: F.Paste + suffix: F_Paste + - layer: B.Paste + suffix: B_Paste + - layer: F.Mask + suffix: F_Mask + - layer: B.Mask + suffix: B_Mask - layer: Edge.Cuts suffix: Edge_Cuts + - name: 'position' + comment: "Pick and place file, JLC style" + type: position + options: + variant: rotated + output: '%f-top-pos.%x' + format: CSV + units: millimeters + separate_files_for_front_and_back: false + only_smd: true + columns: + - id: Ref + name: Designator + - Val + - Package + - id: PosX + name: "Mid X" + - id: PosY + name: "Mid Y" + - id: Rot + name: Rotation + - id: Side + name: Layer + - name: 'bom' + comment: "BoM for JLC" + type: bom + options: + output: '%f.%x' + exclude_filter: 'only_jlc_parts' + ref_separator: ',' + columns: + - field: Value + name: Comment + - field: References + name: Designator + - Footprint + - field: 'LCSC#' + name: 'LCSC Part #' + csv: + hide_pcb_info: true + hide_stats_info: true + quote_all: true \ No newline at end of file