-
Notifications
You must be signed in to change notification settings - Fork 1
/
pre-script.rhai
36 lines (33 loc) · 1.26 KB
/
pre-script.rhai
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
let targets = #{
ch32l003: "riscv32imc-unknown-none-elf",
ch32v003: "riscv32ec-unknown-none-elf",
ch32v103: "riscv32imc-unknown-none-elf",
ch32v203: "riscv32imc-unknown-none-elf",
ch32v208: "riscv32imc-unknown-none-elf",
ch32v303: "riscv32imfc-unknown-none-elf",
ch32v305: "riscv32imfc-unknown-none-elf",
ch32v307: "riscv32imfc-unknown-none-elf",
ch32x033: "riscv32imc-unknown-none-elf",
ch32x035: "riscv32imc-unknown-none-elf",
ch641: "riscv32ec-unknown-none-elf",
};
let embassy = variable::get("embassy");
let mcu_family = variable::get("mcu_family");
let target = targets.get(mcu_family);
variable::set("target", `${target}`);
// Handle families with only one variant
if mcu_family == "ch641" {
variable::set("mcu", "ch641");
} else if mcu_family == "ch32x033" {
variable::set("mcu", "ch32x033f8p6");
}
if embassy {
variable::set("embassy_dep", true);
} else {
// Even if embassy not selected, add embassy dependency for the V2/V3 because USB support depends on Embassy
if mcu_family == "ch32v203" || mcu_family == "ch32v208" || mcu_family == "ch32v303" || mcu_family == "ch32v305" || mcu_family == "ch32v307" {
variable::set("embassy_dep", true);
} else {
variable::set("embassy_dep", false);
}
}