Project

General

Profile

Revision d88f80e5

IDd88f80e5cbb99f68601850efc8f7cf923c4ccb3a
Parent 89f527ad
Child b99ee462

Added by Thomas Mullins about 10 years ago

Added blinky test program

View differences:

scout_avr/bom/Makefile
15 15
BOOT_FLAGS=$(FLAGS) -Wl,-Ttext=0xA00
16 16
VECT_FLAGS=$(FLAGS) -nostartfiles
17 17

  
18
default: bom.hex
18
default: bom.hex bootloader.hex bootvectors.hex
19 19

  
20 20
%.hex: %.elf
21 21
	avr-objcopy -j .text -j .data -O ihex $< $@
22 22

  
23
%.bin: %.elf
24
	avr-objcopy -j .text -j .data -O binary $< $@
25

  
23 26
bom.elf: $(SRC) $(HDR)
24 27
	avr-g++ $(FLAGS) $(SRC) -o $@
25 28

  
......
29 32
program: $(TARGET)
30 33
	avrdude -p $(PART) -c $(PROG) -P usb -B 5 -U flash:w:$(TARGET)
31 34

  
32
test.elf: test.c tiny-twi-sync.c tiny-twi-sync.h
33
	avr-g++ $(FLAGS) test.c tiny-twi-sync.c -o $@
35
blinky.elf: blinky.c
36
	avr-g++ $(FLAGS) blinky.c -o $@
34 37

  
35 38
bootloader.elf: bootloader.c tiny-twi-sync.c tiny-twi-sync.h
36 39
	avr-g++ $(BOOT_FLAGS) bootloader.c tiny-twi-sync.c -o $@
scout_avr/bom/blinky.c
1
#include <avr/io.h>
2
#include <util/delay.h>
3

  
4
int main() {
5
  DDRB |= _BV(PB4);
6
  while (1) {
7
    PINB |= _BV(PB4);
8
    _delay_ms(500);
9
  }
10
  return 0;
11
}
scout_avr/bom/bootloader.c
52 52
}
53 53

  
54 54
static void slave_rx(uint8_t *buf, int len) {
55
  if (len > 1) {
55
  if (len >= 1) {
56 56
    switch (buf[0]) {
57 57
      case BOM_I2C_PGRM:
58 58
        bom_pgrm(buf+1, len-1);

Also available in: Unified diff