1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00
RIOT/cpu/avr8_common/include
Marian Buschsieweke cee7cccfd0
cpu/avr8_common/flash_utils: use C and linker for aliases
`flash_<funcname>()` is implemented by `<funcname>_P()` provided by
the AVR libc on AVR targets. Previously, the preprocessor was used
to do the aliasing, but this causes issues with LLVM: The signatures of
e.g. `printf_P()` expects `const char *`, whereas flash utils expects
`FLASH_ATTR const char *`. For GCC this will just implicitly drop the
`FLASH_ATTR`, while it requires an explicit cast for LLVM.

To implement the explicit cast, `static inline` function wrappers
where used instead where possible. But for the variadic functions
(e.g. `printf(fmt, ...)`) the linker is used to provide the aliases,
as there is no way to pass the variadic functions throw in C. The
alternative would be to implement `flash_printf()` by calling
`vprintf_P()`, but that increased ROM size quite a bit.

Finally, a work around for a bug in Ubuntu's toolchain has been added:
An unused function that calls to `printf_P()`, `fprintf_P()` and
`snprintf_P()`. Since this function is garbage collected anyway, it
has no impact on the generated ELF file.
2023-11-10 14:54:22 +01:00
..
architecture_arch.h sys/architecture: introduce uinttxtptr_t 2022-07-13 23:19:33 +02:00
atomic_utils_arch.h cpu/avr8_common: Normalize method prefix name 2021-01-07 16:29:42 -03:00
c11_atomics_compat_cpu.hpp cpu: Refact atmega_common into avr8_common 2021-01-07 16:29:22 -03:00
cpu.h cpu/avr8_common: Rework avr8_state variable 2023-07-05 19:01:14 +02:00
flash_utils_arch.h cpu/avr8_common/flash_utils: use C and linker for aliases 2023-11-10 14:54:22 +01:00
irq_arch.h cpu/avr8_common: Add AVR8_ISR macro 2023-07-05 20:00:19 +02:00
states_internal.h cpu/avr8_common: Rework avr8_state variable 2023-07-05 19:01:14 +02:00
stdio.h cpu/avr8_common: Wrap stdio.h 2023-02-27 12:31:03 +01:00
thread_arch.h cpu/avr8_common: fix doxygen grouping warnings 2021-09-05 20:38:52 +02:00