treewide: update usage of zephyr_code_relocate

Update usage of zephyr_code_relocate to follow new API. The old method
of relocating a file was the following directive:

zephyr_code_relocate(file location)

The new API for zephyr_code_relocate uses the following directive:

zephyr_code_relocate(FILES file LOCATION location)

update in tree usage to follow this model. Also, update the NXP HAL SHA,
as NXP's HAL uses this macro as well.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
This commit is contained in:
Daniel DeGrasse 2022-10-04 18:44:56 -05:00 committed by Carles Cufí
commit 47271ce8be
9 changed files with 28 additions and 27 deletions

View file

@ -35,11 +35,11 @@ if(CONFIG_FLASH_MCUX_FLEXSPI_XIP)
dt_chosen(chosen_flash PROPERTY "zephyr,flash") dt_chosen(chosen_flash PROPERTY "zephyr,flash")
dt_prop(compat_flash PATH ${chosen_flash} PROPERTY compatible) dt_prop(compat_flash PATH ${chosen_flash} PROPERTY compatible)
if(compat_flash MATCHES "nxp,imx-flexspi-nor") if(compat_flash MATCHES "nxp,imx-flexspi-nor")
zephyr_code_relocate(flash_mcux_flexspi_nor.c ${CONFIG_FLASH_MCUX_FLEXSPI_XIP_MEM}_TEXT) zephyr_code_relocate(FILES flash_mcux_flexspi_nor.c LOCATION ${CONFIG_FLASH_MCUX_FLEXSPI_XIP_MEM}_TEXT)
elseif(compat_flash MATCHES "nxp,imx-flexspi-mx25um51345g") elseif(compat_flash MATCHES "nxp,imx-flexspi-mx25um51345g")
zephyr_code_relocate(flash_mcux_flexspi_mx25um51345g.c ${CONFIG_FLASH_MCUX_FLEXSPI_XIP_MEM}_TEXT) zephyr_code_relocate(FILES flash_mcux_flexspi_mx25um51345g.c LOCATION ${CONFIG_FLASH_MCUX_FLEXSPI_XIP_MEM}_TEXT)
elseif(compat_flash MATCHES "nxp,imx-flexspi-hyperflash") elseif(compat_flash MATCHES "nxp,imx-flexspi-hyperflash")
zephyr_code_relocate(flash_mcux_flexspi_hyperflash.c ${CONFIG_FLASH_MCUX_FLEXSPI_XIP_MEM}_TEXT) zephyr_code_relocate(FILES flash_mcux_flexspi_hyperflash.c LOCATION ${CONFIG_FLASH_MCUX_FLEXSPI_XIP_MEM}_TEXT)
endif() endif()
endif() endif()

View file

@ -14,5 +14,5 @@ zephyr_library_sources_ifdef(CONFIG_MEMC_MCUX_FLEXSPI_APS6408L memc_mcux_flexspi
zephyr_library_sources_ifdef(CONFIG_MEMC_SAM_SMC memc_sam_smc.c) zephyr_library_sources_ifdef(CONFIG_MEMC_SAM_SMC memc_sam_smc.c)
if((DEFINED CONFIG_FLASH_MCUX_FLEXSPI_XIP) AND (DEFINED CONFIG_FLASH)) if((DEFINED CONFIG_FLASH_MCUX_FLEXSPI_XIP) AND (DEFINED CONFIG_FLASH))
zephyr_code_relocate(memc_mcux_flexspi.c ${CONFIG_FLASH_MCUX_FLEXSPI_XIP_MEM}_TEXT) zephyr_code_relocate(FILES memc_mcux_flexspi.c LOCATION ${CONFIG_FLASH_MCUX_FLEXSPI_XIP_MEM}_TEXT)
endif() endif()

View file

@ -10,10 +10,10 @@ target_sources(app PRIVATE ${app_sources})
target_sources_ifdef(CONFIG_NRFX_QSPI app PRIVATE boards/nrf5340dk_nrf5340_cpuapp/ext_mem_init.c) target_sources_ifdef(CONFIG_NRFX_QSPI app PRIVATE boards/nrf5340dk_nrf5340_cpuapp/ext_mem_init.c)
# Run ext_code from the external flash (XIP). No need to copy. # Run ext_code from the external flash (XIP). No need to copy.
zephyr_code_relocate(src/ext_code.c EXTFLASH_TEXT NOCOPY) zephyr_code_relocate(FILES src/ext_code.c LOCATION EXTFLASH_TEXT NOCOPY)
# But still relocate (copy) the data to RAM # But still relocate (copy) the data to RAM
zephyr_code_relocate(src/ext_code.c RAM_DATA) zephyr_code_relocate(FILES src/ext_code.c LOCATION RAM_DATA)
# sram_code instead runs entirely from SRAM after being copied there. # sram_code instead runs entirely from SRAM after being copied there.
zephyr_code_relocate(src/sram_code.c RAM) zephyr_code_relocate(FILES src/sram_code.c LOCATION RAM)

View file

@ -7,8 +7,8 @@ project(adsp_cavs_code_relocation)
target_sources(app PRIVATE src/main.c src/reloc.c) target_sources(app PRIVATE src/main.c src/reloc.c)
zephyr_code_relocate(src/reloc.c SRAM2_LITERAL) zephyr_code_relocate(FILES src/reloc.c LOCATION SRAM2_LITERAL)
zephyr_code_relocate(src/reloc.c SRAM2_TEXT) zephyr_code_relocate(FILES src/reloc.c LOCATION SRAM2_TEXT)
zephyr_code_relocate(src/reloc.c SRAM3_DATA) zephyr_code_relocate(FILES src/reloc.c LOCATION SRAM3_DATA)
zephyr_code_relocate(src/reloc.c SRAM3_RODATA) zephyr_code_relocate(FILES src/reloc.c LOCATION SRAM3_RODATA)
zephyr_code_relocate(src/reloc.c SRAM4_BSS) zephyr_code_relocate(FILES src/reloc.c LOCATION SRAM4_BSS)

View file

@ -31,10 +31,10 @@ endif()
if (CONFIG_PM AND CONFIG_SOC_SERIES_IMX_RT10XX) if (CONFIG_PM AND CONFIG_SOC_SERIES_IMX_RT10XX)
zephyr_sources(power_rt10xx.c) zephyr_sources(power_rt10xx.c)
zephyr_code_relocate(power_rt10xx.c ITCM_TEXT) zephyr_code_relocate(FILES power_rt10xx.c LOCATION ITCM_TEXT)
if (CONFIG_SOC_MIMXRT1064) if (CONFIG_SOC_MIMXRT1064)
zephyr_sources(lpm_rt1064.c) zephyr_sources(lpm_rt1064.c)
zephyr_code_relocate(lpm_rt1064.c ITCM_TEXT) zephyr_code_relocate(FILES lpm_rt1064.c LOCATION ITCM_TEXT)
endif() endif()
endif() endif()

View file

@ -26,4 +26,4 @@ zephyr_linker_sources_ifdef(CONFIG_NXP_IMX_RT5XX_BOOT_HEADER
zephyr_linker_sources_ifdef(CONFIG_USB_DEVICE_DRIVER zephyr_linker_sources_ifdef(CONFIG_USB_DEVICE_DRIVER
SECTIONS usb.ld) SECTIONS usb.ld)
zephyr_code_relocate(flash_clock_setup.c RAM) zephyr_code_relocate(FILES flash_clock_setup.c LOCATION RAM)

View file

@ -30,5 +30,5 @@ zephyr_linker_sources_ifdef(CONFIG_USB_DEVICE_DRIVER
SECTIONS usb.ld) SECTIONS usb.ld)
if(CONFIG_FLASH_MCUX_FLEXSPI_XIP) if(CONFIG_FLASH_MCUX_FLEXSPI_XIP)
zephyr_code_relocate(flash_clock_setup.c RAM) zephyr_code_relocate(FILES flash_clock_setup.c LOCATION RAM)
endif() endif()

View file

@ -9,24 +9,25 @@ FILE(GLOB app_sources src/*.c)
target_sources(app PRIVATE ${app_sources}) target_sources(app PRIVATE ${app_sources})
if (CONFIG_BOARD_QEMU_XTENSA) if (CONFIG_BOARD_QEMU_XTENSA)
set(RAM_PHDR :sram0_phdr) set(RAM_PHDR PHDR sram0_phdr)
set(SRAM2_PHDR :sram2_phdr) set(SRAM2_PHDR PHDR sram2_phdr)
endif() endif()
# Code relocation feature # Code relocation feature
zephyr_code_relocate(src/test_file1.c "SRAM2 ${SRAM2_PHDR}") zephyr_code_relocate(FILES src/test_file1.c ${SRAM2_PHDR} LOCATION SRAM2)
zephyr_code_relocate(src/test_file2.c "RAM ${RAM_PHDR}") zephyr_code_relocate(FILES src/test_file2.c ${RAM_PHDR} LOCATION RAM)
zephyr_code_relocate(src/test_file3.c SRAM2_LITERAL) zephyr_code_relocate(FILES src/test_file3.c LOCATION SRAM2_LITERAL)
zephyr_code_relocate(src/test_file3.c SRAM2_TEXT) zephyr_code_relocate(FILES src/test_file3.c LOCATION SRAM2_TEXT)
zephyr_code_relocate(src/test_file3.c RAM_DATA) zephyr_code_relocate(FILES src/test_file3.c LOCATION RAM_DATA)
zephyr_code_relocate(src/test_file3.c SRAM2_BSS) zephyr_code_relocate(FILES src/test_file3.c LOCATION SRAM2_BSS)
zephyr_code_relocate(../../../kernel/sem.c "RAM ${RAM_PHDR}") zephyr_code_relocate(FILES ../../../kernel/sem.c ${RAM_PHDR} LOCATION RAM)
if (CONFIG_RELOCATE_TO_ITCM) if (CONFIG_RELOCATE_TO_ITCM)
zephyr_code_relocate(../../../lib/libc/minimal/source/string/string.c ITCM_TEXT) zephyr_code_relocate(FILES ../../../lib/libc/minimal/source/string/string.c
LOCATION ITCM_TEXT)
endif() endif()
zephyr_linker_sources(SECTIONS custom-sections.ld) zephyr_linker_sources(SECTIONS custom-sections.ld)

View file

@ -93,7 +93,7 @@ manifest:
groups: groups:
- hal - hal
- name: hal_nxp - name: hal_nxp
revision: b74522c2e452b170922f639bf5720461e533fb7e revision: 3ee6020efc1f8323d0fdc85615d3477161f0aa1f
path: modules/hal/nxp path: modules/hal/nxp
groups: groups:
- hal - hal