1014 views|4 replies

22

Posts

0

Resources
The OP
 

Binary file merging tool PackagingTool [Copy link]

This post was last edited by harchy on 2023-11-10 15:13
  • Function: It can merge and package multiple binary files, such as bin files, font dot files, picture jpg, video avi, etc.
  • Features: Files can be added, sorted, deleted, and offset addresses can be inserted to meet various FLASH burning requirements;
  • Featured recommendation: You can save the list for easy secondary arrangement, saving the trouble of frequent adjustments in R&D!
  • Applicable platform: Windows platform
  • File size: 350K / single file / green version

Main interface:

Regarding the pre-offset: the offset address can be set freely, and whether to add file information is optional, as shown below:

If this option is selected, the merged file address and size information will be written to the leading offset address, each occupying 4 bytes, and the written data format is LSB->MSB, which is used to facilitate microcontroller index access.


The following example shows how to read jpg images for display by the microcontroller. We first package a series of jpg images into bin files and burn them into the FLASH chip under Ruiyou's RA8889. The microcontroller can read the address and size of the file at 8 bytes per time:

//获取图片的地址或者大小信息,共4个字节,再合并成一个数值返回
unsigned long Get_Picture_Address_Size(unsigned long flash_addr)
{
unsigned long temp;
unsigned short i;
unsigned int data_buffer[4]; //存放从FLASH读取出的数据

Enable_SFlash_SPI();

if(FLASH_BUS==0) SPIM_Select_Bus_0(); //总线BUS0
else SPIM_Select_Bus_1(); //总线BUS1

#ifdef OVER_128Mb
Select_nSS_drive_on_xnsfcs3(); //使用CS3位置的FLASH
#else
Select_nSS_drive_on_xnsfcs2(); //使用CS2位置的FLASH
#endif

RA8889_SPI_Flash_WREN(); //写入使能
nSS_Active();
delay_us(1);
SPI_Master_FIFO_Data_Put(0x03);
delay_us(1);

#ifdef OVER_128Mb //32bit 寻址
SPI_Master_FIFO_Data_Put(flash_addr>>24);
SPI_Master_FIFO_Data_Put(flash_addr>>16);
SPI_Master_FIFO_Data_Put(flash_addr>>8);
SPI_Master_FIFO_Data_Put(flash_addr);
#else //24bit 寻址
SPI_Master_FIFO_Data_Put(flash_addr>>16);
SPI_Master_FIFO_Data_Put(flash_addr>>8);
SPI_Master_FIFO_Data_Put(flash_addr);
#endif

for(i=0;i<4;i++)
{
data_buffer[i] = SPI_Master_FIFO_Data_Put(0xff);
}

temp = data_buffer[3]<<24;
temp += data_buffer[2]<<16;
temp += data_buffer[1]<<8;
temp += data_buffer[0];

nSS_Inactive();

while(RA8889_SPI_Flash_RDSR()& 0x01);
RA8889_SPI_Flash_WRDI();
Disable_SFlash_SPI();

return(temp);
}

After the microcontroller reads the jpg storage address and image size, it will be passed to RA8889 and displayed:
//从FLASH读取第n张图片出来显示
int Show_Picture(unsigned int pic_num)
{
unsigned long pic_addr, pic_size;

pic_addr = Get_Picture_Address_Size(0x0000+pic_num*8); //读取到第n个图片地址的值
pic_size = Get_Picture_Address_Size(0x0004+pic_num*8); //读取到第n个图片大小的值


SPI_NOR_initial_JPG_AVI (1,0,FLASH_BUS,FLASH_CS,1);

#ifdef OVER_128Mb
switch_24bits_to_32bits(FLASH_BUS,FLASH_CS);
IDEC_Select_SFI_32bit_Address();
#endif

JPG_NOR (pic_addr,pic_size,canvas_image_width,0,0);
return 1;
}

The special feature of this software is that it will save the compiled list in the .h file while packaging it into a bin file. You can read it back when you need it later, which is convenient for R&D and debugging! It saves frequent importing and adjusting the order of files, which can improve work efficiency!

The single-chip microcomputer needs to call for image display, and needs to call for jpg, avi and other image resources. Since the sizes of such files are different, if there is no FAT file system, it can only be made into fixed calls. It is inconvenient to change the image resources after subsequent production. By using this software, the file size and address information can be saved together while packaging the file. The single-chip microcomputer only needs to address according to the rules. For example, when using Ruiyou's RA8889, some users want to upgrade and change the image resources after mass production. This method can easily solve the problem!
Operation instructions demonstration:
Guide

Download Link:
PackagingTool1.1.0.0.zip (54.3 KB, downloads: 15)

This post is from 51mcu

Latest reply

Thank you for sharing!   Details Published on 2023-11-21 15:36
 

22

Posts

0

Resources
2
 

v1.2.0.1 2023/11/18 Update the offset address setting logic. You can set the offset address of any file to meet the need for a fixed offset function (such as 0x00001000) when merging the MCU's IAP Boot Loader Code and Application Code. Please download the latest version.

This post is from 51mcu
 
 
 

7422

Posts

2

Resources
3
 

Thank you for sharing!

This post is from 51mcu
 
Personal signature

默认摸鱼,再摸鱼。2022、9、28

 
 

22

Posts

0

Resources
4
 

v1.3.0.2 2023/12/5 Adjust the output .h format, and build the enumeration function while exporting. The MCU can directly reference the header file for indexing. This file is consistent with the .h format exported by Image Tool and is compatible. In addition, the width and height information of the picture are added, which can be used with Ruiyou's RA8889.

Import method: Import archive >> Open file selection box >> Select the saved .h file.

Please update to the latest version.

This post is from 51mcu
 
 
 

22

Posts

0

Resources
5
 
This post was last edited by harchy on 2024-7-15 21:04

Ver 2.0.1.0 (This version only supports x64)

(1) Added support for multiple output data formats, perfect match with the entire RA8875/RA8876/RA8889 series;
(2) Added support for selecting FLASH type: bin files can be packaged into NOR or NAND data formats;
(3) Added a thumbnail display window for instant viewing of added image files;
(4) Added a new tool: [ Convert video to AVI file ], which can convert video to AVI (Motion JPEG) format to meet the needs of RA8889;
(5) Added a new tool: [ Convert image to JPG file ], which can convert images to JPG (Baseline) format to meet the needs of RA8889;
(6) Added a new tool: [ Convert bitmap font to image ], which can convert bitmap fonts into BMP or JPG images to facilitate UI design;
(7) Improved functions: The file information is inserted into the bin file header function, and the format is re-planned. The original version only allocated 8 bytes/file, and the new version allocates 16 bytes/file. The image width and height, and file type are added. The stand-alone machine can index and call files, videos, fonts, etc. according to the file header;
(8) The write address (Address) of any file can be set to meet the user's needs for partial update of FLASH, merging Bootloader and App, etc.

Upgrade method: Enter Menu>Help>Latest version

This post is from 51mcu
 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Featured Posts
X-NUCLEO-IKS01A3 Review——by dcexpert

Received the X-NUCLEO-IKS01A3 sensor kit More images of the sensor suite Connecting X-NUCLEO-IKS01A3 using MicroP ...

After upgrading and maintenance, we are working hard for three years

This post was last edited by philips_lu on 2020-3-24 22:19 Recently a friend gave me an old Dell computer, but he was i ...

Basic circuit diagram of op amp and op amp debugging

I believe that people who do hardware design should all know that operational amplifiers, the role of operational ampli ...

[Flower carving hands-on] Interesting and fun music visualization series of small projects (06) --- dot matrix spectrum lamp

I suddenly had the urge to do a series of topics on sound visualization. This topic is a bit difficult and covers a wide ...

[RVB2601 Creative Application Development] Short recording, playback and printing of recording data

This post was last edited by onoff on 2022-6-4 18:01 Refer to the examples on the official website, the SDK examples, ...

View circuit - load switch

In many circuits, one power supply may correspond to multiple loads. Sometimes the power supply of the load needs to be ...

On the issue of common ground interference

The following figure is: a high-voltage pulse discharge system. The green part and the yellow part (external control) ar ...

08. Domestic FPGA Zhengdian Atom DFPGL22G development board evaluation [Learning] DDR read and write experiment

This post was last edited by 1nnocent on 2023-2-18 10:55 1. Introduction DDR3 SDRAM (Double-Data-Rate Three Synchronous ...

Half adder to implement full adder

Hey guys, when designing a full adder using Quartus, isn't it usually implemented using two half adders and an OR gate? ...

Reading check-in station 3: Chapters 9-14 - "RT-Thread Device Driver Development Guide"

Reading partners @南若 @chrisrh @wakojosin @xiaolinen @damiaa Check-in for the third station, here comes the topi ...

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list