Category Archives: Embedded

Arduino: Understanding the Internals


/* pin = Arduino Mapped Pin Name, ex. Digital pin 22: pin = 22 */
void digitalWrite(uint8_t pin, uint8_t val)
{
    uint8_t timer = digitalPinToTimer(pin);
    uint8_t bit   = digitalPinToBitMask(pin);
    uint8_t port  = digitalPinToPort(pin);

    volatile uint8_t *out;
    out = portOutputRegister(port);

    uint8_t oldSREG = SREG;
    cli();

    if (val == LOW) {
        *out &= ~bit;
    } else {
        *out |= bit;
    }
    
    SREG = oldSREG;
}

SREG (Status Register) und Globale Interrupts aktivieren: SREG -Register

extern const uint8_t PROGMEM digital_pin_to_port_PGM[];

#define digitalPinToPort(P) ( pgm_read_byte( digital_pin_to_port_PGM + (P) ) )
#define pgm_read_byte(address_short)    pgm_read_byte_near(address_short)
#define pgm_read_byte_near(address_short) __LPM((uint16_t)(address_short))

Was pgm_read_byte() macht bzw. wie es in Assembler übersetzt wird: Source von pgm_read_byte

C:\arduino-1.0.4\hardware\tools\avr\avr\include
C:\arduino-1.0.4\hardware\arduino\cores\arduino
const uint16_t PROGMEM port_to_mode_PGM[] = {
    NOT_A_PORT,
    &DDRA,
    &DDRB,
    &DDRC,
    &DDRD,
    &DDRE,
    &DDRF,
    &DDRG,
    &DDRH,
    NOT_A_PORT,
    &DDRJ,
    &DDRK,
    &DDRL,
};

/arduino/variants/mega/pins_arduino.h
Accessing data past 64k boundary on atmega1280

Sensors

Gyroscope, Acceleration and Compass

MPU-6050 3x Axis accelerometer sensor and 3x Axis gyroscope sensor
MPU-9150 Nine-Axis (Gyro + Accelerometer + Compass) MEMS MotionTracking (MPU-6050 + AK8975)
AK8975 3-axis electronic compass
HMC5883L Triple Axis Magnetometer
BMP180 Barometric Pressure Sensor
L3GD20 3-axis digital gyroscope
LSM303D 3D accelerometer and 3D magnetometer

Humidity and Temperature

TMP006 Infrared Thermopile Sensor
AM2302 humidity capacitor module
AM2321 capacitive humidity sensing digital temperature and humidity sensor
SHT21 3-axis electronic compass
SHT11 Triple Axis Magnetometer
SHT15 Barometric Pressure Sensor

AM2302 (wired DHT22) temperature-humidity sensor
Sensirion Temperature/Humidity Sensor – SHT11
Arduino – Temperatur und Luftfeuchtigkeit mit dem DHT22 prüfen.

Erfahrungen mit 1-Wire Temp/Feuchte-Sensor AM2305 (anderer Sensor)

Light

ISL29023 Integrated Digital Light Sensor with Interrupt

AVR: Binary to BCD and vice versa

unsigned int bcd2i(unsigned int bcd) {
    unsigned int decimalMultiplier = 1;
    unsigned int digit;
    unsigned int i = 0;
    while (bcd > 0) {
        digit = bcd & 0xF;
        i += digit * decimalMultiplier;
        decimalMultiplier *= 10;
        bcd >>= 4;
    }
    return i;
}
unsigned int i2bcd(unsigned int i) {
    unsigned int binaryShift = 0;
    unsigned int digit;
    unsigned int bcd = 0;
    while (i > 0) {
        digit = i % 10;
        bcd += (digit << binaryShift);
        binaryShift += 4;
        i /= 10;
    }
    return bcd;
}

How to convert binary to BCD ?

AVR Tools

avrdude

AVRDUDE – AVR Downloader/UploaDEr
Mikrocontroller.net – AVRDUDE
AVR Tutorial – Starting out with avrdude
Using the avrdude program

Installation

Windows

WinAVR

Linux

# apt-get install avr-libc binutils-avr gcc-avr
# apt-get install arduino arduino-core extra-xdg-menus libjna-java librxtx-java

binutils

C -> Object -> ELF Executable -> HEX
CC                      = avr-g++
DEVICE                  = atmega168
CPU_FREQ                = 16000000L

#  Use MCU name (atmega2560), not Architecture (avr6)
# Source: http://www.nongnu.org/avr-libc/user-manual/using_tools.html
GLOBAL_CFLAGS           = -O0 -DF_CPU=$(CPU_FREQ) -mmcu=$(DEVICE)
GLOBAL_LDFLAGS          = -mmcu=$(DEVICE)
$ sudo apt-get install gcc-avr
$ sudo apt-get install avr-libc
$ readelf.exe -S arduino_test
There are 3 section headers, starting at offset 0xb0:

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0     Offset address + size can be seen in Hex-Editor
  [ 1] .data             PROGBITS        00800200 0001ac 000006 00  WA  0   0  1 <== Data
  [ 2] .text             PROGBITS        00000000 000074 000138 00  AX  0   0  2 <== Program Code
  [ 3] .shstrtab         STRTAB          00000000 0001b2 000027 00      0   0  1 <== Section Header String Table
  [ 4] .symtab           SYMTAB          00000000 0002cc 0005c0 10      5  12  4 <== Symbol Table
  [ 5] .strtab           STRTAB          00000000 00088c 000412 00      0   0  1 <== String Table
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings)
  I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)
$ avr-readelf.exe -s arduino_test 

Symbol table '.symtab' contains 92 entries:
   Num:    Value  Size Type    Bind   Vis      Ndx Name
     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND 
     1: 00800200     0 SECTION LOCAL  DEFAULT    1 
     2: 00000000     0 SECTION LOCAL  DEFAULT    2 
     3: 00000000     0 FILE    LOCAL  DEFAULT  ABS ArduinoTestMain.c
  [...]
    10: 00800200     6 OBJECT  LOCAL  DEFAULT    1 TEST
    11: 00000136     0 NOTYPE  LOCAL  DEFAULT    2 __stop_program
  [...]
    39: 000000e4     0 NOTYPE  WEAK   DEFAULT    2 __init
    55: 00000116     0 NOTYPE  WEAK   DEFAULT    2 __vector_33
  [...]
    60: 000000f4     0 NOTYPE  GLOBAL DEFAULT    2 __do_copy_data
    61: 0000011a    26 FUNC    GLOBAL DEFAULT    2 main
    62: 00000116     0 NOTYPE  WEAK   DEFAULT    2 __vector_4
  [...]
avr-objdump -s -m avr6 arduino_test
arduino_test:     file format elf32-avr

Contents of section .data:
 800200 48616c6c 6f00                        Hallo.          
Contents of section .text:
 0000 0c947200 0c948b00 0c948b00 0c948b00  ..r.............
 0010 0c948b00 0c948b00 0c948b00 0c948b00  ................
 0020 0c948b00 0c948b00 0c948b00 0c948b00  ................
 0030 0c948b00 0c948b00 0c948b00 0c948b00  ................
 0040 0c948b00 0c948b00 0c948b00 0c948b00  ................
 0050 0c948b00 0c948b00 0c948b00 0c948b00  ................
 0060 0c948b00 0c948b00 0c948b00 0c948b00  ................
 0070 0c948b00 0c948b00 0c948b00 0c948b00  ................
 0080 0c948b00 0c948b00 0c948b00 0c948b00  ................
 0090 0c948b00 0c948b00 0c948b00 0c948b00  ................
 00a0 0c948b00 0c948b00 0c948b00 0c948b00  ................
 00b0 0c948b00 0c948b00 0c948b00 0c948b00  ................
 00c0 0c948b00 0c948b00 0c948b00 0c948b00  ................
 00d0 0c948b00 0c948b00 0c948b00 0c948b00  ................
 00e0 0c948b00 11241fbe cfefd1e2 debfcdbf  .....$..........
 00f0 00e00cbf 12e0a0e0 b2e0e8e3 f1e000e0  ................
 0100 0bbf02c0 07900d92 a630b107 d9f70e94  .........0......
 0110 8d000c94 9a000c94 0000df93 cf93cdb7  ................
 0120 deb7e4e2 f0e08fef 8083e5e2 f0e083e0  ................
 0130 8083ffcf f894ffcf                    ........
$ avr-objcopy -j .text -j .data -O ihex arduino_test arduino_test.hex
$ avr-objdump -m avr6 -s arduino_test.hex

arduino_test.hex:     file format ihex

Contents of section .sec1:
 0000 0c947200 0c948b00 0c948b00 0c948b00  ..r.............
 0010 0c948b00 0c948b00 0c948b00 0c948b00  ................
 0020 0c948b00 0c948b00 0c948b00 0c948b00  ................
 0030 0c94ab00 0c94e500 0c948b00 0c948b00  ................
 0040 0c948b00 0c948b00 0c948b00 0c948b00  ................
 0050 0c948b00 0c948b00 0c948b00 0c948b00  ................
 0060 0c948b00 0c948b00 0c948b00 0c948b00  ................
 0070 0c948b00 0c94c800 0c948b00 0c948b00  ................
 0080 0c948b00 0c948b00 0c948b00 0c948b00  ................
 0090 0c948b00 0c948b00 0c948b00 0c948b00  ................
 00a0 0c948b00 0c948b00 0c948b00 0c948b00  ................
 00b0 0c948b00 0c948b00 0c948b00 0c948b00  ................
 00c0 0c948b00 0c948b00 0c948b00 0c948b00  ................
 00d0 0c948b00 0c948b00 0c948b00 0c948b00  ................
 00e0 0c948b00 11241fbe cfefd1e2 debfcdbf  .....$..........
 00f0 00e00cbf 12e0a0e0 b2e0e8e0 f2e000e0  ................
 0100 0bbf02c0 07900d92 a630b107 d9f70e94  .........0......
 0110 8d000c94 02010c94 0000df93 cf93cdb7  ................
 0120 deb7e4e2 f0e08fef 8083e5e2 f0e083e0  ................
 0130 80830e94 9c00ffcf df93cf93 cdb7deb7  ................
 0140 e8e6f0e0 82e08083 ece6f0e0 82e08083  ................
 0150 cf91df91 08951f92 0f920fb6 0f920090  ................
 0160 5b000f92 1124ef93 ff93df93 cf93cdb7  [....$..........
 0170 deb7e8e2 f0e01082 cf91df91 ff91ef91  ................
 0180 0f900092 5b000f90 0fbe0f90 1f901895  ....[...........
 0190 1f920f92 0fb60f92 00905b00 0f921124  ..........[....$
 01a0 ef93ff93 df93cf93 cdb7deb7 e8e2f0e0  ................
 01b0 1082cf91 df91ff91 ef910f90 00925b00  ..............[.
 01c0 0f900fbe 0f901f90 18951f92 0f920fb6  ................
 01d0 0f920090 5b000f92 1124ef93 ff93df93  ....[....$......
 01e0 cf93cdb7 deb7e8e2 f0e01082 cf91df91  ................
 01f0 ff91ef91 0f900092 5b000f90 0fbe0f90  ........[.......
 0200 1f901895 f894ffcf 48616c6c 6f00      ........Hallo.
$ avr-objdump -d -m avr6 arduino_test

arduino_test:     file format elf32-avr

Disassembly of section .text:

00000000 <__vectors>:
   0:   0c 94 72 00     jmp     0xe4    ; 0xe4 <__ctors_end>
   4:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
   8:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
   c:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  10:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  14:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  18:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  1c:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  20:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  24:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  28:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  2c:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  30:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  34:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  38:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  3c:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  40:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  44:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  48:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  4c:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  50:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  54:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  58:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  5c:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  60:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  64:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  68:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  6c:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  70:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  74:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  78:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  7c:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  80:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  84:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  88:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  8c:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  90:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  94:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  98:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  9c:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  a0:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  a4:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  a8:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  ac:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  b0:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  b4:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  b8:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  bc:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  c0:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  c4:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  c8:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  cc:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  d0:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  d4:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  d8:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  dc:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
  e0:   0c 94 8b 00     jmp     0x116   ; 0x116 <__bad_interrupt>
000000e4 <__ctors_end>:
  e4:   11 24           eor     r1, r1
  e6:   1f be           out     0x3f, r1        ; 63
  e8:   cf ef           ldi     r28, 0xFF       ; 255
  ea:   d1 e2           ldi     r29, 0x21       ; 33
  ec:   de bf           out     0x3e, r29       ; 62
  ee:   cd bf           out     0x3d, r28       ; 61
  f0:   00 e0           ldi     r16, 0x00       ; 0
  f2:   0c bf           out     0x3c, r16       ; 60

000000f4 <__do_copy_data>:
  f4:   12 e0           ldi     r17, 0x02       ; 2
  f6:   a0 e0           ldi     r26, 0x00       ; 0
  f8:   b2 e0           ldi     r27, 0x02       ; 2
  fa:   e8 e3           ldi     r30, 0x38       ; 56
  fc:   f1 e0           ldi     r31, 0x01       ; 1
  fe:   00 e0           ldi     r16, 0x00       ; 0
 100:   0b bf           out     0x3b, r16       ; 59
 102:   02 c0           rjmp    .+4             ; 0x108 <__do_copy_data+0x14>
 104:   07 90           elpm    r0, Z+
 106:   0d 92           st      X+, r0
 108:   a6 30           cpi     r26, 0x06       ; 6
 10a:   b1 07           cpc     r27, r17
 10c:   d9 f7           brne    .-10            ; 0x104 <__do_copy_data+0x10>
 10e:   0e 94 8d 00     call    0x11a   ; 0x11a <main>
 112:   0c 94 9a 00     jmp     0x134   ; 0x134 <_exit>

00000116 <__bad_interrupt>:
 116:   0c 94 00 00     jmp     0       ; 0x0 <__vectors>

0000011a <main>:
 11a:   df 93           push    r29
 11c:   cf 93           push    r28
 11e:   cd b7           in      r28, 0x3d       ; 61
 120:   de b7           in      r29, 0x3e       ; 62
 122:   e4 e2           ldi     r30, 0x24       ; 36
 124:   f0 e0           ldi     r31, 0x00       ; 0
 126:   8f ef           ldi     r24, 0xFF       ; 255
 128:   80 83           st      Z, r24
 12a:   e5 e2           ldi     r30, 0x25       ; 37
 12c:   f0 e0           ldi     r31, 0x00       ; 0
 12e:   83 e0           ldi     r24, 0x03       ; 3
 130:   80 83           st      Z, r24
 132:   ff cf           rjmp    .-2             ; 0x132 <main+0x18>

00000134 <_exit>:
 134:   f8 94           cli

00000136 <__stop_program>:
 136:   ff cf           rjmp    .-2             ; 0x136 <__stop_program>

Use Architecture (avr6), not MCU name (atmega2560)
Source: http://www.nongnu.org/avr-libc/user-manual/using_tools.html

$ avr-objdump -d -m atmega2560 arduino_test

arduino_test:     file format elf32-avr

avr-objdump.exe: Can't use supplied machine atmega2560

Bug in GCC Version 4.3.3 (WinAVR 20100110): no -mmcu in linking-stage doesn’t exit but gives bad result:

$ avr-objdump -d -m avr6 arduino_test

arduino_test:     file format elf32-avr

Disassembly of section .text:

00000000 <__vectors>:
   0:   0c c0           rjmp    .+24            ; 0x1a <__ctors_end>
   2:   1f c0           rjmp    .+62            ; 0x42 <__bad_interrupt>
   4:   1e c0           rjmp    .+60            ; 0x42 <__bad_interrupt>
   6:   1d c0           rjmp    .+58            ; 0x42 <__bad_interrupt>
   8:   1c c0           rjmp    .+56            ; 0x42 <__bad_interrupt>
   a:   1b c0           rjmp    .+54            ; 0x42 <__bad_interrupt>
   c:   1a c0           rjmp    .+52            ; 0x42 <__bad_interrupt>
   e:   19 c0           rjmp    .+50            ; 0x42 <__bad_interrupt>
  10:   18 c0           rjmp    .+48            ; 0x42 <__bad_interrupt>
  12:   17 c0           rjmp    .+46            ; 0x42 <__bad_interrupt>
  14:   16 c0           rjmp    .+44            ; 0x42 <__bad_interrupt>
  16:   15 c0           rjmp    .+42            ; 0x42 <__bad_interrupt>
  18:   14 c0           rjmp    .+40            ; 0x42 <__bad_interrupt>

0000001a <__ctors_end>:
  1a:   11 24           eor     r1, r1
  1c:   1f be           out     0x3f, r1        ; 63
  1e:   cf e5           ldi     r28, 0x5F       ; 95
  20:   d2 e0           ldi     r29, 0x02       ; 2
  22:   de bf           out     0x3e, r29       ; 62
  [...]

Falscher Port ausgewählt

avrdude: Send: 0 [30]   [20] 
avrdude: Send: 0 [30]   [20] 
avrdude: Send: 0 [30]   [20] 
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
avrdude: Send: 0 [30]   [20] 

Installing python-spidermonkey

ClickAndLoad - "ClickAndLoad":
        bool extern : "Allow external link adding" = True
        bool activated : "Activated" = True

install package python-pyrex. move away wd-lib.list (for new libc6 package)

mv /var/lib/dpkg/info/wd-lib.list /root
apt-get install python-pyrex
mv /root/wd-lib.list /var/lib/dpkg/info

Zuerst ein tmp-Verzechnis erstellen:

$ mkdir /home/pyload/tmp
174: print filename
412: tmpdir = tempfile.mkdtemp(prefix="easy_install-",dir="/home/pyload/tmp")
MyBookLive:/DataVolume/shares/Applications/python-spidermonkey# python2.6 setup.py --system-library build
/tmp/easy_install-DXWK35/nose-1.1.2.tar.gz
Traceback (most recent call last):
  File "setup.py", line 190, in <module>
    test_suite = 'nose.collector',
  File "/usr/lib/python2.6/distutils/core.py", line 113, in setup
    _setup_distribution = dist = klass(attrs)
  File "/DataVolume/shares/Applications/python-spidermonkey/setuptools-0.6c9-py2.6.egg/setuptools/dist.py", line 219, in __init__
  File "/DataVolume/shares/Applications/python-spidermonkey/setuptools-0.6c9-py2.6.egg/setuptools/dist.py", line 243, in fetch_build_eggs
  File "/DataVolume/shares/Applications/python-spidermonkey/setuptools-0.6c9-py2.6.egg/pkg_resources.py", line 522, in resolve
  File "/DataVolume/shares/Applications/python-spidermonkey/setuptools-0.6c9-py2.6.egg/pkg_resources.py", line 758, in best_match
  File "/DataVolume/shares/Applications/python-spidermonkey/setuptools-0.6c9-py2.6.egg/pkg_resources.py", line 770, in obtain
  File "/DataVolume/shares/Applications/python-spidermonkey/setuptools-0.6c9-py2.6.egg/setuptools/dist.py", line 286, in fetch_build_egg
  File "/DataVolume/shares/Applications/python-spidermonkey/setuptools-0.6c9-py2.6.egg/setuptools/command/easy_install.py", line 446, in easy_install
  File "/DataVolume/shares/Applications/python-spidermonkey/setuptools-0.6c9-py2.6.egg/setuptools/command/easy_install.py", line 476, in install_item
  File "/DataVolume/shares/Applications/python-spidermonkey/setuptools-0.6c9-py2.6.egg/setuptools/command/easy_install.py", line 626, in install_eggs
  File "/DataVolume/shares/Applications/python-spidermonkey/setuptools-0.6c9-py2.6.egg/setuptools/archive_util.py", line 67, in unpack_archive
  File "/DataVolume/shares/Applications/python-spidermonkey/setuptools-0.6c9-py2.6.egg/setuptools/archive_util.py", line 193, in unpack_tarfile
  File "/usr/lib/python2.6/tarfile.py", line 2152, in _extract_member
    self.makefile(tarinfo, targetpath)
  File "/usr/lib/python2.6/tarfile.py", line 2194, in makefile
    target.close()
IOError: [Errno 28] No space left on device
# svn checkout http://python-spidermonkey.googlecode.com/svn/trunk/ python-spidermonkey-read-only
$ git clone https://github.com/davisp/python-spidermonkey.git
$ apt-get install pkg-config
$ apt-get install libnspr4-dev
$ apt-get install libmozjs-dev
$ python setup.py --system-library build
MyBookLive:/DataVolume/shares/Applications/python-spidermonkey# python2.6 setup.py --system-library build
---------------------------------------------------------------------------
This script requires setuptools version 0.6c9 to run (even to display
help).  I will attempt to download it for you (from
http://pypi.python.org/packages/2.6/s/setuptools/), but
you may need to enable firewall access for this script first.
I will start the download in 15 seconds.

(Note: if this machine does not have network access, please obtain the file

   http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c9-py2.6.egg

and place it in this directory before rerunning this script.)
---------------------------------------------------------------------------
Downloading http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c9-py2.6.egg

/home/pyload/tmp/easy_install-MMxMSs/nose-1.1.2.tar.gz

Installed /DataVolume/shares/Applications/python-spidermonkey/nose-1.1.2-py2.6.egg
running build
running build_ext
building 'spidermonkey' extension
creating build
creating build/temp.linux-ppc-2.6
creating build/temp.linux-ppc-2.6/spidermonkey
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/mozjs -I/usr/include/nspr -I/usr/include/python2.6 -c spidermonkey/pyiter.c -o build/temp.linux-ppc-2.6/spidermonkey/pyiter.o -DXP_UNIX -DJS_THREADSAFE
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/mozjs -I/usr/include/nspr -I/usr/include/python2.6 -c spidermonkey/spidermonkey.c -o build/temp.linux-ppc-2.6/spidermonkey/spidermonkey.o -DXP_UNIX -DJS_THREADSAFE
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/mozjs -I/usr/include/nspr -I/usr/include/python2.6 -c spidermonkey/context.c -o build/temp.linux-ppc-2.6/spidermonkey/context.o -DXP_UNIX -DJS_THREADSAFE
In file included from /usr/include/mozjs/jsatom.h:53,
                 from /usr/include/mozjs/jscntxt.h:49,
                 from spidermonkey/context.c:14:
/usr/include/mozjs/jslock.h:189: warning: function declaration isn't a prototype
spidermonkey/context.c: In function 'Context_new':
spidermonkey/context.c:383: warning: implicit declaration of function 'JS_SetBranchCallback'
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/mozjs -I/usr/include/nspr -I/usr/include/python2.6 -c spidermonkey/convert.c -o build/temp.linux-ppc-2.6/spidermonkey/convert.o -DXP_UNIX -DJS_THREADSAFE
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/mozjs -I/usr/include/nspr -I/usr/include/python2.6 -c spidermonkey/jsobject.c -o build/temp.linux-ppc-2.6/spidermonkey/jsobject.o -DXP_UNIX -DJS_THREADSAFE
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/mozjs -I/usr/include/nspr -I/usr/include/python2.6 -c spidermonkey/jsiterator.c -o build/temp.linux-ppc-2.6/spidermonkey/jsiterator.o -DXP_UNIX -DJS_THREADSAFE
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/mozjs -I/usr/include/nspr -I/usr/include/python2.6 -c spidermonkey/double.c -o build/temp.linux-ppc-2.6/spidermonkey/double.o -DXP_UNIX -DJS_THREADSAFE
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/mozjs -I/usr/include/nspr -I/usr/include/python2.6 -c spidermonkey/error.c -o build/temp.linux-ppc-2.6/spidermonkey/error.o -DXP_UNIX -DJS_THREADSAFE
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/mozjs -I/usr/include/nspr -I/usr/include/python2.6 -c spidermonkey/jsarray.c -o build/temp.linux-ppc-2.6/spidermonkey/jsarray.o -DXP_UNIX -DJS_THREADSAFE
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/mozjs -I/usr/include/nspr -I/usr/include/python2.6 -c spidermonkey/jsfunction.c -o build/temp.linux-ppc-2.6/spidermonkey/jsfunction.o -DXP_UNIX -DJS_THREADSAFE
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/mozjs -I/usr/include/nspr -I/usr/include/python2.6 -c spidermonkey/integer.c -o build/temp.linux-ppc-2.6/spidermonkey/integer.o -DXP_UNIX -DJS_THREADSAFE
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/mozjs -I/usr/include/nspr -I/usr/include/python2.6 -c spidermonkey/string.c -o build/temp.linux-ppc-2.6/spidermonkey/string.o -DXP_UNIX -DJS_THREADSAFE
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/mozjs -I/usr/include/nspr -I/usr/include/python2.6 -c spidermonkey/pyobject.c -o build/temp.linux-ppc-2.6/spidermonkey/pyobject.o -DXP_UNIX -DJS_THREADSAFE
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/mozjs -I/usr/include/nspr -I/usr/include/python2.6 -c spidermonkey/hashcobj.c -o build/temp.linux-ppc-2.6/spidermonkey/hashcobj.o -DXP_UNIX -DJS_THREADSAFE
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/mozjs -I/usr/include/nspr -I/usr/include/python2.6 -c spidermonkey/runtime.c -o build/temp.linux-ppc-2.6/spidermonkey/runtime.o -DXP_UNIX -DJS_THREADSAFE
creating build/lib.linux-ppc-2.6
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions build/temp.linux-ppc-2.6/spidermonkey/pyiter.o build/temp.linux-ppc-2.6/spidermonkey/spidermonkey.o build/temp.linux-ppc-2.6/spidermonkey/context.o build/temp.linux-ppc-2.6/spidermonkey/convert.o build/temp.linux-ppc-2.6/spidermonkey/jsobject.o build/temp.linux-ppc-2.6/spidermonkey/jsiterator.o build/temp.linux-ppc-2.6/spidermonkey/double.o build/temp.linux-ppc-2.6/spidermonkey/error.o build/temp.linux-ppc-2.6/spidermonkey/jsarray.o build/temp.linux-ppc-2.6/spidermonkey/jsfunction.o build/temp.linux-ppc-2.6/spidermonkey/integer.o build/temp.linux-ppc-2.6/spidermonkey/string.o build/temp.linux-ppc-2.6/spidermonkey/pyobject.o build/temp.linux-ppc-2.6/spidermonkey/hashcobj.o build/temp.linux-ppc-2.6/spidermonkey/runtime.o -L/usr/lib/xulrunner-devel-1.9.1/lib -lmozjs -lplds4 -lplc4 -lnspr4 -lpthread -ldl -o build/lib.linux-ppc-2.6/spidermonkey.so
MyBookLive:/DataVolume/shares/Applications/python-spidermonkey# python2.6 setup.py --system-library install
running install
Checking .pth file support in /usr/local/lib/python2.6/dist-packages/
/usr/bin/python2.6 -E -c pass
TEST PASSED: /usr/local/lib/python2.6/dist-packages/ appears to support .pth files
running bdist_egg
running egg_info
creating python_spidermonkey.egg-info
writing python_spidermonkey.egg-info/PKG-INFO
writing top-level names to python_spidermonkey.egg-info/top_level.txt
writing dependency_links to python_spidermonkey.egg-info/dependency_links.txt
writing manifest file 'python_spidermonkey.egg-info/SOURCES.txt'
reading manifest file 'python_spidermonkey.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'README'
writing manifest file 'python_spidermonkey.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-ppc/egg
running install_lib
running build_ext
creating build/bdist.linux-ppc
creating build/bdist.linux-ppc/egg
copying build/lib.linux-ppc-2.6/spidermonkey.so -> build/bdist.linux-ppc/egg
creating stub loader for spidermonkey.so
byte-compiling build/bdist.linux-ppc/egg/spidermonkey.py to spidermonkey.pyc
creating build/bdist.linux-ppc/egg/EGG-INFO
copying python_spidermonkey.egg-info/PKG-INFO -> build/bdist.linux-ppc/egg/EGG-INFO
copying python_spidermonkey.egg-info/SOURCES.txt -> build/bdist.linux-ppc/egg/EGG-INFO
copying python_spidermonkey.egg-info/dependency_links.txt -> build/bdist.linux-ppc/egg/EGG-INFO
copying python_spidermonkey.egg-info/not-zip-safe -> build/bdist.linux-ppc/egg/EGG-INFO
copying python_spidermonkey.egg-info/top_level.txt -> build/bdist.linux-ppc/egg/EGG-INFO
writing build/bdist.linux-ppc/egg/EGG-INFO/native_libs.txt
creating dist
creating 'dist/python_spidermonkey-0.0.9-py2.6-linux-ppc.egg' and adding 'build/bdist.linux-ppc/egg' to it
removing 'build/bdist.linux-ppc/egg' (and everything under it)
Processing setuptools-0.6c9-py2.6.egg
Copying setuptools-0.6c9-py2.6.egg to /usr/local/lib/python2.6/dist-packages
Adding setuptools 0.6c9 to easy-install.pth file
Installing easy_install script to /usr/local/bin
Installing easy_install-2.6 script to /usr/local/bin

Installed /usr/local/lib/python2.6/dist-packages/setuptools-0.6c9-py2.6.egg
Processing dependencies for setuptools==0.6c9
Finished processing dependencies for setuptools==0.6c9
Processing python_spidermonkey-0.0.9-py2.6-linux-ppc.egg
creating /usr/local/lib/python2.6/dist-packages/python_spidermonkey-0.0.9-py2.6-linux-ppc.egg
Extracting python_spidermonkey-0.0.9-py2.6-linux-ppc.egg to /usr/local/lib/python2.6/dist-packages
Adding python-spidermonkey 0.0.9 to easy-install.pth file

Installed /usr/local/lib/python2.6/dist-packages/python_spidermonkey-0.0.9-py2.6-linux-ppc.egg
Processing dependencies for python-spidermonkey==0.0.9
Finished processing dependencies for python-spidermonkey==0.0.9

TI Stellaris LaunchPad EK-LM4F120XL

Getting Started with the Stellaris EK-LM4F120XL LaunchPad Workshop
Stellaris Cortex-M microcontrollers
Texas Instruments LaunchPad site
Third-party LaunchPad BoosterPack development site
Stellaris microcontroller forum on TI E2E
Make the Switch to TI MCUs

Connected LaunchPad Tiva C Series TM4C129
Energia

GCC Flags

mikrocontroller.net: ARM GCC
GCC ARM Options
What does it mean the d16 in fpu option of fpv4-sp-d16?
how to link GCC options to the arm MCU FPU datasheet?
GCC: unbenutzte Funktionen entfernen
Options That Control Optimization, ex. -ffunction-sections -fdata-sections to remove unused functions
Options Controlling the Preprocessor, ex. -MD to generate a dependency output file
What is the purpose of using -pedantic in GCC/G++ compiler?
Options to Request or Suppress Warnings, ex. -pedantic Issue all the warnings demanded by strict ISO C and ISO C++; reject all programs that use forbidden extension
What is TARGET_IS_BLIZZARD_RA1?, Blizzard is the internal TI product name for the LM4F series. This symbol will give the libraries access to the API’s in ROM.

Linker Flags

TM4C123G.ld
ARM compilation error, VPF registered used by executable, not object file

Software

Stellaris/Tiva MCUs PinMux Utility
LM Flash Programmer, GUI and Command Line
Uniflash
TivaWare
Stellaris ICDI Drivers

Mikrocontroller

CC3200, for CC3200-LAUNCHXL
TM4C123GH6PM, for EK-TM4C123GXL
TM4C1294NCPDT, for EK-TM4C1294XL

I-PEX / U.FL

Wikipedia: Hirose U.FL / IPEX
Pigtail cable, I-PEX to SMA female reverse connector
Was ist ein U.FL – Stecker/Buchse

Debug How-To (JTAG/SWD)

Stellaris LM4F120 LaunchPad Debug How To
Stellaris LaunchPad with external debugger (Pictures)
JTAG and the Stellaris Launchpad
CC31xx & CC32xx Debug Support (attach J-Link)

Black Magic Probe

Black Magic Probe for Stellaris Launchpad
Black Magic Probe

Tutorials

Regnerischer Nachmittag
Getting Started with the TI Stellaris LaunchPad on Linux
Stellaris LaunchPad Code Examples: How To Use The RGB LED For Digital Output
TI Stellaris Launchpad Test Run
Embedded Systems – Shape The World

Locked out MCU

TM4C123G Development board unable to initialize and program
Fault on TM4C123G processor
Locked out Evalbot Stellaris lm3s9b92
Tiva TM4C123G LaunchPad Blink the RGB
CLP Unbox
TM4C Error connecting to the target: (Error -1063 @ 0x0), Unresponsive Processor

Kernel Hacks – Ready, Set, Hack!

The complete tutorial for Stellaris LaunchPad development with GNU/Linux (I), 21.11.2012
The complete tutorial for Stellaris Launchpad development with GNU/Linux (II), 23.11.2012
The complete tutorial for Stellaris LaunchPad development with GNU/Linux (III), 25.11.2012

readthedocs.org

Getting Started with C/C++ Development Tools for ARMstrap Boards, Eclipse Edition

wiki.ti.com

Stellaris Launchpad with OpenOCD and Linux, 09.02.2014

openocd.sourceforge.net

GDB and OpenOCD

tincantools.com

OpenOCD Troubleshooting: Can’t Find File.cfg

$ sudo apt-get remove binutils-arm-none-eabi gcc-arm-none-eabi
$ sudo add-apt-repository ppa:terry.guo/gcc-arm-embedded
$ sudo apt-get update
$ sudo apt-get install gcc-arm-none-eabi=4-8-2014q2-0trusty10

StellarisWare Complete (all boards, all components)
Stellaris LM4F120 LaunchPad Evaluation Board Software

$ unzip SW-LM3S-9453.exe

lm4tools

$ cd ~/src/lm4tools/lm4flash
$ make
Package libusb-1.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libusb-1.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libusb-1.0' found
Package libusb-1.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libusb-1.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libusb-1.0' found
gcc -Wall  -O2 lm4flash.c  -o lm4flash
lm4flash.c:30:20: fatal error: libusb.h: No such file or directory
 #include <libusb.h>
                    ^
compilation terminated.
make: *** [lm4flash] Error 1

$ dpkg -l | grep libusb
ii  libgusb2:i386                              0.1.6-5                                     i386         GLib wrapper around libusb1
ii  libusb-0.1-4:i386                          2:0.1.12-23.3ubuntu1                        i386         userspace USB programming library
ii  libusb-1.0-0:i386                          2:1.0.17-1ubuntu2                           i386         userspace USB programming library
ii  libusb-dev                                 2:0.1.12-23.3ubuntu1                        i386         userspace USB programming library development files
ii  libusbmuxd2                                1.0.8-2ubuntu1                              i386         USB multiplexor daemon for iPhone and iPod Touch devices - library

$ grep '\.h$' /var/lib/dpkg/info/libusb-dev.list
/usr/include/usb.h

$ sudo apt-get install libusb-1.0-0-dev

Compiling against libusb-dev on Ubuntu

[167201.448216] usb 3-1: new full-speed USB device number 2 using uhci_hcd
[167201.606478] usb 3-1: New USB device found, idVendor=1cbe, idProduct=00fd
[167201.606490] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[167201.606497] usb 3-1: Product: In-Circuit Debug Interface
[167201.606503] usb 3-1: Manufacturer: Texas Instruments
[167201.606509] usb 3-1: SerialNumber: 0E1057CF
[167202.712884] cdc_acm 3-1:1.0: This device cannot do calls on its own. It is not a modem.
[167202.712944] cdc_acm 3-1:1.0: ttyACM0: USB ACM device
[167202.715631] usbcore: registered new interface driver cdc_acm
[167202.715635] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
$ groups
andreas adm dialout cdrom sudo dip plugdev lpadmin sambashare wireshark

$ echo 'ATTRS{idVendor}=="1cbe", ATTRS{idProduct}=="00fd", GROUP="andreas", MODE="0660"' | \
  sudo tee /etc/udev/rules.d/99-stellaris-launchpad.rules

$ sudo service udev restart
udev stop/waiting
udev start/running, process 32686

$ cd ~/src/stellaris/boards/ek-lm4f120xl/blinky/gcc
$ lm4flash blinky.bin 
Found ICDI device with serial: 0E1057CF
ICDI version: 9270

Libftdi vs FTD2XX

$ sudo apt-get install libhidapi-dev
The following NEW packages will be installed:
  libhidapi-dev libhidapi-hidraw0 libhidapi-libusb0

$ ./configure --enable-maintainer-mode --enable-ftdi --enable-stlink --enable-ti-icdi --enable-ulink --enable-usb-blaster-2 --enable-vsllink --enable-jlink --enable-osbdm --enable-opendous --enable-aice --enable-usbprog --enable-rlink --enable-armjtagew --enable-cmsis-dap --enable-jtag_vpi --enable-usb_blaster_libftdi --enable-amtjtagaccel --enable-ep93xx --enable-at91rm9200 --enable-bcm2835gpio --enable-gw16012 --enable-presto_libftdi --enable-openjtag_ftdi --enable-oocd_trace
[...]
checking whether to build a release... no
checking whether to build Doxygen as HTML... yes
checking whether to build Doxygen as PDF... no
checking whether to enable verbose JTAG I/O messages... no
checking whether to enable verbose USB I/O messages... no
checking whether to enable verbose USB communication messages... no
checking whether to enable malloc free space logging... no
checking whether to enable ZY1000 minidriver... no
checking whether to enable dummy minidriver... no
checking whether standard drivers can be built... yes
checking for LIBFTDI... no
checking for LIBFTDI... yes
checking Build & Link with libftdi...... Success
checking for libftdi highspeed device support... yes
checking for libftdi FT232H device support... yes
checking for LIBUSB1... yes
configure: libusb-1.0 header bug workaround: LIBUSB1_CFLAGS changed to "-isystem /usr/include/libusb-1.0"
checking for LIBUSB0... yes
checking for HIDAPI... no
checking for HIDAPI... yes
checking for environ in unistd.h and stdlib.h... yes
checking that generated files are newer than configure... done
[...]
OpenOCD configuration summary
--------------------------------------------------
MPSSE mode of FTDI based devices        yes
ST-Link JTAG Programmer                 yes
TI ICDI JTAG Programmer                 yes
Keil ULINK JTAG Programmer              yes
Altera USB-Blaster II Compatible        yes
Versaloon-Link JTAG Programmer          yes
Segger J-Link JTAG Programmer           yes
OSBDM (JTAG only) Programmer            yes
eStick/opendous JTAG Programmer         yes
Andes JTAG Programmer                   yes
USBProg JTAG Programmer                 yes
Raisonance RLink JTAG Programmer        yes
Olimex ARM-JTAG-EW Programmer           yes
CMSIS-DAP Compliant Debugger            yes

$ make
$ make install

$ cp /home/andreas/openocd/share/openocd/contrib/99-openocd.rules /etc/udev/rules.d

UART

UART Interrupt problem
UART Interrupt only works once (LM3S1968)

SSI / SPI

LM4F120: SPI (SSI) – interrupt receiving and transmitting
SPI example for LM4F120
Tiva Launchpad SSI Issue Need Help Please
Descripancies in ROM support for EEPROM functions
TM4C123GXL DFU USB

-DTARGET_IS_BLIZZARD_RA1
-DTARGET_IS_BLIZZARD_RB1
-DTARGET_IS_TM4C123_RB1

-DPART_TM4C123GH6PM
-DPART_LM4F120H5QR

In the latest version of TivaWare, there was a change made: TARGET_IS_BLIZZARD_RB1 is now TARGET_IS_TM4C123_RB1. 

Other Parts

LM3S9B96 (OSA)

Link error: softfp vs. hardfp

ARM compilation error, VPF registered used by executable, not object file
Can’t use hard-float with libc? (VFP register linker error)

[LD   ] bin/debug/rfid_reader.elf
arm-none-eabi-ld -T hello.ld -o bin/debug/rfid_reader.elf obj/debug/rfid_reader/startup_gcc.o obj/debug/rfid_reader/main.o obj/debug/rfid_reader/mfrc522.o obj/debug/rfid_reader/uartstdio.o -g --gc-sections -static /home/andreas/src/TivaWare/driverlib/gcc/libdriver.a /usr/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/lib/libm.a /usr/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/lib/libc.a /usr/bin/../lib/gcc/arm-none-eabi/5.4.1/libgcc.a  
arm-none-eabi-ld: error: /home/andreas/src/TivaWare/driverlib/gcc/libdriver.a(gpio.o) uses VFP register arguments, bin/debug/rfid_reader.elf does not
arm-none-eabi-ld: failed to merge target specific data of file /home/andreas/src/TivaWare/driverlib/gcc/libdriver.a(gpio.o)

ATmega48PA programmieren und flashen

avr-gcc -Wall -Os -DF_CPU=8000000  -mmcu=atmega48pa -c main.c -o main.o
unknown MCU 'atmega48pa' specified

atmega48pa ist aber kompatibel mit atmega48p:
ATmega48PA and avr-gcc
avrdude and atmega48pa

#------------------------------------------------------------
# ATmega48P
#------------------------------------------------------------

part
    id               = "m48p";
    desc             = "ATMEGA48P";
     has_debugwire = yes;
     flash_instr   = 0xB6, 0x01, 0x11;
     eeprom_instr  = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00,
                     0xBE, 0x01, 0xB6, 0x01, 0xBC, 0x00, 0xBB, 0xBF,
                     0x99, 0xF9, 0xBB, 0xAF;
    stk500_devcode   = 0x59;
    signature        = 0x1e 0x92 0x0a;
    
    pagel            = 0xd7;
    bs2              = 0xc2;
    chip_erase_delay = 45000;
    pgm_enable       = "1 0 1 0  1 1 0 0    0 1 0 1  0 0 1 1",
                       "x x x x  x x x x    x x x x  x x x x";

    chip_erase       = "1 0 1 0  1 1 0 0    1 0 0 x  x x x x",
                       "x x x x  x x x x    x x x x  x x x x";

    timeout		= 200;
    stabdelay		= 100;
    cmdexedelay		= 25;
    synchloops		= 32;
    bytedelay		= 0;
    pollindex		= 3;
    pollvalue		= 0x53;
    predelay		= 1;
    postdelay		= 1;
    pollmethod		= 1;

    pp_controlstack     =
	0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
	0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
	0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
	0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
    hventerstabdelay    = 100;
    progmodedelay       = 0;
    latchcycles         = 5;
    togglevtg           = 1;
    poweroffdelay       = 15;
    resetdelayms        = 1;
    resetdelayus        = 0;
    hvleavestabdelay    = 15;
    resetdelay          = 15;
    chiperasepulsewidth = 0;
    chiperasepolltimeout = 10;
    programfusepulsewidth = 0;
    programfusepolltimeout = 5;
    programlockpulsewidth = 0;
    programlockpolltimeout = 5;

    memory "eeprom"
        paged           = no;
        page_size       = 4;
        size            = 256;
        min_write_delay = 3600;
        max_write_delay = 3600;
        readback_p1     = 0xff;
        readback_p2     = 0xff;
	read            = "  1   0   1   0      0   0   0   0",
                          "  0   0   0   x      x   x   x   x",
                          " a7  a6  a5  a4     a3  a2  a1  a0",
                          "  o   o   o   o      o   o   o   o";

	write           = "  1   1   0   0      0   0   0   0",
                          "  0   0   0   x      x   x   x   x",
                          " a7  a6  a5  a4     a3  a2  a1  a0", 
                          "  i   i   i   i      i   i   i   i";

	loadpage_lo	= "  1   1   0   0      0   0   0   1",
			  "  0   0   0   0      0   0   0   0",
			  "  0   0   0   0      0   0  a1  a0",
			  "  i   i   i   i      i   i   i   i";

	writepage	= "  1   1   0   0      0   0   1   0",
			  "  0   0   x   x      x   x   x   x",
			  " a7  a6  a5  a4     a3  a2   0   0",
			  "  x   x   x   x      x   x   x   x";

	mode		= 0x41;
	delay		= 20;
	blocksize	= 4;
	readsize	= 256;
      ;
    memory "flash"
        paged           = yes;
        size            = 4096;
        page_size       = 64;
        num_pages       = 64;
        min_write_delay = 4500;
        max_write_delay = 4500;
        readback_p1     = 0x00;
        readback_p2     = 0x00;
        read_lo         = "  0   0   1   0    0   0   0   0",
                          "  0   0   0   0    0 a10  a9  a8",
                          " a7  a6  a5  a4   a3  a2  a1  a0",
                          "  o   o   o   o    o   o   o   o";

        read_hi         = "  0   0   1   0    1   0   0   0",
                          "  0   0   0   0    0 a10  a9  a8",
                          " a7  a6  a5  a4   a3  a2  a1  a0",
                          "  o   o   o   o    o   o   o   o";

        loadpage_lo     = "  0   1   0   0      0   0   0   0",
                          "  0   0   0   x      x   x   x   x",
                          "  x   x   x  a4     a3  a2  a1  a0",
                          "  i   i   i   i      i   i   i   i";

        loadpage_hi     = "  0   1   0   0      1   0   0   0",
                          "  0   0   0   x      x   x   x   x",
                          "  x   x   x  a4     a3  a2  a1  a0",
                          "  i   i   i   i      i   i   i   i";

        writepage       = "  0   1   0   0      1   1   0   0",
                          "  0   0   0   0      0 a10  a9  a8",
                          " a7  a6  a5   x      x   x   x   x",
                          "  x   x   x   x      x   x   x   x";

	mode		= 0x41;
	delay		= 6;
	blocksize	= 64;
	readsize	= 256;
      ;

    memory "lfuse"
        size            = 1;
        min_write_delay = 4500;
        max_write_delay = 4500;
        read            = "0 1 0 1  0 0 0 0   0 0 0 0  0 0 0 0",
                          "x x x x  x x x x   o o o o  o o o o";

        write           = "1 0 1 0  1 1 0 0   1 0 1 0  0 0 0 0",
                          "x x x x  x x x x   i i i i  i i i i";
      ;

    memory "hfuse"
        size            = 1;
        min_write_delay = 4500;
        max_write_delay = 4500;
        read            = "0 1 0 1  1 0 0 0   0 0 0 0  1 0 0 0",
                          "x x x x  x x x x   o o o o  o o o o";

        write           = "1 0 1 0  1 1 0 0   1 0 1 0  1 0 0 0",
                          "x x x x  x x x x   i i i i  i i i i";
      ;

    memory "efuse"
        size            = 1;
        min_write_delay = 4500;
        max_write_delay = 4500;
        read            = "0 1 0 1  0 0 0 0   0 0 0 0  1 0 0 0",
                          "x x x x  x x x x   x x x x  x x x o";

        write           = "1 0 1 0  1 1 0 0   1 0 1 0  0 1 0 0",
                          "x x x x  x x x x   x x x x  x x x i";
      ;

    memory "lock"
        size            = 1;
        min_write_delay = 4500;
        max_write_delay = 4500;
        read            = "0 1 0 1  1 0 0 0   0 0 0 0  0 0 0 0",
                          "x x x x  x x x x   x x o o  o o o o";

        write           = "1 0 1 0  1 1 0 0   1 1 1 x  x x x x",
                          "x x x x  x x x x   1 1 i i  i i i i";
      ;

    memory "calibration"
        size            = 1;
        read            = "0  0  1  1   1  0  0  0   0  0  0  x   x  x  x  x",
                          "0  0  0  0   0  0  0  0   o  o  o  o   o  o  o  o";
      ;

    memory "signature"
        size            = 3;
        read            = "0  0  1  1   0  0  0  0   0  0  0  x   x  x  x  x",
                          "x  x  x  x   x  x a1 a0   o  o  o  o   o  o  o  o";
      ;
  ;
DEVICE  = atmega48p
DEV_CODE = 0x31
AVRDUDE  = avrdude -C avrdude.conf -c avr910 -vvv -P com4 -x devcode=$(DEV_CODE) -b 115200 -p $(DEVICE)