From c2a6d33ff2da986bf9a6e382fd90b8a77b89c9ea Mon Sep 17 00:00:00 2001 From: Martin Preuss Date: Sun, 1 Sep 2024 22:29:08 +0200 Subject: [PATCH] avr: reduced code (bootloader now 569 words). --- avr/att84_bootloader.asm | 6 ++++++ avr/att84_temp1.asm | 1 + avr/common/0BUILD | 1 + avr/common/utils_wait_fixed.asm | 24 ++++++++++++++++++++++++ avr/modules/com2/lowlevel.asm | 18 ++---------------- avr/modules/flash/bootloader.asm | 16 +++++++--------- avr/modules/flash/recv.asm | 25 ++++++++++++------------- avr/modules/flash/wait.asm | 4 ++-- 8 files changed, 55 insertions(+), 40 deletions(-) create mode 100644 avr/common/utils_wait_fixed.asm diff --git a/avr/att84_bootloader.asm b/avr/att84_bootloader.asm index 6cf6f44..23d6646 100644 --- a/avr/att84_bootloader.asm +++ b/avr/att84_bootloader.asm @@ -77,6 +77,11 @@ .equ COM_IRQ_GIMSK_ATTN = PCIE0 +.equ LED_DDR = DDRA +.equ LED_PORT = PORTA +.equ LED_PIN = PINA +.equ LED_PINNUM = PORTA3 + ; *************************************************************************** ; code segment @@ -135,6 +140,7 @@ main: .include "modules/com2/crc.asm" .include "modules/com2/packets.asm" .include "common/crc8.asm" +.include "common/utils_wait_fixed.asm" .include "modules/flash/bootloader.asm" .include "modules/flash/flash.asm" .include "modules/flash/recv.asm" diff --git a/avr/att84_temp1.asm b/avr/att84_temp1.asm index 080ddea..d448a72 100644 --- a/avr/att84_temp1.asm +++ b/avr/att84_temp1.asm @@ -258,6 +258,7 @@ firmwareStart: rjmp main ; includes .include "common/utils.asm" +.include "common/utils_wait_fixed.asm" .include "common/crc8.asm" #ifdef MODULES_TIMER diff --git a/avr/common/0BUILD b/avr/common/0BUILD index 87f2b64..5b0af2a 100644 --- a/avr/common/0BUILD +++ b/avr/common/0BUILD @@ -8,6 +8,7 @@ shared.asm utils.asm utils_wait.asm + utils_wait_fixed.asm watchdog.asm diff --git a/avr/common/utils_wait_fixed.asm b/avr/common/utils_wait_fixed.asm new file mode 100644 index 0000000..66ba62c --- /dev/null +++ b/avr/common/utils_wait_fixed.asm @@ -0,0 +1,24 @@ +; *************************************************************************** +; copyright : (C) 2023 by Martin Preuss +; email : martin@libchipcard.de +; +; *************************************************************************** +; * This file is part of the project "AqHome". * +; * Please see toplevel file COPYING of that project for license details. * +; *************************************************************************** + + + + +; --------------------------------------------------------------------------- +; wait for 10 microsecs (minus cycles for call and ret). +; +; IN: +; - nothing +; OUT: +; - nothing +; REGS: r22 + +Utils_WaitFor10MicroSecs: + Utils_WaitNanoSecs 10000, 7, r22 ; wait for 10us (minus RCALL and RET) + ret diff --git a/avr/modules/com2/lowlevel.asm b/avr/modules/com2/lowlevel.asm index a93bc5a..6c85c43 100644 --- a/avr/modules/com2/lowlevel.asm +++ b/avr/modules/com2/lowlevel.asm @@ -163,7 +163,7 @@ com2WaitForDataState1ms_loop: eor r22, r16 andi r22, (1<