Subversion Repositories idreammicro-avr

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
57 jlesech 1
"""
2
Build project.
3
"""
4
def BuildProject(env, sources, target_name):
5
    # Build program.
6
    env.Program(target = target_name + '.elf', source = sources)
7
 
8
    # Create hex binary file.
9
    env.Command(
10
        target_name + '.hex',
11
        target_name + '.elf',
12
        env['OBJCOPY'] + ' -O ihex $SOURCE $TARGET'
13
    )
14
 
15
AddMethod(Environment, BuildProject)
16
 
17
"""
18
Build library.
19
"""
20
def BuildLibrary(env, sources, target_name):
21
    # Build static library.
22
    env.StaticLibrary(target = target_name, source = sources)
23
 
24
    # Append LIBPATH and LIBS.
25
    env.Append(LIBPATH = [ '#build/libraries/' + target_name + '/' + env['NAME'] ])
26
    env.Append(LIBS = [ target_name ])
27
 
28
AddMethod(Environment, BuildLibrary)
29
 
30
"""
31
Compute memory usage.
32
"""
33
def ComputeMemoryUsage(env, target_name):
34
    # Compute memory usage.
35
    env.Command(
36
        None,
37
        target_name + '.elf',
38
        env['SIZE'] + ' -C --mcu=' + env['MCU'] + ' $SOURCE'
39
    )
40
 
41
AddMethod(Environment, ComputeMemoryUsage)