Skip to content

Commit 8a98c4f

Browse files
Merge pull request #157 from MikroElektronika/improvement/lvgl-conf
Improvement/lvgl conf
2 parents 1e06a6a + 294ac5a commit 8a98c4f

File tree

10 files changed

+924
-11
lines changed

10 files changed

+924
-11
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
**VERSIONS:**
1212

13+
+ **[v2.12.1](./changelog/v2.12.1/changelog.md)**
1314
+ **[v2.12.0](./changelog/v2.12.0/changelog.md)**
1415
+ **[v2.11.5](./changelog/v2.11.5/changelog.md)**
1516
+ **[v2.11.4](./changelog/v2.11.4/changelog.md)**

changelog/v2.12.1/changelog.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<p align="center">
2+
<img src="http://www.mikroe.com/img/designs/beta/logo_small.png?raw=true" alt="MikroElektronika"/>
3+
</p>
4+
5+
---
6+
7+
**[BACK TO MAIN FILE](../../changelog.md)**
8+
9+
---
10+
11+
# `v2.12.1`
12+
13+
+ released: 2024-12-03
14+
15+
## Changes
16+
17+
+ [`v2.12.1`](#v2121)
18+
+ [Changes](#changes)
19+
+ [Improvements](#improvements)
20+
+ [mikroSDK](#mikrosdk)
21+
+ [Fixes](#fixes)
22+
+ [mikroSDK](#mikrosdk-1)
23+
+ [NEW HARDWARE](#new-hardware)
24+
25+
### Improvements
26+
27+
#### mikroSDK
28+
29+
**mikroSDK** LVGL now has the option to build either `LIGHT` or `HEAVY` LVGL configurations.
30+
31+
`HEAVY` configuration shall have all features of `LIGHT` configuration, with the addition of below listed features.
32+
33+
Additional options added for `HEAVY` configuration:
34+
35+
+ `CANVAS`
36+
+ `TABLE`
37+
+ `ANIMIMG`
38+
+ `CALENDAR`
39+
+ `CHART`
40+
+ `IMGBTN`
41+
+ `LIST`
42+
+ `MENU`
43+
+ `METER`
44+
+ `MSGBOX`
45+
+ `SPAN`
46+
+ `TABVIEW`
47+
+ `TILEVIEW`
48+
+ `WIN`
49+
+ `FLEX`
50+
+ `GRID`
51+
52+
> Note that this feature is chosen by NECTO based on MCU memory (RAM/FLASH).
53+
>> i.e. if MCU has at least **96K RAM** and **512K FLASH**, heavy configuration will be built.
54+
55+
### Fixes
56+
57+
#### mikroSDK
58+
59+
+ Fixed a stray space character before closing a comment
60+
+ This caused build issues for FS if `FF_USE_LFN` was defined
61+
62+
### NEW HARDWARE
63+
64+
> NOTE:
65+
>> If any new hardware was added to current version, it will be listed here.
66+
67+
Support added for following hardware:
68+
69+
---
70+
71+
**[BACK TO MAIN FILE](../../changelog.md)**
72+
73+
---

cmake/utils.cmake

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,3 +544,62 @@ macro(find_include_package package_list has_module_list package_name)
544544
list(APPEND ${has_module_list} ${module})
545545
endif()
546546
endmacro()
547+
548+
#############################################################################
549+
## Check if device has enough memory. Check either FLASH, RAM or both.
550+
## Usage:
551+
## has_enough_memory(ENOUGH_MEMORY RAM 98304 FLASH 524288)
552+
## if(${ENOUGH_MEMORY})
553+
## ## Do something if YES
554+
## else()
555+
## ## Do something if NO
556+
## endif()
557+
#############################################################################
558+
function(has_enough_memory check_value)
559+
# Initialize the result to false (OFF)
560+
set(${check_value} OFF PARENT_SCOPE)
561+
562+
# Parse optional arguments
563+
set(options)
564+
set(oneValueArgs FLASH RAM)
565+
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "" ${ARGN})
566+
567+
message(INFO ": MINIMUM FLASH is ${ARG_FLASH} Bytes")
568+
message(INFO ": MINIMUM RAM is ${ARG_RAM} Bytes")
569+
570+
# Validate that at least one of FLASH or RAM is provided
571+
if(NOT DEFINED ARG_FLASH AND NOT DEFINED ARG_RAM)
572+
message(FATAL_ERROR "At least one of 'FLASH' or 'RAM' must be specified.")
573+
endif()
574+
575+
# Check FLASH memory, if required
576+
if(DEFINED ARG_FLASH)
577+
if(NOT DEFINED MCU_FLASH)
578+
message(FATAL_ERROR "MCU_FLASH not defined for ${MCU_NAME}. Please ensure it is set in the database.")
579+
elseif(MCU_FLASH LESS ARG_FLASH)
580+
message(STATUS "The MCU ${MCU_NAME} does not meet the FLASH requirement (Required: ${ARG_FLASH}, Found: ${MCU_FLASH}).")
581+
return()
582+
endif()
583+
message(INFO ": CURRENT FLASH is ${MCU_FLASH} Bytes")
584+
endif()
585+
586+
# Check RAM memory, if required
587+
if(DEFINED ARG_RAM)
588+
if(NOT DEFINED MCU_RAM)
589+
message(FATAL_ERROR "MCU_RAM not defined for ${MCU_NAME}. Please ensure it is set in the database.")
590+
elseif(MCU_RAM LESS ARG_RAM)
591+
message(STATUS "The MCU ${MCU_NAME} does not meet the RAM requirement (Required: ${ARG_RAM}, Found: ${MCU_RAM}).")
592+
return()
593+
endif()
594+
message(INFO ": CURRENT RAM is ${MCU_RAM} Bytes")
595+
endif()
596+
597+
# Infer library name from current directory
598+
get_filename_component(LIBRARY_NAME ${CMAKE_CURRENT_LIST_DIR} NAME)
599+
600+
# If all checks pass, set the result to true (ON)
601+
set(${check_value} ON PARENT_SCOPE)
602+
603+
# Display success message
604+
message(STATUS "MEMORY_CHECK: ${MCU_NAME} has enough memory for '${LIBRARY_NAME}' library.")
605+
endfunction()

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
"display-name": "mikroSDK",
44
"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.",
55
"icon": "images/icon-mikroSDK.png",
6-
"manifest-version": "1.0.20"
6+
"manifest-version": "1.0.21"
77
}

middleware/filesystem/fat/FatFs/ff.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2049,7 +2049,7 @@ static void gen_numname (
20492049
#if FF_USE_LFN
20502050
/*-----------------------------------------------------------------------*/
20512051
/* FAT-LFN: Calculate checksum of an SFN entry */
2052-
/*-----------------------------------------------------------------------* /
2052+
/*-----------------------------------------------------------------------*/
20532053

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

platform/mikrosdk_version/include/mikrosdk_version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ extern "C"{
6767
* @note changes in patch version indicate smaller updates,
6868
* bug fixes and improvements
6969
*/
70-
#define mikroSDK_PATCH_VERSION 0
70+
#define mikroSDK_PATCH_VERSION 1
7171

7272
/**
7373
* @brief mikroSDK_GET_VERSION

thirdparty/lvgl/CMakeLists.txt

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,20 @@ option(LV_CONF_INCLUDE_SIMPLE "Simple include of \"lv_conf.h\" and \"lv_drv_conf
1111

1212
# Option to set LV_CONF_PATH, if set parent path LV_CONF_DIR is added to includes.
1313
option(LV_CONF_PATH "Path defined for lv_conf.h")
14+
15+
# Set path to appropriate "lv_conf.h" file.
16+
has_enough_memory(ENOUGH_MEMORY RAM 131072 FLASH 524288)
17+
if(${ENOUGH_MEMORY})
18+
# Heavy configuration only if MCU has more than:
19+
# 128KB RAM
20+
# 512KB FLASH
21+
message(INFO "LVGL: HEAVY CONFIGURATION")
22+
set(LV_CONF_PATH "${CMAKE_CURRENT_LIST_DIR}/lv_conf/heavy/lv_conf.h")
23+
else()
24+
message(INFO "LVGL: LIGHT CONFIGURATION")
25+
set(LV_CONF_PATH "${CMAKE_CURRENT_LIST_DIR}/lv_conf/light/lv_conf.h")
26+
endif()
27+
1428
get_filename_component(LV_CONF_DIR ${LV_CONF_PATH} DIRECTORY)
1529

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

2135
# If the project has a KEY for including all the header files for LVGL set to "true", add all the LVGL headers.
22-
if(${ADD_ALL_FILES} MATCHES "true")
36+
if(NOT DEFINED LVGL_ADD_ALL_FILES)
37+
set(LVGL_ADD_ALL_FILES OFF) # OFF or ON as value.
38+
endif()
39+
if(${LVGL_ADD_ALL_FILES})
2340
file(GLOB_RECURSE HEADERS ${LVGL_ROOT_DIR}/src/*.h)
41+
list(APPEND HEADERS ${LV_CONF_PATH})
2442
mikrosdk_add_library(lvgl MikroSDK.LVGL ${SOURCES} ${HEADERS})
2543
else()
26-
mikrosdk_add_library(lvgl MikroSDK.LVGL ${SOURCES})
44+
mikrosdk_add_library(lvgl MikroSDK.LVGL ${SOURCES} ${LV_CONF_PATH})
2745
endif()
2846

29-
target_compile_definitions(lvgl
30-
PUBLIC
31-
$<$<BOOL:${LV_LVGL_H_INCLUDE_SIMPLE}>:LV_LVGL_H_INCLUDE_SIMPLE>
32-
$<$<BOOL:${LV_CONF_INCLUDE_SIMPLE}>:LV_CONF_INCLUDE_SIMPLE>
47+
target_compile_definitions(lvgl
48+
PUBLIC
49+
LV_CONF_PATH=${LV_CONF_PATH}
3350
)
3451

3552
# Lbrary and headers can be installed to system using make install.

0 commit comments

Comments
 (0)