解决内存不够问题

This commit is contained in:
zcy 2024-12-14 20:12:54 +08:00
parent 77c50e6a36
commit 6edd08aea4
5 changed files with 7717 additions and 7593 deletions

File diff suppressed because it is too large Load Diff

View File

@ -155,7 +155,6 @@ static void ta_event_cb(lv_event_t * e)
}
}
int main(void)
{
char tmp[20] = "x: ";
@ -224,40 +223,119 @@ int main(void)
lv_obj_t *src = lv_scr_act();
lv_obj_t *label1 = lv_label_create(src);
lv_obj_t *label2 = lv_label_create(src);
//lv_obj_t *label1 = lv_label_create(src);
//lv_obj_t *label2 = lv_label_create(src);
//LV_LABEL_LONG_EXPAND
lv_obj_set_pos(label1,120,20);
lv_obj_set_size(label1,100,50);
sprintf(tmp,"x:%d", ReadX());
lv_label_set_text(label1,tmp);
//lv_obj_set_pos(label1,120,20);
//lv_obj_set_size(label1,100,50);
//sprintf(tmp,"x:%d", ReadX());
//lv_label_set_text(label1,tmp);
//lv_obj_set_style_bg_color(lv_scr_act(), lv_palette_lighten(LV_PALETTE_GREY, 4), 0);
lv_obj_set_pos(label2,120,50);
lv_obj_set_size(label2,100,50);
sprintf(tmp,"y:%d", ReadY());
lv_label_set_text(label2,tmp);
//lv_obj_set_pos(label2,120,50);
//lv_obj_set_size(label2,100,50);
//sprintf(tmp,"y:%d", ReadY());
//lv_label_set_text(label2,tmp);
lv_obj_t *label = lv_label_create(lv_scr_act());
lv_obj_set_style_bg_color(lv_scr_act(), lv_color_hex(0x000000), 0); //0x000000 = ??
lv_obj_set_style_bg_color(lv_scr_act(), lv_color_hex(0xaaaaa), 0); //0x000000 = ??
lv_label_set_recolor(label, true); //??????
lv_obj_set_pos(label, 10, 10); //????
lv_obj_set_size(label, 80, 60); //?????
lv_obj_set_pos(label, 10, 40); //????
lv_obj_set_size(label, 60, 20); //?????
LV_FONT_DECLARE(lv_font_montserrat_20) //????
lv_label_set_text(label, "#00ff80 freq:#"); //????
lv_label_set_text(label, "#ff0080 freq:#"); //????
lv_obj_set_style_text_font(label, &lv_font_montserrat_20, 0);
lv_obj_t *label2 = lv_label_create(lv_scr_act());
lv_obj_set_style_bg_color(lv_scr_act(), lv_color_hex(0xaaaaa), 0); //0x000000 = ??
lv_label_set_recolor(label2, true); //??????
lv_obj_set_pos(label2, 10, 10); //????
lv_obj_set_size(label2, 30, 20); //?????
LV_FONT_DECLARE(lv_font_montserrat_20) //????
lv_label_set_text(label2, "#000000 state:# #00ff00 off #"); //????
lv_obj_set_style_text_font(label2, &lv_font_montserrat_20, 0);
kb = lv_keyboard_create(lv_scr_act());
lv_keyboard_set_mode(kb, LV_KEYBOARD_MODE_NUMBER);
lv_obj_t * ta;
ta = lv_textarea_create(lv_scr_act());
lv_obj_add_event_cb(ta, ta_event_cb, LV_EVENT_ALL, kb);
lv_obj_set_pos(ta, 90, 10); //????
lv_textarea_set_placeholder_text(ta, "10000000");
lv_obj_set_size(ta, 200, 60);
lv_obj_set_pos(ta, 70, 40); //????
lv_obj_set_size(ta, 110, 60);
lv_textarea_add_text(ta, "100000");
static lv_style_t style;
label = lv_label_create(lv_scr_act());
lv_obj_set_style_bg_color(lv_scr_act(), lv_color_hex(0xaaaaa), 0); //0x000000 = ??
lv_label_set_recolor(label, true); //??????
lv_obj_set_pos(label, 180, 40); //????
lv_obj_set_size(label, 40, 20); //?????
LV_FONT_DECLARE(lv_font_montserrat_20) //????
lv_label_set_text(label, "#ff0080 khz#"); //????
lv_obj_set_style_text_font(label, &lv_font_montserrat_20, 0);
lv_obj_t *btn1 = lv_btn_create(lv_scr_act());
lv_obj_set_pos(btn1, 240, 40); //????
lv_obj_set_size(btn1, 60, 20);
lv_style_init(&style);
lv_obj_t* label1 = lv_label_create(btn1); /* ???????? */
lv_obj_set_style_text_font(label1, &lv_font_montserrat_20, LV_PART_MAIN); /* ???? */
lv_label_set_text(label1, "on"); /* ?????? */
lv_obj_set_align(label1,LV_ALIGN_CENTER); /* ?????? */
lv_style_init(&style);
lv_style_set_radius(&style, 3);
lv_style_set_bg_opa(&style, LV_OPA_100);
lv_style_set_bg_color(&style, lv_palette_main(LV_PALETTE_BLUE));
lv_style_set_bg_grad_color(&style, lv_palette_darken(LV_PALETTE_BLUE, 2));
lv_style_set_bg_grad_dir(&style, LV_GRAD_DIR_VER);
lv_style_set_border_opa(&style, LV_OPA_40);
lv_style_set_border_width(&style, 2);
lv_style_set_border_color(&style, lv_palette_main(LV_PALETTE_GREY));
lv_style_set_shadow_width(&style, 8);
lv_style_set_shadow_color(&style, lv_palette_main(LV_PALETTE_GREY));
lv_style_set_shadow_ofs_y(&style, 8);
lv_style_set_outline_opa(&style, LV_OPA_COVER);
lv_style_set_outline_color(&style, lv_palette_main(LV_PALETTE_BLUE));
lv_style_set_text_color(&style, lv_color_white());
lv_style_set_pad_all(&style, 10);
/*Init the pressed style*/
static lv_style_t style_pr;
lv_style_init(&style_pr);
/*Add a large outline when pressed*/
lv_style_set_outline_width(&style_pr, 30);
lv_style_set_outline_opa(&style_pr, LV_OPA_TRANSP);
lv_style_set_translate_y(&style_pr, 5);
lv_style_set_shadow_ofs_y(&style_pr, 3);
lv_style_set_bg_color(&style_pr, lv_palette_darken(LV_PALETTE_BLUE, 2));
lv_style_set_bg_grad_color(&style_pr, lv_palette_darken(LV_PALETTE_BLUE, 4));
/*Add a transition to the outline*/
static lv_style_transition_dsc_t trans;
static lv_style_prop_t props[] = {LV_STYLE_OUTLINE_WIDTH, LV_STYLE_OUTLINE_OPA, 0};
lv_style_set_transition(&style_pr, &trans);
lv_obj_add_style(btn1, &style, 0);
lv_obj_add_style(btn1, &style_pr, LV_STATE_PRESSED);
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)

View File

@ -47,22 +47,22 @@ ARM Macro Assembler Page 1
30 00000000 ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
31 00000000 ; </h>
32 00000000
33 00000000 00000400
33 00000000 00000500
Stack_Size
EQU 0x400
EQU 0x500
34 00000000
35 00000000 AREA STACK, NOINIT, READWRITE, ALIGN
=3
36 00000000 Stack_Mem
SPACE Stack_Size
37 00000400 __initial_sp
38 00000400
39 00000400
40 00000400 ; <h> Heap Configuration
41 00000400 ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
42 00000400 ; </h>
43 00000400
44 00000400 00000900
37 00000500 __initial_sp
38 00000500
39 00000500
40 00000500 ; <h> Heap Configuration
41 00000500 ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
42 00000500 ; </h>
43 00000500
44 00000500 00000400
@ -70,21 +70,21 @@ ARM Macro Assembler Page 2
Heap_Size
EQU 0x900
45 00000400
46 00000400 AREA HEAP, NOINIT, READWRITE, ALIGN=
EQU 0x400
45 00000500
46 00000500 AREA HEAP, NOINIT, READWRITE, ALIGN=
3
47 00000000 __heap_base
48 00000000 Heap_Mem
SPACE Heap_Size
49 00000900 __heap_limit
50 00000900
51 00000900 PRESERVE8
52 00000900 THUMB
53 00000900
54 00000900
55 00000900 ; Vector Table Mapped to Address 0 at Reset
56 00000900 AREA RESET, DATA, READONLY
49 00000400 __heap_limit
50 00000400
51 00000400 PRESERVE8
52 00000400 THUMB
53 00000400
54 00000400
55 00000400 ; Vector Table Mapped to Address 0 at Reset
56 00000400 AREA RESET, DATA, READONLY
57 00000000 EXPORT __Vectors
58 00000000 EXPORT __Vectors_End
59 00000000 EXPORT __Vectors_Size
@ -383,8 +383,8 @@ ARM Macro Assembler Page 6
00000000
00000000
00000000
00000500
00000400
00000900
00000000
Command Line: --debug --xref --diag_suppress=9931 --cpu=Cortex-M0 --apcs=interw
ork --depend=lvgl\startup_stm32f072xb.d -olvgl\startup_stm32f072xb.o -ID:\a\lvg
@ -421,7 +421,7 @@ Symbol: Stack_Mem
At line 245 in file startup_stm32f072xb.s
At line 247 in file startup_stm32f072xb.s
__initial_sp 00000400
__initial_sp 00000500
Symbol: __initial_sp
Definitions
@ -461,7 +461,7 @@ Symbol: __heap_base
Uses
None
Comment: __heap_base unused
__heap_limit 00000900
__heap_limit 00000400
Symbol: __heap_limit
Definitions
@ -918,7 +918,7 @@ Comment: __user_initial_stackheap used once
ARM Macro Assembler Page 1 Alphabetic symbol ordering
Absolute symbols
Heap_Size 00000900
Heap_Size 00000400
Symbol: Heap_Size
Definitions
@ -927,7 +927,7 @@ Symbol: Heap_Size
At line 48 in file startup_stm32f072xb.s
At line 246 in file startup_stm32f072xb.s
Stack_Size 00000400
Stack_Size 00000500
Symbol: Stack_Size
Definitions

View File

@ -30,7 +30,7 @@
; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
; </h>
Stack_Size EQU 0x400
Stack_Size EQU 0x500
AREA STACK, NOINIT, READWRITE, ALIGN=3
Stack_Mem SPACE Stack_Size
@ -41,7 +41,7 @@ __initial_sp
; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
; </h>
Heap_Size EQU 0x900
Heap_Size EQU 0x400
AREA HEAP, NOINIT, READWRITE, ALIGN=3
__heap_base

View File

@ -48,7 +48,7 @@
#define LV_MEM_CUSTOM 0
#if LV_MEM_CUSTOM == 0
/*Size of the memory available for `lv_mem_alloc()` in bytes (>= 2kB)*/
#define LV_MEM_SIZE (4 * 1024U) /*[bytes]*/
#define LV_MEM_SIZE (6 * 1024U) /*[bytes]*/
/*Set an address for the memory pool instead of allocating it as a normal array. Can be in external SRAM too.*/
#define LV_MEM_ADR 0 /*0: unused*/
@ -67,7 +67,7 @@
/*Number of the intermediate memory buffer used during rendering and other internal processing mechanisms.
*You will see an error log message if there wasn't enough buffers. */
#define LV_MEM_BUF_MAX_NUM 128
#define LV_MEM_BUF_MAX_NUM 64
/*Use the standard `memcpy` and `memset` instead of LVGL's own functions. (Might or might not be faster).*/
#define LV_MEMCPY_MEMSET_STD 0
@ -565,7 +565,7 @@
#define LV_USE_TILEVIEW 1
#define LV_USE_WIN 0
#define LV_USE_WIN 1
/*-----------
* Themes
@ -586,10 +586,10 @@
#endif /*LV_USE_THEME_DEFAULT*/
/*A very simple theme that is a good starting point for a custom theme*/
#define LV_USE_THEME_BASIC 0
#define LV_USE_THEME_BASIC 1
/*A theme designed for monochrome displays*/
#define LV_USE_THEME_MONO 1
#define LV_USE_THEME_MONO 0
/*-----------
* Layouts