forked from lowRISC/sonata-software
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xmake.lua
100 lines (89 loc) · 2.88 KB
/
xmake.lua
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
-- Copyright lowRISC Contributors.
-- SPDX-License-Identifier: Apache-2.0
-- Part 1
compartment("blinky_raw")
add_files("part_1/blinky_raw.cc")
compartment("led_walk_raw")
add_files("part_1/led_walk_raw.cc")
firmware("hardware_access_part_1")
add_deps("debug", "freestanding")
add_deps("led_walk_raw", "blinky_raw")
on_load(function(target)
target:values_set("board", "$(board)")
target:values_set("threads", {
{
compartment = "blinky_raw",
priority = 2,
entry_point = "start_blinking",
stack_size = 0x200,
trusted_stack_frames = 1
},
{
compartment = "led_walk_raw",
priority = 1,
entry_point = "start_walking",
stack_size = 0x200,
trusted_stack_frames = 1
},
}, {expand = false})
end)
after_link(convert_to_uf2)
-- Part 2
compartment("gpio_access")
-- This compartment uses C++ thread-safe static initialisation and so
-- depends on the C++ runtime.
add_deps("cxxrt")
add_files("part_2/gpio_access.cc")
compartment("blinky_dynamic")
add_deps("gpio_access")
add_files("part_2/blinky_dynamic.cc")
compartment("led_walk_dynamic")
add_deps("gpio_access")
add_files("part_2/led_walk_dynamic.cc")
firmware("hardware_access_part_2")
add_deps("freestanding", "debug")
add_deps("led_walk_dynamic", "blinky_dynamic")
on_load(function(target)
target:values_set("board", "$(board)")
target:values_set("threads", {
{
compartment = "blinky_dynamic",
priority = 2,
entry_point = "start_blinking",
stack_size = 0x400,
trusted_stack_frames = 3
},
{
compartment = "led_walk_dynamic",
priority = 1,
entry_point = "start_walking",
stack_size = 0x400,
trusted_stack_frames = 3
},
}, {expand = false})
end)
after_link(convert_to_uf2)
-- Part 3
firmware("hardware_access_part_3")
add_deps("freestanding", "debug")
add_deps("led_walk_raw", "led_walk_dynamic")
on_load(function(target)
target:values_set("board", "$(board)")
target:values_set("threads", {
{
compartment = "led_walk_raw",
priority = 2,
entry_point = "start_walking",
stack_size = 0x200,
trusted_stack_frames = 1
},
{
compartment = "led_walk_dynamic",
priority = 3,
entry_point = "start_walking",
stack_size = 0x400,
trusted_stack_frames = 3
},
}, {expand = false})
end)
after_link(convert_to_uf2)