From 7a5900be258f93c021535e1e8787ffeb12003308 Mon Sep 17 00:00:00 2001 From: Martin Preuss Date: Fri, 13 Sep 2024 21:41:38 +0200 Subject: [PATCH] avr: added functions to change speed. Main code might work at 8 MHz, but boot code is compiled for 1 MHz, so we need to set speed accordingly when rebooting into boot loader. --- avr/devices/n00/n00_main.asm | 24 +++++++++++++++++++++++- avr/devices/n06/n06_main.asm | 24 +++++++++++++++++++++++- avr/devices/n11/n11_main.asm | 27 ++++++++++++++++++++++++++- avr/devices/n12/n12_main.asm | 24 +++++++++++++++++++++++- avr/main.asm | 29 +++++++++++++++-------------- avr/modules/comproto/msg_reboot.asm | 1 + 6 files changed, 111 insertions(+), 18 deletions(-) diff --git a/avr/devices/n00/n00_main.asm b/avr/devices/n00/n00_main.asm index 1e55888..fb4c322 100644 --- a/avr/devices/n00/n00_main.asm +++ b/avr/devices/n00/n00_main.asm @@ -100,7 +100,7 @@ reti ; OC1A reti ; OC1B reti ; OVF1 - rjmp timerIrqOC0A ; OC0A + rjmp baseTimerIrqOC0A ; OC0A reti ; OC0B reti ; OVF0 reti ; ACI @@ -129,6 +129,8 @@ firmwareStart: rjmp main .include "common/utils_copy_sdram.asm" .include "common/crc8.asm" +.include "modules/basetimer/main.asm" + #ifdef MODULES_TIMER .include "modules/timer/main.asm" #endif @@ -244,6 +246,26 @@ timerList: .include "main.asm" +systemSetSpeed: +.if clock == 8000000 + ldi r16, (1<