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

8764 Commits

Author SHA1 Message Date
Benjamin Valentin
6389b3c83b Revert "cpu/sam0_common: RTC: avoid negative month after POR"
This reverts commit 897a3ceda9.
2024-03-07 13:52:35 +01:00
Benjamin Valentin
8c4d0c53f2 cpu/sam0_common: RTC: avoid negative month after POR 2024-03-07 13:52:35 +01:00
Benjamin Valentin
897a3ceda9 cpu/sam0_common: RTC: avoid negative month after POR 2024-03-06 18:48:26 +01:00
Benjamin Valentin
5164a6cc59 cpu/native: return _native_retval with NATIVE_AUTO_EXIT 2024-03-04 14:08:52 +01:00
benpicco
ba171a1075
Merge pull request #20444 from Ollrogge/u575zi-q-board
boards/nucleo-u575zi-q: Add support
2024-03-01 17:33:14 +00:00
Ollrogge
53d53d8cc8 boards/nucleo-u575zi-q: Add support 2024-03-01 11:18:18 +01:00
Benjamin Valentin
d26937fe9c cpu/gd32v: don't set FW_ROM_LEN to ROM_LEN
FW_ROM_LEN is supposed to be a subset of ROM_LEN that contains the firmware
(without bootloader, AUX slot).
2024-02-28 13:49:12 +01:00
Benjamin Valentin
a417a3e72c cpu/riscv_common: allow to define AUX slot on flash 2024-02-28 11:49:05 +01:00
Benjamin Valentin
308374fc29 cpu/cortexm_common: allow to define AUX slot on flash 2024-02-28 11:49:05 +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
Marian Buschsieweke
047fb8d3c7
Merge pull request #20419 from benpicco/cpu/native_assert-reval
cpu/native: return error code on failed assertion
2024-02-22 16:31:51 +00:00
Benjamin Valentin
9e9a906f4d cpu/native: return error code on failed assertion 2024-02-22 16:06:32 +01:00
chrysn
6e892d9b1c
Merge pull request #20416 from chrysn-pull-requests/alt20415
cpu/esp: Use CPU_ESP8266 define instead of the removed MCU_ESP8266
2024-02-22 14:31:43 +00:00
chrysn
c3020ce3b7 cpu/esp: Use CPU_ESP8266 define instead of the removed MCU_ESP8266
Follow-up-for: https://github.com/RIOT-OS/RIOT/pull/20397
Closes: https://github.com/RIOT-OS/RIOT/pull/20409
Closes: https://github.com/RIOT-OS/RIOT/pull/20415
2024-02-22 14:26:43 +01:00
benpicco
d83ec632e3
Merge pull request #20406 from FlapKap/fix_eeprom_debug_off_by_one
periph/eeprom: fix off-by-one error in debug statement
2024-02-22 08:48:41 +00:00
Benjamin Valentin
75bf0e33e0 cpu/esp8266: allow arbitrary SPI clocks 2024-02-21 23:15:21 +01:00
Kasper Hjort Berthelsen
9e6276351d periph/eeprom: fix off-by-one error in debug statement
Since p is incremented DEBUG prints the next value instead of the current
I also took the liberty to add debugs to the `write` function
2024-02-21 13:26:36 +01:00
chrysn
756a384442 makefiles, treewide: Remove MCU variable 2024-02-18 20:46:09 +01:00
Marian Buschsieweke
aeca9a52c6
cpu/stm32: implement periph_spi_reconfigure
Fixes https://github.com/RIOT-OS/RIOT/issues/20227
2024-02-15 19:11:37 +01:00
Mihai Renea
fc3d0d8676 cpu/native: fix native_async_read_remove_handler() + enable all baudrates 2024-02-10 15:46:00 +01:00
benpicco
9501f64c4e
Merge pull request #20365 from derMihai/mir/native_uart_poweroff
cpu/native/periph/uart: uart_poweroff() closes the file descriptor + extended baud-rate support on Linux
2024-02-10 10:35:31 +00:00
benpicco
55b6728224
Merge pull request #19738 from benpicco/stdio_dispatch
stdio_dispatch: allow to select multiple stdio methods at the same time
2024-02-09 16:13:27 +00:00
Benjamin Valentin
35ef7ca389 cpu/esp32/stdio_usb_serial_jtag: port to new interface 2024-02-09 15:24:22 +01:00
Mihai Renea
795415d59e cpu/native/periph/uart: uart_poweroff() closes the file descriptor 2024-02-09 12:55:40 +01:00
Marian Buschsieweke
26946a721b
Merge pull request #20360 from maribu/stm32-adc-typo
cpu/stm32/periph_adc: fix register access
2024-02-08 16:31:46 +00:00
Marian Buschsieweke
4ed287cec8
cpu/stm32/periph_adc: fix register access
The register access to SMPR1/SMPR2 was incorrect in three aspects:

1. For channels < 10, SMPR1 was cleared but SMPR2 should have been
   cleared
2. The code was not thread-safe
3. An unneeded write was issued. (The compiler won't combine the
   in-place bitwise operations into a single read-modify-write
   sequence on `volatile` memory.)

Fixes https://github.com/RIOT-OS/RIOT/issues/20261
2024-02-08 14:51:25 +01:00
benpicco
c07eca7696
Merge pull request #20356 from maribu/boards/msp-fixup
boards/olimex-msp430-h2618: change UART config
2024-02-08 10:18:02 +00:00
Marian Buschsieweke
cbd918daab
cpu/msp430/x1xx: fix typo in doc 2024-02-07 20:07:53 +01:00
Benjamin Valentin
453a8be4f3 sys/cpp_new_delete: always enable the module when C++ is used 2024-02-07 11:40:23 +01:00
benpicco
4d9e8a8dde
Merge pull request #20335 from fzi-haxel/pr/native64-board
native64: Separate board for 64-bit native
2024-02-05 22:58:02 +00: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
Marian Buschsieweke
06a05370a2
cpu/sam0_common: Implement gpio_ll_switch_dir 2024-02-05 10:56:16 +01:00
Marian Buschsieweke
c011764022
cpu/atmega_common: implement gpio_ll_switch_dir 2024-02-05 10:56:16 +01:00
Marian Buschsieweke
8bf61336a2
Merge pull request #20290 from maribu/drivers/periph/gpio_ll/features
drivers/periph_gpio_ll: Fix GPIO_DISCONNECT handling and add compile time feature checks
2024-02-05 07:30:54 +00:00
Marian Buschsieweke
f10a994a9e
cpu/gd32v/periph_gpio_ll: fix and clean up
Use analog mode for GPIO_DISCONNECT, as this is said to have the lowest
current leakage due to disabling the Schmitt trigger and correctly
detect this in `gpio_ll_query_conf()`.

Also drop the `schmitt_trigger_disabled` member in `gpio_conf_t`, as
the Schmitt trigger is only ever disabled in Analog mode anyway and
cannot be freely configured.
2024-02-05 08:21:52 +01:00
Marian Buschsieweke
1351c61c6a
cpu/efm32: expose pull up on GPIO_DISCONNECT
Allow enabling the pull on on `GPIO_DISCONNECT` and query that
correctly.
2024-02-05 08:21:51 +01:00
Marian Buschsieweke
6028097132
cpu/stm32/periph_gpio_ll: Fix and clean up
The separate Schmitt trigger bit in the configuration is dropped, as
the Schmitt trigger is only every disabled when in `GPIO_DISCONNECT`
mode. So no need to encode the same information twice.

The `gpio_state_t` is improved to be a bitmask that holds the
MODER register value and a flag indicating whether open-drain mode
should be enabled.

Finally, `GPIO_DISCONNECT` is implemented. This is done by placing the
GPIO in analog mode, which by disabling the Schmitt trigger reduces
power consumption.
2024-02-05 08:21:51 +01:00
Benjamin Valentin
895a6f87ed cpu/stm32/rtc: add support for STM32G0 2024-02-04 19:44:56 +01:00
Marian Buschsieweke
3b3da09ec6
Merge pull request #20313 from maribu/sys/byteorder/cleanup-implementation
sys/byteorder: clean up implementation
2024-02-02 05:38:33 +00: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
benpicco
ad743820f4
Merge pull request #20317 from Wer-Wolf/native_timer_init
Fix for `periph_timer` on `native`
2024-02-01 09:08:20 +00:00
benpicco
4ea27d4c13
Merge pull request #20300 from jparker324/stm32c0_and_nucleo_c031c6
cpu/stm32: add support for STM32C0 and NUCLEO-C031C6
2024-01-31 15:09:25 +00:00
Marian Buschsieweke
b42b1998ec
cpu/sam0_common: fix vendor header files
Ran the `fix_headers.sh` to fix the vendor header files and removed
the no longer needed work around for them.
2024-01-31 14:46:23 +01:00
Marian Buschsieweke
1425dc0652
cpu/sam0_common: Update script to fix vendor headers
The script to fix the vendor header files has been renamed to
`fix_headers.sh` and now does two things:

1. Strip bogus type qualifiers in front of padding (as before)
2. Strip bogus `LITTLE_ENDIAN` defines.
2024-01-31 14:46:23 +01: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
Benjamin Valentin
a21acf0858 cpu/sam0_common: flashpage: disable interrupts while writing 2024-01-30 18:48:01 +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
Jason Parker
b5d72d8242 cpu/stm32: add CPU_FAM_STM32C0 support 2024-01-29 14:44:10 -05: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
chrysn
8f111a3c29
Merge pull request #20299 from chrysn-pull-requests/nrf52-spi-bugs-2
cpu/nrf52 i2c: Wait for complete transmission when writing NOSTOP
2024-01-27 08:56:05 +00:00
chrysn
790e808deb cpu/nrf52 i2c: Wait for complete transmission when writing NOSTOP 2024-01-27 09:41:26 +01:00
chrysn
1073df2ce2
Merge pull request #20298 from chrysn-pull-requests/nrf52-spi-bugs
cpu/nrf52 i2c: Always buffer writes
2024-01-25 16:09:28 +00:00
chrysn
52a976e147 cpu/nrf52 i2c: Add shortcut when data is in RAM
See-Also: https://github.com/RIOT-OS/RIOT/pull/20298#discussion_r1466508505
2024-01-25 16:33:25 +01:00
chrysn
b80d1e622f cpu/nrf52 i2c: Always buffer writes
The underlying peripheral can only read from RAM. This uses the
existing infrastructure (already needed to work around the lack of a
hardware support for I2C_NOSTART) to unconditionally copy any to-be-sent
data into RAM.
2024-01-25 15:24:57 +01:00
Marian Buschsieweke
807fcd7614
cpu/sam0_common/periph_gpio_ll: fix doc
Fix some copy-paste bugs in the doc.
2024-01-23 15:51:36 +01:00
Marian Buschsieweke
f3bd3476ee
cpu/atmega_common: Make GPIO_DISCONNECT alias for GPIO_INPUT
Since on ATmega GPIOs cannot be disconnected and the reset state is
them being an input, this may help making code more portable.
2024-01-23 15:03:34 +01:00
Marian Buschsieweke
bd3f54ac8f
drivers/periph_gpio_ll: Add features for compile-time-checks
This adds the features

 - periph_gpio_ll_input_pull_down:
        To indicate support for input mode with internal pull down
 - periph_gpio_ll_input_pull_keep:
        To indicate support for input mode with internal resistor
        pulling towards current level
 - periph_gpio_ll_input_pull_up:
        To indicate support for input mode with internal pull up
 - periph_gpio_ll_disconnect:
        To indicate a GPIO can be disconnected
 - periph_gpio_ll_open_drain:
        To indicate support for open drain mode
 - periph_gpio_ll_open_drain_pull_up:
        To indicate support for open drain mode with internal pull up
 - periph_gpio_ll_open_source:
        To indicate support for open source mode
 - periph_gpio_ll_open_source_pull_down:
        To indicate support for open source mode with internal pull down
2024-01-23 15:03:34 +01:00
Marian Buschsieweke
0a06b0c1d8
Merge pull request #20282 from chrysn-pull-requests/nrf52-i2c-nostop
cpu/nrf5x i2c: Set up correct interrupts after NOSTOP transmissions
2024-01-23 09:05:35 +00:00
chrysn
fce82dec6e cpu/nrf5x i2c: Forbid receive NOSTOP, document rationale 2024-01-22 23:29:24 +01:00
Marian Buschsieweke
63ec7fc7b5
Merge pull request #19835 from maribu/msp430
cpu/msp430: rework MSP430 x1xx periph drivers
2024-01-22 18:41:23 +00:00
Marian Buschsieweke
675dcc381c
cpu/msp430: rework MSP430 x1xx periph drivers
- Move common code for USART (shared SPI / UART peripheral) to its
  own file and allow sharing the USART peripheral to provide both
  UART and SPI in round-robin fashion.
- Configure both UART and SPI bus via a `struct` in the board's
  `periph_conf.h`
    - this allows allocating the two UARTs as needed by the use case
    - since both USARTs signals have a fixed connection to a single
      GPIO, most configuration is moved to the CPU
    - the board now only needs to decide which bus is provided by
      which USART

Note: Sharing an USART used as UART requires cooperation from the app:
- If the UART is used in TX-only mode (no RX callback), the driver
  will release the USART while not sending
- If the UART is used to also receive, the application needs to power
  the UART down while not expecting something to send. An
  `spi_acquire()` will be blocked while the UART is powered up.
2024-01-22 16:59:23 +01:00
Marian Buschsieweke
1484d305bf
cpu/sam0_common: implement periph_gpio_ll_irq
Co-authored-by: benpicco <benpicco@googlemail.com>
2024-01-22 16:28:30 +01:00
Marian Buschsieweke
855756524f
cpu/sam0_common: Implement periph_gpio_ll
Co-authored-by: benpicco <benpicco@googlemail.com>
2024-01-22 16:28:16 +01:00
chrysn
b91161dfce cpu/nrf5x i2c: Set up correct interrupts after NOSTOP transmissions 2024-01-22 02:03:46 +01:00
Marian Buschsieweke
922276296e
drivers/periph/gpio_ll: pass gpio_conf_t by value
Now that `gpio_conf_t` is on all implemented platforms no larger than
a register, we can more efficiently pass it by value rather than via
pointer.
2024-01-21 09:19:08 +01:00
Marian Buschsieweke
2a00ec13e5
drivers/periph/gpio_ll: shrink gpio_conf_t
This commit optimizes the `gpio_conf_t` type in the following
regards:

- The "base" `gpio_conf_t` is stripped from members that only some
  platforms support, e.g. drive strength, slew rate, and disabling of
  the Schmitt Trigger are no longer universally available but
  platform-specific extensions
- The `gpio_conf_t` is now crammed into a bit-field that is 8 bit or
  16 bit wide. This allows for storing lots of them e.g. in
  `driver_foo_params_t` or `uart_conf_t` etc.
- A `union` of the `struct` with bit-field members and a `bits` is used
  to allow accessing all bits in a simple C statement and to ensure
  alignment for efficient handling of the type

Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
2024-01-21 08:38:40 +01:00
Marian Buschsieweke
504c169346
Merge pull request #20270 from maribu/boards/gd32vf103c-start
boards/gd32vf103c-start: new board
2024-01-20 16:11:31 +00:00
Marian Buschsieweke
8b1c43afb0
cpu/gd32v: Allow configuration of SWJ_CFG
Expose the compile time configuration knob `CONFIG_AFIO_PCF0_SWJ_CFG`
to allow freeing some/all JTAG pins and use them as GPIOs.

As default, PB4 is remapped from NJTRST to be usable as regular GPIO.
This still allows using the JTAG interface for debugging/flashing,
but makes an GPIO exposed by some boards available.
2024-01-19 23:17:35 +01:00
benpicco
d5f1fda70d
Merge pull request #20230 from benpicco/CONFIG_UART_DMA_THRESHOLD_BYTES
cpu/stm32: uart: don't do DMA for small transfers
2024-01-18 12:26:30 +00:00
Marian Buschsieweke
3b5ed6d390
cpu/gd32v: Fix periph_pwm
The API doc clearly states that arbitrary high PWM frequencies can
be requested and the driver should reduce the frequency while keeping
the resolution, when required. So change the code to just do that
rather than blowing assertions.
2024-01-17 21:58:56 +01:00
Benjamin Valentin
9d70fbf2e1 cpu/sam0_common: SDHC: make use of busy_wait() 2024-01-15 14:30:56 +01:00
Benjamin Valentin
7add6c2fcc cpu/avr8_common: make pm_layered a DEFAULT_MODULE
This lets us disable it.
2024-01-11 21:14:43 +01:00
benpicco
714958ad3c
Merge pull request #20241 from benpicco/busy_wait
sys/busy_wait: add busy wait helper
2024-01-11 12:19:31 +00:00
Benjamin Valentin
fff9ff14da cpu/esp32: add busy loop cycles for all sub-arches 2024-01-10 22:43:31 +01:00
Benjamin Valentin
8bcfe7b7b6 cpu/esp8266: ESP8266 needs 5 cycles per busy loop 2024-01-10 22:43:31 +01:00
Benjamin Valentin
5dc43bd62d cpu/avr8_common: AVR-8 needs 7 cycles per busy loop 2024-01-10 22:43:31 +01:00
benpicco
2e3037c3aa
Merge pull request #20240 from benpicco/cpu/atmega-no_thread
cpu/avr8_common: fix build with !core_thread
2024-01-09 22:13:30 +00:00
Benjamin Valentin
cb76cc17e9 cpu/native: fix build with !core_thread 2024-01-09 23:02:01 +01:00
Benjamin Valentin
79b51efc15 cpu/cortexm_common: Cortex M0/M23 needs 4 cycles/busy loop 2024-01-09 19:03:15 +01:00
Benjamin Valentin
bfd29f0fa7 sys/busy_wait: add busy wait helper 2024-01-09 19:03:15 +01:00
Benjamin Valentin
112e378fcc cpu/avr8_common: fix build with !core_thread 2024-01-09 19:00:22 +01:00
Gunar Schorcht
92657f5fd2 cpu/esp32: add SDMMC support 2024-01-05 07:22:27 +01:00
Kevin "Tristate Tom" Weiss
7fef2e4b6f
Merge pull request #20214 from benpicco/CONFIG_SPI_DMA_THRESHOLD_BYTES
cpu/stm32/periph_spi: only perform DMA transfer above threshold
2024-01-04 17:32:02 +00:00
Benjamin Valentin
ca9bf1a29a cpu/stm32: uart: don't do DMA for small transfers 2024-01-04 17:34:18 +01:00
Marian Buschsieweke
616b48d354
Merge pull request #20228 from benpicco/cc2538_get_eui64_primary
cpu/cc2538: fix EUI provider
2024-01-04 14:30:19 +00:00
Benjamin Valentin
94ad4d7ba3 cpu/cc2538: update function signature of EUI provider 2024-01-04 13:15:47 +01:00
Marian Buschsieweke
f860d96a25
Merge pull request #19891 from chrysn-pull-requests/ws2181x_timer
drivers/ws281x: Add gpio_ll and timer based driver
2024-01-03 09:22:26 +00:00
krzysztof-cabaj
29502b2dc4 cpu/stm32/periph: fix typo - or RAM 2024-01-01 13:26:24 +01:00
Benjamin Valentin
753fae6936 cpu/stm32/periph_spi: only perform DMA transfer above threshold 2023-12-23 17:36:30 +01:00
Benjamin Valentin
fbeb1f9a26 drivers/periph/spi: move DMA threshold to common code 2023-12-23 17:35:29 +01:00
Gunar Schorcht
337a63ecb5 cpu/stm32/periph: add SDMMC support for F2/F4/F7/L4 2023-12-21 18:37:43 +01:00
Gunar Schorcht
d91f438589 cpu/stm32/periph/dma: dma_setup_ext for extended configuration
The function configures additional features of the DMA stream for F2/F4/F7.
`dma_setup_ext` added to configure F2/F4/F7 specific additional features like `MBURST`, `PBURST`, `FIFO` and Peripheral flow controller. It is supposed to be used after `dma_setup` and `dma_prepare`.
2023-12-20 09:14:28 +01:00
MrKevinWeiss
7b80348f31
drivers/ws281x: Fix Kconfig
Patch from https://github.com/RIOT-OS/RIOT/pull/19891#pullrequestreview-1753651538
2023-12-19 11:13:43 +01:00
chrysn
02285fd63a
drivers/periph: Add timer_poll feature and timer_poll_channel function 2023-12-19 11:13:41 +01:00
chrysn
abf95d14a6
cpu/nrf5x: Tolerate NULL callback in timers
timer_set has no documented restriction on this being not null, other
implementations explicitly tolerate it (rpx0xx checks inside the ISR,
but doing it at init time keeps the ISR slim).

This is useful when using a timer just to read, without any action when
it triggers (the action is taken depending on read values, eg. in a
thread context).
2023-12-19 11:13:40 +01:00
benpicco
208790a5f1
Merge pull request #20108 from benpicco/drivers/dose-uart_ondemand_tx
drivers/periph/uart: add periph_uart_tx_ondemand feature
2023-12-14 20:42:55 +00:00
Benjamin Valentin
60f8468191 cpu/sam0_common: implement uart_tx_ondemand 2023-12-14 18:30:38 +01:00
Gunar Schorcht
d089c122c1 cpu/sam0_common: improve doc consistency for MTDs 2023-12-14 17:26:29 +01:00
benpicco
6eac1e1761
Merge pull request #15380 from benpicco/mtd_drop_write
mtd/*: drop .write() if .write_page() is implemented
2023-12-13 20:35:53 +00: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
Benjamin Valentin
2235dc2464 cpu/esp_common: flash: 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
Benjamin Valentin
6b86e274d9 cpu/sam0/uart: implement uart_pin_cts()/uart_pin_rts() 2023-12-12 20:26:17 +01:00
Marian Buschsieweke
3002f1efa3
cpu/stm32: fix periph_i2c for F1, F2, L1 and F4 families
- boot the I2C after init in low power mode
    - otherwise I2C will consume more power until the first time it is
      used, which is surprising
- STM32 F1 only: reconfigure SCL and SDA as GPIOs while the I2C
  peripheral is powered down
    - When the I2C peripheral is not clocked, it drives SCL and SDA
      down. This will dissipate power across the pull up resistor.
2023-12-12 09:55:47 +01:00
Marian Buschsieweke
13f0a5062d
cpu/stm32/periph_i2c: improve DEBUG output 2023-12-12 09:55:47 +01:00
Marian Buschsieweke
bb07bb6613
Merge pull request #20160 from maribu/cpu/msp430/timer
cpu/msp430: improve periph_timer
2023-12-10 13:02:30 +00:00
Marian Buschsieweke
a3cd9ef387
Merge pull request #20111 from maribu/cpu/nrf5x_common/cleanup_uart
cpu/nrf5x_common: clean up UART implementation
2023-12-10 08:32:30 +00:00
Marian Buschsieweke
e6154a04a1
cpu/msp430: aid optimizer
Declare functions retrieving the clock domains frequency as pure so
that common subexpressions can be eliminated more easily.
2023-12-10 09:11:23 +01:00
Marian Buschsieweke
7044699388
cpu/msp430: improve periph_timer
- add support for multiple timers
- add support for selecting clock source in the board's `periph_conf.h`
- add support for the prescaler
- implement `periph_timer_query_freqs`
- add a second timer to all MSP430 boards
    - the first timer is fast ticking, high-power
    - the second is slow ticking, low-power
2023-12-10 09:11:23 +01:00
Marian Buschsieweke
43e62e68f7
Merge pull request #20149 from maribu/cpu/stm32/buf-wfi
cpu/cortexm_common: work around bug on WFI for STM32
2023-12-09 15:45:12 +00:00
Marian Buschsieweke
46571b6aec
Merge pull request #20144 from maribu/periph_timer_query_freq-kinetis
cpu/kinetis: implement periph_timer_query_freqs
2023-12-09 12:39:06 +00:00
Marian Buschsieweke
95be5edf5c
Merge pull request #20145 from maribu/periph_timer_query_freq-nrf5x
cpu/nrf5x_common: implement periph_timer_query_freqs
2023-12-09 07:42:56 +00:00
Marian Buschsieweke
b40ab8f833
cpu/nrf5x_common: implement periph_timer_query_freqs 2023-12-08 23:23:07 +01:00
Marian Buschsieweke
2a6ef9fda4
Merge pull request #20146 from maribu/periph_timer_query_freq-qn908x
cpu/qn908x: implement periph_timer_query_freqs
2023-12-08 14:46:01 +00:00
Marian Buschsieweke
9718e9afc0
Merge pull request #20143 from maribu/periph_timer_query_freq-cc26xx_cc13xx
cpu/cc26xx_cc13xx: implement periph_timer_query_freqs
2023-12-08 14:45:55 +00:00
Marian Buschsieweke
481e3a95d4
Merge pull request #20142 from maribu/periph_timer_query_freq-atmega
cpu/atmega_common: implement periph_timer_query_freqs
2023-12-08 11:22:56 +00:00
Marian Buschsieweke
b0261f31ab
Merge pull request #20148 from maribu/periph_timer_query_freq-stm32
cpu/stm32: implement periph_timer_query_freqs
2023-12-07 21:57:49 +00:00
Marian Buschsieweke
eb2e6983d1
Merge pull request #20147 from maribu/periph_timer_query_freq-sam0
cpu/sam0_common: implement periph_timer_query_freqs
2023-12-07 16:24:32 +00:00
Marian Buschsieweke
b6a7815b48
cpu/sam0_common: implement periph_timer_query_freqs 2023-12-07 16:18:09 +01:00
Marian Buschsieweke
35e140b540
cpu/qn908x: implement periph_timer_query_freqs 2023-12-07 16:17:57 +01:00
Marian Buschsieweke
f52e20c248
cpu/kinetis: implement periph_timer_query_freqs 2023-12-07 16:17:31 +01:00
Marian Buschsieweke
c18c47d621
cpu/cc26xx_cc13xx: implement periph_timer_query_freqs 2023-12-07 16:15:43 +01:00
Marian Buschsieweke
e78630fc40
cpu/atmega_common: implement periph_timer_query_freqs 2023-12-07 16:15:22 +01:00
Marian Buschsieweke
3868a7fa10
cpu/stm32: implement periph_timer_query_freqs 2023-12-07 16:15:06 +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
dd88935f46
cpu/msp430: consistently use msp430 prefix in names
Previously sometimes `msp_` was used as prefix, sometimes `msp430_`.
This makes the naming consistent.
2023-12-06 17:10:11 +01:00
Marian Buschsieweke
1c281d2768
cpu/cortexm_common: work around bug on WFI for STM32
See [1] for details. (archive.org backup at [2]).

Fixes https://github.com/RIOT-OS/RIOT/issues/13918
Fixes https://github.com/RIOT-OS/RIOT/issues/14015

[1]: https://cliffle.com/blog/stm32-wfi-bug/
[2]: https://web.archive.org/web/20231205101603/https://cliffle.com/blog/stm32-wfi-bug/
2023-12-05 15:16:55 +01:00
benpicco
182700fef4
Merge pull request #20134 from benpicco/cpu/sam0_common-adc_continuous-fix
cpu/sam0_common: fix adc_continuous_sample()
2023-12-01 20:05:27 +00:00
Benjamin Valentin
1e9b1992df cpu/sam0_common: fix adc_continuous_sample() 2023-12-01 19:45:54 +01:00
Gerson Fernando Budke
166ee62300
cpu/atxmega: Drop unnecessary test config
Co-authored-by: MrKevinWeiss <weiss.kevin604@gmail.com>
Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-12-01 14:12:24 +01:00
Gerson Fernando Budke
ab70f20069
cpu/avr8_common: Fix PM and Common peripherals build
Co-authored-by: Marian Buschsieweke <marian.buschsieweke@posteo.net>
Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-12-01 14:12:24 +01:00
Gerson Fernando Budke
c64a64f549
cpu/atmega_common: Increase stack a little bit
This is necessary to allow run the thread_duel example.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-12-01 14:12:24 +01:00
Gerson Fernando Budke
9dfdedcaf7
cpu/atmega_common: Add PM on peripherals
Add PM blocks to adc/i2c/spi peripherals.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-12-01 14:12:23 +01:00
Gerson Fernando Budke
549e2b4de1
cpu/atxmega: Fix PM states on peripherals
Fix the required PM state on i2c and spi peripherals.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-12-01 14:12:23 +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
david-vankampen
b09713e058
Merge branch 'RIOT-OS:master' into stm32_adc_cal 2023-11-27 14:22:39 -05:00
benpicco
c93a5b84a3
Merge pull request #20020 from gompper/periph/freqm
drivers/include/periph: add FREQM peripheral driver
2023-11-27 16:06:52 +00:00
Marian Buschsieweke
659ef97730
cpu/nrf5x_common: clean up UART implementation
The functions `uart_poweron()`, `uart_poweroff()` and  `uart_mode()`
can share code between the UART (UART without EasyDMA) and UARTE
(UART with EasyDMA) implementations, so let's do that.
2023-11-27 09:49:01 +01:00
Marian Buschsieweke
73bde97e9d
Merge pull request #20102 from maribu/cpu/nrf5x_common/clean_up_uart
cpu/nrf5x: clean up periph_uart
2023-11-26 20:43:29 +00:00
Marian Buschsieweke
a28003f0fa
cpu/nrf5x_common: add whitespace to please linter
Fixes the "comma should be followed by whitespace" warning from
`static-tests`.
2023-11-26 21:33:23 +01:00
Marian Buschsieweke
63faa5f162
cpu/nrf5x: clean up periph_uart
- nRF51: Use `uart_conf_t` for consistency with nRF52
- nRF52832: Use UARTE (UART with EasyDMA) over UART (without DMA), as
  done for all other nRF52 family members
- use `UARTE_PRESENT` to detect whether an UARTE can be used, rather
  than family names
2023-11-26 21:33:23 +01:00
Marian Buschsieweke
60676bfd5c
Merge pull request #20107 from maribu/cpu/nrf51/periph/i2c.c
cpu/nrf51: fix periph_i2c driver
2023-11-24 10:23:57 +00:00
Marian Buschsieweke
e407460243
cpu/nrf51: fix periph_i2c driver
The `i2c_read_bytes()` and `i2c_write_bytes()` function return the
number of bytes written / read, instead of `0` as the API contract
says. This fixes the issue.
2023-11-24 10:03:07 +01:00
Marian Buschsieweke
f4729c28ec
cpu/stm32/periph_spi: improve prescaler calculation
With only 8 possible prescalers, we can just loop over the values
and shift the clock. In addition to being much easier to read, using
shifts over divisions can be a lot faster on CPUs without hardware
division.

In addition an `assert()` is added that checks if the API contract
regarding the SPI frequency is honored. If the requested clock is too
low to be generated, we should rather have a blown assertion than
hard to trace communication errors.

Finally, the term prescaler is used instead of divider, as divider may
imply that the frequency is divided by the given value n, but
in fact is divided by 2^(n+1).
2023-11-24 08:49:25 +01:00
Marian Buschsieweke
63a2a50b5f
cpu/stm32/periph_spi: Fix /CS handling
Previously, the /CS signal was performed by enabling / disabling the
SPI peripheral. This had the disadvantage that clock polarity settings
where not applied starting with `spi_acquire()`, as assumed by e.g.
the SPI SD card driver, but only just before transmitting data.

Now the SPI peripheral is enabled on `spi_acquire()` and only disabled
when calling `spi_release()`, and the `SPI_CR2_SSOE` bit in the `CR2`
register is used for hardware /CS handling (as supposed to).
2023-11-24 08:49:25 +01:00
Marian Buschsieweke
7057aa674d
cpu/stm32: Provide spi_mode_t
This doesn't change the firmware, since for all STM32 MCUs with an
SPI driver the register setting in the mode did match the SPI mode
number by chance. But for some STM32 MCUs with no SPI driver yet
the register layout is indeed different. This will help to provide an
SPI driver for them as well.
2023-11-24 08:49:24 +01:00
Urs Gompper
12acc8dec9 cpu/samd5x: make GCLK definitions overwritable 2023-11-23 21:00:16 +01:00
Urs Gompper
f352609c5e cpu/sam0_common: added peripheral FREQM configuration declaration 2023-11-23 21:00:16 +01:00
Urs Gompper
b1e31fbf61 cpu/samd5x: define GCLK pins 2023-11-23 21:00:15 +01:00
Urs Gompper
5479c7eb96 cpu/samd5x: add conditional enabling of freqm peripheral 2023-11-23 20:53:14 +01:00
Urs Gompper
4c97a27826 cpu/sam0_common: implement freqm peripheral 2023-11-23 20:37:51 +01:00
Marian Buschsieweke
097b99f4f2
cpu/stm32: always apply /CS settings
The CR2 register was only written to if the settings differ from the
reset value. This wasn't actually a bug, since it was cleared in
`spi_release()` to the reset value again. Still, it looks like a bug,
may cause a pipeline flush due to the branch, and increased `.text`
size. So let's get rid of this.
2023-11-21 08:25:32 +01:00
Marian Buschsieweke
f9e4affd19
Merge pull request #19792 from kyleb29/bugfix-19787
cpu/stm32/periph_i2c: prevent corrupting AFIO->MAPR
2023-11-20 20:33:16 +00:00
Kyle Burk
986488db85
cpu/stm32/f1: prevent corrupting AFIO->MAPR
The `SWJ_CFG` field of the `AFIO_MAPR` register is write only and values
read are undefined (random). Hence, using `AFIO->MAPR |= mask;` to
enable flags can corrupt the state of the `SWJ_CFG` (configure it to
an unintended value).

Two helper functions have been introduced:
- `afio_mapr_read()` reads the value, but sanitizes the `SWJ_CFG` field
  to zero
- `afio_mapr_write()` writes the given value, but applies the `SWJ_CFG`
  configured by the board before writing.

Finally, the `nucleo-f103rb` and `bluepill*`/`blackpill*` boards have
been updated to no longer specify `STM32F1_DISABLE_JTAG`, as this
is handled by the `SWJ_CFG` setting (which defaults to disabling JTAG).
2023-11-20 20:28:52 +01:00
MrKevinWeiss
89a16604d3
cpu/esp32: Fix kconfig of esp-lcd 2023-11-15 12:23:39 +01:00
Gunar Schorcht
70053c5284 cpu/esp32: add LCD low-level parallel interface suppport 2023-11-13 13:01:57 +01:00
Gunar Schorcht
33d6281432 cpu/esp32/esp-idf: add LCD driver of ESP-IDF 2023-11-13 13:01:57 +01:00
Marian Buschsieweke
978176a283
Merge pull request #20074 from maribu/sys/flash_utils/avr
sys/flash_utils: Minor bug fixes
2023-11-11 12:58:08 +00:00
Benjamin Valentin
5abdc7eb5f cpu/sam0_common: adc_continuous: fix uninitialized access 2023-11-10 18:35:09 +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
Benjamin Valentin
b289d69b4f cpu/sam0_common: implement periph_adc_continous 2023-11-10 12:10:49 +01:00
David VanKampen
f44faf903d cpu/stm32: add ADCAL operation for stm32g0 2023-11-06 13:34:05 -05:00
bors[bot]
4250c1509e
Merge #20009 #20042
20009: cpu/native: fix bug in periph_timer r=MrKevinWeiss a=maribu

### Contribution description

While debugging https://github.com/RIOT-OS/RIOT/pull/18977#issuecomment-1764258356 it became obvious that the `periph_timer` in `native` is broken and issues early IRQs. This replaces the use of `setitimer` that cannot use a monotonic clock source with `timer_settime()`.

### Testing procedure

I have some non-publishable code that tests if the time an ISR fires in terms of `timer_read()` is no earlier than the time expected. This occasionally triggered with `master`, but I didn't see any of these issues anymore with this PR. I guess I should revive my PR to spice up the periph timer tests and add a polished version of this and let this run for an hour or two.

The tests ins `tests/periph/timer*` should still succeed on `native`. (They do for me in a container running `riot/riotbuild`).

### Issues/PRs references

Found while debugging https://github.com/RIOT-OS/RIOT/pull/18977#issuecomment-1764258356

20042: dist/tools/uf2: add target to also copy families.json file r=MrKevinWeiss a=MichelRottleuthner

### Contribution description

The updated UF2 pkg (#20035) stores the family ID in an external .json file. I overlooked that and flashing fails if this file is not present. This PR fixes it by also copying the json into the tool folder.

### Testing procedure
Check if the `feather-nrf52840-sense` can be flashed when the new UF2 pkg is cloned freshly.


### Issues/PRs references
 Fixes a regression introduced with #20035 


Co-authored-by: Marian Buschsieweke <marian.buschsieweke@posteo.net>
Co-authored-by: Michel Rottleuthner <michel.rottleuthner@haw-hamburg.de>
2023-11-03 14:52:20 +00: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
Benjamin Valentin
7293e43167 cortexm_common: drop TODO about Cortex-M4F FPU
This should have been dropped in 06f0c14460
2023-10-30 13:08:12 +01:00
bors[bot]
03d3874e51
Merge #19465 #19981 #19995
19465: drivers/mtd: use XFA for pointers to defined MTDs r=benpicco a=gschorcht

### Contribution description

This PR provides the support to hold pointers to defined MTDs within a XFA. The XFA allows
- to access MTDs of different types (`mtd_flashpage`, `mtd_sdcard`, `mtd_emulated`, ...) by an index
- to determine the number of MTDs defined in the system.

### Testing procedure

To be defined once PR #19443 is merged because emulated MTDs will allow to test this PR on arbitrary boards.

### Porting Guide

For external boards:
 - remove the `MTD_NUMOF` definition from `board.h`
 - add `MTD_XFA_ADD(<mtd_dev>, <idx>);` to the definition of `<mtd_dev>`.
 - `MTD_0`, `MTD_1`, … defines are no longer needed.

### Issues/PRs references

 Related to PR #19443

19981: Fletcher32: Add incremental API r=benpicco a=bergzand

### Contribution description

This PR extends the current fletcher32 checksum with an incremental API mode. This way the bytes to be checksummed can be supplied via multiple successive calls and do not have to be provided in a single consecutive buffer.

I've also rephrased the warning with the original function a bit as that function uses an `unaligned_get_u16` to access the data. The data thus does not require alignment, but the length does need to be supplied as number of 16 bit words.

### Testing procedure

The test has been extended


### Issues/PRs references

None

19995: sys/psa_crypto: Fix macro for public key max size and SE example r=benpicco a=Einhornhool

### Contribution description
#### 1. Wrong public key size when using secure elements, introduced by  #19954
Fixed conditions for key size macros in `crypto_sizes.h`.

#### 2. EdDSA and ECDSA examples fail when using a secure element because of unsopported changes introduced by #19954
Updated `example/psa_crypto` to use only supported functions for secure elements.

### Testing procedure
Build `example/psa_crypto` for secure elements and run application

Output on master:
```
2023-10-19 14:33:24,372 # main(): This is RIOT! (Version: 2019.07-devel-22378-gb6772)
2023-10-19 14:33:24,372 # HMAC SHA256 took 56393 us
2023-10-19 14:33:24,372 # Cipher AES 128 took 68826 us
2023-10-19 14:33:24,372 # *** RIOT kernel panic:
2023-10-19 14:33:24,373 # HARD FAULT HANDLER
2023-10-19 14:33:24,373 # 
2023-10-19 14:33:24,373 # *** rebooting...

```
Output with fixes:
```
2023-10-19 13:35:24,715 # main(): This is RIOT! (Version: 2019.07-devel-22384-g8ef66-dev/psa-crypto-fixes)
2023-10-19 13:35:24,715 # HMAC SHA256 took 56374 us
2023-10-19 13:35:24,715 # Cipher AES 128 took 68805 us
2023-10-19 13:35:24,715 # ECDSA took 281164 us
2023-10-19 13:35:24,715 # All Done
```


Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
Co-authored-by: Koen Zandberg <koen@bergzand.net>
Co-authored-by: Lena Boeckmann <lena.boeckmann@haw-hamburg.de>
2023-10-19 19:01:12 +00:00
bors[bot]
554efb7040
Merge #19943 #19978
19943: cpu/stm32: FMC used for low-level LCD parallel interface r=maribu a=gschorcht

### Contribution description

This PR provides the implementation of the LCD low-level MCU 8080 parallel interface using the FMC peripheral.

### Testing procedure

```
BOARD=stm32f723e-disco make -C tests/drivers/st77xx flash
```
and
```
BOARD=stm32l496g-disco make -C tests/drivers/st77xx flash
```
should work on top of PR #19941. Drawing operations should be much faster.

### Issues/PRs references

Depends on PR #19941


19978: treewide: fix typos to make codespell happy r=maribu a=maribu

### Contribution description

- fixes typos in comments and docs (no generated firmware changes expected)
- fixes a typo in a string in a GUI of a utility program
- add some false positives to the ignore list

### Testing procedure

- No generated binaries (except for the GUI version of the utility program to flash the MSB-A2) should change
- The diff should not look too scary

### Issues/PRs references

None

Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
Co-authored-by: Marian Buschsieweke <marian.buschsieweke@posteo.net>
2023-10-16 11:12:04 +00:00
Marian Buschsieweke
edc43201db
tree-wide: fix typos in doc and comments
This should not change any generated binary
2023-10-16 12:17:48 +02:00
Gunar Schorcht
94fdead641 cpu/stm32: add FMC support for LCD with parallel interface 2023-10-12 18:19:03 +02:00
Mikolai Gütschow
963775bdd9
sys/psa_crypto: add support for Ed25519 (EdDSA) 2023-10-09 10:21:44 +02:00
Gunar Schorcht
d535277ebb cpu/esp_common: use XFA with MTD pointers for Flash MTD 2023-10-02 12:28:08 +02:00
Gunar Schorcht
9a49dcd479 cpu/esp32: fix RISC-V ISA for ESP32-C3 with GCC 12.2 2023-10-02 01:44:17 +02:00
bors[bot]
149cee491e
Merge #19760 #19946 #19956 #19957
19760: cpu/sam0_common/periph: add low-level SDMMC peripheral driver for SDHC r=benpicco a=gschorcht

### Contribution description

This PR implements the low-level SDIO/SDMMC peripheral driver for SAM0 SDHC according to the definition in #19539.

### Testing procedure

```
BOARD=same54-xpro make -C tests/drivers/sdmmc
```
```
BOARD=same54-xpro make -C tests/sys/vfs_default
```

### Issues/PRs references

~Depends on PR #19539~
Depends on PR #19899

19946: posix_sockets.c: Fix 2 byte int compilation errors r=benpicco a=mrdeep1



19956: cpu/esp32: fix heap definition for ESP32-S2 and ESP32-S3 r=benpicco a=gschorcht

### Contribution description

For ESP32-S2 and ESP32-S3 the symbol `_heap_end` must not be used as `_eheap` for the newlibc `malloc` and function `sbrk`.

`_heap_end` is used by the ESP-IDF heap implementation `esp-idf-heap` and points to the highest possible address (0x40000000) that could be used for the heap in ESP-IDF. It doesn't point to the top address of the unused SRAM area that can be used in newlibc `malloc` and function `sbrk`. Instead, the origin and the length of `dram0_0_seg` must be used to calculate the end of the heap `_eheap`.

The problem only occurs for the newlibc `malloc` when the `sbrk` function is used but not for the ESP-IDF heap implementation `esp_idf_heap`.

### Testing procedure

Use any ESP32-S2 or ESP32-S3 board and flash `tests/sys/malloc`, e.g.
```
CFLAGS='-DCHUNK_SIZE=16384' USEMODULE='stdio_uart' BOARD=esp32s3-pros3 make -j8 -C tests/sys/malloc flash
```
Without the PR the `nm` command will give the wrong address 
```
nm -s tests/sys/malloc/bin/esp32s3-pros3/tests_malloc.elf | grep _eheap
40000000 A _eheap
```
The test will stuck, i.e. the allocation of memory stops when the top of unused SRAM is reached and the board restarts when the watchdog timer expires. With the PR it should work as expected
```
Help: Press s to start test, r to print it is ready
START
main(): This is RIOT! (Version: 2023.10-devel-309-g4669e)
calloc(zu, zu) = 0x10000000
CHUNK_SIZE: 16384
NUMBER_OF_TESTS: 3
Allocated 16384 Bytes at 0x3fc8c4b0, total 16384
...
Allocated 16384 Bytes at 0x3fcec6f0, total 409792
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x7 (TG0WDT_SYS_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
Saved PC:0x403763e3
```

With this PR the `nm` command should give a address in unused SRAM address space
```
nm -s tests/sys/malloc/bin/esp32s3-pros3/tests_malloc.elf | grep _eheap
3fcca000 A _eheap
```
and the test should pass.

### Issues/PRs references


19957: cpu/esp32: fix Octal SPI RAM for ESP32-S3 r=benpicco a=gschorcht

### Contribution description

This PR fixes Octal SPI RAM handling for ESP32-S3.

Functions that are used during the initialization of the Octal SPI RAM must reside in IRAM instead of Flash. Otherwise, the system stucks during boot once the Octal SPI RAM is enabled. The reason is that the Flash is not available during the initialization of the Octal SPI RAM and the functions that are called during that initialization can't be accessed in Flash. As a result the call of such a function leads to code that is messed up and the system crashes.

The PR also includes the documentation fixe for the `esp32s3-box`. It also includes a small documentation fix regarding the SPI RAM for the `esp32s3-pros3` board.

### Testing procedure

Use a board that has Octal SPI RAM and flash `tests/sys/malloc`, e.g.:
```
CFLAGS='-DCHUNK_SIZE=16384' USEMODULE='stdio_uart esp_spi_ram esp_log_startup' \
BOARD=esp32s3-box make -C tests/sys/malloc
```
Without the PR, the system stuck during boot once the information for the Octal SPI RAM is print
```
ESP-ROM:esp32s3-20210327
...
I (133) boot: Loaded app from partition at offset 0x10000
I (134) boot: Disabling RNG early entropy source...
vendor id : 0x0d (AP)
dev id    : 0x02 (generation 3)
density   : 0x03 (64 Mbit)
good-die  : 0x01 (Pass)
Latency   : 0x01 (Fixed)
VCC       : 0x01 (3V)
SRF       : 0x01 (Fast Refresh)
BurstType : 0x01 (Hybrid Wrap)
BurstLen  : 0x01 (32 Byte)
Readlatency  : 0x02 (10 cycles@Fixed)
DriveStrength: 0x00 (1/1)
```
and the board restarts when the watchdog timer expires.

With this PR, the system starts as expected.
```
ESP-ROM:esp32s3-20210327
...
I (132) boot: Loaded app from partition at offset 0x10000
I (133) boot: Disabling RNG early entropy source...
vendor id : 0x0d (AP)
dev id    : 0x02 (generation 3)
density   : 0x03 (64 Mbit)
good-die  : 0x01 (Pass)
Latency   : 0x01 (Fixed)
VCC       : 0x01 (3V)
SRF       : 0x01 (Fast Refresh)
BurstType : 0x01 (Hybrid Wrap)
BurstLen  : 0x01 (32 Byte)
Readlatency  : 0x02 (10 cycles@Fixed)
DriveStrength: 0x00 (1/1)
Found 64MBit SPI RAM device
SPI RAM mode: sram 40m
PSRAM initialized, cache is in normal (1-core) mode.
Pro cpu up.
Single core mode
SPI SRAM memory test OK
Initializing. RAM available for dynamic allocation:
At 3FC8C150 len 00053EB0 (335 KiB): D/IRAM
At 3FCE0000 len 0000EE34 (59 KiB): STACK/DRAM
At 3FCF0000 len 00008000 (32 KiB): DRAM

Starting ESP32x with ID: f412fafd0f8c
ESP-IDF SDK Version v4.4.1

Current clocks in Hz: CPU=80000000 APB=80000000 XTAL=40000000 SLOW=150000
PRO cpu is up (single core mode, only PRO cpu is used)
PRO cpu starts user code
Adding pool of 8192K of external SPI memory to heap allocator
Used clocks in Hz: CPU=80000000 APB=80000000 XTAL=40000000 FAST=8000000 SLOW=150000
XTAL calibration value: 3643448
Heap free: 8754851 bytes

Board configuration:
	UART_DEV(0)	txd=43 rxd=44
	LED		pins=[ ]
	BUTTONS		pins=[ 0 ]

Starting RIOT kernel on PRO cpu
Help: Press s to start test, r to print it is ready
```

### Issues/PRs references


Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
Co-authored-by: Jon Shallow <supjps-libcoap@jpshallow.com>
2023-09-29 08:36:50 +00:00
Gunar Schorcht
cb88b86693 cpu/esp32: place code for SPI RAM in IRAM 2023-09-29 09:01:12 +02:00
Gunar Schorcht
3a40e20452 cpu/esp32: fix ld scripts for heap
For ESP32-S2 and ESP32-S3 the symbol `_heap_end` must not be used as `_eheap` for dynamic memory allocation, because it points to the highest possible address that could be used for the heap, but not to the top address of the unused SRAM area. Instead, the origin and length of `dram0_0_seg` must be used to calculate the end of the heap.
2023-09-29 08:12:59 +02:00
bors[bot]
99dc926f5e
Merge #19952
19952: cpu/stm32/periph/eth: Disable hardware checksums r=maribu a=yarrick

lwIP will fill them in already.

Having this enabled causes empty checksums to be sent: #19853



Co-authored-by: Erik Ekman <eekman@google.com>
2023-09-28 10:41:28 +00:00
Erik Ekman
1986b5eb5c cpu/stm32/periph/eth: Disable hardware checksums
lwIP will fill them in already.

Having this enabled causes empty checksums to be sent: #19853
2023-09-27 21:55:11 +02:00
Gunar Schorcht
869020ac53 cpu/stm32: fix references in documentation 2023-09-27 09:12:06 +02:00
Gunar Schorcht
8e5fc866e4 cpu/esp32: fix references in documentation 2023-09-27 09:12:06 +02:00
Gunar Schorcht
6ab9277234 cpu/sam0_common: add SDMMC support 2023-09-23 19:26:30 +02:00
Gunar Schorcht
33d1e82b73 cpu/samd5x: define power modes 2023-09-23 19:26:30 +02:00
bors[bot]
e688211541
Merge #19923
19923: boards: add Silabs EFM32 Giant Gecko GG11 Starter Kit r=miri64 a=gschorcht

### Contribution description

The PR adds the support for the EFM32GG11B family and the Silabs EFM32 Giant Gecko GG11 Starter Kit board.

The Silabs EFM32 Giant Gecko GG11 has the following on-board features:

- EFM32GG11B MCU with 2 MB flash and 512 kB RAM
- J-Link USB debugger
- 176x176 RGB LCD (not supported)
- 2 user buttons, 2 user RGB LEDs and a touch slider
- Si7021 Relative Humidity and Temperature Sensor
- Si7210 Hall-Effect Sensor (not supported)
- USB OTG interface (Device mode supported)
- 32 MByte Quad-SPI Flash (not supported yet)
- SD card slot (not supported yet, follow-up PR based on PR #19760)
- RJ-45 Ethernet (not supported)
- Dual microphones (not supported)

### Testing procedure

Basic tests should work.

### Issues/PRs references

Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
2023-09-19 19:10:14 +00:00
Gunar Schorcht
59daab0ba7 cpu/efm32: add EFM32GG11 family 2023-09-18 12:40:33 +02:00
Gunar Schorcht
165f86ad4c cpu/efm32: add family EFM32GG11 (generated with EFM2RIOT) 2023-09-18 12:40:33 +02:00
Marian Buschsieweke
63caa45746
cpu/sam3: assert valid freq in timer_init()
The API of timer_init() expects callers to know what frequencies are
supported and only use valid frequencies. So let's add an `assert()`
to aid debugging if the app uses an invalid.
2023-09-15 12:58:31 +02:00
bors[bot]
da7deb518b
Merge #19794 #19912
19794: drivers/periph: Add documentation on thread safety and initialization r=aabadie a=maribu



19912: drivers/at86rf215: switch example config to use EXT3 on same54-xpro  r=aabadie a=benpicco



Co-authored-by: Marian Buschsieweke <marian.buschsieweke@posteo.net>
Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
2023-09-05 12:03:37 +00:00
Benjamin Valentin
4ebf58d47a cpu/sam0_common: gpio: warn if EXTI line is re-used 2023-09-04 16:03:40 +02:00
bors[bot]
9be022afd8
Merge #18547
18547: sys: PSA Crypto API implementation r=MrKevinWeiss a=Einhornhool

### Contribution description
This adds an implementation of the ARM [PSA Crypto API](https://armmbed.github.io/mbed-crypto/html/index.html) specification to RIOT. 

It is a cryptographic API that supports software and hardware backends as well as the use of multiple secure elements, which can be configured with Kconfig.
It integrates indirect, identifier based key management to support persistent storage of key material in local memory and devices with protected key storage.

A description of the implementation design and an evaluation of the processing time and memory overhead in RIOT has been published here: [Usable Security for an IoT OS: Integrating the Zoo of Embedded Crypto Components Below a Common API](https://arxiv.org/abs/2208.09281)

#### Implementation status
So far this implementation supports the following operations:
- Volatile key storage
- AES in CBC mode
- Hashes (MD5, SHA1, SHA224, SHA256)
- HMAC SHA256
- ECDSA with NIST P192 and P256 curves

The following backends are supported so far:
- RIOT Cipher Module
- RIOT Hash Module
- Micro ECC library package
- Cryptocell 310 hardware accelerator on the Nordic NRF52840dk
- Microchip ATECC608A secure element

Other operations and backends as well as persistent key storage can and will be implemented by me and anyone who wants to contribute in the future.

### Testing procedure
So far there is a show case application in `examples/psa_crypto` to demonstrate the usage and configuration of different backends of the API (refer to the application README for more information). 


Co-authored-by: Lena Boeckmann <lena.boeckmann@haw-hamburg.de>
2023-09-04 08:15:08 +00:00
Lena Boeckmann
c01d689769 pkg: Add cryptocell driver and nrf52 HW features 2023-08-31 14:38:49 +02:00
bors[bot]
26cb4db130
Merge #19887 #19898
19887: cpu/efm32/periph: add DAC support for EFM32 Series 1 (VDAC) r=aabadie a=gschorcht

### Contribution description

This PR provides a small change for `periph_dac` to support the VDACs of EFM32 Series 1 MCUs. It was tested with `sltb009a` board for which this PR includes the DAC configuration.

### Testing procedure

`tests/periph/dac` should work for the `sltb009a` board. I've tested it already.
```
BOARD=sltb009a make -j8 -C tests/periph/dac flash
```

### Issues/PRs references

Depends on PR #19886 

19898: tests/net/gcoap_fileserver: disable test on CI r=aabadie a=benpicco




Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
2023-08-30 17:35:08 +00:00
Gunar Schorcht
e934d5220a cpu/efm32: include periph_conf.h for system-related methods 2023-08-30 16:47:52 +02:00
Gunar Schorcht
3499b822ee cpu/efm32: add DAC support for EFM32 Series1 (VDAC) 2023-08-30 16:47:52 +02:00
b7d0080d86
cpu/stm32/ptp: drop vendor file typo workaround 2023-08-28 09:56:40 +02:00
2cc12798bc
cpu/stm32: update stm32u5 patch 2023-08-28 09:47:44 +02:00
aa1959e896
cpu/stm32: bump cmsis packages version 2023-08-28 09:47:44 +02:00
bors[bot]
2a4496b32a
Merge #19539 #19815 #19860 #19886
19539: drivers/periph_sdmmc: define a High-level SDIO/SD/MMC API and low-level SDMMC periperal driver interface r=benpicco a=gschorcht

### Contribution description

This PR provides a SDIO/SD/MMC Device API (SDMMC). It implements a SD host controller driver that provides a high-level functions using a low-level SDIO/SD/MMC peripheral driver for accessing

- MultiMediaCards (MMC) and Embedded MultiMediaCards (eMMC)
- SD Memory Cards (SD Cards) with Standard Capacity (SDSC), High Capacity (SDHC) or Extended Capacity (SDXC).

It supports:

- 1-bit, 4-bit and 8-bit data bus width
- Default Speed and High Speed
- Auto-CLK

The SDIO/SD/MMC device API (SDMMC) is divided into two parts:

1. The high-level API that implements the SD Host Controller driver and allows
   - to inititialize and identify different types of cards,
   - to access them either blockwise or bytewise,
   - to get information about the used card, and
   - to send single commands or application specific commands to the card.

2. The low-level SDIO/SD/MMC peripheral driver implements the low-level functions required by the high-level device API. It has to be implemented for each MCU.

### Limitations:

- Only one card per SDIO/SD/MMC device is supported.
- eMMCs specific features are not supported.
- UHS-I, UHS-II and UHS-III are not supported.

### Testing procedure

PR #19540, PR #19760 or PR #19786 is needed to test this PR.

### Issues/PRs references

Prerequisite for PR #19540
Prerequisite for PR #19760
Prerequisite for PR #19786

19815: cpu/sam0_common/periph/sdhc: busy waiting and clock fixes r=benpicco a=benpicco



19860: drivers/ft5x06: fix vendor ID for FT6xx6 and FTxxxx register addresses r=benpicco a=gschorcht

### Contribution description

This PR provides a fix of the vendor ID for FT6xx6 touch panel driver ICs and a fix of register addresses for FTxxxx.

According to the [Application Note for FT6x06 CTPM](https://cdn-shop.adafruit.com/datasheets/FT6x06_AN_public_ver0.1.3.pdf), the vendor ID of FT6x06 touch panel driver ICs is `0x11` instead of `0xcd`. Although there are no information found in the Web about the FT6x36, the FT6336U touch panel of a ESP32-S3 WT32 SC01 Plus is also working with `0x11` as vendor ID so that it seems that FT6x36 is also using `0x11` as vendor ID.

Figured out with a `stm32f723e-disco` board (revision D03). Without this PR, `tests/drivers/ft5x06` gives:
```
+------------Initializing------------+
[ft5x06] init: invalid vendor ID: '0x11' (expected: 0xcd)
[Error] Initialization failed
```
With this PR it works as expected.
```
+------------Initializing------------+
Initialization successful
main(): This is RIOT! (Version: 2023.10-devel-96-gbb9011-drivers/ft5x06_fix_vendor_id)
FT5x06 test application

+------------Initializing------------+
[ft5x06] init: configuring touchscreen interrupt
Initialization successful
1 touch detected
[ft5x06] read gesture_id '0x00'
Touch 1 - X: 151, Y:138
[ft5x06] read gesture_id '0x00'
```

Some background information found in the Web:

- According to the [STM32CubeF7](c20e6dd15b/Drivers/BSP/STM32F723E-Discovery/stm32f723e_discovery_ts.c (L24-L27)) the FRIDA LCD panel mounted on the `stm32f723e-disco` board either uses FT6x36 (prior revision D) or FT3x67 (revision D). However, the FT5x06 driver type for the card is defined as FT6x06, which does not seem correct: bb9011c3fb/boards/stm32f723e-disco/include/board.h (L59)
- According to the [STM32CubeF7](c20e6dd15b/Drivers/BSP/Components/ft6x06/ft6x06.h (L269-L270)), the vendor ID for FT6x36 should be `0xcd`. However, the FT6336U on ESP32-S3 WT32 SC01 Plus works with vendor ID `0x11`.
- The [Adafruit FT6206 library](95118cd983/Adafruit_FT6206.h (L28)) uses `0x11` as vendor id.
- The `stm32l496g-disco` board uses a FT6236 which has vendor ID `0xcd`.

So the information available on the web is confusing. Maybe, a better solution would be to accept `0x11` as well as `0xcd` as vendor ID for FT6xxx touch panels. Unfortunately, there are no documents available on the registers directly from FocalTech 😟 so it seems to be more speculation than knowledge.

### Testing procedure


### Issues/PRs references



19886: cpu/efm32: fix DAC configuration r=benpicco a=gschorcht

### Contribution description

The EFM32 MCU allows the reference voltage to be configured per DAC device, not per DAC channel. Also, the DAC reference voltage was defined in the configuration but not used anywhere.

At the moment we have only defined one board (`stwstk6220a`) that uses the DAC, so changing the configuration interface shouldn't be critical.

### Testing procedure

`tests/periph/dac` should still work for the `stwstk6220a`
```
BOARD=slwstk6220a make -j8 -C tests/periph/dac flash
```
I don't have a `stwstk6220a` board (EFM32 Series 0) so that I can't test it. I could only test it for the `sltb009a` board (EFM32 Series 1) with the change for VDAC in PR #19887.

### Issues/PRs references


Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
2023-08-23 16:55:09 +00:00
Gunar Schorcht
817bb48843 cpu/efm32: fix DAC reference voltage configuration
The EFM32 MCU allows the reference voltage to be configured per DAC device, not per DAC channel. Also, the DAC reference voltage was defined in the configuration but not used anywhere.
2023-08-15 13:58:39 +02:00
Gunar Schorcht
e1ea18fea2 cpu/riscv_common: remove picolibc from blacklisting in CI 2023-08-07 13:21:40 +02:00
Benjamin Valentin
94771f95ae cpu/esp_common: esp-wifi: drop assert(val) 2023-08-01 23:06:11 +02:00
bors[bot]
576731ca97
Merge #19452
19452: dist/tools/esptools: upgrade ESP32x toolchains to GCC version 12.2 r=MrKevinWeiss a=gschorcht

### Contribution description

This PR upgrades ESP32x toolchains to GCC version 12.2 which is a prerequisite for upgrading the ESP-IDF to version 5.1.

This PR depends on PR #19450 

### Testing procedure

`dist/tools/install.sh all` should install all ESP32x toolchains.
`. dist/tools/export.sh all` should make them visible.

### Issues/PRs references

Depends on PR #19450 

Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
2023-08-01 12:19:48 +00:00
Gunar Schorcht
19a8a22eac cpu/stm32/periph: add FMC support to Kconfig 2023-07-26 09:02:10 +02:00
Gunar Schorcht
516c74b81e cpu/stm32: add FMC RAM as heap
If the board defines `FMC_RAM_ADDR` and `FMC_RAM_LEN`, the FMC RAM is used a additional heap if module `periph_fmc` is enabled.

For that purpose
- the linker symbols `_fmc_ram_addr` and `_fmc_ram_len` are set,
- a memory region `fcmram` is added in linker script for the FMC RAM based on these `_fcm_ram_*` linker symbols
- a section for the FMC RAM is defined in this memory region that defines the heap by setting `_sheap3` and `_eheap3` and
- the number of heaps is set to 4 since to use `_sheap3` and `_eheap3` even though `_sheap1` and `_eheap1` (the backup RAM) and `_sheap2` and `_eheap2` (SRAM4) are not present.
2023-07-26 09:02:10 +02:00
Gunar Schorcht
37472d54c3 cpu/stm32/periph: add FMC support 2023-07-26 09:02:10 +02:00
Gunar Schorcht
79198e92b9 cpu/stm32: set SRAM4 addr to 0 in ld script if length is not defined
Defining the SRAM4 start address as 0 when the SRAM4 length is not defined invalidates the corresponding heap entry.
2023-07-26 08:55:56 +02:00
Gunar Schorcht
1438d41347 dist/tools/esptools: upgrade to gcc 12.2 2023-07-25 23:42:11 +02:00
Gunar Schorcht
fdac7d4e31 cpu/stm32: fix ld script for SRAM4 2023-07-22 12:22:37 +02:00
bors[bot]
ceaf6bd7aa
Merge #19634
19634: tree-wide: mixed box of compilation fixes with clang r=benpicco a=maribu

### Contribution description

As the title says: This should increase the number of apps being able to build with clang quite a bit.


Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
Co-authored-by: Marian Buschsieweke <marian.buschsieweke@posteo.net>
2023-07-18 10:47:46 +00:00
Marian Buschsieweke
f4c5cf173d
cpu/stm32: fix compilation with clang 2023-07-18 12:24:07 +02:00
Marian Buschsieweke
a4bf63e483
cpu/sam0_common: fix vendor header files
Drop type qualifiers in front of anonymous bit fields (padding for
reserved bits) for compatibility with `clang++`. A four line bash
script was added to ease fixing new vendor header files.
2023-07-18 12:24:07 +02:00
Marian Buschsieweke
b1b0690bc8
cpu/nrf5x_common/periph_gpio_ll: fix compilation with clang 2023-07-18 12:24:07 +02:00
bors[bot]
e2c41e7a63
Merge #19822
19822: cpu/atmega_common: hook up BAT LOW irq to power bus r=maribu a=benpicco



Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
2023-07-14 19:15:58 +00:00
bors[bot]
0f50a8fa00
Merge #19798
19798: cpu/nrf53: add I2C and SPI support r=benpicco a=dylad

### Contribution description

This PR provides support for nRF53 SPI and I2C.
It also moves common structs from each nRF CPU folder to `cpu/nrf5x_common` to avoid duplication.
Moreover, since nRF9160 and nRF5340 have shared IRQ for UART/SPI/I2C. Both this families now use a common file to register and manage these interrupts. Note that nRF9160 have different name for its interrupts than nRF5340 but they have the same purpose.

### Testing procedure

Since some structs were moved around, I think this PR should be carefully tested against nRF52, nRF53 and nRF9160 to avoid any issues.
On nRF5340DK-APP, SPI can be tested with its onboard SPI flash.

### Issues/PRs references



Co-authored-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2023-07-13 12:08:04 +00:00
Dylan Laduranty
fdbba517a2 boards/nrf5340dk-app: add SPI flash configuration and I2C pins
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2023-07-12 21:51:50 +02:00
Benjamin Valentin
fd6486b19b cpu/atmega_common: hook up BAT LOW irq to power bus 2023-07-12 14:52:05 +02:00
Dylan Laduranty
f27bde3f37 cpu/nrf53: enable I2C/SPI support
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2023-07-11 23:43:35 +02:00
Dylan Laduranty
5811c847ad cpu/nrfxx: use shared serial IRQ
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2023-07-11 22:42:10 +02:00
Dylan Laduranty
72c93a9743 cpu/nrfxx: introduce shared serial IRQ
For now, nRF53 and nRF9160 will shared UART/I2C/SPI IRQs, nRF52 will reuse the same callback but will keep its own file to avoid breakage. This can be continue in a followup PR

Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2023-07-11 22:39:23 +02:00
Hugues Larrive
064c799e57 cpu/atmega_common: some additional periph drivers fixed for atmega8 cpu
- periph/eeprom.c
- periph/wdt.c
- periph/gpio_ll_irq.c

removed unsupported cpuid and dpgpin feature for atmega8 cpu familly

pkg/qdsa: bump the commit hash bump the commit hash after RIOT-OS/qDSA#4
was merged
2023-07-11 21:22:02 +02:00
Dylan Laduranty
63310189a5 cpu/nrfxx: move I2C/SPI/UART structs to nrf5x_common
This will reduces code duplication across nRF52,nRF53 and nRF9160 families

Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2023-07-11 20:07:26 +02:00
Benjamin Valentin
84ceea33d0 cpu/sam0_common/periph/sdhc: always use 25 MHz 2023-07-11 12:46:36 +02:00
Benjamin Valentin
0f555f061f cpu/sam0_common/periph/sdhc: disable clock when SD card is idle 2023-07-11 12:46:36 +02:00
Benjamin Valentin
bfe98a5885 cpu/sam0_common/periph/sdhc: fix clock generation 2023-07-11 12:46:36 +02:00
Gunar Schorcht
7899e8002e cpu/sam0_common/periph/sdhc: busy wait implementation 2023-07-11 12:46:36 +02:00
bors[bot]
1b8ad7cffc
Merge #19777
19777: cpu/avr8_common: Prepare for rework ISR r=benpicco a=nandojve

### Contribution description

This prepares for rework how ISR is handled for AVR-8 platform. It is not expected changes on the behavior but tests on other boards were welcome to avoid regressions.

#### Improvements
 * Split UART state from ISR states. Now it is necessary two variables and GPIORx registers are automatically selected when available.
 * UART states now supports up to 8 UARTs.
 * Added AVR8_ISR macro do clean-up and hide internals related to ISR processing. This allows changes on ISR without any other changes on drivers.

### Testing procedure

Tests were conducted using atmega328p-xplained-mini and atxmega-a1u-xpro and the zigduino board was only built. The example thread_duel was used to test regressions.

Co-authored-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-07-11 10:39:11 +00:00
Dylan Laduranty
2033911b7f cpu/nrf53: introduce peripheral clocks defines
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2023-07-08 16:53:44 +02:00
Dylan Laduranty
6ea5081da9 cpu/nrf5x_common: share nRF52 PWM driver with nRF53/nRF9160
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2023-07-08 16:53:41 +02:00
bors[bot]
c19626c525
Merge #19811
19811: boards: add ESP32-S3-Box support r=gschorcht a=gschorcht

### Contribution description

This PR provides the support for the [ESP32-S3-Box](https://github.com/espressif/esp-box).

### Testing procedure

The board has been tested with all basic tests for supported hardware including `tests/drivers/ili9341`:

![IMG_20230707_113423](https://github.com/RIOT-OS/RIOT/assets/31932013/048d9b53-5fa2-4809-bfb8-28433d3d11ce)

- [x] tests/drivers/ili9341
- [x] tests/periph/gpio
- [x] tests/periph/i2c
- [x] tests/periph/spi
- [x] tests/periph/uart
- [x] tests/sys/usbus_cdc_ecm 

### Issues/PRs references


Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
2023-07-08 11:23:20 +00:00
Gunar Schorcht
620640631f cpu/esp32s3: fix esp_spi_oct dependency in Kconfig 2023-07-07 16:36:43 +02:00
bors[bot]
8707548104
Merge #19804 #19807 #19809
19804: cpu/nrf{53,9160}: add periph_rtt support r=benpicco a=dylad

### Contribution description

This PR enables support for `periph_rtt` on both nRF9160 and nRF53.
This PR is based on #19803 

I was only able to test on nrf5340dk-app as I don't have access to any nrf9160-based board.

Here is `test/periph/rtt` output for reference on `nrf5340dk-app`:

### Testing procedure
flash `tests/periph/rtt` on `nrf9160dk` or `nrf5340dk-app`  and check the results.
```
s
2023-07-06 16:11:16,471 # START
2023-07-06 16:11:16,479 # main(): This is RIOT! (Version: 2023.07-devel-765-g02c65-cpu/nrf53/add_rtt_support)
2023-07-06 16:11:16,480 # 
2023-07-06 16:11:16,482 # RIOT RTT low-level driver test
2023-07-06 16:11:16,483 # RTT configuration:
2023-07-06 16:11:16,485 # RTT_MAX_VALUE: 0x00ffffff
2023-07-06 16:11:16,487 # RTT_FREQUENCY: 1024
2023-07-06 16:11:16,487 # 
2023-07-06 16:11:16,494 # Testing the tick conversion (with rounding if RTT_FREQUENCY is not power of 2)
2023-07-06 16:11:16,498 # Trying to convert 1 to seconds and back
2023-07-06 16:11:16,501 # Trying to convert 256 to seconds and back
2023-07-06 16:11:16,505 # Trying to convert 65536 to seconds and back
2023-07-06 16:11:16,509 # Trying to convert 16777216 to seconds and back
2023-07-06 16:11:16,514 # Trying to convert 2147483648 to seconds and back
2023-07-06 16:11:16,514 # All ok
2023-07-06 16:11:16,514 # 
2023-07-06 16:11:16,517 # Initializing the RTT driver
2023-07-06 16:11:16,835 # This test will now display 'Hello' every 5 seconds
2023-07-06 16:11:16,835 # 
2023-07-06 16:11:16,836 # RTT now: 4
2023-07-06 16:11:16,840 # Setting initial alarm to now + 5 s (5124)
2023-07-06 16:11:16,841 # rtt_get_alarm() PASSED
2023-07-06 16:11:16,846 # Done setting up the RTT, wait for many Hellos
2023-07-06 16:11:16,852 # { "threads": [{ "name": "main", "stack_size": 1536, "stack_used": 404 }]}
2023-07-06 16:11:21,833 # Hello
2023-07-06 16:11:26,831 # Hello
2023-07-06 16:11:31,830 # Hello
2023-07-06 16:11:36,828 # Hello
2023-07-06 16:11:41,826 # Hello
2023-07-06 16:11:46,825 # Hello
2023-07-06 16:11:51,823 # Hello
2023-07-06 16:11:56,821 # Hello
2023-07-06 16:12:01,821 # Hello
2023-07-06 16:12:06,819 # Hello
2023-07-06 16:12:11,817 # Hello
2023-07-06 16:12:16,815 # Hello
2023-07-06 16:12:21,813 # Hello
2023-07-06 16:12:26,811 # Hello
```
### Issues/PRs references
based on #19803 

19807: boards/esp32s2-lilygo-ttgo-t8: fix display configuration r=benpicco a=gschorcht

### Contribution description

This PR fixes the display configuration for the ESP32-S2 LilyGO TTGO T8 (also known as LilyGo T-Display S2) which uses a ST7789 as display driver IC that is compatible with the ST7735.

For that purpose the ST7735 driver is extended by a pseudomodule definition `st7789` for the ST7789 which is enabled by the board and enables automatically the `st7789` (f57b6b70b8). Vise versa, board's `Makefile.dep` enables automatically the `st7789` pseudomodule if the `st7735` is used. The pseudomodule `st7789` is just used to increase the upper limit for supported lines.

### Testing procedure

```
BOARD=esp32s2-lilygo-ttgo-t8 make -C tests/drivers/st7735/ flash
```
should work:

![IMG_20230707_112616](https://github.com/RIOT-OS/RIOT/assets/31932013/4393866b-27d9-4a6a-96fc-7c460be35cde)

### Issues/PRs references

19809: cpu/nrf53: add usbdev support r=benpicco a=dylad

### Contribution description
This PR enables `periph_usbdev` support on nRF5340DK-app board. Since the IP is the same as nRF52, the driver and its related data and structs were moved from `cpu/nrf52` to `cpu/nrf5x_common`


### Testing procedure
Test any USBUS related test application on `nrf5340dk-app`

`CFLAGS='-DSECTOR_COUNT=64' USEMODULE='mtd_emulated' make BOARD=nrf5340dk-app -C tests/sys/usbus_msc flash`

dmesg output:
```
[ 7466.262760] usb 1-2.1: new full-speed USB device number 16 using xhci_hcd
[ 7466.483916] usb 1-2.1: New USB device found, idVendor=1209, idProduct=7d01, bcdDevice= 1.00
[ 7466.483925] usb 1-2.1: New USB device strings: Mfr=3, Product=2, SerialNumber=4
[ 7466.483928] usb 1-2.1: Product: nrf5340dk-app
[ 7466.483931] usb 1-2.1: Manufacturer: RIOT-os.org
[ 7466.483933] usb 1-2.1: SerialNumber: AD0FD4AE806080C2
[ 7466.487010] usb-storage 1-2.1:1.0: USB Mass Storage device detected
[ 7466.487348] scsi host2: usb-storage 1-2.1:1.0
[ 7467.516789] scsi 2:0:0:0: Direct-Access     RIOT-OS  RIOT_MSC_DISK     1.0 PQ: 0 ANSI: 1
[ 7467.517152] sd 2:0:0:0: Attached scsi generic sg3 type 0
[ 7467.517501] sd 2:0:0:0: [sdd] 64 512-byte logical blocks: (32.8 kB/32.0 KiB)
[ 7467.517732] sd 2:0:0:0: [sdd] Write Protect is off
[ 7467.517733] sd 2:0:0:0: [sdd] Mode Sense: 03 00 00 00
[ 7467.517906] sd 2:0:0:0: [sdd] No Caching mode page found
[ 7467.517910] sd 2:0:0:0: [sdd] Assuming drive cache: write through
[ 7467.532159] sd 2:0:0:0: [sdd] Attached SCSI removable disk
```

I also tested `tests/sys/usbus_cdc_ecm` and `tests/sys/usbus/usbus_hid` succesfully.


### Issues/PRs references



Co-authored-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
2023-07-07 14:30:15 +00:00
Dylan Laduranty
263e99384a cpu/nrf53: setup XL1/XL2 pins for using external 32K osc if needed
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2023-07-07 13:05:06 +02:00
Gunar Schorcht
2ab2c13cb8 cpu/esp32: documentation fix 2023-07-07 11:12:01 +02:00
Dylan Laduranty
37cf43a132 cpu/nrf5x_common: move usbdev driver to nrf5x_common
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2023-07-07 10:53:55 +02:00
Dylan Laduranty
73a3943268 cpu/nrf5x_common/periph/rtt: add IRQ conf for nRF53 and nRF9160
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2023-07-07 09:18:51 +02:00
bors[bot]
a345e00fa6
Merge #19789 #19796 #19802 #19803
19789: cpu/nrf5x/periph/wdt: enable support for nRF53/nRF9160 r=benpicco a=dylad

### Contribution description

This PR enables support for the watchdog driver on nRF53.
This MCU has two watchdog peripherals, for now, it only uses the first one.
The use of the second watchdog can be add in a followup PR later.


### Testing procedure
Flash and play with `tests/periph/wdt` application.


### Issues/PRs references
None.


19796: boards/b_u585i_ iot02a/periph usbdev r=benpicco a=gschorcht

### Contribution description

This PR adds the USB OTG support for STM32U5 and the `b_u585i_iot02a` board.

This PR includes PR #19795 since it uses directly the changes made in PR #19795.

### Testing procedure

Compile and flash
```
BOARD=b-u585i-iot02a make -C tests/sys/usbus_cdc_ecm/ flash term
```
Use the `sudo dmesg` command to get the kernel messages.
```pyhon
[766948.556645] usb 1-2.2: new full-speed USB device number 108 using xhci_hcd
[766948.658688] usb 1-2.2: New USB device found, idVendor=1209, idProduct=7d00, bcdDevice= 1.00
[766948.658696] usb 1-2.2: New USB device strings: Mfr=3, Product=2, SerialNumber=4
[766948.658699] usb 1-2.2: Product: b-u585i-iot02a
[766948.658702] usb 1-2.2: Manufacturer: RIOT-os.org
[766948.658704] usb 1-2.2: SerialNumber: AA140057DA41D467
[766948.668681] cdc_ether 1-2.2:1.0 usb0: register 'cdc_ether' at usb-0000:00:14.0-2.2, CDC Ethernet Device, ea:dc:44:71:d9:24
[766948.743250] cdc_ether 1-2.2:1.0 enxeadc4471d924: renamed from usb0
```
Use the `ifconfig` command on the node to determine the IPv6 LLUA and ping the node.
```
ping6 -c 3 fe80::e8dc:44ff:fe71:c524%enxeadc4471d924
PING fe80::e8dc:44ff:fe71:c524%enxeadc4471d924(fe80::e8dc:44ff:fe71:c524%enxeadc4471d924) 56 data bytes
64 bytes from fe80::e8dc:44ff:fe71:c524%enxeadc4471d924: icmp_seq=1 ttl=64 time=0.523 ms
64 bytes from fe80::e8dc:44ff:fe71:c524%enxeadc4471d924: icmp_seq=2 ttl=64 time=0.546 ms
64 bytes from fe80::e8dc:44ff:fe71:c524%enxeadc4471d924: icmp_seq=3 ttl=64 time=0.599 ms
```

### Issues/PRs references

Includes PR #19795 

19802: cpu/nrf53: enable flashpage support r=benpicco a=dylad

### Contribution description
This PR enables flashpage support on nRF53 family.
The peripheral is identical to nRF52, just add the flashpage configuration and enable the module in both Makefiles.features and Kconfig.


### Testing procedure
run `/tests/periph/flashpage` on `nrf5340dk-app`

output of `make BOARD=nrf5340dk-app flash test`


```
/home/dylan/work/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "115200" --no-reconnect --noprefix --no-repeat-command-on-empty-line 
Twisted not available, please install it if you want to use pyterm's JSON capabilities
Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.

> 
> 
test_last_raw

> test_last_raw
wrote raw short buffer to last flash page
> help
help
Command              Description
---------------------------------------
info                 Show information about pages
dump                 Dump the selected page to STDOUT
dump_local           Dump the local page buffer to STDOUT
read                 Copy the given page to the local page buffer and dump to STDOUT
write                Write the local page buffer to the given page
write_raw            Write (ASCII, max 64B) data to the given address
erase                Erase the given page buffer
edit                 Write bytes to the local page buffer
test                 Write and verify test pattern
test_last_pagewise   Write and verify test pattern on last page available
test_last_pagewise
test_reserved_pagewise Write and verify short write on reserved page
test_last_raw        Write and verify raw short write on last page available
> test_last_pagewise
wrote local page buffer to last flash page
> help
help
Command              Description
---------------------------------------
info                 Show information about pages
dump                 Dump the selected page to STDOUT
dump_local           Dump the local page buffer to STDOUT
read                 Copy the given page to the local page buffer and dump to STDOUT
write                Write the local page buffer to the given page
write_raw            Write (ASCII, max 64B) data to the given address
erase                Erase the given page buffer
edit                 Write bytes to the local page buffer
test                 Write and verify test pattern
test_last_pagewise   Write and verify test pattern on last page available
test_reserved_pagewise Write and verify short write on reserved page
test_reserved_pagewise
test_last_raw        Write and verify raw short write on last page available
> test_reserved_pagewise
Reserved page num: 5 
Since the last firmware update this test has been run 0 times 
wrote local page buffer to reserved flash page

When running on a bootloader, as an extra check, try restarting the board and check whether this application still comes up.
> help
help
Command              Description
---------------------------------------
info                 Show information about pages
dump                 Dump the selected page to STDOUT
dump_local           Dump the local page buffer to STDOUT
read                 Copy the given page to the local page buffer and dump to STDOUT
write                Write the local page buffer to the given page
write_raw            Write (ASCII, max 64B) data to the given address
erase                Erase the given page buffer
edit                 Write bytes to the local page buffer
test                 Write and verify test pattern
test_last_pagewise   Write and verify test pattern on last page available
test_reserved_pagewise Write and verify short write on reserved page
test_last_raw        Write and verify raw short write on last page available
> 
make : on quitte le répertoire « /home/dylan/work/RIOT/tests/periph/flashpage »

```
### Issues/PRs references
None.


19803: cpu/nrf5x_common: rework LFCLK source selection r=benpicco a=dylad

### Contribution description
This PR changes the source selection of LFCLK for all nRF families.
This idea is to use the values provided by Nordic vendor files to properly populate the source of the LFCLK. Then setup a per CPU check to ensure the value provided at board level is fine. In the end, the LFCLK source selection is a mere assignment.
The selection of the LFCLK source is still done at board level. I also add a bit of documentation to help users to select another value if needed.


I'll provide in a followup PR, `periph_rtt` support for both nRF9160 and nRF53.

### Testing procedure
CI should be enough I think. Otherwise, one can ran tests/periph/rtt on any nRF51-based board and any nRF52-based board.
You can also change the LFCLK source at board level to ensure the guards are doing their jobs.

### Issues/PRs references
None.

Co-authored-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
2023-07-06 14:57:33 +00:00
Dylan Laduranty
1d0177dc31 cpu/nrfxx: simplify LFCLK source selection
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2023-07-06 15:47:22 +02:00
Dylan Laduranty
59ef50d7cc cpu/nrf5x_common: enable periph_flashpage on nRF53 family
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2023-07-06 13:49:19 +02:00
Dylan Laduranty
01a1c5f94e cpu/nrf53: add flashpage configuration
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2023-07-06 13:49:19 +02:00
bors[bot]
f0dc0e7c47
Merge #19606 #19753 #19757
19606: doc: add board selection guide r=benpicco a=maribu

### Contribution description

This adds a board selection guide to the documentation to aid new users picking good hardware for their use case.


19753: cpu/atmega8: new cpu r=benpicco a=hugueslarrive

### Contribution description
Splitted from:
- #19740

### Testing procedure
Tested on atmega8 with:
- #19755

### Issues/PRs references

Dependencies:
- #19752
- #19751


19757: core: fix null pointer dereference r=benpicco a=szsam

Check return values of following functions for null:
  - thread_get
  - thread_get_unchecked



Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
Co-authored-by: Hugues Larrive <hlarrive@pm.me>
Co-authored-by: Mingjie Shen <shen497@purdue.edu>
2023-07-05 21:36:31 +00:00
Gerson Fernando Budke
f87cb3fc36 cpu: atmega_common: rtt: Fix vera warnings
Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-07-05 20:00:19 +02: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
ceb414f046 cpu/avr8_common: Drop useless ret instruction
The thread_yield_higher is a normal functions. However it has a non
regular return instruction which is useless. This remove the useless
return on thread_yield_higher to save flash bytes.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-07-05 19:01:15 +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
Dylan Laduranty
1df1279de5 cpu/nrf{53,9160}: enable periph_wdt in Kconfig
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2023-07-05 09:50:02 +02:00
Dylan Laduranty
8ccad4aca7 cpu/nrf5x_common: enable periph_wdt on nRF9160/nRF53
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2023-07-05 09:49:28 +02:00