Skip to content

Commit

Permalink
Merge pull request #157 from MikroElektronika/improvement/lvgl-conf
Browse files Browse the repository at this point in the history
Improvement/lvgl conf
  • Loading branch information
StrahinjaJacimovic authored Dec 3, 2024
2 parents 1e06a6a + 294ac5a commit 8a98c4f
Show file tree
Hide file tree
Showing 10 changed files with 924 additions and 11 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

**VERSIONS:**

+ **[v2.12.1](./changelog/v2.12.1/changelog.md)**
+ **[v2.12.0](./changelog/v2.12.0/changelog.md)**
+ **[v2.11.5](./changelog/v2.11.5/changelog.md)**
+ **[v2.11.4](./changelog/v2.11.4/changelog.md)**
Expand Down
73 changes: 73 additions & 0 deletions changelog/v2.12.1/changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<p align="center">
<img src="http://www.mikroe.com/img/designs/beta/logo_small.png?raw=true" alt="MikroElektronika"/>
</p>

---

**[BACK TO MAIN FILE](../../changelog.md)**

---

# `v2.12.1`

+ released: 2024-12-03

## Changes

+ [`v2.12.1`](#v2121)
+ [Changes](#changes)
+ [Improvements](#improvements)
+ [mikroSDK](#mikrosdk)
+ [Fixes](#fixes)
+ [mikroSDK](#mikrosdk-1)
+ [NEW HARDWARE](#new-hardware)

### Improvements

#### mikroSDK

**mikroSDK** LVGL now has the option to build either `LIGHT` or `HEAVY` LVGL configurations.

`HEAVY` configuration shall have all features of `LIGHT` configuration, with the addition of below listed features.

Additional options added for `HEAVY` configuration:

+ `CANVAS`
+ `TABLE`
+ `ANIMIMG`
+ `CALENDAR`
+ `CHART`
+ `IMGBTN`
+ `LIST`
+ `MENU`
+ `METER`
+ `MSGBOX`
+ `SPAN`
+ `TABVIEW`
+ `TILEVIEW`
+ `WIN`
+ `FLEX`
+ `GRID`

> Note that this feature is chosen by NECTO based on MCU memory (RAM/FLASH).
>> i.e. if MCU has at least **96K RAM** and **512K FLASH**, heavy configuration will be built.
### Fixes

#### mikroSDK

+ Fixed a stray space character before closing a comment
+ This caused build issues for FS if `FF_USE_LFN` was defined

### NEW HARDWARE

> NOTE:
>> If any new hardware was added to current version, it will be listed here.
Support added for following hardware:

---

**[BACK TO MAIN FILE](../../changelog.md)**

---
59 changes: 59 additions & 0 deletions cmake/utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -544,3 +544,62 @@ macro(find_include_package package_list has_module_list package_name)
list(APPEND ${has_module_list} ${module})
endif()
endmacro()

#############################################################################
## Check if device has enough memory. Check either FLASH, RAM or both.
## Usage:
## has_enough_memory(ENOUGH_MEMORY RAM 98304 FLASH 524288)
## if(${ENOUGH_MEMORY})
## ## Do something if YES
## else()
## ## Do something if NO
## endif()
#############################################################################
function(has_enough_memory check_value)
# Initialize the result to false (OFF)
set(${check_value} OFF PARENT_SCOPE)

# Parse optional arguments
set(options)
set(oneValueArgs FLASH RAM)
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "" ${ARGN})

message(INFO ": MINIMUM FLASH is ${ARG_FLASH} Bytes")
message(INFO ": MINIMUM RAM is ${ARG_RAM} Bytes")

# Validate that at least one of FLASH or RAM is provided
if(NOT DEFINED ARG_FLASH AND NOT DEFINED ARG_RAM)
message(FATAL_ERROR "At least one of 'FLASH' or 'RAM' must be specified.")
endif()

# Check FLASH memory, if required
if(DEFINED ARG_FLASH)
if(NOT DEFINED MCU_FLASH)
message(FATAL_ERROR "MCU_FLASH not defined for ${MCU_NAME}. Please ensure it is set in the database.")
elseif(MCU_FLASH LESS ARG_FLASH)
message(STATUS "The MCU ${MCU_NAME} does not meet the FLASH requirement (Required: ${ARG_FLASH}, Found: ${MCU_FLASH}).")
return()
endif()
message(INFO ": CURRENT FLASH is ${MCU_FLASH} Bytes")
endif()

# Check RAM memory, if required
if(DEFINED ARG_RAM)
if(NOT DEFINED MCU_RAM)
message(FATAL_ERROR "MCU_RAM not defined for ${MCU_NAME}. Please ensure it is set in the database.")
elseif(MCU_RAM LESS ARG_RAM)
message(STATUS "The MCU ${MCU_NAME} does not meet the RAM requirement (Required: ${ARG_RAM}, Found: ${MCU_RAM}).")
return()
endif()
message(INFO ": CURRENT RAM is ${MCU_RAM} Bytes")
endif()

# Infer library name from current directory
get_filename_component(LIBRARY_NAME ${CMAKE_CURRENT_LIST_DIR} NAME)

# If all checks pass, set the result to true (ON)
set(${check_value} ON PARENT_SCOPE)

# Display success message
message(STATUS "MEMORY_CHECK: ${MCU_NAME} has enough memory for '${LIBRARY_NAME}' library.")
endfunction()
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"display-name": "mikroSDK",
"description": "MikroSDK 2.0 is an embedded software development framework designed to simplify and accelerate application development on Mikroe hardware platform, specifically for Click Boards and other extension board drivers, on a broad range of microcontroller vendors and architectures. It includes peripheral libraries and drivers, middleware, board support, and application layer libraries among others.",
"icon": "images/icon-mikroSDK.png",
"manifest-version": "1.0.20"
"manifest-version": "1.0.21"
}
5 changes: 2 additions & 3 deletions middleware/filesystem/fat/FatFs/ff.c
Original file line number Diff line number Diff line change
Expand Up @@ -2049,7 +2049,7 @@ static void gen_numname (
#if FF_USE_LFN
/*-----------------------------------------------------------------------*/
/* FAT-LFN: Calculate checksum of an SFN entry */
/*-----------------------------------------------------------------------* /
/*-----------------------------------------------------------------------*/

static BYTE sum_sfn (
const BYTE * __generic_ptr dir /* Pointer to the SFN entry */
Expand Down Expand Up @@ -5886,7 +5886,7 @@ FRESULT f_mkfs (
void* work, /* Pointer to working buffer (null: use len bytes of heap memory) */
UINT len /* Size of working buffer [byte] */
)
{
{
static const WORD cst[] = {1, 4, 16, 64, 256, 512, 0}; /* Cluster size boundary for FAT volume (4Ks unit) */
static const WORD cst32[] = {1, 2, 4, 8, 16, 32, 0}; /* Cluster size boundary for FAT32 volume (128Ks unit) */
static const MKFS_PARM defopt = {FM_ANY, 0, 0, 0, 0}; /* Default parameter */
Expand Down Expand Up @@ -7082,4 +7082,3 @@ FRESULT f_setcp (
return FR_OK;
}
#endif /* FF_CODE_PAGE == 0 */

2 changes: 1 addition & 1 deletion platform/mikrosdk_version/include/mikrosdk_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ extern "C"{
* @note changes in patch version indicate smaller updates,
* bug fixes and improvements
*/
#define mikroSDK_PATCH_VERSION 0
#define mikroSDK_PATCH_VERSION 1

/**
* @brief mikroSDK_GET_VERSION
Expand Down
29 changes: 23 additions & 6 deletions thirdparty/lvgl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,20 @@ option(LV_CONF_INCLUDE_SIMPLE "Simple include of \"lv_conf.h\" and \"lv_drv_conf

# Option to set LV_CONF_PATH, if set parent path LV_CONF_DIR is added to includes.
option(LV_CONF_PATH "Path defined for lv_conf.h")

# Set path to appropriate "lv_conf.h" file.
has_enough_memory(ENOUGH_MEMORY RAM 131072 FLASH 524288)
if(${ENOUGH_MEMORY})
# Heavy configuration only if MCU has more than:
# 128KB RAM
# 512KB FLASH
message(INFO "LVGL: HEAVY CONFIGURATION")
set(LV_CONF_PATH "${CMAKE_CURRENT_LIST_DIR}/lv_conf/heavy/lv_conf.h")
else()
message(INFO "LVGL: LIGHT CONFIGURATION")
set(LV_CONF_PATH "${CMAKE_CURRENT_LIST_DIR}/lv_conf/light/lv_conf.h")
endif()

get_filename_component(LV_CONF_DIR ${LV_CONF_PATH} DIRECTORY)

# Option to build shared libraries (as opposed to static), default: OFF
Expand All @@ -19,17 +33,20 @@ option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
file(GLOB_RECURSE SOURCES ${LVGL_ROOT_DIR}/src/*.c)

# If the project has a KEY for including all the header files for LVGL set to "true", add all the LVGL headers.
if(${ADD_ALL_FILES} MATCHES "true")
if(NOT DEFINED LVGL_ADD_ALL_FILES)
set(LVGL_ADD_ALL_FILES OFF) # OFF or ON as value.
endif()
if(${LVGL_ADD_ALL_FILES})
file(GLOB_RECURSE HEADERS ${LVGL_ROOT_DIR}/src/*.h)
list(APPEND HEADERS ${LV_CONF_PATH})
mikrosdk_add_library(lvgl MikroSDK.LVGL ${SOURCES} ${HEADERS})
else()
mikrosdk_add_library(lvgl MikroSDK.LVGL ${SOURCES})
mikrosdk_add_library(lvgl MikroSDK.LVGL ${SOURCES} ${LV_CONF_PATH})
endif()

target_compile_definitions(lvgl
PUBLIC
$<$<BOOL:${LV_LVGL_H_INCLUDE_SIMPLE}>:LV_LVGL_H_INCLUDE_SIMPLE>
$<$<BOOL:${LV_CONF_INCLUDE_SIMPLE}>:LV_CONF_INCLUDE_SIMPLE>
target_compile_definitions(lvgl
PUBLIC
LV_CONF_PATH=${LV_CONF_PATH}
)

# Lbrary and headers can be installed to system using make install.
Expand Down
Loading

0 comments on commit 8a98c4f

Please sign in to comment.