2022-11-10 22:22:48 +08:00
|
|
|
import os
|
|
|
|
from building import *
|
|
|
|
|
|
|
|
objs = []
|
|
|
|
cwd = GetCurrentDir()
|
|
|
|
|
2023-11-21 17:42:23 +08:00
|
|
|
PORT_DRV_DIR = cwd + '/drivers'
|
|
|
|
PHYTIUM_SDK_DIR = cwd + '/phytium_standalone_sdk'
|
|
|
|
COMMON_DIR = cwd + '/common'
|
2022-11-10 22:22:48 +08:00
|
|
|
|
|
|
|
# common source
|
2023-11-21 17:42:23 +08:00
|
|
|
src = Glob(PHYTIUM_SDK_DIR+'/common/fassert.c')
|
|
|
|
path = [PHYTIUM_SDK_DIR + '/common/']
|
|
|
|
|
|
|
|
src += Glob(COMMON_DIR+'/*.c')
|
|
|
|
path += [COMMON_DIR ]
|
2022-11-10 22:22:48 +08:00
|
|
|
|
2023-11-21 17:42:23 +08:00
|
|
|
# arch port
|
|
|
|
path += [PHYTIUM_SDK_DIR + '/arch/armv8/gcc']
|
2022-11-10 22:22:48 +08:00
|
|
|
|
|
|
|
if GetDepend(['TARGET_ARMV8_AARCH32']):
|
2023-11-21 17:42:23 +08:00
|
|
|
src += Glob(PHYTIUM_SDK_DIR+'/arch/armv8/aarch32/fsmcc.c') + Glob(PHYTIUM_SDK_DIR+'/arch/armv8/aarch32/gcc/fcpu_asm.S')
|
|
|
|
path += [PHYTIUM_SDK_DIR + '/arch/armv8/aarch32']
|
2022-11-10 22:22:48 +08:00
|
|
|
elif GetDepend(['TARGET_ARMV8_AARCH64']):
|
2023-11-21 17:42:23 +08:00
|
|
|
src += Glob(PHYTIUM_SDK_DIR+'/arch/armv8/aarch64/fsmcc.c') + Glob(PHYTIUM_SDK_DIR+'/arch/armv8/aarch64/gcc/fcpu_asm.S')
|
|
|
|
path += [PHYTIUM_SDK_DIR + '/arch/armv8/aarch64']
|
2023-08-02 13:27:09 +08:00
|
|
|
|
2023-11-21 17:42:23 +08:00
|
|
|
# soc & soc_port
|
|
|
|
src += Glob(PHYTIUM_SDK_DIR+'/soc/common/fcpu_info.c')
|
|
|
|
path += [PHYTIUM_SDK_DIR + '/soc/common']
|
2022-11-10 22:22:48 +08:00
|
|
|
|
|
|
|
if GetDepend(['TARGET_F2000_4']):
|
2023-11-21 17:42:23 +08:00
|
|
|
src += Glob(cwd+'/port/soc_port/ft2004/*.c')
|
|
|
|
path += [PHYTIUM_SDK_DIR + '/soc/ft2004']
|
2022-11-10 22:22:48 +08:00
|
|
|
|
2023-08-29 10:27:54 +08:00
|
|
|
if GetDepend(['TARGET_E2000Q']):
|
2023-11-21 17:42:23 +08:00
|
|
|
src += Glob(cwd+'/port/soc_port/e2000/*.c') + Glob(cwd+'/port/soc_port/e2000/q/*.c')
|
|
|
|
path += [PHYTIUM_SDK_DIR + '/soc/e2000'] + [PHYTIUM_SDK_DIR + '/soc/e2000/q']
|
2022-11-10 22:22:48 +08:00
|
|
|
|
2023-08-29 10:27:54 +08:00
|
|
|
if GetDepend(['TARGET_E2000D']):
|
2023-11-21 17:42:23 +08:00
|
|
|
src += Glob(cwd+'/port/soc_port/e2000/*.c') + Glob(cwd+'/port/soc_port/e2000/d/*.c')
|
|
|
|
path += [PHYTIUM_SDK_DIR + '/soc/e2000'] + [PHYTIUM_SDK_DIR + '/soc/e2000/d']
|
2023-05-11 10:25:21 +08:00
|
|
|
|
2023-08-29 10:27:54 +08:00
|
|
|
if GetDepend(['TARGET_PHYTIUMPI']):
|
2023-11-21 17:42:23 +08:00
|
|
|
src += Glob(cwd+'/port/soc_port/phytiumpi/*.c')
|
|
|
|
path += [PHYTIUM_SDK_DIR + '/soc/phytiumpi']
|
2023-08-29 10:27:54 +08:00
|
|
|
|
2022-11-10 22:22:48 +08:00
|
|
|
if GetDepend(['TARGET_D2000']):
|
2023-11-21 17:42:23 +08:00
|
|
|
src += Glob(cwd+'/port/soc_port/d2000/*.c')
|
|
|
|
path += [PHYTIUM_SDK_DIR + '/soc/d2000']
|
2022-11-10 22:22:48 +08:00
|
|
|
|
2024-04-19 08:52:09 +08:00
|
|
|
# board port
|
|
|
|
if GetDepend(['E2000D_DEMO_BOARD']):
|
|
|
|
path += cwd + '/fboard_port/e2000d_demo'
|
|
|
|
|
|
|
|
if GetDepend(['E2000D_DEMO_BOARD']):
|
|
|
|
path += cwd + '/fboard_port/e2000q_demo'
|
|
|
|
|
|
|
|
if GetDepend(['FIREFLY_DEMO_BOARD']):
|
|
|
|
path += cwd + '/fboard_port/firefly'
|
|
|
|
|
|
|
|
if GetDepend(['BSP_USING_SDCARD_FATFS']):
|
|
|
|
if GetDepend(['E2000D_DEMO_BOARD']):
|
|
|
|
src += Glob(cwd + '/port/fboard_port/e2000d_demo/mnt_sdcard.c')
|
|
|
|
|
|
|
|
if GetDepend(['E2000Q_DEMO_BOARD']):
|
|
|
|
src += Glob(cwd + '/port/fboard_port/e2000q_demo/mnt_sdcard.c')
|
|
|
|
|
|
|
|
if GetDepend(['FIREFLY_DEMO_BOARD']):
|
|
|
|
src += Glob(cwd + '/port/fboard_port/firefly/mnt_sdcard.c')
|
|
|
|
else:
|
|
|
|
src += Glob(cwd + '/port/fboard_port/mnt_ramdisk.c')
|
|
|
|
|
2022-11-10 22:22:48 +08:00
|
|
|
# driver
|
2023-11-21 17:42:23 +08:00
|
|
|
path += [PORT_DRV_DIR]
|
2022-11-10 22:22:48 +08:00
|
|
|
|
2023-05-11 10:25:21 +08:00
|
|
|
## spim
|
|
|
|
if GetDepend(['BSP_USING_SPI']):
|
2023-11-21 17:42:23 +08:00
|
|
|
src += Glob(PHYTIUM_SDK_DIR+'/drivers/spi/fspim/*.c') + Glob(PORT_DRV_DIR+'/drv_spi.c')
|
|
|
|
path += [PHYTIUM_SDK_DIR + '/drivers/spi/fspim']
|
2023-05-11 10:25:21 +08:00
|
|
|
|
2022-11-10 22:22:48 +08:00
|
|
|
## serial
|
2023-05-11 10:25:21 +08:00
|
|
|
if GetDepend(['BSP_USING_UART']):
|
2023-11-21 17:42:23 +08:00
|
|
|
src += Glob(PHYTIUM_SDK_DIR+'/drivers/serial/fpl011/*.c') + Glob(PORT_DRV_DIR+'/drv_usart.c')
|
|
|
|
path += [PHYTIUM_SDK_DIR + '/drivers/serial/fpl011']
|
2022-11-10 22:22:48 +08:00
|
|
|
|
2023-05-11 10:25:21 +08:00
|
|
|
## can
|
|
|
|
if GetDepend(['BSP_USING_CAN']):
|
2023-11-21 17:42:23 +08:00
|
|
|
src += Glob(PHYTIUM_SDK_DIR+'/drivers/can/fcan/*.c') + Glob(PORT_DRV_DIR+'/drv_can.c')
|
|
|
|
path += [PHYTIUM_SDK_DIR + '/drivers/can/fcan/']
|
2022-11-10 22:22:48 +08:00
|
|
|
|
2023-05-11 10:25:21 +08:00
|
|
|
## qspi
|
|
|
|
if GetDepend(['BSP_USING_QSPI']):
|
2023-11-21 17:42:23 +08:00
|
|
|
src += Glob(PHYTIUM_SDK_DIR+'/drivers/qspi/fqspi/*.c') + Glob(PORT_DRV_DIR+'/drv_qspi.c')
|
|
|
|
path += [PHYTIUM_SDK_DIR + '/drivers/qspi/fqspi/']
|
2022-11-10 22:22:48 +08:00
|
|
|
|
2023-08-02 13:27:09 +08:00
|
|
|
## eth
|
|
|
|
if GetDepend(['BSP_USING_ETH']):
|
2023-11-21 17:42:23 +08:00
|
|
|
src += Glob(PHYTIUM_SDK_DIR+'/drivers/eth/fxmac/*.c') + Glob(PORT_DRV_DIR+'/drv_xmac.c')
|
|
|
|
path += [PHYTIUM_SDK_DIR + '/drivers/eth/fxmac/'] + [PHYTIUM_SDK_DIR + '/drivers/eth/fxmac/phy/']
|
2023-08-02 13:27:09 +08:00
|
|
|
|
2023-11-21 17:42:23 +08:00
|
|
|
## sdif
|
|
|
|
if GetDepend(['BSP_USING_SDIF']):
|
|
|
|
src += Glob(PHYTIUM_SDK_DIR+'/drivers/mmc/fsdif/*.c') + Glob(PORT_DRV_DIR+'/drv_sdif.c')
|
|
|
|
path += [PHYTIUM_SDK_DIR + '/drivers/mmc/fsdif/']
|
2023-08-02 13:27:09 +08:00
|
|
|
|
|
|
|
## gpio
|
|
|
|
if GetDepend(['BSP_USING_GPIO']):
|
2023-11-21 17:42:23 +08:00
|
|
|
src += Glob(PHYTIUM_SDK_DIR+'/drivers/pin/fgpio/*.c') + Glob(PORT_DRV_DIR+'/drv_gpio.c')
|
|
|
|
path += [PHYTIUM_SDK_DIR + '/drivers/pin/fgpio/']
|
2024-06-16 15:42:37 +08:00
|
|
|
if GetDepend(['TARGET_E2000D']):
|
|
|
|
src += Glob(PHYTIUM_SDK_DIR+'/soc/e2000/fgpio_table.c')
|
|
|
|
if GetDepend(['TARGET_E2000Q']):
|
|
|
|
src += Glob(PHYTIUM_SDK_DIR+'/soc/e2000/fgpio_table.c')
|
|
|
|
if GetDepend(['TARGET_PHYTIUMPI']):
|
|
|
|
src += Glob(PHYTIUM_SDK_DIR+'/soc/phytiumpi/fgpio_table.c')
|
2023-11-21 17:42:23 +08:00
|
|
|
|
|
|
|
## pwm
|
|
|
|
if GetDepend(['BSP_USING_PWM']):
|
|
|
|
src += Glob(PHYTIUM_SDK_DIR+'/drivers/pwm/fpwm/*.c') + Glob(PORT_DRV_DIR+'/drv_pwm.c')
|
|
|
|
path += [PHYTIUM_SDK_DIR + '/drivers/pwm/fpwm/']
|
|
|
|
|
|
|
|
## i2C
|
|
|
|
if GetDepend(['BSP_USING_I2C']):
|
|
|
|
src += Glob(PHYTIUM_SDK_DIR+'/drivers/i2c/fi2c/*.c') + Glob(PORT_DRV_DIR+'/drv_i2c.c')
|
|
|
|
path += [PHYTIUM_SDK_DIR + '/drivers/i2c/fi2c/']
|
2023-08-02 13:27:09 +08:00
|
|
|
|
|
|
|
## iopad
|
2023-11-21 17:42:23 +08:00
|
|
|
if GetDepend(['BSP_USING_IOPAD']):
|
|
|
|
src += Glob(PHYTIUM_SDK_DIR+'/drivers/iomux/fiopad/*.c')
|
|
|
|
path += [PHYTIUM_SDK_DIR + '/drivers/iomux/fiopad/']
|
2023-08-02 13:27:09 +08:00
|
|
|
|
2023-11-21 17:42:23 +08:00
|
|
|
## mio
|
|
|
|
if GetDepend(['I2C_USE_MIO']):
|
|
|
|
src += Glob(PHYTIUM_SDK_DIR+'/drivers/mio/fmio/*.c')
|
|
|
|
path += [PHYTIUM_SDK_DIR + '/drivers/mio/fmio/']
|
2022-11-10 22:22:48 +08:00
|
|
|
|
2023-11-21 17:42:23 +08:00
|
|
|
## board
|
|
|
|
if GetDepend(['E2000D_DEMO_BOARD']):
|
|
|
|
src += Glob(PHYTIUM_SDK_DIR+'/board/e2000d_demo/fio_mux.c')
|
|
|
|
path += [PHYTIUM_SDK_DIR + '/board/e2000d_demo/']
|
|
|
|
|
|
|
|
if GetDepend(['BSP_USING_SDIF']):
|
|
|
|
src += Glob(PHYTIUM_SDK_DIR+'/board/e2000d_demo/fsdif_timing.c')
|
|
|
|
|
|
|
|
if GetDepend(['E2000Q_DEMO_BOARD']):
|
|
|
|
src += Glob(PHYTIUM_SDK_DIR+'/board/e2000q_demo/fio_mux.c')
|
|
|
|
path += [PHYTIUM_SDK_DIR + '/board/e2000q_demo/']
|
|
|
|
|
|
|
|
if GetDepend(['BSP_USING_SDIF']):
|
|
|
|
src += Glob(PHYTIUM_SDK_DIR+'/board/e2000q_demo/fsdif_timing.c')
|
|
|
|
|
|
|
|
if GetDepend(['FIREFLY_DEMO_BOARD']):
|
|
|
|
src += Glob(PHYTIUM_SDK_DIR+'/board/firefly/fio_mux.c')
|
|
|
|
path += [PHYTIUM_SDK_DIR + '/board/firefly/']
|
|
|
|
|
|
|
|
if GetDepend(['BSP_USING_SDIF']):
|
|
|
|
src += Glob(PHYTIUM_SDK_DIR+'/board/firefly/fsdif_timing.c')
|
|
|
|
|
2023-12-16 19:10:26 +08:00
|
|
|
|
|
|
|
LIBS = []
|
|
|
|
LIBPATH = []
|
|
|
|
# fdriver dc
|
|
|
|
if GetDepend(['BSP_USING_DC']):
|
|
|
|
src += Glob(PORT_DRV_DIR+'/drv_dc.c')
|
|
|
|
path += [PHYTIUM_SDK_DIR + '/drivers/media/fdcdp_lib/inc']
|
|
|
|
if GetDepend(['TARGET_ARMV8_AARCH64']):
|
|
|
|
LIBPATH = [PHYTIUM_SDK_DIR + '/drivers/media/fdcdp_lib/']
|
|
|
|
LIBS = ['libfdcdp_standalone_a64.a']
|
|
|
|
|
|
|
|
elif GetDepend(['TARGET_ARMV8_AARCH32']):
|
|
|
|
LIBPATH = [PHYTIUM_SDK_DIR + '/drivers/media/fdcdp_lib/']
|
|
|
|
LIBS = ['libfdcdp_standalone_soft_a32.a']
|
2023-11-21 17:42:23 +08:00
|
|
|
## fdriver port
|
|
|
|
src += Glob(cwd+'/port/fdriver_port/*.c')
|
|
|
|
path += [cwd + '/port/fdriver_port']
|
|
|
|
|
|
|
|
## fboard port
|
|
|
|
path += [cwd + '/port/fboard_port']
|
2023-05-11 10:25:21 +08:00
|
|
|
|
2023-12-08 17:57:55 +08:00
|
|
|
## lwip port
|
|
|
|
src += Glob(cwd+'/port/lwip_port/*.c')
|
|
|
|
path += [cwd + '/port/lwip_port']
|
|
|
|
|
2023-12-08 20:01:34 +08:00
|
|
|
## cherryusb port
|
|
|
|
if GetDepend(['BSP_USING_XHCI']):
|
|
|
|
src += Glob(cwd +'/port/cherryusb_port/drv_xhci.c')
|
|
|
|
path += [cwd + '/port/cherryusb_port']
|
|
|
|
|
|
|
|
if GetDepend(['BSP_USING_PUSB2']):
|
|
|
|
if GetDepend(['PKG_CHERRYUSB_HOST_PUSB2']):
|
|
|
|
src += Glob(cwd +'/port/cherryusb_port/drv_pusb2_hc.c')
|
|
|
|
if GetDepend(['PKG_CHERRYUSB_DEVICE_PUSB2']):
|
|
|
|
src += Glob(cwd +'/port/cherryusb_port/drv_pusb2_dc.c')
|
|
|
|
path += [cwd + '/port/cherryusb_port']
|
|
|
|
|
2023-05-11 10:25:21 +08:00
|
|
|
# phytium ports rt-thread examples
|
|
|
|
PORT_DRV_DIR = cwd + '/examples'
|
|
|
|
|
|
|
|
src += Glob(PORT_DRV_DIR + '/*.c')
|
|
|
|
|
|
|
|
# sdkcomfig.h
|
|
|
|
path += [cwd]
|
2022-11-10 22:22:48 +08:00
|
|
|
|
2023-05-11 10:25:21 +08:00
|
|
|
# add group
|
2022-11-10 22:22:48 +08:00
|
|
|
ASFLAGS = ''
|
|
|
|
group = DefineGroup('FT_DRIVER', src, depend=[
|
2023-12-16 19:10:26 +08:00
|
|
|
''],LIBS = LIBS,LIBPATH=LIBPATH, CPPPATH=path, ASFLAGS = ASFLAGS)
|
2022-11-10 22:22:48 +08:00
|
|
|
|
|
|
|
|
|
|
|
Return('group')
|