Bin File Manipulation

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Bin File Manipulation

635 Views
frozen
Contributor III

Hello I use IMXRT1176 EVK, I have gui project so I use lvgl and freertos btw.

I have asked about how to use bin file for font, I have managed this.

I used below functions to get image and font from bin file.

 

lv_img_set_src(ui->img_external, "F:/image.bin");

lv_font_t ext_font;
lv_binfont_load(&ext_font,"F:/font.bin");

 



I used lvgl font converter to get font file in bin extension. I also used lvgl image converter to get image bin file. Then I merged these two bin files into one. In lv_conf.h file I have added below lines. I got some errors about lack of files and fixed them.

 

/*API for RAWFS (needs to be added separately).*/
#define LV_USE_FS_RAWFS 1
#if LV_USE_FS_RAWFS
/*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
#define LV_FS_RAWFS_LETTER 'F'
/*use the XIP flash*/
#define LV_FS_RAWFS_XIP 1
#if LV_FS_RAWFS_XIP
/*the XIP flash address where the image binary is placed*/
#define LV_FS_RAWFS_XIP_BASE_ADDR 0x30C00000
#endif    /* LV_FS_RAWFS_XIP */
#endif    /* LV_USE_FS_RAWFS */

 


I have also added below codes to my project in a source file as a memory map.

 

#include "lvgl.h"

#if LV_USE_FS_RAWFS
const rawfs_size_t rawfs_file_count = 2;
rawfs_file_t rawfs_files[2] = {
	    0x0, 0, 200000, "/image.bin",//0x30C00000
	0x20000, 0, 60000, "/font.bin",//0x30C20000
};
#endif  /*LV_USE_FS_RAWFS*/

 



After I write this code to flash and writing bin file to related address in flash, I can see font and image embedded in bin file.

Here I want to do something more. When I changed pictures or font in bin file, I don't want to have to change the application code. Changing bin file and writing it into flash's specific address should be enough for me to update pictures and font. But it is not okay now. Because when I change the pictures or font in bin file, I have to change the memory map in application code too. I have edit their start addresses or sizes or maybe names.

Is it possible to embed this memory map into bin file ?

0 Kudos
Reply
2 Replies

432 Views
frozen
Contributor III

Hello @filo96 ,

Yes we solved the issue. We have changed LVGL version to v9.1.0 . v9 is also applicable. If you use v8.x.x you have to manipulate bin font loader source file ..

There is font create function in v9, we have used it as below.

lv_font_t *font_14 = lv_binfont_create("F:/FONT_14.bin");

 

then we called it like that:

lv_obj_set_style_text_font(ui->my_elemet, font_14, LV_PART_MAIN | LV_STATE_DEFAULT);

0 Kudos
Reply

449 Views
filo96
Contributor III

Hello @frozen 

 

We're facing the same issue. Did you solve this?

If yes, how did you reach the goal?

0 Kudos
Reply