Mail Archives: geda-user/2012/07/09/17:03:27
X-Authentication-Warning: | delorie.com: mail set sender to geda-user-bounces using -f
|
X-Recipient: | geda-user AT delorie DOT com
|
X-Mailer: | exmh version 2.7.2 01/07/2005 (debian 1:2.7.2-18) with nmh-1.3
|
X-Exmh-Isig-CompType: | comp
|
X-Exmh-Isig-Folder: | inbox
|
To: | geda-user AT delorie DOT com
|
Subject: | [geda-user] Yet another sym file generator
|
Mime-Version: | 1.0
|
Message-Id: | <20120709210244.60387819FB92@turkos.aspodata.se>
|
Date: | Mon, 9 Jul 2012 23:02:40 +0200 (CEST)
|
From: | karl AT aspodata DOT se (Karl Hammar)
|
X-Virus-Scanned: | ClamAV using ClamSMTP
|
Reply-To: | geda-user AT delorie DOT com
|
I wanted to make some symbols for STM32F100C, a cortex-m3 from ST
in a 48pin lqfp package.
So I wanted a few sym files for this device, e.g. one with
. all pins
. only the power pins
. jtag, osc*, boot* pins
. adc and dac pins
etc.
I tried with tragesym and djboxsym, but the one with all the pins did
not look well, and it would be nice if I could use the same input file
and tell the program to only use thoose and thoose pins. So that is
why I wrote the program [1].
///
Usage. It's input files looks like [2]. Running it through
pintosym.pl:
$ pintosym.pl arm_jtag20.pins
printing to arm_jtag20.sym hdr(w:6)
$
I get [3].
///
The input file ([2]) have three types of lines:
Commands:
!> .sym hdr w:6
Attribute lines:
documentation=http://infocenter.arm.com/help/topic/com.arm.doc.dui0499e/DUI0499E_system_design_reference.pdf page 37..39
Pin lines:
1 pwr VTREF power from target
///
The pin lines is simply:
pinnumber pintype pinlabel +some extra text
The example above produces:
P 400 4200 0 4200 1 0 1
{
T 599 4200 9 10 1 1 0 0 1
pinlabel=VTREF
T 599 4067 9 6 1 1 0 0 1
pinalt=power from target
T 325 4285 5 8 1 1 0 7 1
pinnum=1
T 325 4285 5 8 0 1 0 7 1
pinseq=1
T 275 4140 5 5 0 1 0 7 1
pintype=pwr
}
Since MCU's have a lot of alternate pin functions, I wanted to be able
to attach that info somewhere along the pinlabel. That why I
"invented" pinalt in a little smaller font (6 instead of 10points).
///
Attribute lines are simple lines in the form "attribute=its_value".
The program accepts the following attributes:
dist-license
use-license
author (defaults to the thing (gcos || userid) from the passwd file)
copyright
device
footprint
footprints
documentation (progam accepts multiple doc. lines)
refdes (defaults to U?)
description
value (defaults to attr. device's value)
Where the last three is set visible in the middle or at the top
of the outline. The others are invisible and simply put above
everything else.
To simplify things for the program reads
$ cat ~/.gEDA/pintosym.conf
dist-license=GPL
use-license=unlimited
author=Karl Hammar
copyright=Karl Hammar
$
if it's available and uses that as defaults, so I don't have to
copy'n'paste it for every file.
///
The command lines always begin whith a !. In the example given:
!> .sym hdr w:6
says, make a new sym-file, attach .sym as suffix to the input filename
(less its suffix). Use the "hdr" graphics/style and draw the outline
sides 6 pin_distances (=400 currently) apart.
///////////
Next example is for my MCU. Input file is [4].
The pin and attribute lines look more or less similar.
But the command lines show a few more options. First out is the
debuging aid showarg (- == print to stdout):
!> - showarg l:TIM
! filter $num < 30 && $type eq "pas" && $text =~ m/P.[4-8]/
It produces:
$ ../../pdftopin/pintosym.pl ../../pdftopin/stm32f100lm.lqfp48.pins
ALL PINS:
14 pas PA4 ADC1_IN4 DAC1_OUT SPI1_NSS USART2_CK
15 pas PA5 ADC1_IN5 DAC2_OUT SPI1_SCK
16 pas PA6 ADC1_IN6 SPI1_MISO TIM16_CH1 TIM1_BKIN TIM3_CH1
17 pas PA7 ADC1_IN7 SPI1_MOSI TIM17_CH1 TIM1_CH1N TIM3_CH2
29 pas PA8 MCO TIM1_CH1 USART1_CK
LEFT:
16 pas TIM16_CH1 PA6 ADC1_IN6 SPI1_MISO TIM1_BKIN TIM3_CH1
17 pas TIM17_CH1 PA7 ADC1_IN7 SPI1_MOSI TIM1_CH1N TIM3_CH2
29 pas TIM1_CH1 PA8 MCO USART1_CK
RIGHT:
TOP:
BOTTOM:
NC:
14 pas PA4 ADC1_IN4 DAC1_OUT SPI1_NSS USART2_CK
15 pas PA5 ADC1_IN5 DAC2_OUT SPI1_SCK
width: 0
height: 0
rest: <>
$
The first thing I do is selecting what to use with the "filter"
line. The mcu have 48 pins, but for some stupid reasons I just want
to use thoose with pin numbers < 30, and its pin type should be "pas",
and only thoose pins with a pinlabel matching "P.[4-8]", eg. PA7, but
not PB2.
Then in the showargs line, I tell it only to use thoose pins with a
label matching "TIM" for the left side of the outline.
Well, after the filter, I have five lines left (nr.14-17 and 29).
Then, since pin 14/15 don't have the letters TIM in them, they are
dropped (as seen at NC:), and for the left side I get pin 16,17,29.
///
I comment away the showargs, and run it:
$ ../../pdftopin/pintosym.pl ../../pdftopin/stm32f100lm.lqfp48.pins
printing to stm32f100lm.lqfp48.circle.sym circle(w:25)
printing to stm32f100lm.lqfp48.sym square()
sublabel: all pins
printing to stm32f100lm.lqfp48.hdr.sym hdr(w:8)
sublabel: all pins
printing to stm32f100lm.lqfp48.dil.sym dil(w:8)
sublabel: all pins
printing to stm32f100lm.lqfp48.rect.sym rect(3 2 -0.7 l:OSC,BOOT,TRST,TDI,TMS,TCK,TDO,RST b:^V r:USART t:.*)
sublabel: all pins
printing to stm32f100lm.lqfp48.jtag.sym cutout(l:OSC,BOOT r:TRST,TDI,TMS,TCK,TDO,RST w:6)
sublabel: jtag, boot and crystal pins
filter : $text =~ m/(JT|NRST|OSC|BOOT)/
printing to stm32f100lm.lqfp48.pwr.sym cutout(l:.*)
sublabel: power pins
filter : $type =~ m/pwr/
printing to stm32f100lm.lqfp48.adc.sym cutout(r:DAC l:ADC w:8)
filter : $text =~ m/ADC/
$
And I just got 8 new files (I have put them at [5]):
$ ls -1rt | tail -8
stm32f100lm.lqfp48.circle.sym
stm32f100lm.lqfp48.sym
stm32f100lm.lqfp48.hdr.sym
stm32f100lm.lqfp48.dil.sym
stm32f100lm.lqfp48.rect.sym
stm32f100lm.lqfp48.jtag.sym
stm32f100lm.lqfp48.pwr.sym
stm32f100lm.lqfp48.adc.sym
$
The "!> .circle.sym circle w:25" is my useless favorite. It is
valuable for testing pin placement in various angles. (The w:25 is
the diameter of the thing (in pin distances)).
The next:
!> .sym square
! sublabel all pins
is all pins around a notched square. sublabel add a little extra text
just below the refdes et.al.
The "hdr" style suites more a connector like the arm_jtag example
above.
!> .hdr.sym hdr w:8
! sublabel all pins
STM32F100 are not available in dil package, but this might be useful
for PIC's and AVR's.
!> .dil.sym dil w:8
! sublabel all pins
The style rect is the too much tunable style. Here with crystal,boot
and jtag pins to the left, power pins at bottom, yes why not usart to
the right, and the rest above. To round it out, I cut the corners (the
-0.7 parameter, if I used +0.7, I'd get round corners instead), the
pins are 3 pin_dist from the corner and with an extre 2 at one side so
the pin labels can slip in under each other in the corner.
!> .rect.sym rect 3 2 -0.7 l:OSC,BOOT,TRST,TDI,TMS,TCK,TDO,RST b:^V r:USART t:.*
! sublabel all pins
This is "sub"-symbol style I call cutout, I looks like a strip you
teared off (to show that it is not complete). To the left is the
crystal and boot pins, and to the right the jtag pins. I have to make
it a little wider than default (5) so the text doesn't collide.
!> .jtag.sym cutout l:OSC,BOOT r:TRST,TDI,TMS,TCK,TDO,RST w:6
! filter $text =~ m/(JT|NRST|OSC|BOOT)/
! sublabel jtag, boot and crystal pins
More or less the same, but for power pins.
!> .pwr.sym cutout l:.*
! filter $type =~ m/pwr/
! sublabel power pins
Dito for analogue inputs and outputs. Since I specify r:DAC first,
thoose pins won't appear on the left even though they match ADC.
!> .adc.sym cutout r:DAC l:ADC w:8
! filter $text =~ m/ADC/
////
If I wanted I could have used e.g.
!> .sym square l:^PA b:^PB r:^PC t:^PD
or other combinations.
///
In order to streamline the sym-file generation, the program also
accepts "!include file". So, given that producers ofthen uses the same
pin labels for the same functions for different parts in a family, I
can put:
!> .jtag.sym cutout l:OSC,BOOT r:TRST,TDI,TMS,TCK,TDO,RST w:6
! filter $text =~ m/(JT|NRST|OSC|BOOT)/
! sublabel jtag, boot and crystal pins
!> .pwr.sym cutout l:.*
! filter $type =~ m/pwr/
! sublabel power pins
in a small file to be included from others.
And if I want some sym-files for the STM32F207xxx, collect pin lines
(with the usual pain), add the simple include and I'm done.
Regards,
/Karl Hammar
[1] http://turkos.aspodata.se/git/openhw/pdftopin/pintosym.pl
[2] http://turkos.aspodata.se/git/openhw/share/gschem/arm_jtag20.pins
[3] http://turkos.aspodata.se/git/openhw/share/gschem/arm_jtag20.sym
[4] http://turkos.aspodata.se/git/openhw/pdftopin/stm32f100lm.lqfp48.pins
[5] http://turkos.aspodata.se/tmp/geda/
-----------------------------------------------------------------------
Aspö Data
Lilla Aspö 148
S-742 94 Östhammar
Sweden
+46 173 140 57
- Raw text -