Some of JTAG's instructions [transferred from bbs.e dw.com.cn] I use this section to use JTAG's experience, I hope to help beginners. In the forum, the master is proficient in JTAG, please don't throw bricks to me, you have to throw jade, let everyone benefit. Usually, JTAG is generally divided into two categories, a class of electrical characteristics for testing the chip, detecting the chip is problematic; a class for Debug; generally supporting the JTAG CPU contains these two modules. A CPU containing the JTAG Debug interface module, as long as the clock is normal, you can access the CPU's internal register and the device on the CPU bus, such as Flash, RAM, 44BOX, AT91M Series) built-in module. Registers, registers such as UART, TIMERS, GPIO, etc. The above is just the capabilities of the JTAG interface. To use these features, it is necessary to cooperate with software, and the specific implementation is determined by the specific software. For example, download the program to the RAM function. Understanding the SOC knows that you want to use the external RAM, you need to refer to the SOC Datasheet register description, set the RAM base address, bus width, access speed, etc. Some Soc also need REMAP to work properly. When running Firmware, these settings are done by the Firmware's initializer. However, if you use a JTAG interface, the relevant registers may still be on the power-on value, even when the error value, the RAM does not work properly, so the download must fail. To use it normally, first try the way to set up RAM. In the ADW, you can set it through the let command at the Console window, and you can set the set command at the Console window in AXD.
Below is a command sequence that sets the AT91M40800, turn off the interrupt, sets CS0-CS3, and performs REMAP, for AXD (ADS band debug) setmem 0xfffff124 ,0xffffff, 32 --- Close all interrupt setmem 0xffe00000, 0x0100253d, 32 - - Sets CS0SetMem 0xffe00004, 0x02002021, 32 --- Set cs1setmem 0xffe00008, 0x0300253d, 32 --- Sets CS2 setmem 0xffe0000c, 0x0400253d, 32 - Set CS3setMem 0xffe00020, 1,32 --- Remap If you want to be in ADW (SDT band Used in Debug, then change to: let 0xffff124 = 0xfffffffff --- Close all interrupt let 0xffe00000 = 0x0100253D --- Set CS0LET 0xffe00004 = 0x02002021 --- Set CS1LET 0xffE00008 = 0x0300253D --- Set CS2 Let 0xffE0000c = 0x0400253d --- Sets CS3LET 0xffe00020 = 1 - Remap For convenience, you can save the above command as a file config.ini, and enter OB Config.ini in the Console window. Use other debugs, substantially similar, just the format of commands and commands. When RAM is set, the set register and the value of the register must be consistent with the settings to run the program. Generally compiled target files are ELF formats, or similar formats, containing a target code run address, and running an address is determined at the LINK. DEBUG Download the program to the specified address according to the address information of the ELF file when downloading the program. If the base address of the RAM is set to 0x10000000, the target code will be downloaded to the 0x02000000 when compiling when compiling, the target code will be downloaded to 0x02000000, apparent download failed. All interruptions should be turned off before the JTAG download process, which is the same reason as the interrupt is turned off and the Firmware initialize. When using the JTAG interface, all interrupts are unknown, especially if there is an executable code in Flash, there may be some interrupts to be enabled. Using JTAG download code, it is possible to execute, it may generate an interrupt because unfinished initialization, resulting in an exception. Therefore, it is necessary to turn off the interrupt first, generally completed by setting the SOC's interrupt control register. Write Flash using JTAG. In theory, through JTAG can access all devices on the CPU bus, it should be able to write flash, but flash write mode and RAM are very different, require special commands, and different flash erasure, the programming command is different, and block The size is different, it is difficult to provide this feature. So general Debug does not provide a Flash function, or only a few of several Flash.