| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- #-*- encoding: utf-8 -*-
- #-------------------------------------------------------------------------------
- # SConstruct
- # Copyright (c) Shanghai Real-Thread Electronic Technology Co., Ltd.
- #-------------------------------------------------------------------------------
- import sys
- import os
- #-------------------------------------------------------------------------------
- # System configuration
- #-------------------------------------------------------------------------------
- if os.path.isdir('rt-thread'):
- RTT_ROOT = 'rt-thread'
- elif os.path.isdir('../rt-thread'):
- RTT_ROOT = '../rt-thread'
- else:
- RTT_ROOT = os.path.join(os.getcwd(), '..', '..', '..', '..', '..')
- sys.pycache_prefix = os.path.join(RTT_ROOT, 'scripts', '__pycache__')
- import rtconfig
- sys.path = sys.path + [os.path.abspath(os.path.join(RTT_ROOT, 'scripts'))]
- from building import *
- Export('RTT_ROOT')
- Export('rtconfig')
- #-------------------------------------------------------------------------------
- # Scons Environment
- #-------------------------------------------------------------------------------
- TARGET = rtconfig.TARGET
- DefaultEnvironment(tools=[])
- env = Environment(tools = ['mingw'],
- CPP = rtconfig.CPP,
- AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
- CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
- CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
- AR = rtconfig.AR, ARFLAGS = '-rc',
- LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS,
- LD = rtconfig.LD, DTC = rtconfig.DTC
- )
- env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
- #-------------------------------------------------------------------------------
- # Prepare building environment
- #-------------------------------------------------------------------------------
- objs = PrepareBuilding(env, RTT_ROOT, has_libcpu = False, app = True)
- env.Replace(LINKFLAGS = rtconfig.LFLAGS)
- if GetDepend('RT_USING_FPU'):
- env['CCFLAGS'] = env['CCFLAGS'].replace('-msoft-float', '-mhard-float')
- env['ASFLAGS'] = env['ASFLAGS'].replace('-msoft-float', '-mhard-float')
- env['CXXFLAGS'] = env['CXXFLAGS'].replace('-msoft-float', '-mhard-float')
- env['LINKFLAGS'] = env['LINKFLAGS'].replace('-msoft-float', '-mhard-float')
- #-------------------------------------------------------------------------------
- # Prepare Device Tree
- #-------------------------------------------------------------------------------
- DTCSRC = [os.path.join(GetCurrentDir(), 'board/board.dts')]
- if not os.path.isdir('rt-thread'):
- DTCPATH = [
- os.path.join(GetCurrentDir(), RTT_ROOT + '/drivers/include'),
- os.path.join(GetCurrentDir(), RTT_ROOT + '/apps/rockchip/%s/platform/dtsi/' % rtconfig.CHIP),
- os.path.join(GetCurrentDir(), RTT_ROOT + '/apps/rockchip/%s/platform/dtsi/rockchip' % rtconfig.CHIP)
- ]
- else:
- DTCPATH = [
- os.path.join(GetCurrentDir(), RTT_ROOT + '/drivers/include'),
- os.path.join(GetCurrentDir(), RTT_ROOT + '/../platform/dtsi/'),
- os.path.join(GetCurrentDir(), RTT_ROOT + '/../platform/dtsi/rockchip')
- ]
- DTCFLAGS = '-b 0 '
- DTCFLAGS += '-Wno-interrupt_provider '
- DTCFLAGS += '-Wno-unit_address_vs_reg '
- DTCFLAGS += '-Wno-avoid_unnecessary_addr_size '
- DTCFLAGS += '-Wno-alias_paths '
- DTCFLAGS += '-Wno-graph_child_address '
- DTCFLAGS += '-Wno-simple_bus_reg '
- DTCFLAGS += '-Wno-unique_unit_address '
- PrepareDTC(DTCSRC, depend = [], DTCPATH = DTCPATH, DTCFLAGS = DTCFLAGS)
- #-------------------------------------------------------------------------------
- # Add RuiChing SDK
- #-------------------------------------------------------------------------------
- if not os.path.isdir('rt-thread'):
- objs.extend(
- SConscript(RTT_ROOT + '/SConscript',
- variant_dir='build/sdk/', duplicate=0)
- )
- objs.extend(
- SConscript(RTT_ROOT + '/apps/rockchip/%s/platform/drivers/SConscript' % rtconfig.CHIP,
- variant_dir='build/drivers/', duplicate=0))
- elif os.path.isdir('../rt-thread'):
- pass
- else:
- objs.extend(
- SConscript('platform/drivers/SConscript',
- variant_dir='build/platform/', duplicate=0))
- #-------------------------------------------------------------------------------
- # Make a building
- #-------------------------------------------------------------------------------
- DoBuilding(TARGET, objs)
|