1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
Commit Graph

22 Commits

Author SHA1 Message Date
Benjamin Valentin
5dc43bd62d cpu/avr8_common: AVR-8 needs 7 cycles per busy loop 2024-01-10 22:43:31 +01:00
Gerson Fernando Budke
3b9368a99e
cpu/avr8: Enable PM periph to all SoC
This refactor the current xmega PM peripheral to avr8 common and extend
PM to cpus families.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-12-01 14:12:23 +01:00
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
Gerson Fernando Budke
783afbc666 cpu/avr8_common: Add AVR8_ISR macro
The current ISR implementation for AVR8 requires use of
avr8_[enter/exit]_isr pair which add some boilerplate on code.
This add AVR8_ISR which clean-up the code and make it simpler
and hides any schedule detail from the user perspective.

This is a preparation for future scheduling and irq optimizations.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-07-05 20:00:19 +02:00
Gerson Fernando Budke
93aa10cc5c cpu/avr8_common: Rework avr8_state variable
The avr8_state variable uses bit operation to set/clear the state. This
rework avr8_state to use increment/decrement instead. It introduce the
use of General Purpose IO Register 1 (GPIOR1) when available.

This is a preparation for future scheduling and irq optimizations.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-07-05 19:01:14 +02:00
Gerson Fernando Budke
b7873015aa cpu/avr8_common: Split avr8_state
The avr8_state store state information used to determine scheduling
and uart irq. This move all uart irq states to avr8_state_uart
variable. It introduce the use of General Purpose IO Register 0
(GPIOR0) when available and now all uarts from xmega can be used.

This is a preparation for future scheduling and irq optimizations.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-07-05 19:01:13 +02:00
Marian Buschsieweke
a6f48d84a0
cpu/avr8_common: fix typo in a comment 2023-06-28 22:36:21 +02:00
Marian Buschsieweke
c406f7ef42
cpu/avr8_common: Wrap stdio.h
This allows automatically moving format strings to flash, provided that
code previously compiled fine with `-Wformat-nonliteral` (which in RIOT
is the case due to `-Wformat=2`).
2023-02-27 12:31:03 +01:00
Marian Buschsieweke
4e3c0777fc
sys/flash_utils: add helpers for placing variables in flash
This adds a layer of convenience abstraction over classical Harvard
architectures (like most AVRs) that do not map the flash memory into
the data address space and modern Harvard architectures or von-Neumann
architectures that do so. The motivation is to safe a lot of RAM for
AVR by storing constant strings into flash.
2023-02-27 12:31:03 +01:00
Benjamin Valentin
ea917f4b07 cpu: cpu_print_last_instruction() -> cpu_get_caller_pc() 2022-09-15 10:49:56 +02:00
Benjamin Valentin
34e11bf2bc sys/architecture: introduce uinttxtptr_t 2022-07-13 23:19:33 +02:00
Marian Buschsieweke
740c2faaa8
cpu/avr8_common: fix cpu_print_last_instruction 2022-06-20 19:56:00 +02:00
Benjamin Valentin
41a5b7ef7a core: change return type of irq_is_in(), irq_is_enabled() to bool
This only cleans up the API, no change in behavior or users of the API
is expected.
2021-12-08 15:53:15 +01:00
Benjamin Valentin
3e20e939c6 cpu: drop cpu_init() from public headers
Boards are no longer supposed fo call the function, so drop it from
public header files.
2021-10-18 17:31:26 +02:00
Marian Buschsieweke
417bc949ab
cpu/avr8_common: Clean up cpu_print_last_inscrution() 2021-09-30 10:39:21 +02:00
Jean-Pierre De Jesus DIAZ
1759014134 cpu/avr8_common: fix doxygen grouping warnings
Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
2021-09-05 20:38:52 +02:00
Hauke Petersen
48e2d6e8f9 cpu/atmega_common: implement irq_is_enabled() 2021-08-25 08:01:05 +02:00
Gerson Fernando Budke
aa3af4e2fa cpu/avr8_common/avr8_cpu: Add xmega clock
ATxmega have many clock options.  This introduce clk_init into cpu_init
to allow user select between a default configuration or perform fine
clock tune.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-03-15 20:16:10 -03:00
Gerson Fernando Budke
9081a3b7c7 cpu/avr8_common/include/cpu.h: Increase number of uart
The ATxmega can have up to 8 UARTs.  This increase from 2 up to 7 to
keep avr8_state flags with 8 bits wide.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-03-15 20:16:10 -03:00
0d43c96ac7
cpu/avr8_common: Add dummy thread_arch.h header
The thread_yield_higher function is complex enough to not inline it for
the avr8 cpu
2021-01-19 11:03:21 +01:00
Gerson Fernando Budke
1426e15679 cpu/avr8_common: Normalize method prefix name
Refactor atmega_ prefix to avr8_ prefix and update copyrights.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-01-07 16:29:42 -03:00
Gerson Fernando Budke
4cbd311196 cpu: Refact atmega_common into avr8_common
Split atmega_common code into avr8_common folder.  This moves common
avr8 code to be used for all avr8 variants: tiny, mega and xmega.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-01-07 16:29:22 -03:00