Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ref_app/ref_app.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3233,6 +3233,7 @@
</ClInclude>
<ClInclude Include="src\util\STL_C++XX_stdfloat\stdfloat.h" />
<ClInclude Include="src\util\utility\util_alignas.h" />
<ClInclude Include="src\util\utility\util_attribute.h" />
<ClInclude Include="src\util\utility\util_baselexical_cast.h" />
<ClInclude Include="src\util\utility\util_bit_mask.h" />
<ClInclude Include="src\util\utility\util_communication.h" />
Expand Down
3 changes: 3 additions & 0 deletions ref_app/ref_app.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -2949,6 +2949,9 @@
<ClInclude Include="src\mcal\am6254_soc\mcal_osc.h">
<Filter>src\mcal\am6254_soc</Filter>
</ClInclude>
<ClInclude Include="src\util\utility\util_attribute.h">
<Filter>src\util\utility</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="src\util\STL\algorithm">
Expand Down
10 changes: 1 addition & 9 deletions ref_app/src/app/benchmark/app_benchmark.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <util/utility/util_attribute.h>

#define APP_BENCHMARK_TYPE_NONE 0
#define APP_BENCHMARK_TYPE_COMPLEX 1
Expand Down
4 changes: 2 additions & 2 deletions ref_app/src/app/benchmark/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ref_app/src/app/led/app_led.cpp
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
8 changes: 5 additions & 3 deletions ref_app/src/mcal/avr/mcal_gpt.cpp
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -8,12 +8,14 @@
#include <mcal_gpt.h>
#include <mcal_reg.h>

#include <util/utility/util_attribute.h>

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&
{
Expand All @@ -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
{
Expand Down
6 changes: 4 additions & 2 deletions ref_app/src/mcal/avr/mcal_wdg.h
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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 <util/utility/util_attribute.h>

extern "C" void __my_startup() ATTRIBUTE(section(".startup"), used, noinline);

namespace sys { namespace idle { auto task_func() -> void; } }

Expand Down
6 changes: 3 additions & 3 deletions ref_app/src/os/os_cfg.h
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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, \
Expand Down
8 changes: 2 additions & 6 deletions ref_app/src/sys/start/sys_start.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,10 @@
#include <mcal/mcal.h>
#include <os/os.h>

#if defined(_MSC_VER)
#define ATTRIBUTE(a)
#else
#define ATTRIBUTE(a) __attribute__((a))
#endif
#include <util/utility/util_attribute.h>

#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
Expand Down
21 changes: 21 additions & 0 deletions ref_app/src/util/utility/util_attribute.h
Original file line number Diff line number Diff line change
@@ -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
16 changes: 6 additions & 10 deletions ref_app/target/micros/am6254_soc/Code/Appli/Core/a53/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,24 @@
#include <mcal_cpu.h>
#include <mcal_irq.h>

#include <util/utility/util_attribute.h>

#include <stdbool.h>
#include <stdint.h>

#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);
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)
{
Expand Down
10 changes: 3 additions & 7 deletions ref_app/target/micros/am6254_soc/Code/Startup/Core/a53/Startup.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

#include <mcal_cpu.h>

#include <util/utility/util_attribute.h>

#include <stdint.h>

typedef struct
Expand All @@ -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])
Expand All @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion ref_app/target/micros/avr/make/avr.ld
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
6 changes: 3 additions & 3 deletions ref_app/target/micros/avr/make/avr_flags.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ TGT_ALLFLAGS = -O2
-mmcu=atmega328p \
-mrelax \
-finline-functions \
-finline-limit=32 \
-finline-limit=64 \
-fsigned-char

ifeq ($(TYP_OS),WIN)
Expand All @@ -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

Expand Down
10 changes: 6 additions & 4 deletions ref_app/target/micros/avr/startup/crt0.cpp
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -10,15 +10,17 @@

#include <mcal/mcal.h>

#include <util/utility/util_attribute.h>

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()
{
Expand Down
10 changes: 6 additions & 4 deletions ref_app/target/micros/avr/startup/crt0_init_ram.cpp
Original file line number Diff line number Diff line change
@@ -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 <mcal_memory/mcal_memory_progmem_access.h>

#include <util/utility/util_attribute.h>

#include <algorithm>
#include <cstddef>
#include <cstdint>

#include <mcal_memory/mcal_memory_progmem_access.h>

extern "C"
{
extern mcal_progmem_uintptr_t _rom_data_begin; // Start address for the initialization values of the rom-to-ram section.
Expand All @@ -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()
Expand Down
6 changes: 4 additions & 2 deletions ref_app/target/micros/avr/startup/crt1.cpp
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -8,6 +8,8 @@
#include <cstdint>

#include <mcal_memory/mcal_memory_progmem_access.h>

#include <util/utility/util_attribute.h>
#include <util/utility/util_utype_helper.h>

extern "C"
Expand All @@ -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()
Expand Down
15 changes: 9 additions & 6 deletions ref_app/target/micros/avr/startup/int_vect.cpp
Original file line number Diff line number Diff line change
@@ -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 <mcal_cpu.h>

#include <util/utility/util_attribute.h>

#include <array>
#include <cstddef>
#include <cstdint>
#include <mcal_cpu.h>

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()
Expand All @@ -39,7 +42,7 @@ namespace local
using isr_vector_array_type = std::array<isr_type, count_of_isr_vector>;
}

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<std::uint8_t>(UINT8_C(0x0C)), static_cast<std::uint8_t>(UINT8_C(0x94)) }, __my_startup }, // 0x00 0 reset
Expand Down
Loading
Loading