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 <mathieu.choplain@st.com>
This commit is contained in:
Mathieu Choplain 2024-07-15 12:29:50 +02:00 committed by Anas Nashif
commit 3099491f3e
4 changed files with 28 additions and 5 deletions

View file

@ -7,4 +7,6 @@ project(chan_blen_transfer)
FILE(GLOB app_sources src/*.c)
target_sources(app PRIVATE ${app_sources})
zephyr_code_relocate(FILES src/test_dma.c LOCATION ${CONFIG_DMA_LOOP_TRANSFER_RELOCATE_SECTION}_RODATA_BSS)
if (CONFIG_DMA_LOOP_TRANSFER_RELOCATE_SECTION)
zephyr_code_relocate(FILES src/test_buffers.c LOCATION ${CONFIG_DMA_LOOP_TRANSFER_RELOCATE_SECTION})
endif()

View file

@ -0,0 +1,12 @@
/*
* Copyright (c) 2024 STMicroelectronics
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/kernel.h>
#include "test_buffers.h"
__aligned(32) char tx_data[TEST_BUF_SIZE] = "It is harder to be kind than to be wise........";
__aligned(32) char rx_data[TEST_BUF_SIZE] = { 0 };

View file

@ -0,0 +1,12 @@
/*
* Copyright (c) 2024 STMicroelectronics
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <stdint.h>
#define TEST_BUF_SIZE (48)
extern char tx_data[TEST_BUF_SIZE];
extern char rx_data[TEST_BUF_SIZE];

View file

@ -20,10 +20,7 @@
#include <zephyr/drivers/dma.h>
#include <zephyr/ztest.h>
#define RX_BUFF_SIZE (48)
static __aligned(32) char tx_data[] = "It is harder to be kind than to be wise........";
static __aligned(32) char rx_data[RX_BUFF_SIZE] = { 0 };
#include "test_buffers.h"
static void test_done(const struct device *dma_dev, void *arg,
uint32_t id, int status)