Skip to content

Commit a23758d

Browse files
Mathieu Choplainnashif
authored andcommitted
tests: dma/chan_blen_transfer: relocate TX and RX buffers
This commit places the chan_blen_transfer DMA test's TX and RX buffers in a separate file that gets entirely relocated. This ensures that the buffers reside in the correct memory, without breaking other things due to relocation of test data/code. Fixes #75676. Signed-off-by: Mathieu Choplain <[email protected]> (cherry picked from commit 3099491)
1 parent 422657b commit a23758d

File tree

4 files changed

+28
-5
lines changed

4 files changed

+28
-5
lines changed

tests/drivers/dma/chan_blen_transfer/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ project(chan_blen_transfer)
77
FILE(GLOB app_sources src/*.c)
88
target_sources(app PRIVATE ${app_sources})
99

10-
zephyr_code_relocate(FILES src/test_dma.c LOCATION ${CONFIG_DMA_LOOP_TRANSFER_RELOCATE_SECTION}_RODATA_BSS)
10+
if (CONFIG_DMA_LOOP_TRANSFER_RELOCATE_SECTION)
11+
zephyr_code_relocate(FILES src/test_buffers.c LOCATION ${CONFIG_DMA_LOOP_TRANSFER_RELOCATE_SECTION})
12+
endif()
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* Copyright (c) 2024 STMicroelectronics
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <zephyr/kernel.h>
8+
9+
#include "test_buffers.h"
10+
11+
__aligned(32) char tx_data[TEST_BUF_SIZE] = "It is harder to be kind than to be wise........";
12+
__aligned(32) char rx_data[TEST_BUF_SIZE] = { 0 };
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* Copyright (c) 2024 STMicroelectronics
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <stdint.h>
8+
9+
#define TEST_BUF_SIZE (48)
10+
11+
extern char tx_data[TEST_BUF_SIZE];
12+
extern char rx_data[TEST_BUF_SIZE];

tests/drivers/dma/chan_blen_transfer/src/test_dma.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@
2020
#include <zephyr/drivers/dma.h>
2121
#include <zephyr/ztest.h>
2222

23-
#define RX_BUFF_SIZE (48)
24-
25-
static __aligned(32) char tx_data[] = "It is harder to be kind than to be wise........";
26-
static __aligned(32) char rx_data[RX_BUFF_SIZE] = { 0 };
23+
#include "test_buffers.h"
2724

2825
static void test_done(const struct device *dma_dev, void *arg,
2926
uint32_t id, int status)

0 commit comments

Comments
 (0)