aboutsummaryrefslogtreecommitdiff
path: root/tools/avr_codegen
diff options
context:
space:
mode:
authorCharles Lohr <lohr85@gmail.com>2016-12-05 21:27:57 -0500
committerCharles Lohr <lohr85@gmail.com>2016-12-05 21:27:57 -0500
commit110e71c2334950b0fcdd2f90bff595f55390666d (patch)
treea77dfa7cb83f13246218ef00c99def0638245269 /tools/avr_codegen
parentced3b89795a5d3698da27749339670bd4da121c7 (diff)
downloadlibsurvive-110e71c2334950b0fcdd2f90bff595f55390666d.tar.gz
libsurvive-110e71c2334950b0fcdd2f90bff595f55390666d.tar.bz2
Update with changes from livestream.
Diffstat (limited to 'tools/avr_codegen')
-rw-r--r--tools/avr_codegen/Makefile3
-rw-r--r--tools/avr_codegen/test.c57
-rwxr-xr-xtools/avr_codegen/test.elfbin6744 -> 6792 bytes
-rw-r--r--tools/avr_codegen/test.hex8
4 files changed, 32 insertions, 36 deletions
diff --git a/tools/avr_codegen/Makefile b/tools/avr_codegen/Makefile
index fc2c712..e7b8673 100644
--- a/tools/avr_codegen/Makefile
+++ b/tools/avr_codegen/Makefile
@@ -1,5 +1,5 @@
-all : test.hex burn test.lst
+all : test.hex test.lst
PART=attiny85
PROGPART=t85
@@ -10,6 +10,7 @@ CC=avr-gcc
test.hex : test.elf
avr-objcopy -j .text -j .data -O ihex test.elf test.hex
+ avrdude -c usbtiny -p $(PROGPART) -V -U flash:w:test.hex
test.elf : test.c
avr-gcc -I -g $(CFLAGS) -mmcu=$(PART) -Wl,-Map,test.map -o $@ test.c -L/usr/lib/binutils/avr/2.18
diff --git a/tools/avr_codegen/test.c b/tools/avr_codegen/test.c
index 24b9066..2c875f1 100644
--- a/tools/avr_codegen/test.c
+++ b/tools/avr_codegen/test.c
@@ -26,6 +26,7 @@ static void setup_clock( void )
int main( )
{
+ int k;
cli();
setup_clock();
DDRB = _BV(4) | _BV(3) | _BV(1);
@@ -50,38 +51,30 @@ int main( )
// 14 = 0x95 0x01
// 15 = 0xa1 0x01
//0x10 = 0xab 0x01
- marker = 30;
- do{
- PORTB = _BV(3); //4 = 0x40 3 = 0x48 1 = 0x50
- marker--;
- PORTB = 0;
- } while( marker );
- marker = 30;
-/* do{
- PORTB = _BV(3)|_BV(1); //4 = 0x40 3 = 0x48 1 = 0x50
- marker--;
- PORTB = 0;
- } while( marker );
- marker = 30;
- do{
- PORTB = _BV(3); //4 = 0x40 3 = 0x48 1 = 0x50
- marker--;
- PORTB = 0;
- } while( marker );
- marker = 30;
- do{
- PORTB = _BV(3)|_BV(4); //4 = 0x40 3 = 0x48 1 = 0x50
- marker--;
- PORTB = 0;
- } while( marker );
- marker = 30;
- do{
- PORTB = _BV(3); //4 = 0x40 3 = 0x48 1 = 0x50
- marker--;
- PORTB = 0;
- } while( marker );
- _delay_us(80);
-*/
+
+ // 0x81 0x04
+ // <- <-
+
+ // First look at 0x04. There will be another byte because it is less than
+ // 128!
+ // 0x04<<7 = 0x200
+ // Because 0x81 is >= 128, it's a terminator.
+ // 0x200 | 0x81 = 0x281 << The actual value
+ //
+
+ // _BV(x) is a synonym for (1<<x)
+ #define LED48 _BV(3)
+ #define LED40 _BV(4)
+ #define LED50 _BV(1)
+ //Marker = Length of time for following
+
+ #define DO_MARKER( time, LEDS ) \
+ marker = time; do { PORTB = LEDS; marker--; PORTB = 0; } while( marker );
+ DO_MARKER( 22, LED40 );
+ DO_MARKER( 22, LED50|LED40 );
+ DO_MARKER( 22, LED50 );
+
+
/*
marker = 30;
do{
diff --git a/tools/avr_codegen/test.elf b/tools/avr_codegen/test.elf
index 7ccc392..3ebb44e 100755
--- a/tools/avr_codegen/test.elf
+++ b/tools/avr_codegen/test.elf
Binary files differ
diff --git a/tools/avr_codegen/test.hex b/tools/avr_codegen/test.hex
index 188c3fe..eda91aa 100644
--- a/tools/avr_codegen/test.hex
+++ b/tools/avr_codegen/test.hex
@@ -1,10 +1,12 @@
:100000000EC015C014C013C012C011C010C00FC064
:100010000EC00DC00CC00BC00AC009C008C011241E
-:100020001FBECFE5D2E0DEBFCDBF1AD02EC0E8CFD5
+:100020001FBECFE5D2E0DEBFCDBF1AD03AC0E8CFC9
:100030000F931F9300E010E0980106171707280799
:10004000390759F0EFECF7E03197F1F700C0000005
:100050000F5F1F4F2F4F3F4FF0CF1F910F9108950C
:10006000F89480E886BD16BC80E381BF8AE187BB37
-:1000700098E08EE198BB18BA8150E1F7EFE1FEE419
-:0E0080003197F1F700C00000F4CFF894FFCFE5
+:1000700090E122E132E086E198BB18BA8150E1F7C5
+:1000800086E128BB18BA8150E1F786E138BB18BA7F
+:100090008150E1F7EFE1FEE43197F1F700C0000095
+:0600A000EACFF894FFCF47
:00000001FF