summaryrefslogtreecommitdiff
path: root/components/drivers/serial/device/virtual/SConscript
blob: 64481dad41ddf8887dde6d8c6b514a9ee937c7c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from building import *

group   = []

if not GetDepend(['RT_SERIAL_VIRTUAL']):
    Return('group')

cwd     = GetCurrentDir()
CPPPATH = [cwd + '/../../include']
CPPDEFINES = []

src     = []

font_path = None

if GetDepend(['RT_SERIAL_VIRTUAL_FONT_UNI2_FIXED16']):
    font_path = cwd + '/font-uni2-fixed16.psf'

if GetDepend(['RT_SERIAL_VIRTUAL_FONT_UNI2_VGA16']):
    font_path = cwd + '/font-uni2-vga16.psf'

if font_path != None:
    with open(font_path, 'rb') as psf:
        psf_data = psf.read()

    first_byte = True

    with open(cwd + '/psf.inc', 'w') as font:
        for byte in psf_data:
            if not first_byte:
                font.write(", ")

            font.write("0x{:02x}".format(byte))
            first_byte = False

    src += ['psf.c', 'render.c', 'virtual.c']

group = DefineGroup('DeviceDrivers', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES)
Return('group')