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

799 Commits

Author SHA1 Message Date
Benjamin Valentin
3ba131c0f2 netdev_tap: port to netdev_new_api 2024-11-21 11:45:33 +01:00
Marian Buschsieweke
c2c2cc8592
drivers/periph_gpio: let gpio_read() return bool
Since https://github.com/RIOT-OS/RIOT/pull/20935 gpio_write()
uses a `bool` instead of an `int`. This does the same treatment for
`gpio_read()`.

This does indeed add an instruction to `gpio_read()` implementations.
However, users caring about an instruction more are better served with
`gpio_ll_read()` anyway. And `gpio_read() == 1` is often seen in
newcomer's code, which would now work as expected.
2024-10-23 13:24:09 +02:00
Benjamin Valentin
4627f66caa drivers/periph/gpio: make gpio_write() take a bool 2024-10-22 16:39:48 +02:00
Michael Richardson
7140aef74e doc: note that timer_settime() comes from librt on some systems 2024-08-18 16:02:15 -04:00
Marian Buschsieweke
29a00beaf1
cpu/native/periph_timer: add missing -lrt to linker flags
This fixes https://github.com/RIOT-OS/RIOT/pull/20009#issuecomment-2294803168
2024-08-17 13:52:57 +02:00
Marian Buschsieweke
21151691d7
cpu/native: Fix C11 atomic sizes for musl
musl and glibc have different types for fast atomic integers. This
selects the correct size depending on the used library.
2024-06-05 22:04:43 +02:00
Marian Buschsieweke
ff3f055dc7
cpu/native: fix compilation with GCC 14.1
The first argument to `calloc()` is the number of members, the
second the member size. This fixes an instance where the arguments
where switched.
2024-06-04 15:43:53 +02:00
Marian Buschsieweke
f34cd3f7c1
cpu/native: fix build with musl
This changes a bunch of things that allows building with the musl C lib,
provided that `libucontext-dev` and `pkg-config` are installed.

Note that installing libucontext makes absolutely zero sense on C libs
that do natively provide this deprecated System V API, such as glibc.
Hence, it no sane glibc setup is expected to ever have libucontext
installed.

A main pain point was that argv and argc are expected to be passed to
init_fini handlers, but that is actually a glibc extension. This just
parses `/proc/self/cmdline` by hand to populate argv and argc during
startup, unless running on glibc.
2024-05-31 12:18:33 +02:00
Karl Fessel
2bdca8d6c9
Merge pull request #16809 from kfessel/p-backtrace-fix
native/backtrace: improve its print capabilitys and test
2024-05-08 19:57:18 +00:00
Karl Fessel
37627ce2b8 native/backtrace: improve print capabilitys and test 2024-05-08 12:53:57 +02:00
Marian Buschsieweke
9462ab576e
cpu/native: netdev_tap implements the legacy netdev API 2024-04-30 09:49:36 +02:00
Ollrogge
2f67249ae1 Revert "cpu/native: extend flashpage API"
This reverts commit cdd9f303cf.
2024-04-04 17:37:15 +02:00
Karl Fessel
3e2ab59f4d
Merge pull request #20431 from cogip/native_fixes
cpu/native: add gpio-mock
2024-03-28 22:07:10 +00:00
MrKevinWeiss
e0fdc3c16c
*Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
MrKevinWeiss
7a68fb0d5e
*Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
MrKevinWeiss
0a9c51fdf9
*.config: Modify all .config kconfig files 2024-03-26 14:53:40 +01:00
MrKevinWeiss
0f2b71c60e
*Makefile.features: Remove TEST_KCONFIG includes 2024-03-26 14:53:39 +01:00
Gilles DOFFE
ebf95d2545 cpu/native: enhance GPIO mocking with 2D array representation
This commit introduces a more robust GPIO mocking mechanism by utilizing
a 2-dimensional array. Each element of the array holds a gpio_mock_t
structure describing a pin's attributes such as value, mode, flank,
interruption callback, and callback argument.

This enhancement allows for the arbitrary simulation of GPIOs across
various microcontroller architectures using the current API, while
maintaining consistency through the use of the GPIO_PIN macro.

Additionally, it should be noted that only the maximum number of ports
and maximum number of pins can be altered according to the context.

The implemented API in gpio_mock.c remains rudimentary, providing no
validation but fulfilling the required functions. However, it remains
customizable as all its functions are marked as weak.

Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
2024-03-24 23:12:24 +01:00
Gilles DOFFE
24d9657b40 cpu/native: mark gpio_mock function as weak
This allows developpers to override gpio behavior into their
applications.

Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
2024-03-15 20:27:11 +01:00
Gilles DOFFE
5b4c8fe92d cpu/native: return 0 for all gpio_init*() calls
If the gpio is initialized as an input or interruptable pin, the
gpio_mock driver returns -1 leading to failed initialization.
However that is not because nothing can change the GPIO state that it
has to be an error.
Return 0 in all cases.

Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
2024-03-15 20:27:11 +01:00
Gilles DOFFE
3bfabb4a6c cpu/native/periph/qdec: remove useless loop
Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
2024-03-15 20:27:11 +01:00
Benjamin Valentin
5164a6cc59 cpu/native: return _native_retval with NATIVE_AUTO_EXIT 2024-03-04 14:08:52 +01:00
chrysn
6714a77026
Merge pull request #20339 from chrysn-pull-requests/native64-rust
cpu/native: Enable Rust on 64bit
2024-02-23 10:41:47 +00:00
chrysn
1070175da8 cpu/native: 64bit works with Rust 2024-02-23 11:24:02 +01:00
Benjamin Valentin
9e9a906f4d cpu/native: return error code on failed assertion 2024-02-22 16:06:32 +01:00
Mihai Renea
fc3d0d8676 cpu/native: fix native_async_read_remove_handler() + enable all baudrates 2024-02-10 15:46:00 +01:00
Mihai Renea
795415d59e cpu/native/periph/uart: uart_poweroff() closes the file descriptor 2024-02-09 12:55:40 +01:00
Frederik Haxel
0c2cfe99e6 native64: Add Linux/x86_64 board
Adds a separate board for native64 instead of the `NATIVE_64BIT` workaround.
The files in `boards/native64` are more or less dummy files and just include
the `boards/native` logic (similar to `openlabs-kw41z-mini-256kib`).
The main logic for native is in `makefiles/arch/native.inc.mk`, `cpu/native`
and `boards/native`.

The remaining changes concern the build system, and change native board checks
to native CPU checks to cover both boards.
2024-02-05 22:01:40 +01:00
benpicco
5bd879b406
Merge pull request #20315 from fzi-haxel/native-x86-64-support
native: Linux/x86_64 support
2024-02-01 17:11:56 +00:00
Armin Wolf
d8dc6d3963 cpu/native: timer: Delete POSIX timer upon error
If `register_interrupt` somehow fails, we leak the already created
POSIX timer by returning immediately.

Fix this by calling `timer_delete` before returning.

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
2024-01-30 22:28:13 +01:00
Armin Wolf
eac719166b cpu/native: timer: Stop using err
When using `err`, no stacktrace is generated and the standard panic
functionallity of RIOT is sidestepped.

Use `core_panic` instead.

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
2024-01-30 22:28:13 +01:00
Armin Wolf
acbe7a8af3 cpu/native: timer: Remove unnecessary uses of (void)
In `timer_init`, `freq` is being check so its not unused.
In `timer_set_periodic`, `flags` is being used too.

Remove the uses of `(void)` in both cases.

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
2024-01-30 22:11:14 +01:00
Frederik Haxel
16eff9b6ed native: Linux/x86_64 support
Initial version to test 64 bit compatibility.

Instead of a separate board, the inital version for Linux/x86_64 is enabled
by setting the environment variable `NATIVE_64BIT=y` and compiling as usual.

Not currently implemented:
* Architectures other than x86_64 or operating systems other than Linux
    * No FreeBSD support
    * No Aarch support
* Rust support for x86_64
2024-01-30 16:33:19 +01:00
Marian Buschsieweke
57cd430363
Merge pull request #20306 from Wer-Wolf/native_timer_freq
cpu/native: Add support for periph_timer_query_freqs
2024-01-30 08:20:23 +00:00
Armin Wolf
6070c57e21 cpu/native: Add support for periph_timer_query_freqs
Add support for querying the frequency supported by
`periph_timer`. This allows applications which require
this feature to run on the `native` board.

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
2024-01-30 02:01:50 +01:00
Armin Wolf
d04df84b76 cpu/native: Fix executable stack warning
The tramp assembly was missing a `.note.GNU-stack` section,
meaning the compiler was forced to assume that we require
an executable stack.

Fix this by adding the necessary section.

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
2024-01-28 04:43:42 +01:00
Benjamin Valentin
cb76cc17e9 cpu/native: fix build with !core_thread 2024-01-09 23:02:01 +01:00
Benjamin Valentin
c6646125f7 native/mtd: drop .write()
The old .write() function is only used as a fall-back if .write_page()
is not implemented.
We can drop it.
2023-12-13 16:50:41 +01:00
Gunar Schorcht
d59d48d58b cpu/native: replace external mtd0 declaration
Since the `extern mtd_dev_t *` declarations were removed from board definitions, `mtd_dev_get` has to be used instead.
2023-12-07 15:32:49 +01:00
Marian Buschsieweke
50b841e154
cpu/native: drop unused real_setitimer 2023-11-02 14:12:54 +01:00
Marian Buschsieweke
cea7fcec2f
cpu/native: fix bug in periph_timer
Also use `CLOCK_MONOTONIC` for the timeouts, not just for
`timer_read()`. This fixes mismatches between when a timeout
occurs and what is expected in the context of the values returned by
`timer_read()`.
2023-11-02 14:12:54 +01:00
Marian Buschsieweke
51127f674a
drivers/periph/rtc: improve doc on rtc_set_alarm
- point out behavior on denormalized time stamps
- use errno codes to indicate errors (and adapt the few instances of
  actual error handling to use them)
2023-05-30 17:41:36 +02:00
bors[bot]
718a4513b5
Merge #19368 #19529 #19531
19368: debug: add DEBUG_BREAKPOINT() macro, set breakpoint on failed assertion r=benpicco a=benpicco



19529: cpu/stm32/periph/dac: optimize setting DAC r=benpicco a=Enoch247

### Contribution description

The current implmentation right shifted the 16 bit value passed into `dac_set()` down to the 12 bits that the DAC is actually capable of. This patch drops the shift and instead writes the 16 bit value to the DAC's left aligned 12 bit wide data holding register.


### Testing procedure

do something like:
``` c
#include "perip/dac.h"

int main(void)
{
    dac_set(DAC_LINE(0), 0xffff/2);
    return 0;
}
```
- observe DAC's output is half of vref


### Issues/PRs references

- none known


19531: tests/unittests: allow passing `UNIT_TESTS` via env r=benpicco a=kaspar030



Co-authored-by: Benjamin Valentin <benpicco@beuth-hochschule.de>
Co-authored-by: Joshua DeWeese <jdeweese@primecontrols.com>
Co-authored-by: Kaspar Schleiser <kaspar@schleiser.de>
2023-05-02 18:08:42 +00:00
Marian Buschsieweke
c3500eb6e0
tree wide: fix typos in comments found by codespell
This will not change generated binaries, only the Doxygen output and
source code will have less typos.
2023-05-02 09:52:06 +02:00
Benjamin Valentin
fe4cc9169d cpu/native: define ARCHITECTURE_BREAKPOINT() 2023-04-27 13:19:17 +02:00
Benjamin Valentin
6fe5d85e11 cpu/native: unmount fs on exit 2023-04-26 00:53:14 +02:00
Benjamin Valentin
c438c80548 cpu/native: add host fs access via VFS 2023-04-26 00:53:14 +02:00
Benjamin Valentin
006ad81c0c cpu/native: wire up more fs related syscalls 2023-04-25 13:28:20 +02:00
Benjamin Valentin
8ec1934226 cpu/native: add braces to condition 2023-04-25 13:27:39 +02:00
Teufelchen1
10cada1b8d native/syscalls: rename real_clock_gettime to clock_gettime 2023-04-17 15:21:52 +02:00