File: genlink.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 (36 lines) | stat: -rwxr-xr-x 968 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
#!/bin/sh
#
# Copyright (c) 2011, Peter A. Bigot, licensed under New BSD (see COPYING)
# This file is part of msp430mcu (http://sourceforge.net/projects/mspgcc/)
#
# Generate linker scripts that define addresses for all peripheral
# registers supported on a particular chip.

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

FILES=$(cat ${ANALYSIS}/nonlegacy.lst)
GLD=${ANALYSIS}/ldscripts
rm -rf ${GLD}
mkdir -p ${GLD}
for f in ${FILES} ; do
  bn=$(basename $f .h)
  mkdir -p ${GLD}/${bn}
  (
    cat ${UPSTREAM}/${f} \
    | sed -f ${SCRIPTS}/genlink.sed \
    | cpp \
    | grep '^%regaddr' \
    | sed -e 's@^%regaddr\.\([^ ]*\) *@__@' \
          -e 's@0 +1@1@' \
	  -e 's@2 +1@3@' \
	  -e 's@4 +1@5@' \
	  -e 's@6 +1@7@' \
	  -e 's@8 +1@9@' \
	  -e 's@A +1@B@' \
	  -e 's@C +1@D@' \
	  -e 's@E +1@F@' \
  ) > ${GLD}/${bn}/periph.x
done