From f28e3adfc4b1a1bd52e768de419995ef499b6070 Mon Sep 17 00:00:00 2001 From: Nia Espera Date: Thu, 30 Mar 2023 20:51:34 +0200 Subject: [PATCH 1/4] start --- lvgl-codegen/Cargo.toml | 1 - lvgl-sys/Cargo.toml | 3 ++- lvgl-sys/build/config.rs | 37 ++++++++++++++++++++++++++++ lvgl-sys/{build.rs => build/main.rs} | 2 ++ 4 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 lvgl-sys/build/config.rs rename lvgl-sys/{build.rs => build/main.rs} (99%) diff --git a/lvgl-codegen/Cargo.toml b/lvgl-codegen/Cargo.toml index 8c9722a2..570affe3 100644 --- a/lvgl-codegen/Cargo.toml +++ b/lvgl-codegen/Cargo.toml @@ -15,4 +15,3 @@ lazy_static = "1.4.0" proc-macro2 = "1.0.56" Inflector = "0.11.4" syn = { version = "2.0.13", features = ["full"]} - diff --git a/lvgl-sys/Cargo.toml b/lvgl-sys/Cargo.toml index 6ef36802..bf5a16c3 100644 --- a/lvgl-sys/Cargo.toml +++ b/lvgl-sys/Cargo.toml @@ -10,7 +10,7 @@ repository = "https://github.com/rafaelcaricio/lvgl-rs" readme = "README.md" categories = ["external-ffi-bindings", "embedded", "gui", "no-std"] keywords = ["littlevgl", "lvgl"] -build = "build.rs" +build = "build/main.rs" links = "lvgl" exclude = [ "vendor/lvgl/demos", @@ -30,6 +30,7 @@ cty = "0.2.2" [build-dependencies] cc = "1.0.79" bindgen = "0.64.0" +serde = { version = "1.0.159", features = ["derive"] } [features] use-vendored-config = [] diff --git a/lvgl-sys/build/config.rs b/lvgl-sys/build/config.rs new file mode 100644 index 00000000..c896b4c7 --- /dev/null +++ b/lvgl-sys/build/config.rs @@ -0,0 +1,37 @@ +#[repr(i32)] +enum ColorDepth { + D1 = 1, + D8 = 8, + D16 = 16, + D32 = 32, +} + +#[repr(i32)] +enum ColorMixRoundOFS { + R0 = 0, + R64 = 64, + R128 = 128, + R192 = 192, + R254 = 254, +} + +pub struct LvConfig { + color_depth: ColorDepth, + color_16_swap: bool, + color_screen_transp: bool, + color_mix_round_ofs: ColorMixRoundOFS, + color_chroma_hex: u64, + mem_custom: bool, + mem_size: u128, + mem_adr: usize, // TODO: is this fine when cross-compiling to targets w/ different usize? + mem_custom_include: String, + mem_custom_alloc: String, + mem_custom_free: String, + mem_custom_realloc: String, +} + +pub struct DrvConfig { + +} + +pub fn conf_gen() {} \ No newline at end of file diff --git a/lvgl-sys/build.rs b/lvgl-sys/build/main.rs similarity index 99% rename from lvgl-sys/build.rs rename to lvgl-sys/build/main.rs index 7edfe23b..189cbc15 100644 --- a/lvgl-sys/build.rs +++ b/lvgl-sys/build/main.rs @@ -6,6 +6,8 @@ use std::{ path::{Path, PathBuf}, }; +mod config; + static CONFIG_NAME: &str = "DEP_LV_CONFIG_PATH"; // See https://github.com/rust-lang/rust-bindgen/issues/687#issuecomment-450750547 From bbd33198abd9edb4fb528d1f25b0a375f572cf1d Mon Sep 17 00:00:00 2001 From: Nia Espera Date: Thu, 30 Mar 2023 20:56:15 +0200 Subject: [PATCH 2/4] oop --- lvgl-sys/build/config.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/lvgl-sys/build/config.rs b/lvgl-sys/build/config.rs index c896b4c7..42e2d3d4 100644 --- a/lvgl-sys/build/config.rs +++ b/lvgl-sys/build/config.rs @@ -16,11 +16,13 @@ enum ColorMixRoundOFS { } pub struct LvConfig { + // Color color_depth: ColorDepth, color_16_swap: bool, color_screen_transp: bool, color_mix_round_ofs: ColorMixRoundOFS, color_chroma_hex: u64, + // Memory mem_custom: bool, mem_size: u128, mem_adr: usize, // TODO: is this fine when cross-compiling to targets w/ different usize? @@ -28,6 +30,29 @@ pub struct LvConfig { mem_custom_alloc: String, mem_custom_free: String, mem_custom_realloc: String, + mem_buf_max_num: u32, + memcpy_memset_std: bool, + // HAL + disp_def_refr_period: u32, + indev_def_read_period: u32, + tick_custom: bool, + tick_custom_include: String, + tick_custom_sys_time_expr: String, + dpi_def: u32, + // Drawing + draw_complex: bool, + shadow_cache_size: u128, + circle_cache_size: u128, + layer_simple_buf_size: u128, + layer_simple_fallback_buf_size: u128, + img_cache_def_size: u128, + gradient_max_stops: u32, + grad_cache_def_size: u128, + dither_grdient: bool, + dither_gradient_error_diffusion: bool, + disp_rot_max_buf: u128, + // GPU + } pub struct DrvConfig { From 77aef7fb18b4f468b07af7db9f5d92803a9c4fc9 Mon Sep 17 00:00:00 2001 From: Nia Espera Date: Sat, 1 Apr 2023 17:02:40 +0200 Subject: [PATCH 3/4] more added --- lvgl-sys/build/config.rs | 55 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/lvgl-sys/build/config.rs b/lvgl-sys/build/config.rs index 42e2d3d4..6fd5ad6e 100644 --- a/lvgl-sys/build/config.rs +++ b/lvgl-sys/build/config.rs @@ -15,6 +15,15 @@ enum ColorMixRoundOFS { R254 = 254, } +enum LogLevel { + Trace, + Info, + Warn, + Error, + User, + None, +} + pub struct LvConfig { // Color color_depth: ColorDepth, @@ -52,6 +61,50 @@ pub struct LvConfig { dither_gradient_error_diffusion: bool, disp_rot_max_buf: u128, // GPU + use_gpu_arm2d: bool, + use_gpu_stm32_dma2d: bool, + gpu_dma2d_cmsis_include: String, + use_gpu_swm341_dma2d: bool, + gpu_dma2d_swm341_include: String, + use_gpu_nxp_pxp: bool, + use_gpu_nxp_pxp_auto_init: bool, + use_gpu_nxp_vg_lite: bool, + use_gpu_sdl: bool, + gpu_sdl_include_path: String, + gpu_sdl_lru_size: u128, + gpu_sdl_custom_blend_mode: String, + // Logging + use_log: bool, + log_level: LogLevel, + log_printf: bool, + log_trace_mem: bool, + log_trace_timer: bool, + log_trace_indev: bool, + log_trace_disp_refr: bool, + log_trace_event: bool, + log_trace_obj_create: bool, + log_trace_layout: bool, + log_trace_anim: bool, + // Asserts + use_assert_null: bool, + use_assert_malloc: bool, + use_assert_style: bool, + use_assert_mem_integrity: bool, + use_assert_obj: bool, + assert_handler_include: String, + assert_handler: String, + // Others + use_perf_monitor: bool, + use_perf_monitor_pos: u8, // FIXME + use_mem_monitor: bool, + use_mem_monitor_pos: u8, // FIXME + use_refr_debugger: bool, + sprintf_custom: bool, + sprintf_custom_include: String, + snprintf: String, + vsnprintf: String, + sprintf_use_float: bool, + use_user_data: bool, } @@ -59,4 +112,4 @@ pub struct DrvConfig { } -pub fn conf_gen() {} \ No newline at end of file +pub fn conf_gen() {} From 56381df8ec798d4dbe40a40a5c6b29afdceb4da9 Mon Sep 17 00:00:00 2001 From: Nia Espera Date: Sun, 30 Apr 2023 19:30:50 +0200 Subject: [PATCH 4/4] more --- lvgl-sys/build/config.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lvgl-sys/build/config.rs b/lvgl-sys/build/config.rs index 6fd5ad6e..43a06cfe 100644 --- a/lvgl-sys/build/config.rs +++ b/lvgl-sys/build/config.rs @@ -105,7 +105,20 @@ pub struct LvConfig { vsnprintf: String, sprintf_use_float: bool, use_user_data: bool, - + enable_gc: bool, + gc_include: String, + big_endian_system: bool, + attribute_tick_inc: Option, + attribute_timer_handler: Option, + attribute_flush_ready: Option, + attribute_mem_align_size: u32, + attribute_mem_align: Option, + attribute_large_const: Option, + attribute_large_ram_array: Option, + attribute_fast_mem: Option, + attribute_dma: Option, + export_const_int: u8, //FIXME + use_large_coord: bool, } pub struct DrvConfig {