rt-thread/bsp/nuvoton/tools/sdk_dist.py
Wayne 446bde64c8
[Nuvoton] Update drivers (#5501)
* Update drivers.

1. Improve LVGL avg FPS.
2. Sync configuration to 4.1.0.

* [Nuvoton] Update drivers.

1. Fix open-control order issue in CAN driver.
2. [N9H30] Improve N9H30 I2C busy-wait implementation.
3. [N9H30] Support 1024x600x32b LCD panel.
4. Move nu_packages menu into sub-menu of board.

* Update menu-option.

1. Set BOARD_USING_LCM is on by default.
2. Fix default value setting in choice-option.

* Fix control function in I2C driver.

* Add sdk_dist.py and ADC touching calibration function.

Co-authored-by: Wayne Lin <wclin@nuvoton.com>
2022-01-16 18:43:27 +08:00

39 lines
1.3 KiB
Python

import os
import sys
import shutil
cwd_path = os.getcwd()
sys.path.append(os.path.join(os.path.dirname(cwd_path), 'rt-thread', 'tools'))
def dist_modify_relative_path(board_kconfig_path):
# Read in the file
with open(board_kconfig_path, 'r') as file :
filedata = file.read()
# Replace the target string
filedata = filedata.replace('$BSP_DIR/../libraries', './libraries')
# Write the file out again
with open(board_kconfig_path, 'w') as file:
file.write(filedata)
# BSP dist function
def dist_do_building(BSP_ROOT, dist_dir):
from mkdist import bsp_copy_files
import rtconfig
library_path = os.path.join(os.path.dirname(BSP_ROOT), 'libraries')
library_dir = os.path.join(dist_dir, 'libraries')
print('=> copy nuvoton bsp drivers')
bsp_copy_files(os.path.join(library_path, rtconfig.BSP_LIBRARY_TYPE),
os.path.join(library_dir, rtconfig.BSP_LIBRARY_TYPE))
print('=> copy nu_packages')
bsp_copy_files(os.path.join(library_path, 'nu_packages'),
os.path.join(library_dir, 'nu_packages'))
print('=> copy Kconfig')
shutil.copyfile(os.path.join(library_path, 'Kconfig'), os.path.join(library_dir, 'Kconfig'))
print('=> Modify libraries relative path in board/Kconfig ')
dist_modify_relative_path(os.path.join(dist_dir, 'board', 'Kconfig'))