Skip to content

Commit

Permalink
tests: drivers: uart: Bug fix
Browse files Browse the repository at this point in the history
This commit fixes the following
bug.Issue link:
https://github.com/zephyrproject-rtos/
zephyr/issues/86399.
Some users reported data access
violations due to the qualifier.
Removing static ensures proper memory
alignment and avoids potential
memory access issues.

Signed-off-by: S Swetha <s.swetha@intel.com>
  • Loading branch information
sswetha18 authored and fabiobaltieri committed Mar 4, 2025
1 parent 5736aed commit c90694c
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tests/drivers/uart/uart_async_api/src/test_uart_async.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ ZTEST_USER(uart_async_chain_read, test_chained_read)
#if NOCACHE_MEM
static __aligned(32) uint8_t tx_buf[10] __used __NOCACHE;
#else
static __aligned(32) uint8_t tx_buf[10];
__aligned(32) uint8_t tx_buf[10];
#endif /* NOCACHE_MEM */
int iter = 6;
uint32_t rx_timeout_ms = 50;
Expand Down Expand Up @@ -489,7 +489,7 @@ ZTEST_USER(uart_async_double_buf, test_double_buffer)
#if NOCACHE_MEM
static __aligned(32) uint8_t tx_buf[4] __used __NOCACHE;
#else
static __aligned(32) uint8_t tx_buf[4];
__aligned(32) uint8_t tx_buf[4];
#endif /* NOCACHE_MEM */

zassert_equal(uart_rx_enable(uart_dev, double_buffer[0], sizeof(double_buffer[0]),
Expand Down Expand Up @@ -596,8 +596,8 @@ ZTEST_USER(uart_async_read_abort, test_read_abort)
static __aligned(32) uint8_t rx_buf[100] __used __NOCACHE;
static __aligned(32) uint8_t tx_buf[100] __used __NOCACHE;
#else
static __aligned(32) uint8_t rx_buf[100];
static __aligned(32) uint8_t tx_buf[100];
__aligned(32) uint8_t rx_buf[100];
__aligned(32) uint8_t tx_buf[100];
#endif /* NOCACHE_MEM */

memset(rx_buf, 0, sizeof(rx_buf));
Expand Down Expand Up @@ -701,7 +701,7 @@ ZTEST_USER(uart_async_write_abort, test_write_abort)
#if NOCACHE_MEM
static __aligned(32) uint8_t tx_buf[100] __used __NOCACHE;
#else
static __aligned(32) uint8_t tx_buf[100];
__aligned(32) uint8_t tx_buf[100];
#endif /* NOCACHE_MEM */

memset(test_rx_buf, 0, sizeof(test_rx_buf));
Expand Down Expand Up @@ -778,8 +778,8 @@ ZTEST_USER(uart_async_timeout, test_forever_timeout)
static __aligned(32) uint8_t rx_buf[100] __used __NOCACHE;
static __aligned(32) uint8_t tx_buf[100] __used __NOCACHE;
#else
static __aligned(32) uint8_t rx_buf[100];
static __aligned(32) uint8_t tx_buf[100];
__aligned(32) uint8_t rx_buf[100];
__aligned(32) uint8_t tx_buf[100];
#endif /* NOCACHE_MEM */

memset(rx_buf, 0, sizeof(rx_buf));
Expand Down Expand Up @@ -870,7 +870,7 @@ ZTEST_USER(uart_async_chain_write, test_chained_write)
#if NOCACHE_MEM
static __aligned(32) uint8_t rx_buf[20] __used __NOCACHE;
#else
static __aligned(32) uint8_t rx_buf[20];
__aligned(32) uint8_t rx_buf[20];
#endif /* NOCACHE_MEM */

memset(rx_buf, 0, sizeof(rx_buf));
Expand Down

0 comments on commit c90694c

Please sign in to comment.