File: periphs.sh

package info (click to toggle)
msp430mcu 20120406-2
  • links: PTS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, stretch, wheezy
  • size: 66,788 kB
  • ctags: 627,664
  • sloc: ansic: 605,160; python: 838; sh: 165; makefile: 37; sed: 2
file content (38 lines) | stat: -rwxr-xr-x 941 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/sh
#
# Extract the peripheral presence identifiers from each header,
# generating lists of all peripherals available on each MCU, and all
# MCUs supported by each peripheral.

MSP430MCU_ROOT=${MSP430MCU_ROOT:-${MSP430_ROOT:-/msp430}/msp430mcu}
UPSTREAM=${MSP430MCU_ROOT}/upstream
ANALYSIS=${MSP430MCU_ROOT}/analysis
SCRIPTS=${MSP430MCU_ROOT}/scripts

cd ${ANALYSIS}

rm -rf peripherals
mkdir -p peripherals
cat nonlegacy.lst \
 | while read MCU ; do
   mcu=$(basename ${MCU} .h)
   grep 'define\s*__MSP430_HAS_' ../upstream/${MCU} \
    | awk '{print $2;}' \
    | sort \
    | uniq \
    | sed -e 's@^__MSP430_HAS_\(.*\)__$@\1@' \
    > peripherals/${mcu}.periph
done

cat peripherals/*.periph \
  | sort \
  | uniq \
  > peripherals.lst

cat peripherals.lst \
  | while read PERIPH ; do
    grep -l "^${PERIPH}\$" peripherals/*.periph \
    | sort \
    | sed -e 's@^.*/\([^/]*\).periph@\1@' \
    > peripherals/${PERIPH}.mcus
done