summaryrefslogtreecommitdiff
path: root/tools/xmake.lua
blob: c09941c48384dcea93f235bfbd4d0cfd4f6a9042 (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
40
41
42
43
44
45
46
add_rules("mode.debug", "mode.release")

toolchain("${toolchain}")
    set_kind("standalone")
    set_sdkdir("${sdkdir}")
toolchain_end()

target("${target}")
    set_kind("binary")
    set_toolchains("${toolchain}")

    add_files(
        ${src_path}
    )

    add_includedirs(
        ${inc_path}
    )

    add_defines(
        ${define}
    )

    add_cflags(
        "${cflags}" ,{force = true}
    )
    add_cxxflags(
        "${cxxflags}" ,{force = true}
    )

    add_asflags(
        "${asflags}" ,{force = true}
    )

    add_ldflags(
        "${ldflags}" ,{force = true}
    )

    set_targetdir("./")
    set_filename("rtthread.elf")

    after_build(function(target)
        os.exec("${toolchain}-objcopy -O ihex rtthread.elf rtthread.hex")
        os.exec("${toolchain}-objcopy -O binary rtthread.elf rtthread.bin")
        os.exec("${toolchain}-size rtthread.elf")
    end)