#[derive(Debug, Clone)]
pub struct Dep {
pub name: &'static str,
pub source: DepSource,
pub default_features: bool,
pub features: &'static [&'static str],
pub optional: bool,
}
#[derive(Debug, Clone)]
#[allow(dead_code)] pub enum DepSource {
Path(&'static str),
Version(&'static str),
PackageRename {
package: &'static str,
version: &'static str,
},
}
#[derive(Debug, Clone)]
#[allow(dead_code)] pub enum DefaultPolicy {
Empty,
AllManifestFeatures,
Explicit(&'static [&'static str]),
}
#[derive(Debug, Clone)]
pub struct ExtraBin {
pub name: &'static str,
pub path: &'static str,
pub required_features: &'static [&'static str],
}
pub struct ProngTemplate {
pub base_deps: &'static [Dep],
pub target_cfg_deps: &'static [(&'static str, &'static [Dep])],
pub build_deps: &'static [Dep],
pub feature_expansions: &'static [(&'static str, &'static [&'static str])],
pub extra_features: &'static [(&'static str, &'static [&'static str])],
pub default_features: DefaultPolicy,
pub bin_required_features: &'static [&'static str],
pub extra_bins: &'static [ExtraBin],
}
pub fn lookup(
prong: &str,
generator: &str,
vendor: &str,
board: &str,
) -> Option<&'static ProngTemplate> {
for entry in TEMPLATES {
if entry.0 == prong && entry.1 == generator && entry.2 == vendor && entry.3 == board {
return Some(entry.4);
}
}
None
}
type TemplateKey = (
&'static str,
&'static str,
&'static str,
&'static str,
&'static ProngTemplate,
);
const TEMPLATES: &[TemplateKey] = &[
(
"linux",
"hand_written",
"ti",
"beaglebone_black_nhd_cape",
&BBB_LINUX,
),
(
"bare_metal",
"hosted",
"esp",
"beetle_esp32c3",
&BEETLE_ESP_HAL,
),
(
"bare_metal",
"creator-bsp-pac",
"esp",
"beetle_esp32c3",
&BEETLE_BSP_PAC,
),
(
"freertos",
"hand_written",
"stm",
"stm32h747i_disco",
&H747_FREERTOS,
),
(
"zephyr",
"hand_written",
"stm",
"stm32h747i_disco",
&H747_ZEPHYR,
),
];
static BBB_LINUX: ProngTemplate = ProngTemplate {
base_deps: &[
Dep {
name: "rlvgl-core",
source: DepSource::Path("../../core"),
default_features: true,
features: &[],
optional: false,
},
Dep {
name: "rlvgl-platform",
source: DepSource::Path("../../platform"),
default_features: false,
features: &[],
optional: false,
},
Dep {
name: "rlvgl-decomp",
source: DepSource::Path("../../rlvgl-decomp"),
default_features: true,
features: &[],
optional: true,
},
Dep {
name: "rlvgl-playit",
source: DepSource::Path("../../playit"),
default_features: false,
features: &["std"],
optional: true,
},
Dep {
name: "rlvgl-widgets",
source: DepSource::Path("../../widgets"),
default_features: false,
features: &[],
optional: true,
},
Dep {
name: "libc",
source: DepSource::Version("0.2"),
default_features: true,
features: &[],
optional: false,
},
Dep {
name: "heapless",
source: DepSource::Version("0.8"),
default_features: false,
features: &[],
optional: false,
},
],
target_cfg_deps: &[],
build_deps: &[Dep {
name: "cc",
source: DepSource::Version("1"),
default_features: true,
features: &[],
optional: false,
}],
feature_expansions: &[
("linux", &["rlvgl-platform/linux_fbdev"]),
("splash", &["rlvgl-platform/splash", "dep:rlvgl-decomp"]),
("desktop", &[]),
("playit", &["dep:rlvgl-playit"]),
("star_crawl", &["dep:rlvgl-widgets"]),
],
extra_features: &[],
default_features: DefaultPolicy::AllManifestFeatures,
bin_required_features: &[],
extra_bins: &[],
};
static BEETLE_ESP_HAL: ProngTemplate = ProngTemplate {
base_deps: &[
Dep {
name: "rlvgl-core",
source: DepSource::Path("../../core"),
default_features: false,
features: &[],
optional: true,
},
Dep {
name: "rlvgl-platform",
source: DepSource::Path("../../platform"),
default_features: false,
features: &[],
optional: true,
},
Dep {
name: "rlvgl-widgets",
source: DepSource::Path("../../widgets"),
default_features: false,
features: &[],
optional: true,
},
Dep {
name: "ssd1306",
source: DepSource::Version("0.9"),
default_features: false,
features: &["graphics"],
optional: true,
},
],
target_cfg_deps: &[(
"cfg(target_arch = \"riscv32\")",
&[
Dep {
name: "esp-hal",
source: DepSource::Version("=1.0.0-beta.0"),
default_features: true,
features: &["esp32c3", "unstable"],
optional: true,
},
Dep {
name: "esp-backtrace",
source: DepSource::Version("0.15"),
default_features: true,
features: &["esp32c3", "panic-handler", "println"],
optional: true,
},
Dep {
name: "esp-println",
source: DepSource::Version("0.13"),
default_features: true,
features: &["esp32c3", "log"],
optional: true,
},
Dep {
name: "esp-alloc",
source: DepSource::Version("0.6"),
default_features: true,
features: &[],
optional: true,
},
],
)],
build_deps: &[],
feature_expansions: &[(
"esp_hal",
&[
"dep:esp-hal",
"dep:esp-backtrace",
"dep:esp-println",
"dep:esp-alloc",
"dep:ssd1306",
"dep:rlvgl-core",
"dep:rlvgl-platform",
"dep:rlvgl-widgets",
"rlvgl-platform/ssd1306",
],
)],
extra_features: &[],
default_features: DefaultPolicy::Empty,
bin_required_features: &["esp_hal"],
extra_bins: &[],
};
static BEETLE_BSP_PAC: ProngTemplate = ProngTemplate {
base_deps: &[],
target_cfg_deps: &[(
"cfg(target_arch = \"riscv32\")",
&[
Dep {
name: "esp32c3",
source: DepSource::Version("0.31"),
default_features: true,
features: &["critical-section", "rt"],
optional: true,
},
Dep {
name: "esp-riscv-rt",
source: DepSource::Version("0.13"),
default_features: true,
features: &[],
optional: true,
},
Dep {
name: "riscv-rt",
source: DepSource::Version("0.16"),
default_features: true,
features: &["memory"],
optional: true,
},
Dep {
name: "riscv",
source: DepSource::Version("0.15"),
default_features: true,
features: &["critical-section-single-hart"],
optional: true,
},
Dep {
name: "panic-halt",
source: DepSource::Version("1"),
default_features: true,
features: &[],
optional: true,
},
],
)],
build_deps: &[],
feature_expansions: &[(
"bsp_pac",
&[
"dep:esp32c3",
"dep:esp-riscv-rt",
"dep:riscv-rt",
"dep:riscv",
"dep:panic-halt",
],
)],
extra_features: &[],
default_features: DefaultPolicy::Empty,
bin_required_features: &["bsp_pac"],
extra_bins: &[],
};
static H747_BASE_DEPS: &[Dep] = &[
Dep {
name: "rlvgl-core",
source: DepSource::Path("../../core"),
default_features: false,
features: &[],
optional: false,
},
Dep {
name: "rlvgl-platform",
source: DepSource::Path("../../platform"),
default_features: false,
features: &[],
optional: false,
},
Dep {
name: "rlvgl-widgets",
source: DepSource::Path("../../widgets"),
default_features: false,
features: &[],
optional: false,
},
Dep {
name: "rlvgl-ui",
source: DepSource::Path("../../ui"),
default_features: false,
features: &[],
optional: false,
},
Dep {
name: "rlvgl-i18n",
source: DepSource::Path("../../i18n"),
default_features: true,
features: &[],
optional: false,
},
Dep {
name: "rlvgl-decomp",
source: DepSource::Path("../../rlvgl-decomp"),
default_features: true,
features: &[],
optional: false,
},
Dep {
name: "rlvgl-playit",
source: DepSource::Path("../../playit"),
default_features: false,
features: &[],
optional: false,
},
];
static H747_TARGET_CFG_DEPS: &[(&str, &[Dep])] = &[(
"cfg(any(target_arch = \"arm\", target_os = \"none\"))",
&[
Dep {
name: "cortex-m-rt",
source: DepSource::Version("0.7"),
default_features: true,
features: &[],
optional: false,
},
Dep {
name: "cortex-m",
source: DepSource::Version("0.7"),
default_features: true,
features: &["critical-section-single-core"],
optional: false,
},
Dep {
name: "embedded-alloc",
source: DepSource::Version("=0.5.1"),
default_features: true,
features: &[],
optional: false,
},
Dep {
name: "panic-halt",
source: DepSource::Version("1"),
default_features: true,
features: &[],
optional: false,
},
Dep {
name: "critical-section",
source: DepSource::Version("1.1.2"),
default_features: true,
features: &[],
optional: false,
},
Dep {
name: "stm32h7",
source: DepSource::Version("0.15.1"),
default_features: true,
features: &["rt"],
optional: true,
},
Dep {
name: "stm32h7xx-hal",
source: DepSource::Version("0.16"),
default_features: true,
features: &["stm32h747cm7", "sdmmc", "fmc", "xspi"],
optional: true,
},
Dep {
name: "embedded-hal",
source: DepSource::Version("1"),
default_features: true,
features: &[],
optional: true,
},
Dep {
name: "embedded-hal-02",
source: DepSource::PackageRename {
package: "embedded-hal",
version: "0.2.7",
},
default_features: true,
features: &["unproven"],
optional: true,
},
Dep {
name: "embedded-sdmmc",
source: DepSource::Version("0.9"),
default_features: false,
features: &[],
optional: true,
},
],
)];
const H747_CM7_EXPANSION: &[&str] = &[
"rlvgl-platform/stm32h747i_disco",
"dep:stm32h7",
"stm32h7/stm32h747cm7",
"dep:stm32h7xx-hal",
"dep:embedded-hal",
"dep:embedded-hal-02",
"dep:embedded-sdmmc",
];
static H747_FREERTOS: ProngTemplate = ProngTemplate {
base_deps: H747_BASE_DEPS,
target_cfg_deps: H747_TARGET_CFG_DEPS,
build_deps: &[],
feature_expansions: &[
("cm7", H747_CM7_EXPANSION),
("freertos", &["rlvgl-platform/freertos"]),
("adapted_cmd", &[]),
("dma2d", &["rlvgl-platform/dma2d"]),
("splash", &["rlvgl-platform/splash"]),
("desktop", &[]),
],
extra_features: &[],
default_features: DefaultPolicy::Empty,
bin_required_features: &["cm7"],
extra_bins: &[],
};
static H747_ZEPHYR: ProngTemplate = ProngTemplate {
base_deps: H747_BASE_DEPS,
target_cfg_deps: H747_TARGET_CFG_DEPS,
build_deps: &[],
feature_expansions: &[
("cm7", H747_CM7_EXPANSION),
("zephyr", &[]),
("dma2d", &["rlvgl-platform/dma2d"]),
("splash", &["rlvgl-platform/splash"]),
("desktop", &[]),
],
extra_features: &[],
default_features: DefaultPolicy::Empty,
bin_required_features: &[],
extra_bins: &[],
};