Files with the suffix X0 are a type of hexadecimal file format, and the Intel Hex file format is also a commonly used hexadecimal file format. X0 is a common file format for TI programming software and tools, while Hex files are a common file format for third-party programmers. Compilers (such as TI's integrated development environment CCS ) compile C language or assembly language programs to generate binary machine code, and then the machine code generates two hexadecimal file formats, X0 and Hex. This article first introduces these two file formats, then introduces how to generate these two file formats in the CCS compilation environment, and finally uses examples to further understand these two file formats in conjunction with the UCD3xxx series digital power controller .
1 X0 and Hex file formats
X0 and Hex files are ASCII (American Standard Code for Information Interchange) text files consisting of lines of text that conform to the corresponding file format. In computers, all data must be represented by binary numbers when stored and calculated. For example, 52 letters such as a, b, c, d (including uppercase), numbers such as 0, 1, and some commonly used symbols (such as *, #, @, etc.) must also be represented by binary numbers when stored in the computer. ASCII code is used to represent these letters, numbers and symbols. It uses a specified combination of 7 or 8 bits of binary numbers to represent 128 or 256 possible characters. X0 and Hex file formats use ASCII code to represent binary information.
The name of the X0 format is "Tektronix Extended hexadecimal file format" and the specific format is shown in Figure 1.
Figure 1 : X0 file format
X0 file uses the percent sign "%" as the record mark, indicating the beginning of a line; the record length refers to the number of characters (not bytes) in each line except the percent sign, which occupies one byte; the record type occupies one character, and there are two types: 6 - represents data, and 8 - represents the end; the checksum is the checksum of the entire line of characters (note that it is not a byte) except the checksum itself and the percent sign, which occupies one byte; the address has a total of 9 characters, the first character is 8, which means that the address occupies a total of 8 characters, and the following 8 characters (4 bytes) are the address to be loaded with data; data is program code or other information.
Take the commonly used computer "Hello, Word! (with line break)" as an example. If it is loaded to address 0x006B, then the X0 file is as follows
express:
%2A6DE80000006B48656C6C6F2C20576F726C64210A
%09819800000000
There are many types of Hex file formats. This article mainly introduces the "Intel Hexadecimal object file format", the specific format is shown in Figure 2.
Figure 2 : Hex file format
Intel Hex files use a colon ":" as a record marker, indicating the beginning of a new line; the record length occupies one byte, which refers to the number of bytes of actual data or information contained in each line; the load offset occupies two bytes, which is a relative address (the load offset plus the extended linear address is the absolute address); there are 6 record types, namely: 0 - data record, 1 - end of file record, 2 - extended segment address record, 3 - start segment address record, 4 - extended linear address record, 5 - start linear address record; the data part of each line record is variable, and can be up to 255 bytes, or it may not be, depending on the type of record. The last one is the checksum, which is the checksum excluding the colon and the checksum itself. The specific method is to accumulate each byte, and then take the last byte of the calculation result (negated plus 1) as the check byte.
Let’s take “Hello, Word! (with line break)” as an example. Load it to address 0x0000. The Hex file is as follows:
:0F00000048656C6C6F2C20576F726C64210A7E
:00000001FF
2 UCD3xxx storage structure
Figure 3 : UCD3xxx memory structure
Before introducing how to generate X0 and Hex files, you need to first understand the storage structure of the UCD3xxx series digital controller, as shown in Figure 3. UCD3xxx has three modes: reset mode, ROM mode, and Flash mode. The storage mapping corresponding to these three states is different. In reset mode, all memory is mapped to ROM; in ROM mode, the program flash is mapped from 0x10000 to 0x17FFF, the data flash is from 0x18800 to 0x18FFF, and the random access memory (RAM) is placed from 0x19000 to 0x19FFF ; in Flash mode, the data and random access locations remain unchanged, and the program flash location is remapped to 0 to 0x7FFF. The last 4 bytes of the program flash are the checksum of the entire program flash.
The UCD3xxx startup process is: enter the reset mode after power-on; enter the ROM mode after power-on, and the chip will automatically jump to 0xA000 for execution. In the address range from 0xA000 to 0xAFFF, a ROM program is solidified. In addition to some chip initialization, this program will also calculate the checksum of the program flash memory, and then compare it with the checksum saved in the last 4 bytes of the program flash memory. If they are inconsistent, the program will stop and wait for the host command. If the comparison results are consistent, the chip will enter the Flash mode, and the ROM program will execute the jump instruction to enter the program flash memory for execution.
3How to generate X0 and Hex files in CCS integrated development environment
Figure 4 : CCS compiler compilation option settings
The generation of X0 and Hex files is inseparable from the format conversion programs: Hex470.exe and FusionX0ToHex.exe. Hex470.exe is a program that comes with the assembly language toolkit. FusionX0ToHex.exe is a conversion program that comes with the TI Digital Power Designer graphical user interface (GUI). Hex470.exe and FusionX0ToHex.exe can be called using the command line. The following describes their respective command formats.
The command line format of Hex470.exe is: Hex470 [options] filename, hex470 is the command to call the conversion program, options are additional information to control the conversion process (for details, please refer to Reference 2), and filename refers to the name of the input file. Hex470 can convert files with the suffix Out generated by CCS compilation into Hex files of various formats, such as:
Hex470 –i sample.out
This command converts the generated sample.out file into an Intel Hex format file named sample.hex.
Hex470 –x sample.out
This command converts the generated sample.out file into an X0 format file with the file name sample.x0.
Since Hex470 can directly convert Out files into Hex files, why do we need to convert them into X0 first and then into Hex files? There are two reasons: Hex470 does not calculate the checksum of the program flash memory; the Hex file address generated by Hex470 is based on the program flash memory mode, and the address required by the burner is ROM mode, that is, from 0x10000 to 0x17FFF, so UCD3xxx does not support the Hex file directly generated by Hex470. It is necessary to use the FusionX0ToHex.exe conversion program to convert the X0 file into a Hex format file. The specific command format is:
FusionX0ToHex --infile x0-file
--format intel|srec|hexdump
--pflash-checksum calc|none|source
--export pflash|dflash|both|source
--outfile hex-file
- --infile mainly specifies the input X0 file.
- --format main
- Specifies which Hex format to generate, which are intel, srec (Motorola S-Record) and hexdump.
- --pflash-checksum mainly specifies the verification mode of the program flash memory. calc mode - calculates the check bit based on the X0 file and writes it to the corresponding position; none mode - the check bit defaults to 0xFFFFFFFF; source mode uses the check bit of X0 itself.
- --export specifies which part of the storage to export. pflash means exporting only the program flash memory. dflash means exporting the data flash memory. both means exporting both the program and data flash memory. Regardless of which part, if X0 does not exist in the file, fill it with 0xFF. source means exporting X0 directly.
- --outfile specifies the output Hex file name.
The following describes how to embed hex470 and FusionX0ToHex command lines in the CCS compilation environment.
In the CCS (version 3.x) compilation environment, enter the Project menu, then select Build Options, and then click the General tab, and the interface shown in Figure 4 will appear. In the Final build steps, we can enter the following two command lines:
hex470 -x -memwidth 8 .\debug\FB_48V_HS.out
FusionX0ToHex --infile FB_48V_HS.x0 --pflash-checksum calc --export both --format intel –outfile FB_48V_HS.hex
In the first command: -x option means converting .\debug\FB_48V_HS.out into X0 file, -memwidth 8 defines the system memory word width as 8 bits.
Figure 5 : Generated X0 file ( UCD3xxx )
Figure 6 : Generated Hex file ( UCD3xxx )
In the second command: the input file to be converted is FB_48V_HS.x0, the output file is FB_48V_HS.hex, the check bit of the program flash is calculated, and the program and data flash contents are output at the same time, the format is Intel hexadecimal.
4 Further understanding of X0 and Hex file formats based on UCD3xxx
To further understand the X0 and Hex formats, let’s take a look at the specific X0 and Hex files generated by the UCD3xxx hard-switch full-bridge evaluation board software, as shown in Figures 5 and 6.
The first column of Figure 5 starts with a percent sign; the following two columns (one byte) indicate the length of characters in each line except the percent sign, and the maximum number of characters in each line is 0x4E (78); then one column indicates the data type, except for the last line which is 8 (end), the others are all 6 (data); the next two columns are the checksum of the entire line; the address occupies 9 columns, starting with 8, and the following 4 bytes represent the actual address; the address is followed by data. As can be seen from the figure, the address of the program flash memory of the X0 file starts from 0, and there is no checksum of the entire program flash memory. TI burning software and tools mainly use files in the X0 format. The burning software will calculate the checksum of the program flash memory by itself, and then write to the last 4 bytes, so X0 does not need to calculate the checksum of the entire program flash memory.
The first column of Figure 6 is all colons; the following byte refers to the number of bytes of data contained in the entire row; two bytes are offset addresses; one byte refers to the record type; and then there are data of varying bytes. The last byte is the checksum for each row. The first row of Figure 6 specifies the extended address, which is 0x0001; the last row marks the end of the file. In addition, the last 4 bytes of the program flash memory (pink area) are the checksum of the entire program flash memory. If this checksum is incorrect, the program will not jump to the program flash memory for execution.
5. Summary
If you use the burning software (GUI) and tools (USB adapter) provided by TI to burn, you only need files in X0 format; if you use a third-party burner to burn on the production line, you will need files in Hex format. You can generate the required X0 or Hex files according to the introduction in this article.
6 References
1. SLUS868D - Digital Power Controllers, Texas Instruments Inc., 2012
2. SPNU118J - ARM Assembly Language Tools v4.9 User's Guide, Texas Instruments Inc., 2011
3. SRecord V1.59- Manipulate EPROM load files, 2012
4. Fusion Digital Power Designer, Texas Instruments Inc., 2012
Previous article:Analysis of the importance of digital power supply accuracy
Next article:Digital Power Conversion Solves Data Center Power Consumption Issues
Recommended ReadingLatest update time:2024-11-16 18:07
Honor will launch the Hunter gaming laptop on September 16: equipped with Intel Core i7
Honor has been teasing the launch of its Hunter gaming laptop recently. The brand has officially announced that it will launch the gaming laptop in China on September 16. It is not the only product to be unveiled at the event. The company has also confirmed that it will launch the Honor Watch GS Pro and Honor Watch ES
[Mobile phone portable]
Intel develops new AI technology to build fictional scenes from photos
Recently, Stanford University and Intel jointly developed a technology. After inputting 5,000 German street photos into their artificial intelligence system, the technology can, with the assistance of humans, allow the system to construct some simulated fictional scenes. Let's follow the mobile phone portable editor
[Mobile phone portable]
Intel plans to acquire Granulate
Granulate's autonomous optimization software helps clouds and data centers improve performance and return on investment Today, Intel announced an agreement to acquire Granulate Cloud Solutions, an Israel-based developer of real-time continuous optimization software . The acquisition of Granulate will not only help c
[Semiconductor design/manufacturing]
Intel helps build driverless tractors based on 5G and intelligent edge technologies, driving industry innovation and upgrading
A dedicated wireless network keeps tractors running smoothly at a California vineyard.
Image caption: Federated Wireless and Blue White Robotics are working with Intel to provide self-driving technology to tractors in California vineyards. One of the tractors, unveiled at the Intel Vision Summit i
[Network Communication]
Intel reflects on Vietnam's escalation of lockdown: impact on production expansion
In order to curb the new coronavirus epidemic, Ho Chi Minh City, Vietnam's largest city, has increased the intensity of its epidemic prevention measures starting today (23), prohibiting people from going out and sending troops to enforce the blockade and distribute food to residents until September 15. This has caused
[Mobile phone portable]
Intel acquires Israeli startup Moovit to make up for its shortcomings in autonomous driving
On May 6, according to Intel's official website, Intel recently announced that it has acquired Israeli urban traffic data startup Moovit for approximately US$900 million (approximately RMB 6.35 billion). After the transaction is completed, Moovit will join Mobileye's business but maintain an independent brand. Moovi
[Automotive Electronics]
Intel joins hands with Hanshow Technology and Microsoft to create smart retail AI solutions
Intel, Hanshow Technology and Microsoft team up to create smart retail AI solutions to accelerate innovation in the retail industry In the increasingly competitive retail market, digital innovation technologies represented by artificial intelligence (AI), computer vision, and the Internet of Things are becoming one o
[Internet of Things]
Genetec Launches New Automatic License Plate Recognition System Using Intel Deep Learning Vision Processing Unit
According to foreign media reports, at the IACP held in Chicago from October 26 to 29, 2019, Canada's Genetec launched the next-generation ALPR (Automatic License Plate Recognition) system. The system is powered by Intel Movidius™ Myriad™ X VPU (Visual Processing Unit), and the new Genetec AutoVu™ SharpZ3 is one of th
[Automotive Electronics]
- Popular Resources
- Popular amplifiers
- 100 Examples of Microcontroller C Language Applications (with CD-ROM, 3rd Edition) (Wang Huiliang, Wang Dongfeng, Dong Guanqiang)
- Principles and Applications of Single Chip Microcomputers 3rd Edition (Zhang Yigang)
- Microcomputer Principles and Interface Technology 3rd Edition (Zhou Mingde, Zhang Xiaoxia, Lan Fangpeng)
- Microcomputer Principles and Interface Technology Examples and Exercises (Kong Qingyun, Qin Xiaohong)
Latest Power Management Articles
- MathWorks and NXP Collaborate to Launch Model-Based Design Toolbox for Battery Management Systems
- STMicroelectronics' advanced galvanically isolated gate driver STGAP3S provides flexible protection for IGBTs and SiC MOSFETs
- New diaphragm-free solid-state lithium battery technology is launched: the distance between the positive and negative electrodes is less than 0.000001 meters
- [“Source” Observe the Autumn Series] Application and testing of the next generation of semiconductor gallium oxide device photodetectors
- 采用自主设计封装,绝缘电阻显著提高!ROHM开发出更高电压xEV系统的SiC肖特基势垒二极管
- Will GaN replace SiC? PI's disruptive 1700V InnoMux2 is here to demonstrate
- From Isolation to the Third and a Half Generation: Understanding Naxinwei's Gate Driver IC in One Article
- The appeal of 48 V technology: importance, benefits and key factors in system-level applications
- Important breakthrough in recycling of used lithium-ion batteries
MoreSelected Circuit Diagrams
MorePopular Articles
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
MoreDaily News
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
Guess you like
- Ask about the SYN480R circuit
- TI C6748 chip PRU part assembly software package sprc940.zip
- The new issue of "Analog Dialogue" is online, free download!
- Is there any domestic chip factory that makes 74 series chips?
- Vias
- Do you know about energy storage emergency power supply?
- After adding shutdown and low power consumption, stm32 will run away after working for 8-9 hours
- [Silicon Labs Development Kit Review] +6-axis inertial sensor ICM-20648
- Welcome our new moderator, Azuma Simeng~~
- Thanks to all the staff of Electronic Engineering Forum