BlinkPIC32

Changeset

0:47e3885a4c3a
23 months ago Paul Boddie raw files shortlog changelog graph A simple LED-blinking demonstration for MIPS-based PIC32 microcontrollers.
Makefile (file) README.txt (file) blink.S (file) blink.ld (file) docs/COPYING.txt (file) docs/gpl-3.0.txt (file) mips.h (file) pic32.h (file)
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/Makefile	Mon Oct 15 21:59:18 2018 +0200
     1.3 @@ -0,0 +1,75 @@
     1.4 +# Makefile - Build the BlinkPIC32 payload
     1.5 +#
     1.6 +# Copyright (C) 2015, 2017, 2018 Paul Boddie <paul@boddie.org.uk>
     1.7 +# Copyright (C) Xiangfu Liu <xiangfu@sharism.cc>
     1.8 +#
     1.9 +# This program is free software: you can redistribute it and/or modify
    1.10 +# it under the terms of the GNU General Public License as published by
    1.11 +# the Free Software Foundation, either version 3 of the License, or
    1.12 +# (at your option) any later version.
    1.13 +#
    1.14 +# This program is distributed in the hope that it will be useful,
    1.15 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.16 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.17 +# GNU General Public License for more details.
    1.18 +#
    1.19 +# You should have received a copy of the GNU General Public License
    1.20 +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
    1.21 +
    1.22 +ARCH = mipsel-linux-gnu
    1.23 +CC = $(ARCH)-gcc
    1.24 +LD = $(ARCH)-ld
    1.25 +NM = $(ARCH)-nm
    1.26 +OBJCOPY=$(ARCH)-objcopy
    1.27 +OBJDUMP=$(ARCH)-objdump
    1.28 +
    1.29 +# NOTE: -O2 is actually needed to prevent memcpy references, whereas probably
    1.30 +# NOTE: one of the -f{freestanding, no-hosted, no-builtin} options should work.
    1.31 +# NOTE: See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56888
    1.32 +
    1.33 +CFLAGS = -O2 -Wall \
    1.34 +	-fno-unit-at-a-time -fno-zero-initialized-in-bss \
    1.35 +	-ffreestanding -fno-hosted -fno-builtin \
    1.36 +	-march=mips32
    1.37 +LDFLAGS = -nostdlib -EL
    1.38 +
    1.39 +TARGET = blink.elf
    1.40 +DUMP = $(TARGET:.elf=.dump)
    1.41 +MAP = $(TARGET:.elf=.map)
    1.42 +SCRIPT = $(TARGET:.elf=.ld)
    1.43 +
    1.44 +HEX = $(TARGET:.elf=.hex)
    1.45 +SREC = $(TARGET:.elf=.srec)
    1.46 +
    1.47 +# Ordering of objects is important and cannot be left to replacement rules.
    1.48 +
    1.49 +SRC = blink.S
    1.50 +OBJ = blink.o
    1.51 +
    1.52 +.PHONY:	all clean distclean
    1.53 +
    1.54 +all:	$(HEX) $(SREC)
    1.55 +
    1.56 +clean:
    1.57 +	rm -f $(OBJ) $(TARGET) $(HEX) $(SREC) $(DUMP) *.map
    1.58 +
    1.59 +distclean: clean
    1.60 +	echo "Nothing else to clean."
    1.61 +
    1.62 +$(HEX): $(TARGET)
    1.63 +	$(OBJCOPY) -O ihex $(TARGET) $(HEX)
    1.64 +
    1.65 +$(SREC): $(TARGET)
    1.66 +	$(OBJCOPY) -O srec $(TARGET) $(SREC)
    1.67 +
    1.68 +$(TARGET): $(OBJ)
    1.69 +	$(LD) $(LDFLAGS) -T $(SCRIPT) $(OBJ) -o $@
    1.70 +	$(OBJDUMP) -D $(TARGET) > $(DUMP)
    1.71 +	$(OBJDUMP) -h $(TARGET) > $(MAP)
    1.72 +	$(NM) -n $(TARGET) > System.map
    1.73 +
    1.74 +.c.o:
    1.75 +	$(CC) -c $(CFLAGS) $< -o $@
    1.76 +
    1.77 +.S.o:
    1.78 +	$(CC) -c $(CFLAGS) $< -o $@
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/README.txt	Mon Oct 15 21:59:18 2018 +0200
     2.3 @@ -0,0 +1,154 @@
     2.4 +Introduction
     2.5 +------------
     2.6 +
     2.7 +The BlinkPIC32 project provides software and circuit information to
     2.8 +demonstrate a trivial LED-blinking application using a PIC32 microcontroller,
     2.9 +in particular one with a DIP-28 profile that can be set up on a breadboard.
    2.10 +
    2.11 +Contact, Copyright and Licence Information
    2.12 +------------------------------------------
    2.13 +
    2.14 +The author can be contacted at the following e-mail address:
    2.15 +
    2.16 +paul@boddie.org.uk
    2.17 +
    2.18 +Copyright and licence information can be found in the docs directory - see
    2.19 +docs/COPYING.txt and docs/gpl-3.0.txt for more information.
    2.20 +
    2.21 +
    2.22 +
    2.23 +Using the Software
    2.24 +==================
    2.25 +
    2.26 +The software to be transferred to the microcontroller can be built as follows:
    2.27 +
    2.28 +make
    2.29 +
    2.30 +This should produce a file called blink.hex that can then be transferred to the
    2.31 +device. This will toggle an output that can be connected to a light-emitting
    2.32 +diode (LED) to demonstrate the operation of the program.
    2.33 +
    2.34 +
    2.35 +
    2.36 +Hardware Details
    2.37 +================
    2.38 +
    2.39 +The following pinout provides a summary of the pertinent functions associated
    2.40 +with the pins on the microcontroller.
    2.41 +
    2.42 +PIC32MX270F256B-50I/SP Pinout
    2.43 +-----------------------------
    2.44 +
    2.45 + 5          MCLR# 1  \/  28 AVDD
    2.46 + cap        RA0   2      27 AVSS
    2.47 + cap        RA1   3      26 RB15      ap
    2.48 + cap  PGED1/RB0   4      25 RB14      a
    2.49 + cap  PGEC1/RB1   5      24 RB13      ap
    2.50 + cap        RB2   6      23 VUSB3V3
    2.51 + cap        RB3   7      22 RB11/PGEC2
    2.52 +            VSS   8      21 RB10/PGED2
    2.53 + c          RA2   9      20 VCAP
    2.54 + cp         RA3  10      19 VSS
    2.55 + c          RB4  11      18 RB9/TDO   5cp
    2.56 + cp         RA4  12      17 RB8/TCK   5cp
    2.57 +            VDD  13      16 RB7/TDI   5cp
    2.58 + 5c     TMS/RB5  14      15 VBUS      5
    2.59 +
    2.60 +    default pin supply limitation of -0.3V to VDD + 0.3V
    2.61 +5 = 5V-tolerant pin with supply limitation of -0.3V to 5.5V if VDD >= 2.3V
    2.62 +a = analogue/digital pin
    2.63 +c = permit change notification configuration
    2.64 +p = parallel master/slave port pin
    2.65 +
    2.66 +Thus, there should be up to 5 5V-tolerant I/O pins.
    2.67 +
    2.68 +The microcontroller can be set up to function normally in a breadboard circuit
    2.69 +and also be connected up to a programming circuit at the same time. This
    2.70 +permits immediate feedback about the programming of the device without the
    2.71 +need to connect and disconnect the programmer.
    2.72 +
    2.73 +
    2.74 +
    2.75 +Breadboard Circuit
    2.76 +==================
    2.77 +
    2.78 +In order to be programmed and to function normally, the device needs to be
    2.79 +deployed in a circuit configured as follows:
    2.80 +
    2.81 +PIC32MX270F256B-50I/SP
    2.82 +----------------------
    2.83 +MCLR#                   3.3V (via 10K pull-up resistor)
    2.84 +VSS                     GND
    2.85 +VDD                     3.3V
    2.86 +VSS                     GND
    2.87 +VCAP                    GND (via 10F capacitor)
    2.88 +VUSB3V3                 3.3V
    2.89 +AVSS                    GND
    2.90 +AVDD                    3.3V
    2.91 +
    2.92 +"Figure 2-1: Recommended Minimum Connection" from the "PIC32MX1XX/2XX
    2.93 +28/36/44-pin Family Data Sheet" stipulates additional 0.1F ceramic capacitors
    2.94 +between VDD and VSS and between AVDD and AVSS.
    2.95 +
    2.96 +
    2.97 +
    2.98 +Demonstration Circuit
    2.99 +=====================
   2.100 +
   2.101 +To test the software payload, the RA3 pin should be connected to a LED in
   2.102 +series with a 100 ohm resistor, routing to GND.
   2.103 +
   2.104 +PIC32MX270F256B-50I/SP
   2.105 +----------------------
   2.106 +RA3                     LED -> GND (via 100 ohm resistor)
   2.107 +
   2.108 +
   2.109 +
   2.110 +ICSP Programming Circuit
   2.111 +========================
   2.112 +
   2.113 +To avoid limitations with JTAG programming and associated limitations it may
   2.114 +impose on pin usage, the ICSP mechanism needs to be employed instead. The
   2.115 +circuit should resemble the following:
   2.116 +
   2.117 +PIC32MX270F256B-50I/SP  Arduino
   2.118 +----------------------  -------
   2.119 +MCLR#                   A0
   2.120 +PGEC1/PGEC2             A2 (pulled up via 2K2 resistor to 3.3V)
   2.121 +PGED1/PGED2             A1 (via 220ohm resistor, then pulled up via 2K2
   2.122 +                            resistor to 3.3V)
   2.123 +
   2.124 +The pull-up from MCLR# to VDD can apparently be left in place.
   2.125 +
   2.126 +The Pickle and Nanu Nanu software are used for programming:
   2.127 +
   2.128 +https://wiki.kewl.org/dokuwiki/projects:pickle
   2.129 +https://wiki.kewl.org/dokuwiki/projects:nanu-nanu
   2.130 +
   2.131 +Nanu Nanu can be deployed in the 5V-16M configuration on an Arduino
   2.132 +Duemilanove with an "open drain" or "sink" circuit as described above. Then,
   2.133 +the pload program provided by Pickle can be used to write the boot.hex file as
   2.134 +follows (as a sufficiently privileged user):
   2.135 +
   2.136 +./pload program /dev/ttyUSB0 blink.hex
   2.137 +
   2.138 +Note that the Pickle configuration file (~/.pickle or ~/.pickle/config) will
   2.139 +need to have the port and baudrate settings defined. For example:
   2.140 +
   2.141 +DEVICE=/dev/ttyUSB0
   2.142 +BAUDRATE=115200
   2.143 +DEBUG=1
   2.144 +
   2.145 +
   2.146 +
   2.147 +References
   2.148 +==========
   2.149 +
   2.150 +Basic PIC32 breadboard circuit:
   2.151 +
   2.152 +http://umassamherstm5.org/tech-tutorials/pic32-tutorials/pic32mx220-tutorials/pic32mx220-breadboard
   2.153 +
   2.154 +ArduPIC32 JTAG-based programmer:
   2.155 +
   2.156 +http://www.microchip.com/forums/m653443.aspx
   2.157 +https://code.google.com/archive/p/ardupic32/
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/blink.S	Mon Oct 15 21:59:18 2018 +0200
     3.3 @@ -0,0 +1,116 @@
     3.4 +/*
     3.5 + * Blink LEDs using a PIC32 microcontroller.
     3.6 + *
     3.7 + * Copyright (C) 2017, 2018 Paul Boddie <paul@boddie.org.uk>
     3.8 + *
     3.9 + * This program is free software: you can redistribute it and/or modify
    3.10 + * it under the terms of the GNU General Public License as published by
    3.11 + * the Free Software Foundation, either version 3 of the License, or
    3.12 + * (at your option) any later version.
    3.13 + *
    3.14 + * This program is distributed in the hope that it will be useful,
    3.15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    3.16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3.17 + * GNU General Public License for more details.
    3.18 + *
    3.19 + * You should have received a copy of the GNU General Public License
    3.20 + * along with this program.  If not, see <http://www.gnu.org/licenses/>.
    3.21 + */
    3.22 +
    3.23 +#include "mips.h"
    3.24 +#include "pic32.h"
    3.25 +
    3.26 +/* Disable JTAG functionality on pins. */
    3.27 +
    3.28 +.section .devcfg0, "a"
    3.29 +.word 0xfffffffb	/* DEVCFG0<2> = JTAGEN = 0 */
    3.30 +
    3.31 +/*
    3.32 +Set the oscillator to be the FRC oscillator with PLL, with peripheral clock
    3.33 +divided by 2, and FRCDIV+PLL selected.
    3.34 +
    3.35 +The watchdog timer (FWDTEN) is also disabled.
    3.36 +
    3.37 +The secondary oscillator pin (FSOSCEN) is disabled to avoid pin conflicts with
    3.38 +RPB4.
    3.39 +*/
    3.40 +
    3.41 +.section .devcfg1, "a"
    3.42 +.word 0xff7fdfd9	/* DEVCFG1<23> = FWDTEN = 0; DEVCFG1<13:12> = FPBDIV<1:0> = 1;
    3.43 +			DEVCFG1<5> = FSOSCEN = 0; DEVCFG1<2:0> = FNOSC<2:0> = 001 */
    3.44 +
    3.45 +/*
    3.46 +Set the FRC oscillator PLL function with an input division of 4, an output
    3.47 +division of 2, a multiplication of 24, yielding a multiplication of 3.
    3.48 +
    3.49 +The FRC is apparently at 16MHz and this produces a system clock of 48MHz.
    3.50 +*/
    3.51 +
    3.52 +.section .devcfg2, "a"
    3.53 +.word 0xfff9fffb	/* DEVCFG2<18:16> = FPLLODIV<2:0> = 001;
    3.54 +			DEVCFG2<6:4> = FPLLMUL<2:0> = 111;
    3.55 +			DEVCFG2<2:0> = FPLLIDIV<2:0> = 011 */
    3.56 +
    3.57 +.text
    3.58 +.globl _start
    3.59 +
    3.60 +_start:
    3.61 +	/* Set pins for output. */
    3.62 +
    3.63 +	jal init_pins
    3.64 +	nop
    3.65 +
    3.66 +	/* Clear output (LED). */
    3.67 +
    3.68 +	la $t0, PORTA
    3.69 +	li $t1, (1 << 3)	/* PORTA<3> = RA3 */
    3.70 +	sw $t1, CLR($t0)
    3.71 +
    3.72 +	/* Main program. */
    3.73 +main:
    3.74 +	li $a1, (3 << 24)	/* counter ~= 50000000 */
    3.75 +
    3.76 +	/* Monitoring loop. */
    3.77 +loop:
    3.78 +	addiu $a1, $a1, -1	/* counter -= 1 */
    3.79 +	bnez $a1, loop
    3.80 +	nop
    3.81 +
    3.82 +	/* Invert output (LED). */
    3.83 +
    3.84 +	la $t0, PORTA
    3.85 +	li $t1, (1 << 3)	/* PORTA<3> = RA3 */
    3.86 +	sw $t1, INV($t0)
    3.87 +
    3.88 +	j main
    3.89 +	nop
    3.90 +
    3.91 +
    3.92 +
    3.93 +init_pins:
    3.94 +	/* DEVCFG0<2> needs setting to 0 before the program is run. */
    3.95 +
    3.96 +	la $v0, CFGCON
    3.97 +	li $v1, (1 << 3)	/* CFGCON<3> = JTAGEN = 0 */
    3.98 +	sw $v1, CLR($v0)
    3.99 +
   3.100 +init_outputs:
   3.101 +	/* Remove analogue features from pins. */
   3.102 +
   3.103 +	la $v0, ANSELA
   3.104 +	sw $zero, 0($v0)	/* ANSELA = 0 */
   3.105 +	la $v0, ANSELB
   3.106 +	sw $zero, 0($v0)	/* ANSELB = 0 */
   3.107 +
   3.108 +	la $v0, TRISA
   3.109 +	sw $zero, 0($v0)
   3.110 +	la $v0, TRISB
   3.111 +	sw $zero, 0($v0)
   3.112 +
   3.113 +	la $v0, PORTA
   3.114 +	sw $zero, 0($v0)
   3.115 +	la $v0, PORTB
   3.116 +	sw $zero, 0($v0)
   3.117 +
   3.118 +	jr $ra
   3.119 +	nop
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/blink.ld	Mon Oct 15 21:59:18 2018 +0200
     4.3 @@ -0,0 +1,47 @@
     4.4 +OUTPUT_ARCH(mips)
     4.5 +ENTRY(_start)
     4.6 +
     4.7 +/* See...
     4.8 + * FIGURE 4-5: MEMORY MAP ON RESET FOR PIC32MX170/270 DEVICES (64 KB RAM, 256 KB FLASH)
     4.9 + * PIC32MX1XX/2XX 28/36/44-pin Family Data Sheet
    4.10 + */
    4.11 +
    4.12 +MEMORY
    4.13 +{
    4.14 +  kseg1_data_mem       (w!x) : ORIGIN = 0xA0000000, LENGTH = 0x10000
    4.15 +  kseg0_boot_mem       (rx)  : ORIGIN = 0x9FC00000, LENGTH = 0xBF0
    4.16 +  kseg0_program_mem    (rx)  : ORIGIN = 0x9D000000, LENGTH = 0x40000
    4.17 +  physical_boot_mem    (rx)  : ORIGIN = 0x1FC00000, LENGTH = 0xBF0
    4.18 +  physical_program_mem (rx)  : ORIGIN = 0x1D000000, LENGTH = 0x40000
    4.19 +  sfrs                       : ORIGIN = 0xBF800000, LENGTH = 0x100000
    4.20 +  configsfrs                 : ORIGIN = 0xBFC00BF0, LENGTH = 0x10
    4.21 +  config3                    : ORIGIN = 0xBFC00BF0, LENGTH = 0x4
    4.22 +  config2                    : ORIGIN = 0xBFC00BF4, LENGTH = 0x4
    4.23 +  config1                    : ORIGIN = 0xBFC00BF8, LENGTH = 0x4
    4.24 +  config0                    : ORIGIN = 0xBFC00BFC, LENGTH = 0x4
    4.25 +  physical_config3           : ORIGIN = 0x3FC00BF0, LENGTH = 0x4
    4.26 +  physical_config2           : ORIGIN = 0x3FC00BF4, LENGTH = 0x4
    4.27 +  physical_config1           : ORIGIN = 0x3FC00BF8, LENGTH = 0x4
    4.28 +  physical_config0           : ORIGIN = 0x3FC00BFC, LENGTH = 0x4
    4.29 +}
    4.30 +
    4.31 +SECTIONS
    4.32 +{
    4.33 +  .text : { *(.text*) } > kseg0_boot_mem AT > physical_boot_mem
    4.34 +  .flash : { *(.flash*) } > kseg0_program_mem AT > physical_program_mem
    4.35 +  .bss  : { *(.bss*)  } > kseg1_data_mem
    4.36 +  .got : {
    4.37 +           _gp = ALIGN(16);
    4.38 +           *(.got*)
    4.39 +         } > kseg0_boot_mem AT > physical_boot_mem
    4.40 +  .devcfg0 : {
    4.41 +	*(.devcfg0)
    4.42 +	} > config0 AT > physical_config0
    4.43 +  .devcfg1 : {
    4.44 +	*(.devcfg1)
    4.45 +	} > config1 AT > physical_config1
    4.46 +  .devcfg2 : {
    4.47 +	*(.devcfg2)
    4.48 +	} > config2 AT > physical_config2
    4.49 +  /DISCARD/ : { *(.reginfo) *(.MIPS.abiflags) }
    4.50 +}
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/docs/COPYING.txt	Mon Oct 15 21:59:18 2018 +0200
     5.3 @@ -0,0 +1,19 @@
     5.4 +Licence Agreement for BlinkPIC32
     5.5 +--------------------------------
     5.6 +
     5.7 +Original materials for this project:
     5.8 +
     5.9 +Copyright (C) 2017, 2018 Paul Boddie <paul@boddie.org.uk>
    5.10 +
    5.11 +This program is free software; you can redistribute it and/or modify it under
    5.12 +the terms of the GNU General Public License as published by the Free Software
    5.13 +Foundation; either version 3 of the License, or (at your option) any later
    5.14 +version.
    5.15 +
    5.16 +This program is distributed in the hope that it will be useful, but WITHOUT
    5.17 +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    5.18 +FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
    5.19 +details.
    5.20 +
    5.21 +You should have received a copy of the GNU General Public License along with
    5.22 +this program.  If not, see <http://www.gnu.org/licenses/>.
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/docs/gpl-3.0.txt	Mon Oct 15 21:59:18 2018 +0200
     6.3 @@ -0,0 +1,674 @@
     6.4 +                    GNU GENERAL PUBLIC LICENSE
     6.5 +                       Version 3, 29 June 2007
     6.6 +
     6.7 + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
     6.8 + Everyone is permitted to copy and distribute verbatim copies
     6.9 + of this license document, but changing it is not allowed.
    6.10 +
    6.11 +                            Preamble
    6.12 +
    6.13 +  The GNU General Public License is a free, copyleft license for
    6.14 +software and other kinds of works.
    6.15 +
    6.16 +  The licenses for most software and other practical works are designed
    6.17 +to take away your freedom to share and change the works.  By contrast,
    6.18 +the GNU General Public License is intended to guarantee your freedom to
    6.19 +share and change all versions of a program--to make sure it remains free
    6.20 +software for all its users.  We, the Free Software Foundation, use the
    6.21 +GNU General Public License for most of our software; it applies also to
    6.22 +any other work released this way by its authors.  You can apply it to
    6.23 +your programs, too.
    6.24 +
    6.25 +  When we speak of free software, we are referring to freedom, not
    6.26 +price.  Our General Public Licenses are designed to make sure that you
    6.27 +have the freedom to distribute copies of free software (and charge for
    6.28 +them if you wish), that you receive source code or can get it if you
    6.29 +want it, that you can change the software or use pieces of it in new
    6.30 +free programs, and that you know you can do these things.
    6.31 +
    6.32 +  To protect your rights, we need to prevent others from denying you
    6.33 +these rights or asking you to surrender the rights.  Therefore, you have
    6.34 +certain responsibilities if you distribute copies of the software, or if
    6.35 +you modify it: responsibilities to respect the freedom of others.
    6.36 +
    6.37 +  For example, if you distribute copies of such a program, whether
    6.38 +gratis or for a fee, you must pass on to the recipients the same
    6.39 +freedoms that you received.  You must make sure that they, too, receive
    6.40 +or can get the source code.  And you must show them these terms so they
    6.41 +know their rights.
    6.42 +
    6.43 +  Developers that use the GNU GPL protect your rights with two steps:
    6.44 +(1) assert copyright on the software, and (2) offer you this License
    6.45 +giving you legal permission to copy, distribute and/or modify it.
    6.46 +
    6.47 +  For the developers' and authors' protection, the GPL clearly explains
    6.48 +that there is no warranty for this free software.  For both users' and
    6.49 +authors' sake, the GPL requires that modified versions be marked as
    6.50 +changed, so that their problems will not be attributed erroneously to
    6.51 +authors of previous versions.
    6.52 +
    6.53 +  Some devices are designed to deny users access to install or run
    6.54 +modified versions of the software inside them, although the manufacturer
    6.55 +can do so.  This is fundamentally incompatible with the aim of
    6.56 +protecting users' freedom to change the software.  The systematic
    6.57 +pattern of such abuse occurs in the area of products for individuals to
    6.58 +use, which is precisely where it is most unacceptable.  Therefore, we
    6.59 +have designed this version of the GPL to prohibit the practice for those
    6.60 +products.  If such problems arise substantially in other domains, we
    6.61 +stand ready to extend this provision to those domains in future versions
    6.62 +of the GPL, as needed to protect the freedom of users.
    6.63 +
    6.64 +  Finally, every program is threatened constantly by software patents.
    6.65 +States should not allow patents to restrict development and use of
    6.66 +software on general-purpose computers, but in those that do, we wish to
    6.67 +avoid the special danger that patents applied to a free program could
    6.68 +make it effectively proprietary.  To prevent this, the GPL assures that
    6.69 +patents cannot be used to render the program non-free.
    6.70 +
    6.71 +  The precise terms and conditions for copying, distribution and
    6.72 +modification follow.
    6.73 +
    6.74 +                       TERMS AND CONDITIONS
    6.75 +
    6.76 +  0. Definitions.
    6.77 +
    6.78 +  "This License" refers to version 3 of the GNU General Public License.
    6.79 +
    6.80 +  "Copyright" also means copyright-like laws that apply to other kinds of
    6.81 +works, such as semiconductor masks.
    6.82 +
    6.83 +  "The Program" refers to any copyrightable work licensed under this
    6.84 +License.  Each licensee is addressed as "you".  "Licensees" and
    6.85 +"recipients" may be individuals or organizations.
    6.86 +
    6.87 +  To "modify" a work means to copy from or adapt all or part of the work
    6.88 +in a fashion requiring copyright permission, other than the making of an
    6.89 +exact copy.  The resulting work is called a "modified version" of the
    6.90 +earlier work or a work "based on" the earlier work.
    6.91 +
    6.92 +  A "covered work" means either the unmodified Program or a work based
    6.93 +on the Program.
    6.94 +
    6.95 +  To "propagate" a work means to do anything with it that, without
    6.96 +permission, would make you directly or secondarily liable for
    6.97 +infringement under applicable copyright law, except executing it on a
    6.98 +computer or modifying a private copy.  Propagation includes copying,
    6.99 +distribution (with or without modification), making available to the
   6.100 +public, and in some countries other activities as well.
   6.101 +
   6.102 +  To "convey" a work means any kind of propagation that enables other
   6.103 +parties to make or receive copies.  Mere interaction with a user through
   6.104 +a computer network, with no transfer of a copy, is not conveying.
   6.105 +
   6.106 +  An interactive user interface displays "Appropriate Legal Notices"
   6.107 +to the extent that it includes a convenient and prominently visible
   6.108 +feature that (1) displays an appropriate copyright notice, and (2)
   6.109 +tells the user that there is no warranty for the work (except to the
   6.110 +extent that warranties are provided), that licensees may convey the
   6.111 +work under this License, and how to view a copy of this License.  If
   6.112 +the interface presents a list of user commands or options, such as a
   6.113 +menu, a prominent item in the list meets this criterion.
   6.114 +
   6.115 +  1. Source Code.
   6.116 +
   6.117 +  The "source code" for a work means the preferred form of the work
   6.118 +for making modifications to it.  "Object code" means any non-source
   6.119 +form of a work.
   6.120 +
   6.121 +  A "Standard Interface" means an interface that either is an official
   6.122 +standard defined by a recognized standards body, or, in the case of
   6.123 +interfaces specified for a particular programming language, one that
   6.124 +is widely used among developers working in that language.
   6.125 +
   6.126 +  The "System Libraries" of an executable work include anything, other
   6.127 +than the work as a whole, that (a) is included in the normal form of
   6.128 +packaging a Major Component, but which is not part of that Major
   6.129 +Component, and (b) serves only to enable use of the work with that
   6.130 +Major Component, or to implement a Standard Interface for which an
   6.131 +implementation is available to the public in source code form.  A
   6.132 +"Major Component", in this context, means a major essential component
   6.133 +(kernel, window system, and so on) of the specific operating system
   6.134 +(if any) on which the executable work runs, or a compiler used to
   6.135 +produce the work, or an object code interpreter used to run it.
   6.136 +
   6.137 +  The "Corresponding Source" for a work in object code form means all
   6.138 +the source code needed to generate, install, and (for an executable
   6.139 +work) run the object code and to modify the work, including scripts to
   6.140 +control those activities.  However, it does not include the work's
   6.141 +System Libraries, or general-purpose tools or generally available free
   6.142 +programs which are used unmodified in performing those activities but
   6.143 +which are not part of the work.  For example, Corresponding Source
   6.144 +includes interface definition files associated with source files for
   6.145 +the work, and the source code for shared libraries and dynamically
   6.146 +linked subprograms that the work is specifically designed to require,
   6.147 +such as by intimate data communication or control flow between those
   6.148 +subprograms and other parts of the work.
   6.149 +
   6.150 +  The Corresponding Source need not include anything that users
   6.151 +can regenerate automatically from other parts of the Corresponding
   6.152 +Source.
   6.153 +
   6.154 +  The Corresponding Source for a work in source code form is that
   6.155 +same work.
   6.156 +
   6.157 +  2. Basic Permissions.
   6.158 +
   6.159 +  All rights granted under this License are granted for the term of
   6.160 +copyright on the Program, and are irrevocable provided the stated
   6.161 +conditions are met.  This License explicitly affirms your unlimited
   6.162 +permission to run the unmodified Program.  The output from running a
   6.163 +covered work is covered by this License only if the output, given its
   6.164 +content, constitutes a covered work.  This License acknowledges your
   6.165 +rights of fair use or other equivalent, as provided by copyright law.
   6.166 +
   6.167 +  You may make, run and propagate covered works that you do not
   6.168 +convey, without conditions so long as your license otherwise remains
   6.169 +in force.  You may convey covered works to others for the sole purpose
   6.170 +of having them make modifications exclusively for you, or provide you
   6.171 +with facilities for running those works, provided that you comply with
   6.172 +the terms of this License in conveying all material for which you do
   6.173 +not control copyright.  Those thus making or running the covered works
   6.174 +for you must do so exclusively on your behalf, under your direction
   6.175 +and control, on terms that prohibit them from making any copies of
   6.176 +your copyrighted material outside their relationship with you.
   6.177 +
   6.178 +  Conveying under any other circumstances is permitted solely under
   6.179 +the conditions stated below.  Sublicensing is not allowed; section 10
   6.180 +makes it unnecessary.
   6.181 +
   6.182 +  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
   6.183 +
   6.184 +  No covered work shall be deemed part of an effective technological
   6.185 +measure under any applicable law fulfilling obligations under article
   6.186 +11 of the WIPO copyright treaty adopted on 20 December 1996, or
   6.187 +similar laws prohibiting or restricting circumvention of such
   6.188 +measures.
   6.189 +
   6.190 +  When you convey a covered work, you waive any legal power to forbid
   6.191 +circumvention of technological measures to the extent such circumvention
   6.192 +is effected by exercising rights under this License with respect to
   6.193 +the covered work, and you disclaim any intention to limit operation or
   6.194 +modification of the work as a means of enforcing, against the work's
   6.195 +users, your or third parties' legal rights to forbid circumvention of
   6.196 +technological measures.
   6.197 +
   6.198 +  4. Conveying Verbatim Copies.
   6.199 +
   6.200 +  You may convey verbatim copies of the Program's source code as you
   6.201 +receive it, in any medium, provided that you conspicuously and
   6.202 +appropriately publish on each copy an appropriate copyright notice;
   6.203 +keep intact all notices stating that this License and any
   6.204 +non-permissive terms added in accord with section 7 apply to the code;
   6.205 +keep intact all notices of the absence of any warranty; and give all
   6.206 +recipients a copy of this License along with the Program.
   6.207 +
   6.208 +  You may charge any price or no price for each copy that you convey,
   6.209 +and you may offer support or warranty protection for a fee.
   6.210 +
   6.211 +  5. Conveying Modified Source Versions.
   6.212 +
   6.213 +  You may convey a work based on the Program, or the modifications to
   6.214 +produce it from the Program, in the form of source code under the
   6.215 +terms of section 4, provided that you also meet all of these conditions:
   6.216 +
   6.217 +    a) The work must carry prominent notices stating that you modified
   6.218 +    it, and giving a relevant date.
   6.219 +
   6.220 +    b) The work must carry prominent notices stating that it is
   6.221 +    released under this License and any conditions added under section
   6.222 +    7.  This requirement modifies the requirement in section 4 to
   6.223 +    "keep intact all notices".
   6.224 +
   6.225 +    c) You must license the entire work, as a whole, under this
   6.226 +    License to anyone who comes into possession of a copy.  This
   6.227 +    License will therefore apply, along with any applicable section 7
   6.228 +    additional terms, to the whole of the work, and all its parts,
   6.229 +    regardless of how they are packaged.  This License gives no
   6.230 +    permission to license the work in any other way, but it does not
   6.231 +    invalidate such permission if you have separately received it.
   6.232 +
   6.233 +    d) If the work has interactive user interfaces, each must display
   6.234 +    Appropriate Legal Notices; however, if the Program has interactive
   6.235 +    interfaces that do not display Appropriate Legal Notices, your
   6.236 +    work need not make them do so.
   6.237 +
   6.238 +  A compilation of a covered work with other separate and independent
   6.239 +works, which are not by their nature extensions of the covered work,
   6.240 +and which are not combined with it such as to form a larger program,
   6.241 +in or on a volume of a storage or distribution medium, is called an
   6.242 +"aggregate" if the compilation and its resulting copyright are not
   6.243 +used to limit the access or legal rights of the compilation's users
   6.244 +beyond what the individual works permit.  Inclusion of a covered work
   6.245 +in an aggregate does not cause this License to apply to the other
   6.246 +parts of the aggregate.
   6.247 +
   6.248 +  6. Conveying Non-Source Forms.
   6.249 +
   6.250 +  You may convey a covered work in object code form under the terms
   6.251 +of sections 4 and 5, provided that you also convey the
   6.252 +machine-readable Corresponding Source under the terms of this License,
   6.253 +in one of these ways:
   6.254 +
   6.255 +    a) Convey the object code in, or embodied in, a physical product
   6.256 +    (including a physical distribution medium), accompanied by the
   6.257 +    Corresponding Source fixed on a durable physical medium
   6.258 +    customarily used for software interchange.
   6.259 +
   6.260 +    b) Convey the object code in, or embodied in, a physical product
   6.261 +    (including a physical distribution medium), accompanied by a
   6.262 +    written offer, valid for at least three years and valid for as
   6.263 +    long as you offer spare parts or customer support for that product
   6.264 +    model, to give anyone who possesses the object code either (1) a
   6.265 +    copy of the Corresponding Source for all the software in the
   6.266 +    product that is covered by this License, on a durable physical
   6.267 +    medium customarily used for software interchange, for a price no
   6.268 +    more than your reasonable cost of physically performing this
   6.269 +    conveying of source, or (2) access to copy the
   6.270 +    Corresponding Source from a network server at no charge.
   6.271 +
   6.272 +    c) Convey individual copies of the object code with a copy of the
   6.273 +    written offer to provide the Corresponding Source.  This
   6.274 +    alternative is allowed only occasionally and noncommercially, and
   6.275 +    only if you received the object code with such an offer, in accord
   6.276 +    with subsection 6b.
   6.277 +
   6.278 +    d) Convey the object code by offering access from a designated
   6.279 +    place (gratis or for a charge), and offer equivalent access to the
   6.280 +    Corresponding Source in the same way through the same place at no
   6.281 +    further charge.  You need not require recipients to copy the
   6.282 +    Corresponding Source along with the object code.  If the place to
   6.283 +    copy the object code is a network server, the Corresponding Source
   6.284 +    may be on a different server (operated by you or a third party)
   6.285 +    that supports equivalent copying facilities, provided you maintain
   6.286 +    clear directions next to the object code saying where to find the
   6.287 +    Corresponding Source.  Regardless of what server hosts the
   6.288 +    Corresponding Source, you remain obligated to ensure that it is
   6.289 +    available for as long as needed to satisfy these requirements.
   6.290 +
   6.291 +    e) Convey the object code using peer-to-peer transmission, provided
   6.292 +    you inform other peers where the object code and Corresponding
   6.293 +    Source of the work are being offered to the general public at no
   6.294 +    charge under subsection 6d.
   6.295 +
   6.296 +  A separable portion of the object code, whose source code is excluded
   6.297 +from the Corresponding Source as a System Library, need not be
   6.298 +included in conveying the object code work.
   6.299 +
   6.300 +  A "User Product" is either (1) a "consumer product", which means any
   6.301 +tangible personal property which is normally used for personal, family,
   6.302 +or household purposes, or (2) anything designed or sold for incorporation
   6.303 +into a dwelling.  In determining whether a product is a consumer product,
   6.304 +doubtful cases shall be resolved in favor of coverage.  For a particular
   6.305 +product received by a particular user, "normally used" refers to a
   6.306 +typical or common use of that class of product, regardless of the status
   6.307 +of the particular user or of the way in which the particular user
   6.308 +actually uses, or expects or is expected to use, the product.  A product
   6.309 +is a consumer product regardless of whether the product has substantial
   6.310 +commercial, industrial or non-consumer uses, unless such uses represent
   6.311 +the only significant mode of use of the product.
   6.312 +
   6.313 +  "Installation Information" for a User Product means any methods,
   6.314 +procedures, authorization keys, or other information required to install
   6.315 +and execute modified versions of a covered work in that User Product from
   6.316 +a modified version of its Corresponding Source.  The information must
   6.317 +suffice to ensure that the continued functioning of the modified object
   6.318 +code is in no case prevented or interfered with solely because
   6.319 +modification has been made.
   6.320 +
   6.321 +  If you convey an object code work under this section in, or with, or
   6.322 +specifically for use in, a User Product, and the conveying occurs as
   6.323 +part of a transaction in which the right of possession and use of the
   6.324 +User Product is transferred to the recipient in perpetuity or for a
   6.325 +fixed term (regardless of how the transaction is characterized), the
   6.326 +Corresponding Source conveyed under this section must be accompanied
   6.327 +by the Installation Information.  But this requirement does not apply
   6.328 +if neither you nor any third party retains the ability to install
   6.329 +modified object code on the User Product (for example, the work has
   6.330 +been installed in ROM).
   6.331 +
   6.332 +  The requirement to provide Installation Information does not include a
   6.333 +requirement to continue to provide support service, warranty, or updates
   6.334 +for a work that has been modified or installed by the recipient, or for
   6.335 +the User Product in which it has been modified or installed.  Access to a
   6.336 +network may be denied when the modification itself materially and
   6.337 +adversely affects the operation of the network or violates the rules and
   6.338 +protocols for communication across the network.
   6.339 +
   6.340 +  Corresponding Source conveyed, and Installation Information provided,
   6.341 +in accord with this section must be in a format that is publicly
   6.342 +documented (and with an implementation available to the public in
   6.343 +source code form), and must require no special password or key for
   6.344 +unpacking, reading or copying.
   6.345 +
   6.346 +  7. Additional Terms.
   6.347 +
   6.348 +  "Additional permissions" are terms that supplement the terms of this
   6.349 +License by making exceptions from one or more of its conditions.
   6.350 +Additional permissions that are applicable to the entire Program shall
   6.351 +be treated as though they were included in this License, to the extent
   6.352 +that they are valid under applicable law.  If additional permissions
   6.353 +apply only to part of the Program, that part may be used separately
   6.354 +under those permissions, but the entire Program remains governed by
   6.355 +this License without regard to the additional permissions.
   6.356 +
   6.357 +  When you convey a copy of a covered work, you may at your option
   6.358 +remove any additional permissions from that copy, or from any part of
   6.359 +it.  (Additional permissions may be written to require their own
   6.360 +removal in certain cases when you modify the work.)  You may place
   6.361 +additional permissions on material, added by you to a covered work,
   6.362 +for which you have or can give appropriate copyright permission.
   6.363 +
   6.364 +  Notwithstanding any other provision of this License, for material you
   6.365 +add to a covered work, you may (if authorized by the copyright holders of
   6.366 +that material) supplement the terms of this License with terms:
   6.367 +
   6.368 +    a) Disclaiming warranty or limiting liability differently from the
   6.369 +    terms of sections 15 and 16 of this License; or
   6.370 +
   6.371 +    b) Requiring preservation of specified reasonable legal notices or
   6.372 +    author attributions in that material or in the Appropriate Legal
   6.373 +    Notices displayed by works containing it; or
   6.374 +
   6.375 +    c) Prohibiting misrepresentation of the origin of that material, or
   6.376 +    requiring that modified versions of such material be marked in
   6.377 +    reasonable ways as different from the original version; or
   6.378 +
   6.379 +    d) Limiting the use for publicity purposes of names of licensors or
   6.380 +    authors of the material; or
   6.381 +
   6.382 +    e) Declining to grant rights under trademark law for use of some
   6.383 +    trade names, trademarks, or service marks; or
   6.384 +
   6.385 +    f) Requiring indemnification of licensors and authors of that
   6.386 +    material by anyone who conveys the material (or modified versions of
   6.387 +    it) with contractual assumptions of liability to the recipient, for
   6.388 +    any liability that these contractual assumptions directly impose on
   6.389 +    those licensors and authors.
   6.390 +
   6.391 +  All other non-permissive additional terms are considered "further
   6.392 +restrictions" within the meaning of section 10.  If the Program as you
   6.393 +received it, or any part of it, contains a notice stating that it is
   6.394 +governed by this License along with a term that is a further
   6.395 +restriction, you may remove that term.  If a license document contains
   6.396 +a further restriction but permits relicensing or conveying under this
   6.397 +License, you may add to a covered work material governed by the terms
   6.398 +of that license document, provided that the further restriction does
   6.399 +not survive such relicensing or conveying.
   6.400 +
   6.401 +  If you add terms to a covered work in accord with this section, you
   6.402 +must place, in the relevant source files, a statement of the
   6.403 +additional terms that apply to those files, or a notice indicating
   6.404 +where to find the applicable terms.
   6.405 +
   6.406 +  Additional terms, permissive or non-permissive, may be stated in the
   6.407 +form of a separately written license, or stated as exceptions;
   6.408 +the above requirements apply either way.
   6.409 +
   6.410 +  8. Termination.
   6.411 +
   6.412 +  You may not propagate or modify a covered work except as expressly
   6.413 +provided under this License.  Any attempt otherwise to propagate or
   6.414 +modify it is void, and will automatically terminate your rights under
   6.415 +this License (including any patent licenses granted under the third
   6.416 +paragraph of section 11).
   6.417 +
   6.418 +  However, if you cease all violation of this License, then your
   6.419 +license from a particular copyright holder is reinstated (a)
   6.420 +provisionally, unless and until the copyright holder explicitly and
   6.421 +finally terminates your license, and (b) permanently, if the copyright
   6.422 +holder fails to notify you of the violation by some reasonable means
   6.423 +prior to 60 days after the cessation.
   6.424 +
   6.425 +  Moreover, your license from a particular copyright holder is
   6.426 +reinstated permanently if the copyright holder notifies you of the
   6.427 +violation by some reasonable means, this is the first time you have
   6.428 +received notice of violation of this License (for any work) from that
   6.429 +copyright holder, and you cure the violation prior to 30 days after
   6.430 +your receipt of the notice.
   6.431 +
   6.432 +  Termination of your rights under this section does not terminate the
   6.433 +licenses of parties who have received copies or rights from you under
   6.434 +this License.  If your rights have been terminated and not permanently
   6.435 +reinstated, you do not qualify to receive new licenses for the same
   6.436 +material under section 10.
   6.437 +
   6.438 +  9. Acceptance Not Required for Having Copies.
   6.439 +
   6.440 +  You are not required to accept this License in order to receive or
   6.441 +run a copy of the Program.  Ancillary propagation of a covered work
   6.442 +occurring solely as a consequence of using peer-to-peer transmission
   6.443 +to receive a copy likewise does not require acceptance.  However,
   6.444 +nothing other than this License grants you permission to propagate or
   6.445 +modify any covered work.  These actions infringe copyright if you do
   6.446 +not accept this License.  Therefore, by modifying or propagating a
   6.447 +covered work, you indicate your acceptance of this License to do so.
   6.448 +
   6.449 +  10. Automatic Licensing of Downstream Recipients.
   6.450 +
   6.451 +  Each time you convey a covered work, the recipient automatically
   6.452 +receives a license from the original licensors, to run, modify and
   6.453 +propagate that work, subject to this License.  You are not responsible
   6.454 +for enforcing compliance by third parties with this License.
   6.455 +
   6.456 +  An "entity transaction" is a transaction transferring control of an
   6.457 +organization, or substantially all assets of one, or subdividing an
   6.458 +organization, or merging organizations.  If propagation of a covered
   6.459 +work results from an entity transaction, each party to that
   6.460 +transaction who receives a copy of the work also receives whatever
   6.461 +licenses to the work the party's predecessor in interest had or could
   6.462 +give under the previous paragraph, plus a right to possession of the
   6.463 +Corresponding Source of the work from the predecessor in interest, if
   6.464 +the predecessor has it or can get it with reasonable efforts.
   6.465 +
   6.466 +  You may not impose any further restrictions on the exercise of the
   6.467 +rights granted or affirmed under this License.  For example, you may
   6.468 +not impose a license fee, royalty, or other charge for exercise of
   6.469 +rights granted under this License, and you may not initiate litigation
   6.470 +(including a cross-claim or counterclaim in a lawsuit) alleging that
   6.471 +any patent claim is infringed by making, using, selling, offering for
   6.472 +sale, or importing the Program or any portion of it.
   6.473 +
   6.474 +  11. Patents.
   6.475 +
   6.476 +  A "contributor" is a copyright holder who authorizes use under this
   6.477 +License of the Program or a work on which the Program is based.  The
   6.478 +work thus licensed is called the contributor's "contributor version".
   6.479 +
   6.480 +  A contributor's "essential patent claims" are all patent claims
   6.481 +owned or controlled by the contributor, whether already acquired or
   6.482 +hereafter acquired, that would be infringed by some manner, permitted
   6.483 +by this License, of making, using, or selling its contributor version,
   6.484 +but do not include claims that would be infringed only as a
   6.485 +consequence of further modification of the contributor version.  For
   6.486 +purposes of this definition, "control" includes the right to grant
   6.487 +patent sublicenses in a manner consistent with the requirements of
   6.488 +this License.
   6.489 +
   6.490 +  Each contributor grants you a non-exclusive, worldwide, royalty-free
   6.491 +patent license under the contributor's essential patent claims, to
   6.492 +make, use, sell, offer for sale, import and otherwise run, modify and
   6.493 +propagate the contents of its contributor version.
   6.494 +
   6.495 +  In the following three paragraphs, a "patent license" is any express
   6.496 +agreement or commitment, however denominated, not to enforce a patent
   6.497 +(such as an express permission to practice a patent or covenant not to
   6.498 +sue for patent infringement).  To "grant" such a patent license to a
   6.499 +party means to make such an agreement or commitment not to enforce a
   6.500 +patent against the party.
   6.501 +
   6.502 +  If you convey a covered work, knowingly relying on a patent license,
   6.503 +and the Corresponding Source of the work is not available for anyone
   6.504 +to copy, free of charge and under the terms of this License, through a
   6.505 +publicly available network server or other readily accessible means,
   6.506 +then you must either (1) cause the Corresponding Source to be so
   6.507 +available, or (2) arrange to deprive yourself of the benefit of the
   6.508 +patent license for this particular work, or (3) arrange, in a manner
   6.509 +consistent with the requirements of this License, to extend the patent
   6.510 +license to downstream recipients.  "Knowingly relying" means you have
   6.511 +actual knowledge that, but for the patent license, your conveying the
   6.512 +covered work in a country, or your recipient's use of the covered work
   6.513 +in a country, would infringe one or more identifiable patents in that
   6.514 +country that you have reason to believe are valid.
   6.515 +
   6.516 +  If, pursuant to or in connection with a single transaction or
   6.517 +arrangement, you convey, or propagate by procuring conveyance of, a
   6.518 +covered work, and grant a patent license to some of the parties
   6.519 +receiving the covered work authorizing them to use, propagate, modify
   6.520 +or convey a specific copy of the covered work, then the patent license
   6.521 +you grant is automatically extended to all recipients of the covered
   6.522 +work and works based on it.
   6.523 +
   6.524 +  A patent license is "discriminatory" if it does not include within
   6.525 +the scope of its coverage, prohibits the exercise of, or is
   6.526 +conditioned on the non-exercise of one or more of the rights that are
   6.527 +specifically granted under this License.  You may not convey a covered
   6.528 +work if you are a party to an arrangement with a third party that is
   6.529 +in the business of distributing software, under which you make payment
   6.530 +to the third party based on the extent of your activity of conveying
   6.531 +the work, and under which the third party grants, to any of the
   6.532 +parties who would receive the covered work from you, a discriminatory
   6.533 +patent license (a) in connection with copies of the covered work
   6.534 +conveyed by you (or copies made from those copies), or (b) primarily
   6.535 +for and in connection with specific products or compilations that
   6.536 +contain the covered work, unless you entered into that arrangement,
   6.537 +or that patent license was granted, prior to 28 March 2007.
   6.538 +
   6.539 +  Nothing in this License shall be construed as excluding or limiting
   6.540 +any implied license or other defenses to infringement that may
   6.541 +otherwise be available to you under applicable patent law.
   6.542 +
   6.543 +  12. No Surrender of Others' Freedom.
   6.544 +
   6.545 +  If conditions are imposed on you (whether by court order, agreement or
   6.546 +otherwise) that contradict the conditions of this License, they do not
   6.547 +excuse you from the conditions of this License.  If you cannot convey a
   6.548 +covered work so as to satisfy simultaneously your obligations under this
   6.549 +License and any other pertinent obligations, then as a consequence you may
   6.550 +not convey it at all.  For example, if you agree to terms that obligate you
   6.551 +to collect a royalty for further conveying from those to whom you convey
   6.552 +the Program, the only way you could satisfy both those terms and this
   6.553 +License would be to refrain entirely from conveying the Program.
   6.554 +
   6.555 +  13. Use with the GNU Affero General Public License.
   6.556 +
   6.557 +  Notwithstanding any other provision of this License, you have
   6.558 +permission to link or combine any covered work with a work licensed
   6.559 +under version 3 of the GNU Affero General Public License into a single
   6.560 +combined work, and to convey the resulting work.  The terms of this
   6.561 +License will continue to apply to the part which is the covered work,
   6.562 +but the special requirements of the GNU Affero General Public License,
   6.563 +section 13, concerning interaction through a network will apply to the
   6.564 +combination as such.
   6.565 +
   6.566 +  14. Revised Versions of this License.
   6.567 +
   6.568 +  The Free Software Foundation may publish revised and/or new versions of
   6.569 +the GNU General Public License from time to time.  Such new versions will
   6.570 +be similar in spirit to the present version, but may differ in detail to
   6.571 +address new problems or concerns.
   6.572 +
   6.573 +  Each version is given a distinguishing version number.  If the
   6.574 +Program specifies that a certain numbered version of the GNU General
   6.575 +Public License "or any later version" applies to it, you have the
   6.576 +option of following the terms and conditions either of that numbered
   6.577 +version or of any later version published by the Free Software
   6.578 +Foundation.  If the Program does not specify a version number of the
   6.579 +GNU General Public License, you may choose any version ever published
   6.580 +by the Free Software Foundation.
   6.581 +
   6.582 +  If the Program specifies that a proxy can decide which future
   6.583 +versions of the GNU General Public License can be used, that proxy's
   6.584 +public statement of acceptance of a version permanently authorizes you
   6.585 +to choose that version for the Program.
   6.586 +
   6.587 +  Later license versions may give you additional or different
   6.588 +permissions.  However, no additional obligations are imposed on any
   6.589 +author or copyright holder as a result of your choosing to follow a
   6.590 +later version.
   6.591 +
   6.592 +  15. Disclaimer of Warranty.
   6.593 +
   6.594 +  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
   6.595 +APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
   6.596 +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
   6.597 +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
   6.598 +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   6.599 +PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
   6.600 +IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
   6.601 +ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
   6.602 +
   6.603 +  16. Limitation of Liability.
   6.604 +
   6.605 +  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
   6.606 +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
   6.607 +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
   6.608 +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
   6.609 +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
   6.610 +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
   6.611 +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
   6.612 +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
   6.613 +SUCH DAMAGES.
   6.614 +
   6.615 +  17. Interpretation of Sections 15 and 16.
   6.616 +
   6.617 +  If the disclaimer of warranty and limitation of liability provided
   6.618 +above cannot be given local legal effect according to their terms,
   6.619 +reviewing courts shall apply local law that most closely approximates
   6.620 +an absolute waiver of all civil liability in connection with the
   6.621 +Program, unless a warranty or assumption of liability accompanies a
   6.622 +copy of the Program in return for a fee.
   6.623 +
   6.624 +                     END OF TERMS AND CONDITIONS
   6.625 +
   6.626 +            How to Apply These Terms to Your New Programs
   6.627 +
   6.628 +  If you develop a new program, and you want it to be of the greatest
   6.629 +possible use to the public, the best way to achieve this is to make it
   6.630 +free software which everyone can redistribute and change under these terms.
   6.631 +
   6.632 +  To do so, attach the following notices to the program.  It is safest
   6.633 +to attach them to the start of each source file to most effectively
   6.634 +state the exclusion of warranty; and each file should have at least
   6.635 +the "copyright" line and a pointer to where the full notice is found.
   6.636 +
   6.637 +    <one line to give the program's name and a brief idea of what it does.>
   6.638 +    Copyright (C) <year>  <name of author>
   6.639 +
   6.640 +    This program is free software: you can redistribute it and/or modify
   6.641 +    it under the terms of the GNU General Public License as published by
   6.642 +    the Free Software Foundation, either version 3 of the License, or
   6.643 +    (at your option) any later version.
   6.644 +
   6.645 +    This program is distributed in the hope that it will be useful,
   6.646 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
   6.647 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   6.648 +    GNU General Public License for more details.
   6.649 +
   6.650 +    You should have received a copy of the GNU General Public License
   6.651 +    along with this program.  If not, see <http://www.gnu.org/licenses/>.
   6.652 +
   6.653 +Also add information on how to contact you by electronic and paper mail.
   6.654 +
   6.655 +  If the program does terminal interaction, make it output a short
   6.656 +notice like this when it starts in an interactive mode:
   6.657 +
   6.658 +    <program>  Copyright (C) <year>  <name of author>
   6.659 +    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
   6.660 +    This is free software, and you are welcome to redistribute it
   6.661 +    under certain conditions; type `show c' for details.
   6.662 +
   6.663 +The hypothetical commands `show w' and `show c' should show the appropriate
   6.664 +parts of the General Public License.  Of course, your program's commands
   6.665 +might be different; for a GUI interface, you would use an "about box".
   6.666 +
   6.667 +  You should also get your employer (if you work as a programmer) or school,
   6.668 +if any, to sign a "copyright disclaimer" for the program, if necessary.
   6.669 +For more information on this, and how to apply and follow the GNU GPL, see
   6.670 +<http://www.gnu.org/licenses/>.
   6.671 +
   6.672 +  The GNU General Public License does not permit incorporating your program
   6.673 +into proprietary programs.  If your program is a subroutine library, you
   6.674 +may consider it more useful to permit linking proprietary applications with
   6.675 +the library.  If this is what you want to do, use the GNU Lesser General
   6.676 +Public License instead of this License.  But first, please read
   6.677 +<http://www.gnu.org/philosophy/why-not-lgpl.html>.
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/mips.h	Mon Oct 15 21:59:18 2018 +0200
     7.3 @@ -0,0 +1,63 @@
     7.4 +#ifndef __MIPS_H__
     7.5 +#define __MIPS_H__
     7.6 +
     7.7 +#define KSEG0_BASE	0x80000000
     7.8 +#define KSEG1_BASE	0xA0000000
     7.9 +
    7.10 +#define CP0_INDEX	$0
    7.11 +#define CP0_ENTRYLO0	$2
    7.12 +#define CP0_ENTRYLO1	$3
    7.13 +#define CP0_CONTEXT	$4
    7.14 +#define CP0_PAGEMASK	$5
    7.15 +#define CP0_WIRED	$6
    7.16 +#define CP0_BADVADDR	$8
    7.17 +#define CP0_COUNT	$9
    7.18 +#define CP0_ENTRYHI	$10
    7.19 +#define CP0_COMPARE	$11
    7.20 +#define CP0_STATUS	$12
    7.21 +#define CP0_INTCTL	$12, 1
    7.22 +#define CP0_CAUSE	$13
    7.23 +#define CP0_EPC		$14
    7.24 +#define CP0_EBASE	$15, 1
    7.25 +#define CP0_CONFIG	$16
    7.26 +#define CP0_WATCHLO	$18
    7.27 +#define CP0_DEBUG	$23
    7.28 +#define CP0_TAGLO	$28
    7.29 +#define CP0_TAGHI	$29
    7.30 +#define CP0_ERROREPC	$30, 0
    7.31 +
    7.32 +#define STATUS_CP0	0x10000000
    7.33 +#define STATUS_BEV	0x00400000
    7.34 +
    7.35 +#define STATUS_IRQ	0x0000fc00
    7.36 +#define STATUS_IRQ_SHIFT	10
    7.37 +
    7.38 +#define STATUS_UM	0x00000010
    7.39 +#define STATUS_ERL	0x00000004
    7.40 +#define STATUS_EXL	0x00000002
    7.41 +#define STATUS_IE	0x00000001
    7.42 +
    7.43 +#define CAUSE_IV	0x00800000
    7.44 +
    7.45 +#define EBASE_MASK	0x3ffff000
    7.46 +
    7.47 +#define INTCTL_MASK	0x000003e0
    7.48 +
    7.49 +#define DEBUG_DM	0x40000000
    7.50 +
    7.51 +#define TLB_CACHED	0x00000018
    7.52 +#define TLB_UNCACHED	0x00000010
    7.53 +#define TLB_DIRTY	0x00000004
    7.54 +#define TLB_VALID	0x00000002
    7.55 +#define TLB_GLOBAL	0x00000001
    7.56 +
    7.57 +#define TLB_READ	(TLB_CACHED | TLB_VALID)
    7.58 +#define TLB_WRITE	(TLB_CACHED | TLB_DIRTY | TLB_VALID)
    7.59 +#define TLB_ALL_READ	(TLB_CACHED | TLB_VALID | TLB_GLOBAL)
    7.60 +#define TLB_ALL_WRITE	(TLB_CACHED | TLB_DIRTY | TLB_VALID | TLB_GLOBAL)
    7.61 +
    7.62 +#define CONFIG_K0	0x00000007
    7.63 +#define CONFIG_K0_UNCACHED		2
    7.64 +#define CONFIG_K0_CACHABLE_NONCOHERENT	3
    7.65 +
    7.66 +#endif /* __MIPS_H__ */
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/pic32.h	Mon Oct 15 21:59:18 2018 +0200
     8.3 @@ -0,0 +1,125 @@
     8.4 +#ifndef __PIC32_H__
     8.5 +#define __PIC32_H__
     8.6 +
     8.7 +/* See...
     8.8 + * TABLE 4-1: SFR MEMORYMAP
     8.9 + * TABLE 11-3: PORTA REGISTER MAP
    8.10 + * 11.2 CLR, SET and INV Registers
    8.11 + * PIC32MX1XX/2XX 28/36/44-pin Family Data Sheet
    8.12 + */
    8.13 +
    8.14 +#define OC1CON		0xBF803000
    8.15 +#define OC1R		0xBF803010
    8.16 +#define OC1RS		0xBF803020
    8.17 +#define OC2CON		0xBF803200
    8.18 +#define OC2R		0xBF803210
    8.19 +#define OC2RS		0xBF803220
    8.20 +#define OC3CON		0xBF803400
    8.21 +#define OC3R		0xBF803410
    8.22 +#define OC3RS		0xBF803420
    8.23 +
    8.24 +#define T1CON   	0xBF800600
    8.25 +#define TMR1    	0xBF800610
    8.26 +#define PR1     	0xBF800620
    8.27 +#define T2CON   	0xBF800800
    8.28 +#define TMR2    	0xBF800810
    8.29 +#define PR2     	0xBF800820
    8.30 +#define T3CON   	0xBF800A00
    8.31 +#define TMR3    	0xBF800A10
    8.32 +#define PR3     	0xBF800A20
    8.33 +
    8.34 +#define U1MODE		0xBF806000
    8.35 +#define U1STA		0xBF806010
    8.36 +#define U1TXREG		0xBF806020
    8.37 +#define U1RXREG		0xBF806030
    8.38 +#define U1BRG		0xBF806040
    8.39 +
    8.40 +#define PMCON 		0xBF807000
    8.41 +#define PMMODE		0xBF807010
    8.42 +#define PMADDR		0xBF807020
    8.43 +#define PMDOUT		0xBF807030
    8.44 +#define PMDIN 		0xBF807040
    8.45 +#define PMAEN 		0xBF807050
    8.46 +#define PMSTAT		0xBF807060
    8.47 +
    8.48 +#define OSCCON		0xBF80F000
    8.49 +#define REFOCON		0xBF80F020
    8.50 +#define REFOTRIM	0xBF80F030
    8.51 +#define CFGCON		0xBF80F200
    8.52 +#define SYSKEY		0xBF80F230
    8.53 +
    8.54 +#define U1RXR		0xBF80FA50
    8.55 +
    8.56 +#define RPA0R		0xBF80FB00
    8.57 +#define RPA1R		0xBF80FB04
    8.58 +#define RPA2R		0xBF80FB08
    8.59 +#define RPA3R		0xBF80FB0C
    8.60 +#define RPA4R		0xBF80FB10
    8.61 +#define RPB0R		0xBF80FB2C
    8.62 +#define RPB1R		0xBF80FB30
    8.63 +#define RPB2R		0xBF80FB34
    8.64 +#define RPB3R		0xBF80FB38
    8.65 +#define RPB4R		0xBF80FB3C
    8.66 +#define RPB5R		0xBF80FB40
    8.67 +#define RPB10R		0xBF80FB54
    8.68 +#define RPB15R		0xBF80FB68
    8.69 +
    8.70 +#define INTCON		0xBF881000
    8.71 +#define IFS0		0xBF881030
    8.72 +#define IFS1		0xBF881040
    8.73 +#define IEC0		0xBF881060
    8.74 +#define IEC1		0xBF881070
    8.75 +#define IPC1		0xBF8810A0
    8.76 +#define IPC2		0xBF8810B0
    8.77 +#define IPC7		0xBF881100
    8.78 +#define IPC8		0xBF881110
    8.79 +#define IPC10		0xBF881130
    8.80 +
    8.81 +#define BMXCON		0xBF882000
    8.82 +#define BMXDKPBA	0xBF882010
    8.83 +#define BMXDUDBA	0xBF882020
    8.84 +#define BMXDUPBA	0xBF882030
    8.85 +#define BMXDRMSZ	0xBF882040
    8.86 +
    8.87 +#define DMACON		0xBF883000
    8.88 +#define DCH0CON		0xBF883060
    8.89 +#define DCH0ECON	0xBF883070
    8.90 +#define DCH0INT		0xBF883080
    8.91 +#define DCH0SSA		0xBF883090
    8.92 +#define DCH0DSA		0xBF8830A0
    8.93 +#define DCH0SSIZ	0xBF8830B0
    8.94 +#define DCH0DSIZ	0xBF8830C0
    8.95 +#define DCH0CSIZ	0xBF8830F0
    8.96 +#define DCH1CON		0xBF883120
    8.97 +#define DCH1ECON	0xBF883130
    8.98 +#define DCH1INT		0xBF883140
    8.99 +#define DCH1SSA		0xBF883150
   8.100 +#define DCH1DSA		0xBF883160
   8.101 +#define DCH1SSIZ	0xBF883170
   8.102 +#define DCH1DSIZ	0xBF883180
   8.103 +#define DCH1CSIZ	0xBF8831B0
   8.104 +#define DCH2CON		0xBF8831E0
   8.105 +#define DCH2ECON	0xBF8831F0
   8.106 +#define DCH2INT		0xBF883200
   8.107 +#define DCH2SSA		0xBF883210
   8.108 +#define DCH2DSA		0xBF883220
   8.109 +#define DCH2SSIZ	0xBF883230
   8.110 +#define DCH2DSIZ	0xBF883240
   8.111 +#define DCH2CSIZ	0xBF883270
   8.112 +
   8.113 +#define ANSELA		0xBF886000
   8.114 +#define TRISA		0xBF886010
   8.115 +#define PORTA		0xBF886020
   8.116 +#define LATA		0xBF886030
   8.117 +#define ODCA		0xBF886040
   8.118 +#define ANSELB		0xBF886100
   8.119 +#define TRISB		0xBF886110
   8.120 +#define PORTB		0xBF886120
   8.121 +#define LATB		0xBF886130
   8.122 +#define ODCB		0xBF886140
   8.123 +
   8.124 +#define CLR 0x4
   8.125 +#define SET 0x8
   8.126 +#define INV 0xC
   8.127 +
   8.128 +#endif /* __PIC32_H__ */