From edf5f145013aa28ffbc7f19f874cd489a92f8449 Mon Sep 17 00:00:00 2001 From: rodri Date: Sat, 5 Jun 2021 11:10:23 +0000 Subject: public release. --- asm/blinkdelay2/avr.map | 404 +++++++++++++++++++++++++++++++++++++++++++++++ asm/blinkdelay2/avrdasm | 2 + asm/blinkdelay2/blink.s | 67 ++++++++ asm/blinkdelay2/dat.h | 25 +++ asm/blinkdelay2/link.ld | 56 +++++++ asm/blinkdelay2/m328p.ld | 8 + asm/blinkdelay2/makefile | 19 +++ 7 files changed, 581 insertions(+) create mode 100644 asm/blinkdelay2/avr.map create mode 100755 asm/blinkdelay2/avrdasm create mode 100644 asm/blinkdelay2/blink.s create mode 100644 asm/blinkdelay2/dat.h create mode 100644 asm/blinkdelay2/link.ld create mode 100644 asm/blinkdelay2/m328p.ld create mode 100644 asm/blinkdelay2/makefile (limited to 'asm/blinkdelay2') diff --git a/asm/blinkdelay2/avr.map b/asm/blinkdelay2/avr.map new file mode 100644 index 0000000..844079f --- /dev/null +++ b/asm/blinkdelay2/avr.map @@ -0,0 +1,404 @@ +Archive member included to satisfy reference by file (symbol) + +/usr/lib/gcc/avr/8.2.0/avr5/libgcc.a(_exit.o) + /usr/lib/gcc/avr/8.2.0/../../../../avr/lib/avr5/crtatmega328p.o (exit) + +Memory Configuration + +Name Origin Length Attributes +text 0x0000000000000000 0x0000000000020000 xr +data 0x0000000000800060 0x000000000000ffa0 rw !x +eeprom 0x0000000000810000 0x0000000000010000 rw !x +fuse 0x0000000000820000 0x0000000000000400 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/8.2.0/../../../../avr/lib/avr5/crtatmega328p.o +LOAD /tmp/ccnHW39M.o +START GROUP +LOAD /usr/lib/gcc/avr/8.2.0/avr5/libgcc.a +LOAD /usr/lib/gcc/avr/8.2.0/../../../../avr/lib/avr5/libm.a +LOAD /usr/lib/gcc/avr/8.2.0/../../../../avr/lib/avr5/libc.a +LOAD /usr/lib/gcc/avr/8.2.0/../../../../avr/lib/avr5/libatmega328p.a +END GROUP + 0x0000000000020000 __TEXT_REGION_LENGTH__ = DEFINED (__TEXT_REGION_LENGTH__)?__TEXT_REGION_LENGTH__:0x20000 + 0x000000000000ffa0 __DATA_REGION_LENGTH__ = DEFINED (__DATA_REGION_LENGTH__)?__DATA_REGION_LENGTH__:0xffa0 + 0x0000000000010000 __EEPROM_REGION_LENGTH__ = DEFINED (__EEPROM_REGION_LENGTH__)?__EEPROM_REGION_LENGTH__:0x10000 + 0x0000000000000400 __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 0x124 + *(.vectors) + .vectors 0x0000000000000000 0x68 /usr/lib/gcc/avr/8.2.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) + *(.lowtext) + *(.lowtext*) + 0x0000000000000068 __ctors_start = . + *(.ctors) + 0x0000000000000068 __ctors_end = . + 0x0000000000000068 __dtors_start = . + *(.dtors) + 0x0000000000000068 __dtors_end = . + SORT_BY_NAME(*)(.ctors) + SORT_BY_NAME(*)(.dtors) + *(.init0) + .init0 0x0000000000000068 0x0 /usr/lib/gcc/avr/8.2.0/../../../../avr/lib/avr5/crtatmega328p.o + 0x0000000000000068 __init + *(.init0) + *(.init1) + *(.init1) + *(.init2) + .init2 0x0000000000000068 0xc /usr/lib/gcc/avr/8.2.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/8.2.0/../../../../avr/lib/avr5/crtatmega328p.o + *(.init9) + *(.text) + .text 0x000000000000007c 0x4 /usr/lib/gcc/avr/8.2.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 + .text 0x0000000000000080 0xa0 /tmp/ccnHW39M.o + 0x0000000000000080 vectors + 0x00000000000000fe main + .text 0x0000000000000120 0x0 /usr/lib/gcc/avr/8.2.0/avr5/libgcc.a(_exit.o) + 0x0000000000000120 . = ALIGN (0x2) + *(.text.*) + .text.libgcc.mul + 0x0000000000000120 0x0 /usr/lib/gcc/avr/8.2.0/avr5/libgcc.a(_exit.o) + .text.libgcc.div + 0x0000000000000120 0x0 /usr/lib/gcc/avr/8.2.0/avr5/libgcc.a(_exit.o) + .text.libgcc 0x0000000000000120 0x0 /usr/lib/gcc/avr/8.2.0/avr5/libgcc.a(_exit.o) + .text.libgcc.prologue + 0x0000000000000120 0x0 /usr/lib/gcc/avr/8.2.0/avr5/libgcc.a(_exit.o) + .text.libgcc.builtins + 0x0000000000000120 0x0 /usr/lib/gcc/avr/8.2.0/avr5/libgcc.a(_exit.o) + .text.libgcc.fmul + 0x0000000000000120 0x0 /usr/lib/gcc/avr/8.2.0/avr5/libgcc.a(_exit.o) + .text.libgcc.fixed + 0x0000000000000120 0x0 /usr/lib/gcc/avr/8.2.0/avr5/libgcc.a(_exit.o) + 0x0000000000000120 . = ALIGN (0x2) + *(.fini9) + .fini9 0x0000000000000120 0x0 /usr/lib/gcc/avr/8.2.0/avr5/libgcc.a(_exit.o) + 0x0000000000000120 exit + 0x0000000000000120 _exit + *(.fini9) + *(.fini8) + *(.fini8) + *(.fini7) + *(.fini7) + *(.fini6) + *(.fini6) + *(.fini5) + *(.fini5) + *(.fini4) + *(.fini4) + *(.fini3) + *(.fini3) + *(.fini2) + *(.fini2) + *(.fini1) + *(.fini1) + *(.fini0) + .fini0 0x0000000000000120 0x4 /usr/lib/gcc/avr/8.2.0/avr5/libgcc.a(_exit.o) + *(.fini0) + *(.hightext) + *(.hightext*) + *(.progmemx.*) + 0x0000000000000124 . = ALIGN (0x2) + *(.jumptables) + *(.jumptables*) + 0x0000000000000124 _etext = . + +.data 0x0000000000800100 0x0 load address 0x0000000000000124 + [!provide] PROVIDE (__data_start = .) + *(.data) + .data 0x0000000000800100 0x0 /usr/lib/gcc/avr/8.2.0/../../../../avr/lib/avr5/crtatmega328p.o + .data 0x0000000000800100 0x0 /tmp/ccnHW39M.o + .data 0x0000000000800100 0x0 /usr/lib/gcc/avr/8.2.0/avr5/libgcc.a(_exit.o) + *(.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 0x0000000000800100 0x0 /usr/lib/gcc/avr/8.2.0/../../../../avr/lib/avr5/crtatmega328p.o + .bss 0x0000000000800100 0x0 /tmp/ccnHW39M.o + .bss 0x0000000000800100 0x0 /usr/lib/gcc/avr/8.2.0/avr5/libgcc.a(_exit.o) + *(.bss*) + *(COMMON) + [!provide] PROVIDE (__bss_end = .) + 0x0000000000000124 __data_load_start = LOADADDR (.data) + 0x0000000000000124 __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*) + +.stab + *(.stab) + +.stabstr + *(.stabstr) + +.stab.excl + *(.stab.excl) + +.stab.exclstr + *(.stab.exclstr) + +.stab.index + *(.stab.index) + +.stab.indexstr + *(.stab.indexstr) + +.comment + *(.comment) + +.note.gnu.avr.deviceinfo + 0x0000000000000000 0x40 + .note.gnu.avr.deviceinfo + 0x0000000000000000 0x40 /usr/lib/gcc/avr/8.2.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/8.2.0/../../../../avr/lib/avr5/crtatmega328p.o + +.debug_abbrev 0x0000000000000000 0x5a2 + *(.debug_abbrev) + .debug_abbrev 0x0000000000000000 0x5a2 /usr/lib/gcc/avr/8.2.0/../../../../avr/lib/avr5/crtatmega328p.o + +.debug_line 0x0000000000000000 0x1d + *(.debug_line .debug_line.* .debug_line_end) + .debug_line 0x0000000000000000 0x1d /usr/lib/gcc/avr/8.2.0/../../../../avr/lib/avr5/crtatmega328p.o + +.debug_frame + *(.debug_frame) + +.debug_str 0x0000000000000000 0x208 + *(.debug_str) + .debug_str 0x0000000000000000 0x208 /usr/lib/gcc/avr/8.2.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) + +.debug_addr + *(.debug_addr) +OUTPUT(blink.elf elf32-avr) +LOAD linker stubs diff --git a/asm/blinkdelay2/avrdasm b/asm/blinkdelay2/avrdasm new file mode 100755 index 0000000..ea0707b --- /dev/null +++ b/asm/blinkdelay2/avrdasm @@ -0,0 +1,2 @@ +#!/bin/sh +avr-objdump -D *.elf diff --git a/asm/blinkdelay2/blink.s b/asm/blinkdelay2/blink.s new file mode 100644 index 0000000..efc9255 --- /dev/null +++ b/asm/blinkdelay2/blink.s @@ -0,0 +1,67 @@ +.include "dat.h" + +vectors: + jmp start + jmp badirq ; IRQ0 + jmp badirq ; IRQ1 + jmp badirq ; PCINT0 + jmp badirq ; PCINT1 + jmp badirq ; PCINT2 + jmp badirq ; Watchdog Timeout + jmp badirq ; Timer2 CompareA + jmp badirq ; Timer2 CompareB + jmp badirq ; Timer2 Overflow + jmp badirq ; Timer1 Capture + jmp badirq ; Timer1 CompareA + jmp badirq ; Timer1 CompareB + jmp badirq ; Timer1 Overflow + jmp badirq ; Timer0 CompareA + jmp badirq ; Timer0 CompareB + jmp badirq ; Timer0 Overflow + jmp badirq ; SPI Transfer Complete + jmp badirq ; USART RX Complete + jmp badirq ; USART UDR Empty + jmp badirq ; USART TX Complete + jmp badirq ; ADC Conversion Complete + jmp badirq ; EEPROM Ready + jmp badirq ; Analog Comparator + jmp badirq ; 2-wire Serial + jmp badirq ; SPM Ready + +start: + eor r1, r1 + out SREG, r1 + ldi r28, 0xff + ldi r29, 0x8 + out SPL, r28 + out SPH, r29 + call main +halt: + rjmp halt + +badirq: + jmp vectors + +.globl main +main: + ldi r16, 1<text + .data : + { + *(.data) + . = ALIGN(2); + _edata = . ; + } >data AT>text + .bss ADDR(.data) + SIZEOF (.data) : AT (ADDR (.bss)) + { + *(.bss) + *(.bss*) + *(COMMON) + . = ALIGN(2); + } >data + .eeprom : + { + KEEP(*(.eeprom*)) + } >eeprom + .fuse : + { + KEEP(*(.fuse)) + KEEP(*(.lfuse)) + KEEP(*(.hfuse)) + KEEP(*(.efuse)) + } >fuse + .lock : + { + KEEP(*(.lock*)) + } >lock + .signature : + { + KEEP(*(.signature*)) + } >signature + _end = .; +} diff --git a/asm/blinkdelay2/m328p.ld b/asm/blinkdelay2/m328p.ld new file mode 100644 index 0000000..cc16198 --- /dev/null +++ b/asm/blinkdelay2/m328p.ld @@ -0,0 +1,8 @@ +SECTIONS +{ + . = 0x0; + .text : { *(.text) } + . = 0x8000000; + .data : { *(.data) } + .bss : { *(.bss) } +} diff --git a/asm/blinkdelay2/makefile b/asm/blinkdelay2/makefile new file mode 100644 index 0000000..063bd39 --- /dev/null +++ b/asm/blinkdelay2/makefile @@ -0,0 +1,19 @@ +AS=avr-as +LD=avr-ld +LDSCRIPT=link.ld + +PORT=/dev/ttyACM0 +TARG=blink + +all: build + +build: + $(AS) -mmcu=atmega328p -c -o $(TARG).o $(TARG).s + $(LD) -T$(LDSCRIPT) -o $(TARG).elf $(TARG).o + avr-objcopy -j .text -j .data -O ihex $(TARG).elf $(TARG).hex + +burn: + avrdude -v -p atmega328p -c arduino -P $(PORT) -b 115200 -D -U flash:w:$(TARG).hex + +clean: + rm -f $(TARG).elf $(TARG).o $(TARG).hex -- cgit v1.2.3