diff --git a/ref_app/ref_app.vcxproj b/ref_app/ref_app.vcxproj index acf78b8c9..4e6589d0c 100644 --- a/ref_app/ref_app.vcxproj +++ b/ref_app/ref_app.vcxproj @@ -3233,6 +3233,7 @@ + diff --git a/ref_app/ref_app.vcxproj.filters b/ref_app/ref_app.vcxproj.filters index 3deb12c95..2e21722da 100644 --- a/ref_app/ref_app.vcxproj.filters +++ b/ref_app/ref_app.vcxproj.filters @@ -2949,6 +2949,9 @@ src\mcal\am6254_soc + + src\util\utility + diff --git a/ref_app/src/app/benchmark/app_benchmark.h b/ref_app/src/app/benchmark/app_benchmark.h index 6e5118049..faadfbe01 100644 --- a/ref_app/src/app/benchmark/app_benchmark.h +++ b/ref_app/src/app/benchmark/app_benchmark.h @@ -8,15 +8,7 @@ #ifndef APP_BENCHMARK_2018_10_02_H #define APP_BENCHMARK_2018_10_02_H - #if defined(ATTRIBUTE) - #undef ATTRIBUTE - #endif - - #if defined(_MSC_VER) - #define ATTRIBUTE(a) - #else - #define ATTRIBUTE(a) __attribute__((a)) - #endif + #include #define APP_BENCHMARK_TYPE_NONE 0 #define APP_BENCHMARK_TYPE_COMPLEX 1 diff --git a/ref_app/src/app/benchmark/readme.md b/ref_app/src/app/benchmark/readme.md index eda6f7b0d..9405ea6b8 100644 --- a/ref_app/src/app/benchmark/readme.md +++ b/ref_app/src/app/benchmark/readme.md @@ -84,13 +84,13 @@ The benchmark used is a ${\sim}100$ decimal digit AGM $\pi$ calculation. | Target | runtime $[ms]$ | relative | |--------------------|-----------------|------------| | `am6254_soc_` | 0.37 | 1.0 | -| `am335x` | 1.5 | 4.0 | +| `am335x` | 1.5 | 4.1 | | `stm32f446` | 5.1 | 14 | | `rpi_pico2_rp2350` | 6.3 | 17 | | `wch_ch32v307` | 8.0 | 22 | | `xtensa_esp32_s3` | 9.1 | 25 | | `rpi_pico_rp2040` | 19 | 51 | -| `avr` | 420 | 760 | +| `avr` | 410 | 1100 | There are strikingly differing performance classes for the $8$-bit MICROCHIP(R) AVR controller of the ARDUINO diff --git a/ref_app/src/app/led/app_led.cpp b/ref_app/src/app/led/app_led.cpp index 05ba08d50..d09656122 100644 --- a/ref_app/src/app/led/app_led.cpp +++ b/ref_app/src/app/led/app_led.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Copyright Christopher Kormanyos 2007 - 2024. +// Copyright Christopher Kormanyos 2007 - 2025. // 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) diff --git a/ref_app/src/mcal/avr/mcal_gpt.cpp b/ref_app/src/mcal/avr/mcal_gpt.cpp index 7ce1c1164..8540d6483 100644 --- a/ref_app/src/mcal/avr/mcal_gpt.cpp +++ b/ref_app/src/mcal/avr/mcal_gpt.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Copyright Christopher Kormanyos 2007 - 2024. +// Copyright Christopher Kormanyos 2007 - 2025. // 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,12 +8,14 @@ #include #include +#include + namespace { // The one (and only one) system tick. volatile auto mcal_gpt_system_tick = mcal::gpt::value_type { }; - auto gpt_is_initialized() -> bool& __attribute__((used, noinline)); + auto gpt_is_initialized() -> bool& ATTRIBUTE(used, noinline); auto gpt_is_initialized() -> bool& { @@ -24,7 +26,7 @@ namespace } extern "C" -auto __vector_16() -> void __attribute__((signal, used, externally_visible)); +auto __vector_16() -> void ATTRIBUTE(signal, used, externally_visible); auto __vector_16() -> void { diff --git a/ref_app/src/mcal/avr/mcal_wdg.h b/ref_app/src/mcal/avr/mcal_wdg.h index 23a37e965..d34bbcbfe 100644 --- a/ref_app/src/mcal/avr/mcal_wdg.h +++ b/ref_app/src/mcal/avr/mcal_wdg.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Copyright Christopher Kormanyos 2007 - 2024. +// Copyright Christopher Kormanyos 2007 - 2025. // 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,7 +8,9 @@ #ifndef MCAL_WDT_2010_04_10_H #define MCAL_WDT_2010_04_10_H - extern "C" void __my_startup() __attribute__((section(".startup"), used, noinline)); + #include + + extern "C" void __my_startup() ATTRIBUTE(section(".startup"), used, noinline); namespace sys { namespace idle { auto task_func() -> void; } } diff --git a/ref_app/src/os/os_cfg.h b/ref_app/src/os/os_cfg.h index 42d845af7..5cb4a64b0 100644 --- a/ref_app/src/os/os_cfg.h +++ b/ref_app/src/os/os_cfg.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Copyright Christopher Kormanyos 2007 - 2024. +// Copyright Christopher Kormanyos 2007 - 2025. // 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) @@ -92,11 +92,11 @@ { \ os::task_control_block(app::led::task_init, \ app::led::task_func, \ - os::timer_type::microseconds(UINT32_C( 4000)), \ + os::timer_type::microseconds(UINT32_C( 7000)), \ os::timer_type::microseconds(UINT32_C( 0))), \ os::task_control_block(app::benchmark::task_init, \ app::benchmark::task_func, \ - os::timer_type::microseconds(UINT32_C( 750000)), \ + os::timer_type::microseconds(UINT32_C( 830000)), \ os::timer_type::microseconds(UINT32_C( 379))), \ os::task_control_block(sys::mon::task_init, \ sys::mon::task_func, \ diff --git a/ref_app/src/sys/start/sys_start.cpp b/ref_app/src/sys/start/sys_start.cpp index 7fb66a3f3..4ac3c5e85 100644 --- a/ref_app/src/sys/start/sys_start.cpp +++ b/ref_app/src/sys/start/sys_start.cpp @@ -8,14 +8,10 @@ #include #include -#if defined(_MSC_VER) -#define ATTRIBUTE(a) -#else -#define ATTRIBUTE(a) __attribute__((a)) -#endif +#include #if (defined(__XTENSA__) && !defined(CONFIG_IDF_TARGET_ESP32S3)) -extern "C" ATTRIBUTE(used) auto app_main_loop() -> int; +extern "C" auto app_main_loop() -> int ATTRIBUTE(used); #else ATTRIBUTE(used) auto main() -> int; #endif diff --git a/ref_app/src/util/utility/util_attribute.h b/ref_app/src/util/utility/util_attribute.h new file mode 100644 index 000000000..34175b3be --- /dev/null +++ b/ref_app/src/util/utility/util_attribute.h @@ -0,0 +1,21 @@ +/////////////////////////////////////////////////////////////////////////////// +// Copyright Christopher Kormanyos 2025. +// 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) +// + +#ifndef UTIL_ATTRIBUTE_2025_08_09_H + #define UTIL_ATTRIBUTE_2025_08_09_H + + #if defined(ATTRIBUTE) + #undef ATTRIBUTE + #endif + + #if defined(_MSC_VER) + #define ATTRIBUTE(...) + #else + #define ATTRIBUTE(...) __attribute__((__VA_ARGS__)) + #endif + +#endif // UTIL_ATTRIBUTE_2025_08_09_H diff --git a/ref_app/target/micros/am6254_soc/Code/Appli/Core/a53/main.c b/ref_app/target/micros/am6254_soc/Code/Appli/Core/a53/main.c index 492b4d990..38e500cf4 100644 --- a/ref_app/target/micros/am6254_soc/Code/Appli/Core/a53/main.c +++ b/ref_app/target/micros/am6254_soc/Code/Appli/Core/a53/main.c @@ -10,18 +10,14 @@ #include #include +#include + #include #include -#if defined(__GNUC__) -#define ATTRIBUTE_USED __attribute__((used)) -#else -#define ATTRIBUTE_USED -#endif - extern uint32_t GetActiveCoreId(void); -extern ATTRIBUTE_USED int main(void); +extern int main(void) ATTRIBUTE(used); //extern void main_core0(void); extern void main_core1(void); @@ -29,9 +25,9 @@ extern void main_core2(void); extern void main_core3(void); extern void main_core0_init(void); -ATTRIBUTE_USED void timer_isr(void); -ATTRIBUTE_USED void main_x(void); -ATTRIBUTE_USED static void main_init(const uint32_t ActiveCore); +void timer_isr(void) ATTRIBUTE(used); +void main_x(void) ATTRIBUTE(used); +static void main_init(const uint32_t ActiveCore) ATTRIBUTE(used); void main_x(void) { diff --git a/ref_app/target/micros/am6254_soc/Code/Startup/Core/a53/Startup.c b/ref_app/target/micros/am6254_soc/Code/Startup/Core/a53/Startup.c index 91056f1fa..7874c261d 100644 --- a/ref_app/target/micros/am6254_soc/Code/Startup/Core/a53/Startup.c +++ b/ref_app/target/micros/am6254_soc/Code/Startup/Core/a53/Startup.c @@ -22,6 +22,8 @@ #include +#include + #include typedef struct @@ -44,12 +46,6 @@ extern const runtimeCopyTable_t __RUNTIME_COPY_TABLE[]; extern const runtimeClearTable_t __RUNTIME_CLEAR_TABLE[]; extern unsigned long __CTOR_LIST__[]; -#if defined(__GNUC__) -#define ATTRIBUTE_USED __attribute__((used,noinline)) -#else -#define ATTRIBUTE_USED -#endif - #define __STARTUP_RUNTIME_COPYTABLE (runtimeCopyTable_t*)(&__RUNTIME_COPY_TABLE[0]) #define __STARTUP_RUNTIME_CLEARTABLE (runtimeClearTable_t*)(&__RUNTIME_CLEAR_TABLE[0]) #define __STARTUP_RUNTIME_CTORS (unsigned long*)(&__CTOR_LIST__[0]) @@ -65,7 +61,7 @@ static void Startup_Unexpected_Exit(void); static void Startup_InitSystemClock(void); static void Startup_InitSystemPeripheral(void); -extern ATTRIBUTE_USED void main_x(void); +extern void main_x(void) ATTRIBUTE(used); void Startup_Init(void) { diff --git a/ref_app/target/micros/avr/make/avr.ld b/ref_app/target/micros/avr/make/avr.ld index 6750717d3..afe3d031e 100644 --- a/ref_app/target/micros/avr/make/avr.ld +++ b/ref_app/target/micros/avr/make/avr.ld @@ -1,5 +1,5 @@ /* - Copyright Christopher Kormanyos 2007 - 2023. + Copyright Christopher Kormanyos 2007 - 2025. 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) diff --git a/ref_app/target/micros/avr/make/avr_flags.gmk b/ref_app/target/micros/avr/make/avr_flags.gmk index d22d7ee60..eff74bdb5 100644 --- a/ref_app/target/micros/avr/make/avr_flags.gmk +++ b/ref_app/target/micros/avr/make/avr_flags.gmk @@ -20,7 +20,7 @@ TGT_ALLFLAGS = -O2 -mmcu=atmega328p \ -mrelax \ -finline-functions \ - -finline-limit=32 \ + -finline-limit=64 \ -fsigned-char ifeq ($(TYP_OS),WIN) @@ -30,8 +30,8 @@ TGT_ALLFLAGS := $(TGT_ALLFLAGS) -mlong-double=64 INC_PREFIX := -isystem -STD_C := c23 -STD_CPP := c++23 +STD_C := c11 +STD_CPP := c++20 else diff --git a/ref_app/target/micros/avr/startup/crt0.cpp b/ref_app/target/micros/avr/startup/crt0.cpp index d5e67e1d8..8c941a55a 100644 --- a/ref_app/target/micros/avr/startup/crt0.cpp +++ b/ref_app/target/micros/avr/startup/crt0.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Copyright Christopher Kormanyos 2007 - 2021. +// Copyright Christopher Kormanyos 2007 - 2025. // 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) @@ -10,15 +10,17 @@ #include +#include + asm(".extern __initial_stack_pointer"); namespace crt { - void init_ram () __attribute__((section(".startup"), used, noinline)); - void init_ctors() __attribute__((section(".startup"), used, noinline)); + void init_ram () ATTRIBUTE(section(".startup"), used, noinline); + void init_ctors() ATTRIBUTE(section(".startup"), used, noinline); } -extern "C" void __my_startup() __attribute__((section(".startup"), used, noinline)); +extern "C" void __my_startup() ATTRIBUTE(section(".startup"), used, noinline); void __my_startup() { diff --git a/ref_app/target/micros/avr/startup/crt0_init_ram.cpp b/ref_app/target/micros/avr/startup/crt0_init_ram.cpp index 2a9e01edd..425d73560 100644 --- a/ref_app/target/micros/avr/startup/crt0_init_ram.cpp +++ b/ref_app/target/micros/avr/startup/crt0_init_ram.cpp @@ -1,16 +1,18 @@ /////////////////////////////////////////////////////////////////////////////// -// Copyright Christopher Kormanyos 2007 - 2019. +// Copyright Christopher Kormanyos 2007 - 2025. // 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 #include -#include - extern "C" { extern mcal_progmem_uintptr_t _rom_data_begin; // Start address for the initialization values of the rom-to-ram section. @@ -22,7 +24,7 @@ extern "C" namespace crt { - void init_ram() __attribute__((section(".startup"), used, noinline)); + void init_ram() ATTRIBUTE(section(".startup"), used, noinline); } void crt::init_ram() diff --git a/ref_app/target/micros/avr/startup/crt1.cpp b/ref_app/target/micros/avr/startup/crt1.cpp index bd0d52a2d..7a2f05706 100644 --- a/ref_app/target/micros/avr/startup/crt1.cpp +++ b/ref_app/target/micros/avr/startup/crt1.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Copyright Christopher Kormanyos 2007 - 2022. +// Copyright Christopher Kormanyos 2007 - 2025. // 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,6 +8,8 @@ #include #include + +#include #include extern "C" @@ -28,7 +30,7 @@ extern "C" namespace crt { - void init_ctors() __attribute__((section(".startup"), used, noinline)); + void init_ctors() ATTRIBUTE(section(".startup"), used, noinline); } void crt::init_ctors() diff --git a/ref_app/target/micros/avr/startup/int_vect.cpp b/ref_app/target/micros/avr/startup/int_vect.cpp index 6f7c0c315..176b1d789 100644 --- a/ref_app/target/micros/avr/startup/int_vect.cpp +++ b/ref_app/target/micros/avr/startup/int_vect.cpp @@ -1,18 +1,21 @@ /////////////////////////////////////////////////////////////////////////////// -// Copyright Christopher Kormanyos 2007 - 2023. +// Copyright Christopher Kormanyos 2007 - 2025. // 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 #include -#include -extern "C" void __my_startup () __attribute__((section(".startup"), used, noinline)); -extern "C" void __vector_unused_irq() __attribute__((signal, used, externally_visible)); -extern "C" void __vector_16 () __attribute__((signal, used, externally_visible)); +extern "C" void __my_startup () ATTRIBUTE(section(".startup"), used, noinline); +extern "C" void __vector_unused_irq() ATTRIBUTE(signal, used, externally_visible); +extern "C" void __vector_16 () ATTRIBUTE(signal, used, externally_visible); extern "C" void __vector_unused_irq() @@ -39,7 +42,7 @@ namespace local using isr_vector_array_type = std::array; } -const volatile local::isr_vector_array_type my_isr_vector __attribute__((section(".isr_vector"))) = +const volatile local::isr_vector_array_type my_isr_vector ATTRIBUTE(section(".isr_vector")) = {{ // address index interrupt source { { static_cast(UINT8_C(0x0C)), static_cast(UINT8_C(0x94)) }, __my_startup }, // 0x00 0 reset diff --git a/ref_app/target/micros/xtensa_esp32_s3_riscv_cop/startup/main.cpp b/ref_app/target/micros/xtensa_esp32_s3_riscv_cop/startup/main.cpp index 408c039f1..985a51c6d 100644 --- a/ref_app/target/micros/xtensa_esp32_s3_riscv_cop/startup/main.cpp +++ b/ref_app/target/micros/xtensa_esp32_s3_riscv_cop/startup/main.cpp @@ -27,19 +27,11 @@ #include #include -#include - -#if defined(ATTRIBUTE) -#undef ATTRIBUTE -#endif +#include -#if defined(_MSC_VER) -#define ATTRIBUTE(a) -#else -#define ATTRIBUTE(a) __attribute__((a)) -#endif +#include -ATTRIBUTE(used) auto main() -> int; +auto main() -> int ATTRIBUTE(used); namespace {