From ae1e4c3e3754fb77232f1b71e41ea758314e2cb4 Mon Sep 17 00:00:00 2001 From: Martin Preuss Date: Sun, 20 Jul 2025 00:05:53 +0200 Subject: [PATCH] avr: bootloader works with new com2w code. --- avr/devices/n27/boot/boot.asm | 4 +- avr/modules/flash/0BUILD | 1 + avr/modules/flash/io_com2w.asm | 462 +++++++++++++++++++++++++++++++++ avr/modules/flash/io_stub.asm | 60 +++++ 4 files changed, 525 insertions(+), 2 deletions(-) create mode 100644 avr/modules/flash/io_com2w.asm create mode 100644 avr/modules/flash/io_stub.asm diff --git a/avr/devices/n27/boot/boot.asm b/avr/devices/n27/boot/boot.asm index 767f207..f867d2b 100644 --- a/avr/devices/n27/boot/boot.asm +++ b/avr/devices/n27/boot/boot.asm @@ -26,6 +26,7 @@ .include "../defs.asm" .include "common/calls.asm" +.include "common/utils_io.asm" .include "devices/all/defs.asm" @@ -122,8 +123,7 @@ main: .include "modules/flash/defs.asm" .include "modules/flash/eeprom.asm" .include "modules/flash/io.asm" -.include "modules/flash/io_attn.asm" -.include "modules/flash/io_bitbang.asm" +.include "modules/flash/io_com2w.asm" .include "modules/flash/flash1p.asm" .include "modules/flash/flashxp.asm" .include "modules/flash/flashprocess.asm" diff --git a/avr/modules/flash/0BUILD b/avr/modules/flash/0BUILD index 53f3762..d6e181c 100644 --- a/avr/modules/flash/0BUILD +++ b/avr/modules/flash/0BUILD @@ -9,6 +9,7 @@ flash4p.asm flashxp.asm flashprocess.asm + io_stub.asm io.asm io_attn.asm io_bitbang.asm diff --git a/avr/modules/flash/io_com2w.asm b/avr/modules/flash/io_com2w.asm new file mode 100644 index 0000000..1a56014 --- /dev/null +++ b/avr/modules/flash/io_com2w.asm @@ -0,0 +1,462 @@ +; *************************************************************************** +; copyright : (C) 2025 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. * +; *************************************************************************** + +#ifndef AVR_MODULES_FLASH_IO_COM2W_H +#define AVR_MODULES_FLASH_IO_COM2W_H + + + + +.equ COM2W_WAITTIME1 = 30000 +.equ COM2W_WAITTIME2 = 10000 + + + + +; *************************************************************************** +; code + +.cseg + + + +; --------------------------------------------------------------------------- +; @routine ioRawInit +; +; Init raw message subsystem. +; + +ioRawInit: + ; setup CLK line (as input, disable internal pull-up resistor) + cbi COM_CLK_DDR, COM_CLK_PIN ; set CLK as input +.ifdef COM_CLK_PUE + inr r16, COM_CLK_PUE + cbr r16, (1<