arm: Convert DT_DTCM_* to new devicetree.h macros

Convert various DT_DTCM_* macros to use DT_CHOSEN(zephyr_dtcm) and
associated macros from devicetree.h.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
Kumar Gala 2020-04-23 17:51:08 -05:00 committed by Kumar Gala
parent 4d7d3a25c1
commit a49817d17e
4 changed files with 21 additions and 11 deletions

View file

@ -27,12 +27,12 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME);
#include "eth_stm32_hal_priv.h"
#if defined(CONFIG_ETH_STM32_HAL_USE_DTCM_FOR_DMA_BUFFER) && \
!defined(DT_DTCM_BASE_ADDRESS)
#error DTCM for DMA buffer is activated but DT_DTCM_BASE_ADDRESS is not present
!DT_HAS_NODE(DT_CHOSEN(zephyr_dtcm))
#error DTCM for DMA buffer is activated but zephyr,dtcm is not present in dts
#endif
#if defined(CONFIG_ETH_STM32_HAL_USE_DTCM_FOR_DMA_BUFFER) && \
defined(DT_DTCM_BASE_ADDRESS)
DT_HAS_NODE(DT_CHOSEN(zephyr_dtcm))
static ETH_DMADescTypeDef dma_rx_desc_tab[ETH_RXBUFNB] __dtcm_noinit_section;
static ETH_DMADescTypeDef dma_tx_desc_tab[ETH_TXBUFNB] __dtcm_noinit_section;
static u8_t dma_rx_buffer[ETH_RXBUFNB][ETH_RX_BUF_SIZE] __dtcm_noinit_section;

View file

@ -98,8 +98,8 @@ MEMORY
#ifdef DT_CCM_BASE_ADDRESS
CCM (rw) : ORIGIN = DT_CCM_BASE_ADDRESS, LENGTH = DT_CCM_SIZE * 1K
#endif
#ifdef DT_DTCM_BASE_ADDRESS
DTCM (rw) : ORIGIN = DT_DTCM_BASE_ADDRESS, LENGTH = DT_DTCM_SIZE * 1K
#if DT_HAS_NODE(DT_CHOSEN(zephyr_dtcm))
DTCM (rw) : ORIGIN = DT_REG_ADDR(DT_CHOSEN(zephyr_dtcm)), LENGTH = DT_REG_SIZE(DT_CHOSEN(zephyr_dtcm))
#endif
SRAM (wx) : ORIGIN = RAM_ADDR, LENGTH = RAM_SIZE
#ifdef CONFIG_BT_STM32_IPM
@ -388,7 +388,7 @@ SECTIONS
GROUP_END(RAMABLE_REGION)
#ifdef DT_DTCM_BASE_ADDRESS
#if DT_HAS_NODE(DT_CHOSEN(zephyr_dtcm))
GROUP_START(DTCM)
SECTION_PROLOGUE(_DTCM_BSS_SECTION_NAME, (NOLOAD),SUBALIGN(4))
@ -423,7 +423,7 @@ GROUP_START(DTCM)
__dtcm_data_rom_start = LOADADDR(_DTCM_DATA_SECTION_NAME);
GROUP_END(DTCM)
#endif /* DT_DTCM_BASE_ADDRESS */
#endif
#ifdef CONFIG_CUSTOM_SECTIONS_LD
/* Located in project source directory */
#include <custom-sections.ld>

View file

@ -24,6 +24,16 @@
#include <sys/util.h>
#include <offsets.h>
/* We need to dummy out DT_HAS_NODE when building the unittests since including
* devicetree.h would require generating dummy header files to match what the
* generate creates, so its easier to just dummy out DT_HAS_NODE.
*/
#ifdef ZTEST_UNITTEST
#define DT_HAS_NODE(x) 0
#else
#include <devicetree.h>
#endif
#ifdef _LINKER
@ -217,7 +227,7 @@ extern char __ccm_noinit_end[];
extern char __ccm_end[];
#endif /* DT_CCM_BASE_ADDRESS */
#ifdef DT_DTCM_BASE_ADDRESS
#if DT_HAS_NODE(DT_CHOSEN(zephyr_dtcm))
extern char __dtcm_data_start[];
extern char __dtcm_data_end[];
extern char __dtcm_bss_start[];
@ -227,7 +237,7 @@ extern char __dtcm_noinit_end[];
extern char __dtcm_data_rom_start[];
extern char __dtcm_start[];
extern char __dtcm_end[];
#endif /* DT_DTCM_BASE_ADDRESS */
#endif
/* Used by the Security Attribution Unit to configure the
* Non-Secure Callable region.

View file

@ -110,7 +110,7 @@ void z_bss_zero(void)
(void)memset(&__ccm_bss_start, 0,
((u32_t) &__ccm_bss_end - (u32_t) &__ccm_bss_start));
#endif
#ifdef DT_DTCM_BASE_ADDRESS
#if DT_HAS_NODE(DT_CHOSEN(zephyr_dtcm))
(void)memset(&__dtcm_bss_start, 0,
((u32_t) &__dtcm_bss_end - (u32_t) &__dtcm_bss_start));
#endif
@ -151,7 +151,7 @@ void z_data_copy(void)
(void)memcpy(&__ccm_data_start, &__ccm_data_rom_start,
__ccm_data_end - __ccm_data_start);
#endif
#ifdef DT_DTCM_BASE_ADDRESS
#if DT_HAS_NODE(DT_CHOSEN(zephyr_dtcm))
(void)memcpy(&__dtcm_data_start, &__dtcm_data_rom_start,
__dtcm_data_end - __dtcm_data_start);
#endif