From e1ab22ff54798fe0b5ddc0e2f029bb99a36beca5 Mon Sep 17 00:00:00 2001 From: Christopher Kormanyos Date: Fri, 29 Dec 2023 18:04:53 +0100 Subject: [PATCH 1/2] Upgrade avr-gcc on Win* to 12.3.0 --- .../micros/atmega4809/make/atmega4809.ld | 31 ++---- .../atmega4809/make/atmega4809_flags.gmk | 9 +- .../micros/atmega4809/startup/int_vect.cpp | 101 +++++++++--------- ref_app/target/micros/avr/make/avr_flags.gmk | 4 +- .../target/micros/avr/startup/int_vect.cpp | 60 ++++++----- 5 files changed, 98 insertions(+), 107 deletions(-) diff --git a/ref_app/target/micros/atmega4809/make/atmega4809.ld b/ref_app/target/micros/atmega4809/make/atmega4809.ld index 982cecc1b..88ec5b134 100644 --- a/ref_app/target/micros/atmega4809/make/atmega4809.ld +++ b/ref_app/target/micros/atmega4809/make/atmega4809.ld @@ -1,6 +1,5 @@ - /* - Copyright Christopher Kormanyos 2021. + Copyright Christopher Kormanyos 2021 - 2023. Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -8,15 +7,11 @@ /* Linker script for ATMEL(R) AVR(R) ATmega32P. */ -INPUT(libgcc.a libc.a libm.a) +INPUT(libc.a libm.a libgcc.a) OUTPUT_FORMAT("elf32-avr","elf32-avr","elf32-avr") OUTPUT_ARCH(avr:103) -/* The beginning and end of the program ROM area. */ -_rom_begin = 0x00000000; -_rom_end = 0x0000BFFC; - /* The beginning and end (i.e., top) of the stack */ /* Set up a stack with a size of 0x200=(1/2)K */ _stack_begin = 0x00803E00; @@ -27,8 +22,9 @@ __initial_stack_pointer = 0x00803FFE; MEMORY { - ROM(rx) : ORIGIN = 0, LENGTH = 48K - 4 - RAM(rw!x) : ORIGIN = 0x00802800, LENGTH = 0x00001600 + VEC(rx) : ORIGIN = 0, LENGTH = 0x100 + ROM(rx) : ORIGIN = 0x100, LENGTH = 48K - 0x100 + RAM(rwx) : ORIGIN = 0x00802800, LENGTH = 0x00001600 } SECTIONS @@ -42,7 +38,7 @@ SECTIONS *(.isr_vector) . = ALIGN(0x10); KEEP(*(.isr_vector)) - } > ROM = 0xAAAA + } > VEC = 0x5555 /* Startup code */ .startup : @@ -69,13 +65,12 @@ SECTIONS . = ALIGN(2); *(.text*) . = ALIGN(2); + *(.rodata) + . = ALIGN(2); + *(.rodata*) + . = ALIGN(2); } > ROM - .text : - { - . = ALIGN(0x10); - } > ROM = 0xAAAA - . = 0x00802800; . = ALIGN(2); @@ -89,12 +84,6 @@ SECTIONS *(.data*) . = ALIGN(2); KEEP (*(.data*)) - *(.rodata) /* Do *NOT* move this! Include .rodata here if gcc is used with -fdata-sections. */ - . = ALIGN(2); - KEEP (*(.rodata)) - *(.rodata*) - . = ALIGN(2); - KEEP (*(.rodata*)) _data_end = .; } > RAM AT > ROM diff --git a/ref_app/target/micros/atmega4809/make/atmega4809_flags.gmk b/ref_app/target/micros/atmega4809/make/atmega4809_flags.gmk index ae0e0bd2a..9035157ae 100644 --- a/ref_app/target/micros/atmega4809/make/atmega4809_flags.gmk +++ b/ref_app/target/micros/atmega4809/make/atmega4809_flags.gmk @@ -10,7 +10,7 @@ # ------------------------------------------------------------------------------ ifneq ($(MAKE),make) -GCC_VERSION = 11.2.0 +GCC_VERSION = 12.3.0 endif GCC_TARGET = avr GCC_PREFIX = avr @@ -25,11 +25,10 @@ TGT_ALLFLAGS = -O2 -finline-limit=16 \ -fsigned-char \ -ifeq ($(GCC_VERSION),11.2.0) +ifeq ($(GCC_VERSION),12.3.0) TGT_ALLFLAGS := $(TGT_ALLFLAGS) \ - -mlong-double=64 \ - -DAVR_LIBC_LEGACY_IO=0 \ - -D__AVR_DEV_LIB_NAME__=atmega4809 + -mdouble=32 \ + -mlong-double=64 endif TGT_CFLAGS = -std=c99 \ diff --git a/ref_app/target/micros/atmega4809/startup/int_vect.cpp b/ref_app/target/micros/atmega4809/startup/int_vect.cpp index ce3a14f63..389db8db9 100644 --- a/ref_app/target/micros/atmega4809/startup/int_vect.cpp +++ b/ref_app/target/micros/atmega4809/startup/int_vect.cpp @@ -1,11 +1,12 @@ /////////////////////////////////////////////////////////////////////////////// -// Copyright Christopher Kormanyos 2007 - 2019. +// Copyright Christopher Kormanyos 2007 - 2023. // Distributed under the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt // or copy at http://www.boost.org/LICENSE_1_0.txt) // #include +#include #include #include @@ -22,63 +23,63 @@ void __vector_unused_irq() } } -namespace +namespace local { typedef struct struct_isr_type { typedef void(*function_type)(); - const std::uint8_t jmp[2]; // JMP instruction (0x940C): 0x0C = low byte, 0x94 = high byte. - const function_type func; // The interrupt service routine. + const std::uint8_t jmp[static_cast(UINT8_C(2))]; // JMP instruction (0x940C): 0x0C = low byte, 0x94 = high byte. + const function_type func; // The interrupt service routine. } isr_type; -} -extern "C" -const volatile std::array __isr_vector __attribute__((section(".isr_vector"))); + constexpr auto count_of_isr_vector = static_cast(UINT8_C(40)); -extern "C" -const volatile std::array __isr_vector = + using isr_vector_array_type = std::array; +} + +const volatile local::isr_vector_array_type my_isr_vector __attribute__((section(".isr_vector"))) = {{ - // addr. nr. interrupt source - { { 0x0C, 0x94 }, __my_startup }, // 0x00 RESET - { { 0x0C, 0x94 }, __vector_unused_irq }, // 0x02 NMI Non-Maskable Interrupt from CRC 2 - { { 0x0C, 0x94 }, __vector_unused_irq }, // 0x04 VLM Voltage Level Monitor 3 - { { 0x0C, 0x94 }, __vector_3 }, // 0x06 RTC Overflow or compare match 4 - { { 0x0C, 0x94 }, __vector_unused_irq }, // 0x08 PIT Periodic interrupt 5 - { { 0x0C, 0x94 }, __vector_unused_irq }, // 0x0A CCL Configurable Custom Logic 6 - { { 0x0C, 0x94 }, __vector_unused_irq }, // 0x0C PORTA External interrupt 7 - { { 0x0C, 0x94 }, __vector_unused_irq }, // 0x0E TCA0 Overflow 8 - { { 0x0C, 0x94 }, __vector_unused_irq }, // 0x10 TCA0 Underflow (Split mode) 9 - { { 0x0C, 0x94 }, __vector_unused_irq }, // 0x12 TCA0 Compare channel 0 - { { 0x0C, 0x94 }, __vector_unused_irq }, // 0x14 TCA0 Compare channel 1 11 - { { 0x0C, 0x94 }, __vector_unused_irq }, // 0x16 TCA0 Compare channel 2 12 - { { 0x0C, 0x94 }, __vector_unused_irq }, // 0x18 TCB0 Capture 13 - { { 0x0C, 0x94 }, __vector_unused_irq }, // 0x1A TCB1 Capture 14 - { { 0x0C, 0x94 }, __vector_unused_irq }, // 0x1C TWI0 Slave 15 - { { 0x0C, 0x94 }, __vector_unused_irq }, // 0x1E TWI0 Master 16 - { { 0x0C, 0x94 }, __vector_unused_irq }, // 0x20 SPI0 Serial Peripheral Interface 0 17 - { { 0x0C, 0x94 }, __vector_unused_irq }, // 0x22 USART0 Receive Complete 18 - { { 0x0C, 0x94 }, __vector_unused_irq }, // 0x24 USART0 Data Register Empty 19 - { { 0x0C, 0x94 }, __vector_unused_irq }, // 0x26 USART0 Transmit Complete 20 - { { 0x0C, 0x94 }, __vector_unused_irq }, // 0x28 PORTD External interrupt 21 - { { 0x0C, 0x94 }, __vector_unused_irq }, // 0x2A AC0 Compare 22 - { { 0x0C, 0x94 }, __vector_unused_irq }, // 0x2C ADC0 Result Ready 23 - { { 0x0C, 0x94 }, __vector_unused_irq }, // 0x2E ADC0 Window Compare 24 - { { 0x0C, 0x94 }, __vector_unused_irq }, // 0x30 PORTC External interrupt 25 - { { 0x0C, 0x94 }, __vector_unused_irq }, // 0x32 TCB2 Capture 26 - { { 0x0C, 0x94 }, __vector_unused_irq }, // 0x34 USART1 Receive Complete 27 - { { 0x0C, 0x94 }, __vector_unused_irq }, // 0x36 USART1 Data Register Empty 28 - { { 0x0C, 0x94 }, __vector_unused_irq }, // 0x38 USART1 Transmit Complete 29 - { { 0x0C, 0x94 }, __vector_unused_irq }, // 0x3A PORTF External interrupt 30 - { { 0x0C, 0x94 }, __vector_unused_irq }, // 0x3C NVM Ready 31 - { { 0x0C, 0x94 }, __vector_unused_irq }, // 0x3E USART2 Receive Complete 32 - { { 0x0C, 0x94 }, __vector_unused_irq }, // 0x40 USART2 Data Register Empty 33 - { { 0x0C, 0x94 }, __vector_unused_irq }, // 0x42 USART2 Transmit Complete 34 - { { 0x0C, 0x94 }, __vector_unused_irq }, // 0x44 PORTB External interruptX35 - { { 0x0C, 0x94 }, __vector_unused_irq }, // 0x46 PORTE External interrupt 36 - { { 0x0C, 0x94 }, __vector_unused_irq }, // 0x48 TCB3 Capture 37 - { { 0x0C, 0x94 }, __vector_unused_irq }, // 0x4A USART3 Receive Complete 38 - { { 0x0C, 0x94 }, __vector_unused_irq }, // 0x4C USART3 Data Register Empty 39 - { { 0x0C, 0x94 }, __vector_unused_irq } // 0x4E USART3 Transmit Complete + // address index interrupt source + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __my_startup }, // 0x00 0 RESET + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x02 1 NMI Non-Maskable Interrupt from CRC + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x04 2 VLM Voltage Level Monitor + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_3 }, // 0x06 3 RTC Overflow or compare match + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x08 4 PIT Periodic interrupt + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x0A 5 CCL Configurable Custom Logic + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x0C 6 PORTA External interrupt + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x0E 7 TCA0 Overflow + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x10 8 TCA0 Underflow (Split mode) + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x12 9 TCA0 Compare channel + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x14 10 TCA0 Compare channel 1 + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x16 11 TCA0 Compare channel 2 + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x18 12 TCB0 Capture + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x1A 13 TCB1 Capture + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x1C 14 TWI0 Slave + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x1E 15 TWI0 Master + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x20 16 SPI0 Serial Peripheral Interface 0 + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x22 17 USART0 Receive Complete + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x24 18 USART0 Data Register Empty + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x26 19 USART0 Transmit Complete + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x28 20 PORTD External interrupt + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x2A 21 AC0 Compare + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x2C 22 ADC0 Result Ready + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x2E 23 ADC0 Window Compare + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x30 24 PORTC External interrupt + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x32 25 TCB2 Capture + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x34 26 USART1 Receive Complete + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x36 27 USART1 Data Register Empty + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x38 28 USART1 Transmit Complete + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x3A 29 PORTF External interrupt + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x3C 30 NVM Ready + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x3E 31 USART2 Receive Complete + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x40 32 USART2 Data Register Empty + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x42 33 USART2 Transmit Complete + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x44 34 PORTB External interruptX + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x46 35 PORTE External interrupt + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x48 36 TCB3 Capture + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x4A 37 USART3 Receive Complete + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x4C 38 USART3 Data Register Empty + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq } // 0x4E 39 USART3 Transmit Complete }}; diff --git a/ref_app/target/micros/avr/make/avr_flags.gmk b/ref_app/target/micros/avr/make/avr_flags.gmk index eaefc118b..744f2884a 100644 --- a/ref_app/target/micros/avr/make/avr_flags.gmk +++ b/ref_app/target/micros/avr/make/avr_flags.gmk @@ -10,7 +10,7 @@ # ------------------------------------------------------------------------------ ifneq ($(MAKE),make) -GCC_VERSION = 11.2.0 +GCC_VERSION = 12.3.0 endif GCC_TARGET = avr GCC_PREFIX = avr @@ -24,7 +24,7 @@ TGT_ALLFLAGS = -Os -finline-limit=32 \ -fsigned-char -ifeq ($(GCC_VERSION),11.2.0) +ifeq ($(GCC_VERSION),12.3.0) TGT_ALLFLAGS := $(TGT_ALLFLAGS) \ -mdouble=32 \ -mlong-double=64 diff --git a/ref_app/target/micros/avr/startup/int_vect.cpp b/ref_app/target/micros/avr/startup/int_vect.cpp index b173da191..6f7c0c315 100644 --- a/ref_app/target/micros/avr/startup/int_vect.cpp +++ b/ref_app/target/micros/avr/startup/int_vect.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Copyright Christopher Kormanyos 2007 - 2019. +// Copyright Christopher Kormanyos 2007 - 2023. // Distributed under the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt // or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -34,36 +34,38 @@ namespace local } isr_type; - using isr_vector_array_type = std::array(UINT8_C(26))>; + constexpr auto count_of_isr_vector = static_cast(UINT8_C(26)); + + using isr_vector_array_type = std::array; } const volatile local::isr_vector_array_type my_isr_vector __attribute__((section(".isr_vector"))) = {{ - // addr. nr. interrupt source - { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __my_startup }, // 0x00, 0, reset - { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x02, 1, ext0 - { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x04, 2, ext1 - { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x06, 3, pin0 - { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x08, 4, pin1 - { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x0A, 5, pin2 - { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x0C, 6, watchdog - { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x0E, 7, timer2 cmp a - { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x10, 8, timer2 cmp b - { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x12, 9, timer2 ovf - { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x14, 10, timer1 cap - { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x16, 11, timer1 cmp a - { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x18, 12, timer1 cmp b - { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x1A, 13, timer1 ovf - { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x1C, 14, timer0 cmp a - { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x1E, 15, timer0 cmp b - { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_16 }, // 0x2E, 16, timer0 ovf - { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x20, 17, spi(TM) - { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x22, 18, usart rx - { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x24, 19, usart err - { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x26, 20, usart tx - { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x28, 21, adc - { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x2A, 22, eep ready - { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x2C, 23, comparator - { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x2E, 24, two-wire - { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq } // 0x30, 25, spm + // address index interrupt source + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __my_startup }, // 0x00 0 reset + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x02 1 ext0 + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x04 2 ext1 + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x06 3 pin0 + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x08 4 pin1 + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x0A 5 pin2 + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x0C 6 watchdog + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x0E 7 timer2 cmp a + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x10 8 timer2 cmp b + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x12 9 timer2 ovf + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x14 10 timer1 cap + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x16 11 timer1 cmp a + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x18 12 timer1 cmp b + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x1A 13 timer1 ovf + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x1C 14 timer0 cmp a + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x1E 15 timer0 cmp b + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_16 }, // 0x2E 16 timer0 ovf + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x20 17 spi(TM) + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x22 18 usart rx + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x24 19 usart err + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x26 20 usart tx + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x28 21 adc + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x2A 22 eep ready + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x2C 23 comparator + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq }, // 0x2E 24 two-wire + { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __vector_unused_irq } // 0x30 25 spm }}; From cc7b6b1dee369b797dbd8367bdf215ef09ad5ce1 Mon Sep 17 00:00:00 2001 From: Christopher Kormanyos Date: Fri, 29 Dec 2023 18:40:56 +0100 Subject: [PATCH 2/2] Repair misguided false handle rodata in LD-file --- .../target/micros/atmega4809/make/atmega4809.ld | 14 ++++++++------ ref_app/target/micros/avr/make/avr.ld | 14 ++++++++------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/ref_app/target/micros/atmega4809/make/atmega4809.ld b/ref_app/target/micros/atmega4809/make/atmega4809.ld index 88ec5b134..447121480 100644 --- a/ref_app/target/micros/atmega4809/make/atmega4809.ld +++ b/ref_app/target/micros/atmega4809/make/atmega4809.ld @@ -22,8 +22,8 @@ __initial_stack_pointer = 0x00803FFE; MEMORY { - VEC(rx) : ORIGIN = 0, LENGTH = 0x100 - ROM(rx) : ORIGIN = 0x100, LENGTH = 48K - 0x100 + VEC(rx) : ORIGIN = 0x00000000, LENGTH = 0x00000100 + ROM(rx) : ORIGIN = 0x00000100, LENGTH = 48K - 0x00000100 RAM(rwx) : ORIGIN = 0x00802800, LENGTH = 0x00001600 } @@ -65,10 +65,6 @@ SECTIONS . = ALIGN(2); *(.text*) . = ALIGN(2); - *(.rodata) - . = ALIGN(2); - *(.rodata*) - . = ALIGN(2); } > ROM . = 0x00802800; @@ -84,6 +80,12 @@ SECTIONS *(.data*) . = ALIGN(2); KEEP (*(.data*)) + *(.rodata) /* Use special handling of rodata (i.e., as part of data since _const_ variables are stored in RAM for AVR arch). */ + . = ALIGN(2); + KEEP (*(.rodata)) + *(.rodata*) + . = ALIGN(2); + KEEP (*(.rodata*)) _data_end = .; } > RAM AT > ROM diff --git a/ref_app/target/micros/avr/make/avr.ld b/ref_app/target/micros/avr/make/avr.ld index b574ec1ba..6750717d3 100644 --- a/ref_app/target/micros/avr/make/avr.ld +++ b/ref_app/target/micros/avr/make/avr.ld @@ -22,8 +22,8 @@ __initial_stack_pointer = 0x00800900 - 2; MEMORY { - VEC(rx) : ORIGIN = 0, LENGTH = 0x80 - ROM(rx) : ORIGIN = 0x80, LENGTH = 32K - 0x80 + VEC(rx) : ORIGIN = 0x00000000, LENGTH = 0x00000080 + ROM(rx) : ORIGIN = 0x00000080, LENGTH = 32K - 0x00000080 RAM(rwx) : ORIGIN = 0x00800100, LENGTH = 0x00000780 - 0x00000100 } @@ -65,10 +65,6 @@ SECTIONS . = ALIGN(2); *(.text*) . = ALIGN(2); - *(.rodata) - . = ALIGN(2); - *(.rodata*) - . = ALIGN(2); } > ROM . = 0x00800100; @@ -84,6 +80,12 @@ SECTIONS *(.data*) . = ALIGN(2); KEEP (*(.data*)) + *(.rodata) /* Use special handling of rodata (i.e., as part of data since _const_ variables are stored in RAM for AVR arch). */ + . = ALIGN(2); + KEEP (*(.rodata)) + *(.rodata*) + . = ALIGN(2); + KEEP (*(.rodata*)) _data_end = .; } > RAM AT > ROM