INIT COMMIT
This commit is contained in:
parent
9660033528
commit
1492aea0d1
|
@ -0,0 +1,113 @@
|
||||||
|
/*
|
||||||
|
* Author: Jake Goodwin
|
||||||
|
* Date: 2022
|
||||||
|
* Description: Interfacing with a 1602LCD only with the uc no perifs
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <avr/io.h>
|
||||||
|
#include <avr/interrupt.h>
|
||||||
|
#include <avr/sleep.h>
|
||||||
|
#include <util/delay.h>
|
||||||
|
|
||||||
|
|
||||||
|
#define RS_PORT PORTD
|
||||||
|
#define RS_PIN PIND0
|
||||||
|
#define RS_DDR DDD0
|
||||||
|
|
||||||
|
|
||||||
|
#define RW_PORT PORTD
|
||||||
|
#define RW_PIN PIND1
|
||||||
|
#define RW_DDR DDD1
|
||||||
|
|
||||||
|
|
||||||
|
#define ENA_PORT PORTD
|
||||||
|
#define ENA_PIN PIND2
|
||||||
|
#define ENA_DDR DDD2
|
||||||
|
|
||||||
|
#define BIT4_PORT PORTD
|
||||||
|
#define BIT4_PIN PIND3
|
||||||
|
#define BIT4_DDR DDD3
|
||||||
|
|
||||||
|
|
||||||
|
#define BIT5_PORT PORTD
|
||||||
|
#define BIT5_PIN PIND4
|
||||||
|
#define BIT5_DDR DDD4
|
||||||
|
|
||||||
|
#define BIT6_PORT PORTD
|
||||||
|
#define BIT6_PIN PIND5
|
||||||
|
#define BIT6_DDR DDD5
|
||||||
|
|
||||||
|
#define BIT7_PORT PORTD
|
||||||
|
#define BIT7_PIN PIND6
|
||||||
|
#define BIT7_DDR DDD6
|
||||||
|
|
||||||
|
#define LED_PIN PINC0
|
||||||
|
#define LED_PORT PORTC
|
||||||
|
#define LED_DDR DDC0
|
||||||
|
|
||||||
|
//LCD CONNECTIONS
|
||||||
|
//PIND0 RS, H: data input L: Instruction input
|
||||||
|
//PIND1 RW, H: read L: write
|
||||||
|
//PIND2 ENABLE, Enable signal
|
||||||
|
//PIND3 BIT4
|
||||||
|
//PIND4 BIT5
|
||||||
|
//PIND5 BIT6
|
||||||
|
//PIND6 BIT7
|
||||||
|
|
||||||
|
//#############################
|
||||||
|
//FUNCTIONS
|
||||||
|
//#############################
|
||||||
|
|
||||||
|
void init_lcd(void) {
|
||||||
|
DDRD |= (1<<RS_DDR)|(1<<RW_DDR)|(1<<ENA_DDR)|
|
||||||
|
(1<<BIT4_PIN)|(1<<BIT5_PIN)|(1<<BIT6_PIN)|(1<<BIT7_PIN);
|
||||||
|
|
||||||
|
_delay_ms(40);
|
||||||
|
|
||||||
|
PORTD = (0<<RS_PIN)|(0<<RW_PIN)|(0<<ENA_PIN)|
|
||||||
|
(1<<BIT4_PIN)|(1<<BIT5_PIN)|(0<<BIT6_PIN)|(1<<BIT7_PIN);
|
||||||
|
|
||||||
|
_delay_ms_(5);
|
||||||
|
|
||||||
|
PORTD = (0<<RS_PIN)|(0<<RW_PIN)|(0<<ENA_PIN)|
|
||||||
|
(1<<BIT4_PIN)|(1<<BIT5_PIN)|(0<<BIT6_PIN)|(1<<BIT7_PIN);
|
||||||
|
|
||||||
|
_delay_ms(1);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void cmd_lcd() {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Input: None
|
||||||
|
* Output: None
|
||||||
|
* Description: Toggles the pin for the LED indicator.
|
||||||
|
*/
|
||||||
|
static void led_blink(void) {
|
||||||
|
//Set the DDR for output.
|
||||||
|
DDRC |= (1<<LED_PIN);
|
||||||
|
|
||||||
|
PORTC ^= (1<<LED_PIN);
|
||||||
|
_delay_ms(250);
|
||||||
|
PORTC ^= (1<<LED_PIN);
|
||||||
|
_delay_ms(250);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
//SETUP HERE.
|
||||||
|
init_lcd();
|
||||||
|
|
||||||
|
while(1) {
|
||||||
|
led_blink();
|
||||||
|
test_lcd();
|
||||||
|
_delay_ms(1000);
|
||||||
|
off_lcd();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -0,0 +1,415 @@
|
||||||
|
Archive member included to satisfy reference by file (symbol)
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_exit.o)
|
||||||
|
/usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/crtatmega328p.o (exit)
|
||||||
|
|
||||||
|
Discarded input sections
|
||||||
|
|
||||||
|
.data 0x0000000000000000 0x0 /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/crtatmega328p.o
|
||||||
|
.bss 0x0000000000000000 0x0 /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/crtatmega328p.o
|
||||||
|
.text 0x0000000000000000 0x0 1602LCD_char_display.o
|
||||||
|
.data 0x0000000000000000 0x0 1602LCD_char_display.o
|
||||||
|
.bss 0x0000000000000000 0x0 1602LCD_char_display.o
|
||||||
|
.text.cmd_lcd 0x0000000000000000 0x2 1602LCD_char_display.o
|
||||||
|
.text 0x0000000000000000 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_exit.o)
|
||||||
|
.data 0x0000000000000000 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_exit.o)
|
||||||
|
.bss 0x0000000000000000 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_exit.o)
|
||||||
|
.text.libgcc.mul
|
||||||
|
0x0000000000000000 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_exit.o)
|
||||||
|
.text.libgcc.div
|
||||||
|
0x0000000000000000 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_exit.o)
|
||||||
|
.text.libgcc 0x0000000000000000 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_exit.o)
|
||||||
|
.text.libgcc.prologue
|
||||||
|
0x0000000000000000 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_exit.o)
|
||||||
|
.text.libgcc.builtins
|
||||||
|
0x0000000000000000 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_exit.o)
|
||||||
|
.text.libgcc.fmul
|
||||||
|
0x0000000000000000 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_exit.o)
|
||||||
|
.text.libgcc.fixed
|
||||||
|
0x0000000000000000 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_exit.o)
|
||||||
|
|
||||||
|
Memory Configuration
|
||||||
|
|
||||||
|
Name Origin Length Attributes
|
||||||
|
text 0x0000000000000000 0x0000000000008000 xr
|
||||||
|
data 0x0000000000800100 0x0000000000000800 rw !x
|
||||||
|
eeprom 0x0000000000810000 0x0000000000000400 rw !x
|
||||||
|
fuse 0x0000000000820000 0x0000000000000003 rw !x
|
||||||
|
lock 0x0000000000830000 0x0000000000000400 rw !x
|
||||||
|
signature 0x0000000000840000 0x0000000000000400 rw !x
|
||||||
|
user_signatures 0x0000000000850000 0x0000000000000400 rw !x
|
||||||
|
*default* 0x0000000000000000 0xffffffffffffffff
|
||||||
|
|
||||||
|
Linker script and memory map
|
||||||
|
|
||||||
|
Address of section .data set to 0x800100
|
||||||
|
LOAD /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/crtatmega328p.o
|
||||||
|
LOAD 1602LCD_char_display.o
|
||||||
|
START GROUP
|
||||||
|
LOAD /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a
|
||||||
|
LOAD /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/libm.a
|
||||||
|
LOAD /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/libc.a
|
||||||
|
LOAD /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/libatmega328p.a
|
||||||
|
END GROUP
|
||||||
|
0x0000000000000000 __TEXT_REGION_ORIGIN__ = DEFINED (__TEXT_REGION_ORIGIN__)?__TEXT_REGION_ORIGIN__:0x0
|
||||||
|
[0x0000000000800100] __DATA_REGION_ORIGIN__ = DEFINED (__DATA_REGION_ORIGIN__)?__DATA_REGION_ORIGIN__:0x800060
|
||||||
|
[0x0000000000008000] __TEXT_REGION_LENGTH__ = DEFINED (__TEXT_REGION_LENGTH__)?__TEXT_REGION_LENGTH__:0x20000
|
||||||
|
[0x0000000000000800] __DATA_REGION_LENGTH__ = DEFINED (__DATA_REGION_LENGTH__)?__DATA_REGION_LENGTH__:0xffa0
|
||||||
|
[0x0000000000000400] __EEPROM_REGION_LENGTH__ = DEFINED (__EEPROM_REGION_LENGTH__)?__EEPROM_REGION_LENGTH__:0x10000
|
||||||
|
[0x0000000000000003] __FUSE_REGION_LENGTH__ = DEFINED (__FUSE_REGION_LENGTH__)?__FUSE_REGION_LENGTH__:0x400
|
||||||
|
0x0000000000000400 __LOCK_REGION_LENGTH__ = DEFINED (__LOCK_REGION_LENGTH__)?__LOCK_REGION_LENGTH__:0x400
|
||||||
|
0x0000000000000400 __SIGNATURE_REGION_LENGTH__ = DEFINED (__SIGNATURE_REGION_LENGTH__)?__SIGNATURE_REGION_LENGTH__:0x400
|
||||||
|
0x0000000000000400 __USER_SIGNATURE_REGION_LENGTH__ = DEFINED (__USER_SIGNATURE_REGION_LENGTH__)?__USER_SIGNATURE_REGION_LENGTH__:0x400
|
||||||
|
|
||||||
|
.hash
|
||||||
|
*(.hash)
|
||||||
|
|
||||||
|
.dynsym
|
||||||
|
*(.dynsym)
|
||||||
|
|
||||||
|
.dynstr
|
||||||
|
*(.dynstr)
|
||||||
|
|
||||||
|
.gnu.version
|
||||||
|
*(.gnu.version)
|
||||||
|
|
||||||
|
.gnu.version_d
|
||||||
|
*(.gnu.version_d)
|
||||||
|
|
||||||
|
.gnu.version_r
|
||||||
|
*(.gnu.version_r)
|
||||||
|
|
||||||
|
.rel.init
|
||||||
|
*(.rel.init)
|
||||||
|
|
||||||
|
.rela.init
|
||||||
|
*(.rela.init)
|
||||||
|
|
||||||
|
.rel.text
|
||||||
|
*(.rel.text)
|
||||||
|
*(.rel.text.*)
|
||||||
|
*(.rel.gnu.linkonce.t*)
|
||||||
|
|
||||||
|
.rela.text
|
||||||
|
*(.rela.text)
|
||||||
|
*(.rela.text.*)
|
||||||
|
*(.rela.gnu.linkonce.t*)
|
||||||
|
|
||||||
|
.rel.fini
|
||||||
|
*(.rel.fini)
|
||||||
|
|
||||||
|
.rela.fini
|
||||||
|
*(.rela.fini)
|
||||||
|
|
||||||
|
.rel.rodata
|
||||||
|
*(.rel.rodata)
|
||||||
|
*(.rel.rodata.*)
|
||||||
|
*(.rel.gnu.linkonce.r*)
|
||||||
|
|
||||||
|
.rela.rodata
|
||||||
|
*(.rela.rodata)
|
||||||
|
*(.rela.rodata.*)
|
||||||
|
*(.rela.gnu.linkonce.r*)
|
||||||
|
|
||||||
|
.rel.data
|
||||||
|
*(.rel.data)
|
||||||
|
*(.rel.data.*)
|
||||||
|
*(.rel.gnu.linkonce.d*)
|
||||||
|
|
||||||
|
.rela.data
|
||||||
|
*(.rela.data)
|
||||||
|
*(.rela.data.*)
|
||||||
|
*(.rela.gnu.linkonce.d*)
|
||||||
|
|
||||||
|
.rel.ctors
|
||||||
|
*(.rel.ctors)
|
||||||
|
|
||||||
|
.rela.ctors
|
||||||
|
*(.rela.ctors)
|
||||||
|
|
||||||
|
.rel.dtors
|
||||||
|
*(.rel.dtors)
|
||||||
|
|
||||||
|
.rela.dtors
|
||||||
|
*(.rela.dtors)
|
||||||
|
|
||||||
|
.rel.got
|
||||||
|
*(.rel.got)
|
||||||
|
|
||||||
|
.rela.got
|
||||||
|
*(.rela.got)
|
||||||
|
|
||||||
|
.rel.bss
|
||||||
|
*(.rel.bss)
|
||||||
|
|
||||||
|
.rela.bss
|
||||||
|
*(.rela.bss)
|
||||||
|
|
||||||
|
.rel.plt
|
||||||
|
*(.rel.plt)
|
||||||
|
|
||||||
|
.rela.plt
|
||||||
|
*(.rela.plt)
|
||||||
|
|
||||||
|
.text 0x0000000000000000 0xfe
|
||||||
|
*(.vectors)
|
||||||
|
.vectors 0x0000000000000000 0x68 /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/crtatmega328p.o
|
||||||
|
0x0000000000000000 __vectors
|
||||||
|
0x0000000000000000 __vector_default
|
||||||
|
*(.vectors)
|
||||||
|
*(.progmem.gcc*)
|
||||||
|
0x0000000000000068 . = ALIGN (0x2)
|
||||||
|
0x0000000000000068 __trampolines_start = .
|
||||||
|
*(.trampolines)
|
||||||
|
.trampolines 0x0000000000000068 0x0 linker stubs
|
||||||
|
*(.trampolines*)
|
||||||
|
0x0000000000000068 __trampolines_end = .
|
||||||
|
*libprintf_flt.a:*(.progmem.data)
|
||||||
|
*libc.a:*(.progmem.data)
|
||||||
|
*(.progmem*)
|
||||||
|
0x0000000000000068 . = ALIGN (0x2)
|
||||||
|
*(.jumptables)
|
||||||
|
*(.jumptables*)
|
||||||
|
*(.lowtext)
|
||||||
|
*(.lowtext*)
|
||||||
|
0x0000000000000068 __ctors_start = .
|
||||||
|
*(.ctors)
|
||||||
|
0x0000000000000068 __ctors_end = .
|
||||||
|
0x0000000000000068 __dtors_start = .
|
||||||
|
*(.dtors)
|
||||||
|
0x0000000000000068 __dtors_end = .
|
||||||
|
SORT(*)(.ctors)
|
||||||
|
SORT(*)(.dtors)
|
||||||
|
*(.init0)
|
||||||
|
.init0 0x0000000000000068 0x0 /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/crtatmega328p.o
|
||||||
|
0x0000000000000068 __init
|
||||||
|
*(.init0)
|
||||||
|
*(.init1)
|
||||||
|
*(.init1)
|
||||||
|
*(.init2)
|
||||||
|
.init2 0x0000000000000068 0xc /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/crtatmega328p.o
|
||||||
|
*(.init2)
|
||||||
|
*(.init3)
|
||||||
|
*(.init3)
|
||||||
|
*(.init4)
|
||||||
|
*(.init4)
|
||||||
|
*(.init5)
|
||||||
|
*(.init5)
|
||||||
|
*(.init6)
|
||||||
|
*(.init6)
|
||||||
|
*(.init7)
|
||||||
|
*(.init7)
|
||||||
|
*(.init8)
|
||||||
|
*(.init8)
|
||||||
|
*(.init9)
|
||||||
|
.init9 0x0000000000000074 0x8 /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/crtatmega328p.o
|
||||||
|
*(.init9)
|
||||||
|
*(.text)
|
||||||
|
.text 0x000000000000007c 0x4 /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/crtatmega328p.o
|
||||||
|
0x000000000000007c __vector_22
|
||||||
|
0x000000000000007c __vector_1
|
||||||
|
0x000000000000007c __vector_24
|
||||||
|
0x000000000000007c __vector_12
|
||||||
|
0x000000000000007c __bad_interrupt
|
||||||
|
0x000000000000007c __vector_6
|
||||||
|
0x000000000000007c __vector_3
|
||||||
|
0x000000000000007c __vector_23
|
||||||
|
0x000000000000007c __vector_25
|
||||||
|
0x000000000000007c __vector_11
|
||||||
|
0x000000000000007c __vector_13
|
||||||
|
0x000000000000007c __vector_17
|
||||||
|
0x000000000000007c __vector_19
|
||||||
|
0x000000000000007c __vector_7
|
||||||
|
0x000000000000007c __vector_5
|
||||||
|
0x000000000000007c __vector_4
|
||||||
|
0x000000000000007c __vector_9
|
||||||
|
0x000000000000007c __vector_2
|
||||||
|
0x000000000000007c __vector_21
|
||||||
|
0x000000000000007c __vector_15
|
||||||
|
0x000000000000007c __vector_8
|
||||||
|
0x000000000000007c __vector_14
|
||||||
|
0x000000000000007c __vector_10
|
||||||
|
0x000000000000007c __vector_16
|
||||||
|
0x000000000000007c __vector_18
|
||||||
|
0x000000000000007c __vector_20
|
||||||
|
0x0000000000000080 . = ALIGN (0x2)
|
||||||
|
*(.text.*)
|
||||||
|
.text.init_lcd
|
||||||
|
0x0000000000000080 0x32 1602LCD_char_display.o
|
||||||
|
0x0000000000000080 init_lcd
|
||||||
|
.text.startup.main
|
||||||
|
0x00000000000000b2 0x48 1602LCD_char_display.o
|
||||||
|
0x00000000000000b2 main
|
||||||
|
0x00000000000000fa . = ALIGN (0x2)
|
||||||
|
*(.fini9)
|
||||||
|
.fini9 0x00000000000000fa 0x0 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_exit.o)
|
||||||
|
0x00000000000000fa exit
|
||||||
|
0x00000000000000fa _exit
|
||||||
|
*(.fini9)
|
||||||
|
*(.fini8)
|
||||||
|
*(.fini8)
|
||||||
|
*(.fini7)
|
||||||
|
*(.fini7)
|
||||||
|
*(.fini6)
|
||||||
|
*(.fini6)
|
||||||
|
*(.fini5)
|
||||||
|
*(.fini5)
|
||||||
|
*(.fini4)
|
||||||
|
*(.fini4)
|
||||||
|
*(.fini3)
|
||||||
|
*(.fini3)
|
||||||
|
*(.fini2)
|
||||||
|
*(.fini2)
|
||||||
|
*(.fini1)
|
||||||
|
*(.fini1)
|
||||||
|
*(.fini0)
|
||||||
|
.fini0 0x00000000000000fa 0x4 /usr/lib/gcc/avr/5.4.0/avr5/libgcc.a(_exit.o)
|
||||||
|
*(.fini0)
|
||||||
|
0x00000000000000fe _etext = .
|
||||||
|
|
||||||
|
.data 0x0000000000800100 0x0 load address 0x00000000000000fe
|
||||||
|
[!provide] PROVIDE (__data_start, .)
|
||||||
|
*(.data)
|
||||||
|
*(.data*)
|
||||||
|
*(.gnu.linkonce.d*)
|
||||||
|
*(.rodata)
|
||||||
|
*(.rodata*)
|
||||||
|
*(.gnu.linkonce.r*)
|
||||||
|
0x0000000000800100 . = ALIGN (0x2)
|
||||||
|
0x0000000000800100 _edata = .
|
||||||
|
[!provide] PROVIDE (__data_end, .)
|
||||||
|
|
||||||
|
.bss 0x0000000000800100 0x0
|
||||||
|
[!provide] PROVIDE (__bss_start, .)
|
||||||
|
*(.bss)
|
||||||
|
*(.bss*)
|
||||||
|
*(COMMON)
|
||||||
|
[!provide] PROVIDE (__bss_end, .)
|
||||||
|
0x00000000000000fe __data_load_start = LOADADDR (.data)
|
||||||
|
0x00000000000000fe __data_load_end = (__data_load_start + SIZEOF (.data))
|
||||||
|
|
||||||
|
.noinit 0x0000000000800100 0x0
|
||||||
|
[!provide] PROVIDE (__noinit_start, .)
|
||||||
|
*(.noinit*)
|
||||||
|
[!provide] PROVIDE (__noinit_end, .)
|
||||||
|
0x0000000000800100 _end = .
|
||||||
|
[!provide] PROVIDE (__heap_start, .)
|
||||||
|
|
||||||
|
.eeprom 0x0000000000810000 0x0
|
||||||
|
*(.eeprom*)
|
||||||
|
0x0000000000810000 __eeprom_end = .
|
||||||
|
|
||||||
|
.fuse
|
||||||
|
*(.fuse)
|
||||||
|
*(.lfuse)
|
||||||
|
*(.hfuse)
|
||||||
|
*(.efuse)
|
||||||
|
|
||||||
|
.lock
|
||||||
|
*(.lock*)
|
||||||
|
|
||||||
|
.signature
|
||||||
|
*(.signature*)
|
||||||
|
|
||||||
|
.user_signatures
|
||||||
|
*(.user_signatures*)
|
||||||
|
|
||||||
|
.stab 0x0000000000000000 0x654
|
||||||
|
*(.stab)
|
||||||
|
.stab 0x0000000000000000 0x654 1602LCD_char_display.o
|
||||||
|
0x684 (size before relaxing)
|
||||||
|
|
||||||
|
.stabstr 0x0000000000000000 0xcee
|
||||||
|
*(.stabstr)
|
||||||
|
.stabstr 0x0000000000000000 0xcee 1602LCD_char_display.o
|
||||||
|
|
||||||
|
.stab.excl
|
||||||
|
*(.stab.excl)
|
||||||
|
|
||||||
|
.stab.exclstr
|
||||||
|
*(.stab.exclstr)
|
||||||
|
|
||||||
|
.stab.index
|
||||||
|
*(.stab.index)
|
||||||
|
|
||||||
|
.stab.indexstr
|
||||||
|
*(.stab.indexstr)
|
||||||
|
|
||||||
|
.comment 0x0000000000000000 0x11
|
||||||
|
*(.comment)
|
||||||
|
.comment 0x0000000000000000 0x11 1602LCD_char_display.o
|
||||||
|
0x12 (size before relaxing)
|
||||||
|
|
||||||
|
.note.gnu.avr.deviceinfo
|
||||||
|
0x0000000000000000 0x40
|
||||||
|
.note.gnu.avr.deviceinfo
|
||||||
|
0x0000000000000000 0x40 /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/crtatmega328p.o
|
||||||
|
|
||||||
|
.note.gnu.build-id
|
||||||
|
*(.note.gnu.build-id)
|
||||||
|
|
||||||
|
.debug
|
||||||
|
*(.debug)
|
||||||
|
|
||||||
|
.line
|
||||||
|
*(.line)
|
||||||
|
|
||||||
|
.debug_srcinfo
|
||||||
|
*(.debug_srcinfo)
|
||||||
|
|
||||||
|
.debug_sfnames
|
||||||
|
*(.debug_sfnames)
|
||||||
|
|
||||||
|
.debug_aranges
|
||||||
|
*(.debug_aranges)
|
||||||
|
|
||||||
|
.debug_pubnames
|
||||||
|
*(.debug_pubnames)
|
||||||
|
|
||||||
|
.debug_info 0x0000000000000000 0x5f4
|
||||||
|
*(.debug_info .gnu.linkonce.wi.*)
|
||||||
|
.debug_info 0x0000000000000000 0x5f4 /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/crtatmega328p.o
|
||||||
|
|
||||||
|
.debug_abbrev 0x0000000000000000 0x5a2
|
||||||
|
*(.debug_abbrev)
|
||||||
|
.debug_abbrev 0x0000000000000000 0x5a2 /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/crtatmega328p.o
|
||||||
|
|
||||||
|
.debug_line 0x0000000000000000 0x1a
|
||||||
|
*(.debug_line .debug_line.* .debug_line_end)
|
||||||
|
.debug_line 0x0000000000000000 0x1a /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/crtatmega328p.o
|
||||||
|
|
||||||
|
.debug_frame
|
||||||
|
*(.debug_frame)
|
||||||
|
|
||||||
|
.debug_str 0x0000000000000000 0x208
|
||||||
|
*(.debug_str)
|
||||||
|
.debug_str 0x0000000000000000 0x208 /usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/crtatmega328p.o
|
||||||
|
|
||||||
|
.debug_loc
|
||||||
|
*(.debug_loc)
|
||||||
|
|
||||||
|
.debug_macinfo
|
||||||
|
*(.debug_macinfo)
|
||||||
|
|
||||||
|
.debug_weaknames
|
||||||
|
*(.debug_weaknames)
|
||||||
|
|
||||||
|
.debug_funcnames
|
||||||
|
*(.debug_funcnames)
|
||||||
|
|
||||||
|
.debug_typenames
|
||||||
|
*(.debug_typenames)
|
||||||
|
|
||||||
|
.debug_varnames
|
||||||
|
*(.debug_varnames)
|
||||||
|
|
||||||
|
.debug_pubtypes
|
||||||
|
*(.debug_pubtypes)
|
||||||
|
|
||||||
|
.debug_ranges
|
||||||
|
*(.debug_ranges)
|
||||||
|
|
||||||
|
.debug_macro
|
||||||
|
*(.debug_macro)
|
||||||
|
OUTPUT(1602LCD_char_display.elf elf32-avr)
|
||||||
|
LOAD linker stubs
|
Binary file not shown.
|
@ -0,0 +1,210 @@
|
||||||
|
|
||||||
|
##########------------------------------------------------------##########
|
||||||
|
########## Project-specific Details ##########
|
||||||
|
########## Check these every time you start a new project ##########
|
||||||
|
##########------------------------------------------------------##########
|
||||||
|
|
||||||
|
#MCU = atmega168p
|
||||||
|
#MCU = atmega2560
|
||||||
|
#MCU = attiny85
|
||||||
|
MCU = atmega328p
|
||||||
|
F_CPU = 1000000UL
|
||||||
|
BAUD = 9600UL
|
||||||
|
## Also try BAUD = 19200 or 38400 if you're feeling lucky.
|
||||||
|
|
||||||
|
## A directory for common include files and the simple USART library.
|
||||||
|
## If you move either the current folder or the Library folder, you'll
|
||||||
|
## need to change this path to match.
|
||||||
|
#LIBDIR = ../../AVR-Programming-Library
|
||||||
|
#LIBDIR = /usr/lib/gcc/avr/5.4.0/
|
||||||
|
LIBDIR = /lib/avr/
|
||||||
|
|
||||||
|
##########------------------------------------------------------##########
|
||||||
|
########## Programmer Defaults ##########
|
||||||
|
########## Set up once, then forget about it ##########
|
||||||
|
########## (Can override. See bottom of file.) ##########
|
||||||
|
##########------------------------------------------------------##########
|
||||||
|
|
||||||
|
PROGRAMMER_TYPE = usbasp-clone
|
||||||
|
# extra arguments to avrdude: baud rate, chip type, -F flag, etc.
|
||||||
|
PROGRAMMER_ARGS = -b 9600 -B 4 -v
|
||||||
|
|
||||||
|
##########------------------------------------------------------##########
|
||||||
|
########## Program Locations ##########
|
||||||
|
########## Won't need to change if they're in your PATH ##########
|
||||||
|
##########------------------------------------------------------##########
|
||||||
|
|
||||||
|
CC = avr-gcc
|
||||||
|
OBJCOPY = avr-objcopy
|
||||||
|
OBJDUMP = avr-objdump
|
||||||
|
AVRSIZE = avr-size
|
||||||
|
AVRDUDE = avrdude
|
||||||
|
|
||||||
|
##########------------------------------------------------------##########
|
||||||
|
########## Makefile Magic! ##########
|
||||||
|
########## Summary: ##########
|
||||||
|
########## We want a .hex file ##########
|
||||||
|
########## Compile source files into .elf ##########
|
||||||
|
########## Convert .elf file into .hex ##########
|
||||||
|
########## You shouldn't need to edit below. ##########
|
||||||
|
##########------------------------------------------------------##########
|
||||||
|
|
||||||
|
## The name of your project (without the .c)
|
||||||
|
# TARGET = blinkLED
|
||||||
|
## Or name it automatically after the enclosing directory
|
||||||
|
TARGET = $(lastword $(subst /, ,$(CURDIR)))
|
||||||
|
|
||||||
|
# Object files: will find all .c/.h files in current directory
|
||||||
|
# and in LIBDIR. If you have any other (sub-)directories with code,
|
||||||
|
# you can add them in to SOURCES below in the wildcard statement.
|
||||||
|
SOURCES=$(wildcard *.c $(LIBDIR)/*.c)
|
||||||
|
OBJECTS=$(SOURCES:.c=.o)
|
||||||
|
HEADERS=$(SOURCES:.c=.h)
|
||||||
|
|
||||||
|
## Compilation options, type man avr-gcc if you're curious.
|
||||||
|
CPPFLAGS = -DF_CPU=$(F_CPU) -DBAUD=$(BAUD) -I. -I$(LIBDIR)
|
||||||
|
CFLAGS = -Os -g -std=gnu99 -Wall
|
||||||
|
## Use short (8-bit) data types
|
||||||
|
CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
|
||||||
|
## Splits up object files per function
|
||||||
|
CFLAGS += -ffunction-sections -fdata-sections
|
||||||
|
LDFLAGS = -Wl,-Map,$(TARGET).map
|
||||||
|
## Optional, but often ends up with smaller code
|
||||||
|
LDFLAGS += -Wl,--gc-sections
|
||||||
|
## Relax shrinks code even more, but makes disassembly messy
|
||||||
|
## LDFLAGS += -Wl,--relax
|
||||||
|
## LDFLAGS += -Wl,-u,vfprintf -lprintf_flt -lm ## for floating-point printf
|
||||||
|
## LDFLAGS += -Wl,-u,vfprintf -lprintf_min ## for smaller printf
|
||||||
|
TARGET_ARCH = -mmcu=$(MCU)
|
||||||
|
|
||||||
|
## Explicit pattern rules:
|
||||||
|
## To make .o files from .c files
|
||||||
|
%.o: %.c $(HEADERS) Makefile
|
||||||
|
$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c -o $@ $<;
|
||||||
|
|
||||||
|
$(TARGET).elf: $(OBJECTS)
|
||||||
|
$(CC) $(LDFLAGS) $(TARGET_ARCH) $^ $(LDLIBS) -o $@
|
||||||
|
|
||||||
|
%.hex: %.elf
|
||||||
|
$(OBJCOPY) -j .text -j .data -O ihex $< $@
|
||||||
|
|
||||||
|
%.eeprom: %.elf
|
||||||
|
$(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O ihex $< $@
|
||||||
|
|
||||||
|
%.lst: %.elf
|
||||||
|
$(OBJDUMP) -S $< > $@
|
||||||
|
|
||||||
|
## These targets don't have files named after them
|
||||||
|
.PHONY: all disassemble disasm eeprom size clean squeaky_clean flash fuses
|
||||||
|
|
||||||
|
all: $(TARGET).hex
|
||||||
|
|
||||||
|
debug:
|
||||||
|
@echo
|
||||||
|
@echo "Source files:" $(SOURCES)
|
||||||
|
@echo "MCU, F_CPU, BAUD:" $(MCU), $(F_CPU), $(BAUD)
|
||||||
|
@echo
|
||||||
|
|
||||||
|
# Optionally create listing file from .elf
|
||||||
|
# This creates approximate assembly-language equivalent of your code.
|
||||||
|
# Useful for debugging time-sensitive bits,
|
||||||
|
# or making sure the compiler does what you want.
|
||||||
|
disassemble: $(TARGET).lst
|
||||||
|
|
||||||
|
disasm: disassemble
|
||||||
|
|
||||||
|
# Optionally show how big the resulting program is
|
||||||
|
size: $(TARGET).elf
|
||||||
|
$(AVRSIZE) -C --mcu=$(MCU) $(TARGET).elf
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(TARGET).elf $(TARGET).hex $(TARGET).obj \
|
||||||
|
$(TARGET).o $(TARGET).d $(TARGET).eep $(TARGET).lst \
|
||||||
|
$(TARGET).lss $(TARGET).sym $(TARGET).map $(TARGET)~ \
|
||||||
|
$(TARGET).eeprom
|
||||||
|
|
||||||
|
squeaky_clean:
|
||||||
|
rm -f *.elf *.hex *.obj *.o *.d *.eep *.lst *.lss *.sym *.map *~ *.eeprom
|
||||||
|
|
||||||
|
##########------------------------------------------------------##########
|
||||||
|
########## Programmer-specific details ##########
|
||||||
|
########## Flashing code to AVR using avrdude ##########
|
||||||
|
##########------------------------------------------------------##########
|
||||||
|
|
||||||
|
flash: $(TARGET).hex
|
||||||
|
$(AVRDUDE) -c $(PROGRAMMER_TYPE) -p $(MCU) $(PROGRAMMER_ARGS) -U flash:w:$<
|
||||||
|
|
||||||
|
## An alias
|
||||||
|
program: flash
|
||||||
|
|
||||||
|
flash_eeprom: $(TARGET).eeprom
|
||||||
|
$(AVRDUDE) -c $(PROGRAMMER_TYPE) -p $(MCU) $(PROGRAMMER_ARGS) -U eeprom:w:$<
|
||||||
|
|
||||||
|
avrdude_terminal:
|
||||||
|
$(AVRDUDE) -c $(PROGRAMMER_TYPE) -p $(MCU) $(PROGRAMMER_ARGS) -nt
|
||||||
|
|
||||||
|
## If you've got multiple programmers that you use,
|
||||||
|
## you can define them here so that it's easy to switch.
|
||||||
|
## To invoke, use something like `make flash_arduinoISP`
|
||||||
|
flash_usbtiny: PROGRAMMER_TYPE = usbtiny
|
||||||
|
flash_usbtiny: PROGRAMMER_ARGS = # USBTiny works with no further arguments
|
||||||
|
flash_usbtiny: flash
|
||||||
|
|
||||||
|
flash_usbasp: PROGRAMMER_TYPE = usbasp
|
||||||
|
flash_usbasp: PROGRAMMER_ARGS = # USBasp works with no further arguments
|
||||||
|
flash_usbasp: flash
|
||||||
|
|
||||||
|
flash_arduinoISP: PROGRAMMER_TYPE = avrisp
|
||||||
|
flash_arduinoISP: PROGRAMMER_ARGS = -b 19200 -P /dev/ttyACM0
|
||||||
|
## (for windows) flash_arduinoISP: PROGRAMMER_ARGS = -b 19200 -P com5
|
||||||
|
flash_arduinoISP: flash
|
||||||
|
|
||||||
|
flash_109: PROGRAMMER_TYPE = avr109
|
||||||
|
flash_109: PROGRAMMER_ARGS = -b 9600 -P /dev/ttyUSB0
|
||||||
|
flash_109: flash
|
||||||
|
|
||||||
|
##########------------------------------------------------------##########
|
||||||
|
########## Fuse settings and suitable defaults ##########
|
||||||
|
##########------------------------------------------------------##########
|
||||||
|
|
||||||
|
## Mega 48, 88, 168, 328 default values
|
||||||
|
LFUSE = 0x62 #
|
||||||
|
HFUSE = 0xdf #High fuses
|
||||||
|
EFUSE = 0x00 #
|
||||||
|
|
||||||
|
## ATtiny85 Settings
|
||||||
|
#LFUSE = 0x62
|
||||||
|
#HFUSE = 0xdf
|
||||||
|
#EFUSE = 0xff
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Generic
|
||||||
|
FUSE_STRING = -U lfuse:w:$(LFUSE):m -U hfuse:w:$(HFUSE):m -U efuse:w:$(EFUSE):m
|
||||||
|
|
||||||
|
fuses:
|
||||||
|
$(AVRDUDE) -c $(PROGRAMMER_TYPE) -p $(MCU) \
|
||||||
|
$(PROGRAMMER_ARGS) $(FUSE_STRING)
|
||||||
|
show_fuses:
|
||||||
|
$(AVRDUDE) -c $(PROGRAMMER_TYPE) -p $(MCU) $(PROGRAMMER_ARGS) -nv
|
||||||
|
|
||||||
|
## Called with no extra definitions, sets to defaults
|
||||||
|
set_default_fuses: FUSE_STRING = -U lfuse:w:$(LFUSE):m -U hfuse:w:$(HFUSE):m -U efuse:w:$(EFUSE):m
|
||||||
|
set_default_fuses: fuses
|
||||||
|
|
||||||
|
## Set the fuse byte for full-speed mode
|
||||||
|
## Note: can also be set in firmware for modern chips
|
||||||
|
set_fast_fuse: LFUSE = 0xE2
|
||||||
|
set_fast_fuse: FUSE_STRING = -U lfuse:w:$(LFUSE):m
|
||||||
|
set_fast_fuse: fuses
|
||||||
|
|
||||||
|
## Set the EESAVE fuse byte to preserve EEPROM across flashes
|
||||||
|
set_eeprom_save_fuse: HFUSE = 0xD7
|
||||||
|
set_eeprom_save_fuse: FUSE_STRING = -U hfuse:w:$(HFUSE):m
|
||||||
|
set_eeprom_save_fuse: fuses
|
||||||
|
|
||||||
|
## Clear the EESAVE fuse byte
|
||||||
|
clear_eeprom_save_fuse: FUSE_STRING = -U hfuse:w:$(HFUSE):m
|
||||||
|
clear_eeprom_save_fuse: fuses
|
Loading…
Reference in New Issue