当前位置:网站首页>What are the ways to simulate and burn programs? (including common tools and usage)

What are the ways to simulate and burn programs? (including common tools and usage)

2022-06-25 11:13:00 iron2222

Write it at the front :

Stay at school these days , Working on a motor driven project , It uses the platform of Hefei jiefa , Car specification level chip AC7801/11 Series of chips .
However, there are various problems in the process of simulation and program burning , Take advantage of this opportunity , In private, it summarizes several common ways of common simulation and burning programs , And related operations , Hopefully that helped .

 Insert picture description here

Single chip microcomputer ISP、IAP and ICP The difference between several burning methods

1.ICP(In Circuit Programing)

The software of the hardware manufacturer and the emulator can be used to burn the program , At present, there are JTAG and SWD Interface . and ICP Programming is to SWD Interface .

perform ICP function , Only three pins are required :RESET、ICPDA、 and ICPCK.RESET Used to enter or exit ICP Pattern ,ICPDA Input and output pins for data ,ICPCK Input pin for programming clock . Users need to reserve on the system board VDD、GND And these three pins .

General workflow :PC Software running on (ICP Programming tools ) adopt SWD Interface update chip internal APROM、LDROM、 Data flash (DataFlash) And the target user configuration word (Config)

2.ISP(In System Programing)

And ICP The difference is , The target chip passes USB/UART/SPI/I²C/RS-485/CAN And other peripheral interfaces LDROM Boot code to update the internal of the chip APROM、 Data flash (DataFlash) And user configuration word (Config).

3.IAP(In applicating Programing)

IAP It is a method to realize online electric erasure and programming through software .IAP Technology is structurally Flash Memory is mapped into two banks , When running a user program on a bank , You can reprogram another memory , Then move the program from one memory to another .

What is? ISP:

Use a writer to write code Burn in , however , The chip can be on the target board , No need to take it out , When designing the target board, the interface is designed on it , So called " In system programming ", I don't have to leave the system ;

What is? IAP:

In application programming , There's the chip itself ( Or through peripheral chips ) You can use a series of operations to code write in , Like a support Iap The single chip computer of , Internal division 3 A program area ,1 It's the bootstrap area ,2 Run program area ,3 It's a download area , The chip receives the download command through the serial port , Enter the boot area and run the boot program , Under the bootloader, you will new code Download the content to the download area , After downloading and checking, copy the contents of the download area to 2 District , Run the reset program , be Iap complete ;

applications :

  • ISP Program upgrade needs to be solved on site , But it's better not to dismantle the machine ;

  • IAP If there is a network management system , Download everything with the NMS , People don't have to run around

similarities and differences

  • ISP In general, it is through the special serial programming interface of the single-chip microcomputer to control the internal control of the single-chip microcomputer Flash Memory programming ;
    and IAP Technology is structurally Flash Memory is mapped into two banks , When running a user program on a bank , You can reprogram another memory , And then move control from one storage to another .

  • ISP In general, the implementation of this method needs few external circuits ;
    and IAP The implementation of is more flexible , Usually, the serial port of single chip microcomputer can be used to connect to the computer RS232 mouth , The internal memory is programmed by a specially designed firmware program .

  • ISP and IAP Very similar , There is no need to pull the chip out of the board , That's it PC-MCU Programming interface (JTAG、 A serial port 、 Twisted pair 、SPI etc. ) Fix the purpose of upgrading the new version .

MCU Internally, an independent section is executed first Boot Code ( This paragraph Boot Codes are generally factory preset , Or burning with a programmer , Usually only 1k or 4k,SST It usually takes up a separate piece of Block,Philips Usually let BootROM Address and other Flash overlap , To achieve the hidden effect ),Boot Responsible for controlling the code for erasing program memory and programming program memory ( Or execution code provided outside the processor ), Then through some kind of communication with PC The way computers communicate ( Such as ,ether so ), Put a user specified in PC Compiled on MCU A runnable binary code file is programmed into MCU Program memory in .

ISP and IAP The actual use of

ISP The implementation of is relatively simple , The general practice is that the internal memory can be rewritten by the software of the host computer through the serial port . For MCU, it can be realized through SPI Or other serial interface to receive the data from the upper computer and write it into the memory . So even if we solder the chip to the circuit board , As long as the serial port with the upper computer interface is reserved , Then the internal memory of the chip can be rewritten , Without removing the chip .

IAP The implementation of is relatively more complex , In the realization of IAP When the function , There must be two memory areas inside the MCU , Generally, a piece is called BOOT District , The other one is called the storage area . Single chip microcomputer power on running in BOOT District , If the conditions of external rewriting program are met , The program in the storage area is rewritten . If the external rewriting conditions are not met , The program pointer jumps to the memory , Start executing the program in the store , In this way IAP function .

in short :
ISP=> modify MCU Internal data needs external intervention ;
IAP=> modify MCU Internal data can be used without external intervention .
The two can be said to be an implementation mechanism of data update .
Generally, you have ISP After function , No programmers , It's programming with a download line . But it's not that they must not support programmers , Specific model specific analysis . Whether the simulator is needed for simulation and whether it has ISP and IAP There is no necessary connection .
Just have IAP function , Can be in MCU Write the monitor program inside , Simulate an emulator , Of course , This monitor is resource intensive , There are some differences between the simulator and the one using hardware .

Respective burning tools

1.ICP Use SWD Interface for burning program .

The commonly used burning tool is J-Link、ST-Link、Nu-Link. The matching burning software is J-Flash、NuMicro_ICP_Programming_Tool、st-link utility.

2.ISP Is to use the bootstrap program through USB/UART And other interfaces ,

The first is to have bootloader. The most common way to burn is to learn 8051 SCM when used STC-ISP Burning tool .

3.IAP It is a method to realize online electric erasure and programming through software , No tools were used , Only through the software method to update Flash Data in .

Summary :

1.ICP: Use SWD Interface for burning , Such as J-Link Burners and J-Flash Software used with .

2.ISP: Use the bootstrap (bootloader) Plus periphery UART/USB Wait for the interface to burn .

3.IAP: The software itself realizes the method of online electric erasure and programming , Don't use any tools . The program is usually divided into two parts , Bootloader and application respectively .

Burning tools

J-Link yes SEGGER The company supports simulation ARM The core chip has launched JTAG Emulator . coordination IAR EWAR,ADS,KEIL,WINARM,RealView Integrated development environment, etc ARM7/ARM9/ARM11,Cortex M0/M1/M3/M4, CortexA5/A8/A9 And the simulation of the core chip , And IAR,Keil And so on , It is easy to operate 、 Easy to connect 、 Easy to learn , It's learning to develop ARM The best and most practical development tool .

image

Simply speaking : J-Link It's a JTAG Protocol conversion box , It passes through USB transmission , Convert to... Inside the simulator JTAG agreement , Realized a conversion from software to hardware . Users only need one USB Interface , Can be realized JTAG download , In the past JTAG Agreements are all made with 20pin The adaptor for ( Upper figure ), But with the development of the times , Many computers are no longer equipped with parallel ports , Instead, more and more USB Interface , This was born J-Link Emulator , Just one USB Interface , The user can burn and debug the chip , It greatly facilitates the work and simplifies the computer interface .

Of course, to support simulation ARM Kernel emulator J-Link More than supporting JTAG Also supports SWD download

SWD Download mode :

image

IAR And MDK Configure two download methods

IAR

Open the project file , In the project file - Right click -Options

image

find J-Link/J-Trace - Connection - Select download mode

image

MDK:

First, make sure the download method is correct then Settings.
image

Then you can modify the download method and download speed , Note that below is USB Pattern

image

ST-Link yes ST Italian semiconductor for evaluation 、 Development STM8/STM32 series MCU And the design of online simulation and download as one of the development tools , Support JTAG/SWD/SWIM Three models .

  • Support all belts SWIM Interface STM8 Series MCU
  • Support all belts JTAG/SWD Interface STM32 Series MCU

image

ULINK It has been discontinued , What's on sale is ULINK2 and ULINKpro edition ,ULINK2 yes ARM/KEIL company (2005 year ARM Acquired KEIL) The latest matching RealView MDK The emulator used ,ULINK2 Simulators are also known as Keil ULINK2、ARM ULINK2 Emulator .

image

ULINK2 The emulator supports :

  • On chip debugging ( Use on-chip JTAG/SWD/SWV)
  • FLASH Memory programming ( User configurable FLASH Programming algorithms )
  • Here are the versions ULINK The difference between simulators , See supported chip cores , Software development tools, etc ;

image

JTAG

JTAG(Joint Test Action Group, Joint test action team ) It's an international standard test protocol (IEEE 1149.1 compatible ), It is mainly used for chip internal test , Most devices now support JTAG agreement ,ARM、DSP、FPGA etc. ,JTAG The interface of single chip microcomputer with computer USB Download the debugger , Need to use J-Link(USB turn JTAG).

The standard JTAG It's the fourth line :TDI,TMS,TCK,TDO, Corresponding to data input respectively , Mode selection , The clock , Data output , The reset pin is not connected .

image

image

SWD

SWD The full name is Serial Wire Debug( Serial debugging ),SWD In mode, use JLink The board for us debug when , It's a standard second line DIO and CLK,RESET The pin is not connected to , When you frequently fail to download , Can be connected to RESET Pin try again .

In high speed mode ,SWD Than JTAG More reliable , The common wiring signals are as follows , Choose according to the specific situation .

image

Be careful : SWD In mode ,SWDIO The pull-up resistor can be reserved , stay ST Some of MCU Reference design , It is suggested to add , The actual test does not affect the download .

image

SWIM

SWIM Interfaces are common in ST Of STM8 Series MCU ,ST-Link2 And STM8 The connection just needs to be 4 Root line , See table .

image

image

USB turn TTL

Serial port sends data (USART) yes STM32 Functions often used in debugging , But computers USB Level standard and serial port TTL Different standards , So we need one USB turn TTL Line to complete the communication between them .

image

Big knot

  • JLink It's universal ARM Core chip emulator , Support chip and software development environment more , optimization ;
  • ST-Link Is aimed at STM8/STM32, If you use STM8/STM32 Single chip microcomputer , The preferred ST-Link, Of course with JLink download ST Series of microcontrollers can also ;
  • ULink Focus on Keil platform , Support ARM7/9,Cortex-M0~M4,ULink2 And support 8051 Series of chips , Comprehensive performance ( Support chip types 、 Software development environment and debugging speed ) Not as good as JLink;
    All three support JTAG and SWD Pattern ;

JTAG、SWD、SWIM The difference between the three download modes :

  • JTAG There's a lot of wiring , The stability in high-speed mode is not as good as SWD;
  • SWD Less wiring , You can spare the extra GPIO, The required wiring signal varies with the simulator ( Mainly in the VCC and RESET),DIO and CLK It's a must ;
  • SWIM Common in STM8 Single chip microcomputer , need 4 Root line ;

At the end

Time flies , This time last year, I went to Shanghai to study alone , I'm worried that I can't find a place to live , A year has passed in the blink of an eye , Have time to write a summary of this year , Dig a hole first ~
Finally, good morning , Good afternoon and good night ?

reference :
https://blog.csdn.net/error_again/article/details/108253440
http://t.csdn.cn/h2YQX
http://t.csdn.cn/xL5Tk

原网站

版权声明
本文为[iron2222]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/176/202206251048350392.html