Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bsp/nxp/imx/imxrt/imxrt1180-nxp-evk/cm33/board/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ if GetDepend(['BSP_USE_MULTICORE']):
LINKFLAGS += ' --predefine="-D__use_shmem__=1"'
LINKFLAGS += ' --predefine="-D__multicore__=1"'
if rtconfig.PLATFORM in ['iccarm']:
LINKFLAGS += ' __use_shmem__=1'
LINKFLAGS += ' __multicore__=1'
LINKFLAGS += ' --config_def __use_shmem__=1'
LINKFLAGS += ' --config_def __multicore__=1'

if GetDepend(['BSP_USING_ETH']):
CPPDEFINES += ['SDK_NETC_USED=1', 'FSL_ETH_ENABLE_CACHE_CONTROL=1']
Expand Down
31 changes: 26 additions & 5 deletions bsp/nxp/imx/imxrt/imxrt1180-nxp-evk/cm33/rtconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
'FLEXSPI_NOR_HYPERRAM': 'MIMXRT1189xxxxx_cm33_flexspi_nor_hyperram',
}[_LINKER_SCRIPT_TYPE]


if PLATFORM == 'gcc':
PREFIX = 'arm-none-eabi-'
CC = PREFIX + 'gcc'
Expand Down Expand Up @@ -229,25 +228,32 @@
EXEC_PATH = EXEC_PATH + '/arm/bin/'
POST_ACTION = 'ielftool --bin $TARGET rtthread.bin'

# Map from linker script type to the matching Keil target name.
_LINKER_SCRIPT_TO_KEIL_TARGET = {
# Map from linker script type to the matching Keil target / IAR configuration name.
# Keil targets and IAR configurations share the same names, so one table serves both.
_LINKER_SCRIPT_TO_PROJECT_TARGET = {
'RAM': 'rtthread_ram',
'FLEXSPI_NOR': 'rtthread_flexspi_nor',
'FLEXSPI_NOR_HYPERRAM': 'rtthread_flexspi_nor_hyperram',
}
KEIL_BUILD_TARGETS = tuple(_LINKER_SCRIPT_TO_PROJECT_TARGET.values())

def _get_active_project_target():
"""Return the Keil target / IAR config name matching the selected linker script."""
return _LINKER_SCRIPT_TO_PROJECT_TARGET.get(_LINKER_SCRIPT_TYPE, 'rtthread_ram')

def update_keil_active_target(uvoptx_path='project.uvoptx'):
"""Set <IsCurrentTarget> in project.uvoptx to match the selected linker script."""
import xml.etree.ElementTree as etree

active = _LINKER_SCRIPT_TO_KEIL_TARGET.get(_LINKER_SCRIPT_TYPE, 'rtthread_ram')
active = _get_active_project_target()

if not os.path.exists(uvoptx_path):
return
return active

tree = etree.parse(uvoptx_path)
root = tree.getroot()


for tgt in tree.findall('Target'):
tname = tgt.find('TargetName')
is_current = tgt.find('TargetOption/OPTFL/IsCurrentTarget')
Expand All @@ -261,7 +267,22 @@ def update_keil_active_target(uvoptx_path='project.uvoptx'):

print('Keil active target set to: ' + active)

# Return the active target name so the caller (tools/targets/keil.py) can
# build the matching target with UV4.exe instead of the template's first one.
return active

def iar_get_active_config():

"""Return the IAR configuration name matching the selected linker script.

This hook is called by tools/targets/iar.py when generating the IAR
project so that the active configuration follows the Kconfig linker
script selection. It is board-specific and only defined here.
"""
return _get_active_project_target()

def dist_handle(BSP_ROOT, dist_dir):

import sys
cwd_path = os.getcwd()
# sys.path.append(os.path.join(os.path.dirname(BSP_ROOT), 'tools'))
Expand Down
4 changes: 2 additions & 2 deletions bsp/nxp/imx/imxrt/imxrt1180-nxp-evk/cm7/board/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ if GetDepend(['BSP_USE_MULTICORE']):
LINKFLAGS += ' --predefine="-D__use_shmem__=1"'
LINKFLAGS += ' --predefine="-D__multicore__=1"'
if rtconfig.PLATFORM in ['iccarm']:
LINKFLAGS += ' __use_shmem__=1'
LINKFLAGS += ' __multicore__=1'
LINKFLAGS += ' --config_def __use_shmem__=1'
LINKFLAGS += ' --config_def __multicore__=1'

if GetDepend(['BSP_USING_ETH']):
CPPDEFINES += ['SDK_NETC_USED=1', 'FSL_ETH_ENABLE_CACHE_CONTROL=1']
Expand Down
29 changes: 25 additions & 4 deletions bsp/nxp/imx/imxrt/imxrt1180-nxp-evk/cm7/rtconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,22 +242,29 @@
EXEC_PATH = EXEC_PATH + '/arm/bin/'
POST_ACTION = 'ielftool --bin $TARGET rtthread.bin'

# Map from linker script type to the matching Keil target name.
_LINKER_SCRIPT_TO_KEIL_TARGET = {
# Map from linker script type to the matching Keil target / IAR configuration name.
# Keil targets and IAR configurations share the same names, so one table serves both.
_LINKER_SCRIPT_TO_PROJECT_TARGET = {
'RAM': 'rtthread_ram',
'HYPERRAM': 'rtthread_hyperram',
'FLEXSPI_NOR': 'rtthread_flexspi_nor',
'FLEXSPI_NOR_HYPERRAM': 'rtthread_flexspi_nor_hyperram',
}
KEIL_BUILD_TARGETS = tuple(_LINKER_SCRIPT_TO_PROJECT_TARGET.values())
Comment thread
nxp-ran marked this conversation as resolved.
Resolved
IAR_USE_TEMPLATE_ICF = True

def _get_active_project_target():
"""Return the Keil target / IAR config name matching the selected linker script."""
return _LINKER_SCRIPT_TO_PROJECT_TARGET.get(_LINKER_SCRIPT_TYPE, 'rtthread_ram')

def update_keil_active_target(uvoptx_path='project.uvoptx'):
"""Set <IsCurrentTarget> in project.uvoptx to match the selected linker script."""
import xml.etree.ElementTree as etree

active = _LINKER_SCRIPT_TO_KEIL_TARGET.get(_LINKER_SCRIPT_TYPE, 'rtthread_ram')
active = _get_active_project_target()

if not os.path.exists(uvoptx_path):
return
return active

tree = etree.parse(uvoptx_path)
root = tree.getroot()
Expand All @@ -275,6 +282,20 @@ def update_keil_active_target(uvoptx_path='project.uvoptx'):

print('Keil active target set to: ' + active)

# Return the active target name so the caller (tools/targets/keil.py) can
# build the matching target with UV4.exe instead of the template's first one.
return active


def iar_get_active_config():
"""Return the IAR configuration name matching the selected linker script.

This hook is called by tools/targets/iar.py when generating the IAR
project so that the active configuration follows the Kconfig linker
script selection. It is board-specific and only defined here.
"""
return _get_active_project_target()

def dist_handle(BSP_ROOT, dist_dir):
import sys
cwd_path = os.getcwd()
Expand Down
5 changes: 5 additions & 0 deletions tools/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ pkgs --update # 更新软件包
pkgs --list # 列出已安装包
```

生成 IAR 工程时,已有 `.ewp` 中的工程设置会保留;源码分组和 SCons 管理的
头文件路径、宏定义及链接选项会根据模板和当前配置重新生成。手动添加的源码
分组及分组级设置不会保留。已有工程中的配置名称及生成选项需要与模板匹配,
否则生成会报错;模板中新增的配置会添加到工程中。

### 核心概念

- **SConstruct**: BSP根目录的主构建脚本
Expand Down
Loading
Loading