| Next revision | Previous revision Next revisionBoth sides next revision |
| toh:tp-link:tl-mr3420:debrick.using.jtag [2018/05/31 18:17] – created from ru source benryanau | toh:tp-link:tl-mr3420:debrick.using.jtag [2018/06/02 01:38] – link fixed tmomas |
|---|
| FIXME **This page is not fully translated, yet. Please help completing the translation.**\\ //(remove this paragraph once the translation is finished)// | ====== Example of repairing the router via JTAG (ar724x) ====== |
| |
| ===== Пример восстановления роутера через JTAG (ar724x) ===== | ** Note: ** The list of routers on which the main configuration file for OpenOCD should work, in fact, can be much larger (almost all AR724x processors). However, for each platform ((Device with a specific architecture used by NOR / NAND / DDR memory, number of indicators, buttons, their attachment to GPIO numbers, etc. For example, here the platform is considered - AP99)), an appropriate loader, modified so that it can be downloaded from SDRAM memory - without loss of functionality. |
| |
| **Примечание:** Список роутеров на которых должен работать основной конфигурационный файл для OpenOCD, на самом деле, может быть намного больше (практически все процессоры AR724x). Однако для каждой платформы((Устройство с конкретной архитектурой, используемой NOR/NAND/DDR памятью, кол-вом индикаторов, кнопок, привязанность их к номерам GPIO, прочее. Например, здесь рассматривается платформа – AP99)) необходим соответствующий, собственный загрузчик, измененный таким образом, чтобы можно было его загружать из SDRAM памяти - без потери функциональности. | ===== Hardware ===== |
| |
| ==== Аппаратная часть ==== | ==== JTAG on the processor ==== |
| | -> [[docs: techref: hardware: port.jtag]] |
| | The pinout of the [[http://www.linux-mips.org/wiki/JTAG|EJTAG v3.1]] interface on the AR724x looks like this: |
| | ^ JTAG Common Name ^ AR724x Pin ^ Connector EJTAG for DIR-615 Ex ^ |
| | | <del> EJTAG_SEL </del> //(do not use) // | 79 | {{: media: dlink: dir-615: e4-photos: d-link.dir-615e4-jtag.jpg? 400}} | |
| | | ** TDI ** | 81 | ::: | |
| | | ** TDO ** | 82 | ::: | |
| | | ** TMS ** | 84 | ::: | |
| | | ** TCK ** | 85 | ::: | |
| | | <del> RST </del> //(do not use)// | 93 | ::: | |
| |
| === JTAG на процессоре === | If there is no marking of the reference of the processor feet on the board, then one can use this orientation: \\ |
| -> [[docs:techref:hardware:port.jtag]] | {{http://oi42.tinypic.com/atkwfc.jpg?300px|Raspinovka common on all AR724x processors}} |
| Распиновка [[http://www.linux-mips.org/wiki/JTAG|EJTAG v3.1]] интерфейса на AR724x, выглядит следующим образом: | |
| ^ JTAG Common Name ^ AR724x Pin ^ Разъем EJTAG на DIR-615 Ex ^ | |
| | <del>EJTAG_SEL</del> //(не используем)// | 79 | {{:media:dlink:dir-615:e4-photos:d-link.dir-615e4-jtag.jpg?400}} | | |
| | **TDI** | 81 | ::: | | |
| | **TDO** | 82 | ::: | | |
| | **TMS** | 84 | ::: | | |
| | **TCK** | 85 | ::: | | |
| | <del>RST</del> //(не используем)// | 93 | ::: | | |
| | |
| Если отсутствует маркировка отсчета ножек процессора на плате, то можно воспользоваться такой ориентировкой:\\ | |
| {{http://oi42.tinypic.com/atkwfc.jpg?300px|Распиновка общая на всех процессорах AR724x}} | |
| |
| \\ | \\ |
| |
| ===Подключение к JTAG=== | ==== Connecting to JTAG ==== |
| |
| **Примечание:** Отладка и тестирование (для написания этой инструкции) производилось с исправным загрузчиком, поэтому необходимо было на время отключить флеш-память устройства (**CS0**=>3.3V), чтобы процесс инициализации и загрузки устройства прервался(в загрузчике может быть инструкция отключения JTAG порта для освобождения GPIO линии). | ** Note: ** Debugging and testing (for writing this instruction) was performed with a working loader, so it was necessary to temporarily disable the flash memory of the device (** CS0 ** => 3.3V), so that the device initialization and boot process was interrupted in the bootloader, there may be an instruction to disable the JTAG port to release the GPIO line). |
| |
| **EJTAG_SEL** пин - AR724**0**/ AR724**1**/AR724**2** учитывая то, что на многих устройствах не выведен EJTAG разъем - логическое состояние этого пина не имеет особой роли на работу JTAG протокола. Достаточно прервать загрузку устройства с флеш-памяти, описанным выше способом. А если учитывать то, что Вы читаете эту инструкцию - скорее всего, Ваше устройство и так не загружается должным образом. | ** EJTAG_SEL ** pin - AR724**0**/AR724**1**/AR724**2** Considering that EJTAG connector is not displayed on many devices - the logical state of this pin does not have a specific role for JTAG operation protocol. It's enough to interrupt the device boot from the flash memory, described in the above way. And if you consider that you are reading this manual - most likely, your device does not boot properly. |
| |
| **RST** пин - AR724**0**/ AR724**1**/AR724**2** полностью сбрасывает процессор, т.е. в том числе записанные регистры инициализации процессора, это состояние равносильно отключению питания от устройства – поэтому, этот пин мы тоже **не будем** использовать. | ** RST ** pin - AR724**0**/ AR724**1**/ AR724**2** completely resets the processor, i.e. including the recorded CPU initialization registers, this state is equivalent to disconnecting power from the device - therefore, we will not ** use this pin ** either. |
| |
| -> [[docs:techref:hardware:port.jtag.cables]] | -> [[docs: techref: hardware: port.jtag.cables]] |
| Подключение, как правило, производится через специальный JTAG адаптер. Это могут быть простые и дешевые USB-JTAG адаптеры, так и старые адаптеры на основе параллельного порта (LPT) для компьютера - как правило, такие адаптеры самодельные. | The connection is usually made through a special JTAG adapter. These can be simple and cheap USB-JTAG adapters, and old parallel-port-based adapters (LPT) for a computer - usually these adapters are self-made. |
| |
| В примере, представленном в этом разделе, подключение производилось через старый и медленный JTAG адаптер для LPT порта – [[http://ciclamab.altervista.org/hard_corpo_jtag.htm|Wiggler(без буфера)]]. Конструкция этого адаптера чрезвычайно проста. | In the example presented in this section, the connection was made through the old and slow JTAG adapter for the LPT port - [[http://ciclamab.altervista.org/hard_corpo_jtag.htm|Wiggler( without the buffer)]]. The design of this adapter is extremely simple. |
| |
| ==== Программная часть ==== | ===== The software part ===== |
| |
| Программная часть содержит список программ, которые понадобятся в процессе отладки и восстановления через интерфейс JTAG. Также, эта часть содержит список используемых команд OpenOCD и конфигурационный файл для процессоров AR724x. | The program part contains a list of programs that will be needed during debugging and recovery through the JTAG interface. Also, this part contains a list of used OpenOCD commands and a configuration file for AR724x processors. |
| |
| === Программы для работы с JTAG === | ==== Programs for working with JTAG ==== |
| |
| * **OpenOCD**((При необходимости можно заменить на **OCD Commander**, но следует помнить, что там другой формат отправки регистров в процессор, поэтому конфиг. файл необходимо переделать под этот формат.)) - [[http://dangerousprototypes.com/docs/Compile_OpenOCD_for_Windows|Как собрать OpenOCD для Windows в среде Linux OS]], [[http://kazus.ru/forums/attachment.php?attachmentid=7775&d=1273832853|Как собрать OpenOCD для Windows в среде Windows OS]](на русском). \\ Также можно воспользоваться [[http://www.freddiechopin.info/en/download/category/4-openocd|последней стабильной]] версией OpenOCD, собранной для Windows (программа включает в себя практически все JTAG адаптеры). | * ** OpenOCD ** ((If necessary, you can replace it with ** OCD Commander **, but remember that there is another format for sending registers to the processor, so the config file needs to be changed to this format.)) - [[http://dangerousprototypes.com/docs/Compile_OpenOCD_for_Windows|How to build OpenOCD for Windows in Linux OS environment]], [[http://kazus.ru/forums/attachment.php?attachmentid=7775&d=1273832853|How to assemble OpenOCD for Windows in Windows OS environment]] (in Russian). \\ You can also use the [[http://www.freddiechopin.info/en/download/category/4-openocd|last stable]] version of OpenOCD, built for Windows (the program includes almost all JTAG adapters). |
| |
| |
| * **PuTTY** – ''telnet'' консоль. Эта консоль также используется для подключения к роутеру через последовательный порт. | * ** PuTTY ** - '' telnet '' console. This console is also used to connect to the router through the serial port. |
| |
| * **[[#init-ar7240.cfg|init-ar7240.cfg]]** - конфиг. файл для программы OpenOCD и Вашего устройства (конфиг. файл, необходимо скопировать в папку программы OpenOCD как target/init-ar7240.cfg). | * ** [[# # init-ar7240.cfg | init-ar7240.cfg]] ** - config. file for the OpenOCD program and your device (config file, you need to copy it to the OpenOCD program folder as target /init-ar7240.cfg). |
| |
| * **[[http://www.mediafire.com/download/8pajc4hjppw6yja/8Muboot_RAM_version.bin|8Muboot_RAM_version.bin]]** - загрузчик, который можно запустить в SDRAM памяти через JTAG (спасибо участнику форума OpenWRT с ником **tthrx**) | * ** [[http://www.mediafire.com/download/8pajc4hjppw6yja/8Muboot_RAM_version.bin|8Muboot_RAM_version.bin]] ** is a boot loader that can be run in SDRAM memory via JTAG (thanks to a member of the OpenWRT forum with a nickname ** tthrx **) |
| |
| * **backup.bin** - условный загрузчик или другой фрагмент данных флеш-памяти, который необходимо восстановить. \\ \\ **Примечание:** Учтите, что в загрузчике хранится информация о MAC адресе ((TP-Link: U-boot MAC offset 0x01fc00 (value in HEX format) )) и PIN коде((TP-Link: U-boot PIN offset 0x01fe00 (value in Dec format) )) устройства. Следует также знать, что используемый **art** раздел с EEPROM информацией для чипа беспроводной связи, должен соответствовать чипу беспроводной связи восстанавливаемого устройства. \\ Например: **art** раздел роутера MR3420(WiFi Chip: AR9287) не подойдет к роутеру MR3220(WiFi Chip: AR9285) и наоборот. | * ** backup.bin ** - a conditional bootloader or another piece of flash data that needs to be restored. \\ \\ ** Note: ** Note that the bootloader stores information about the MAC address (TP-Link: U-boot MAC offset 0x01fc00 (value in HEX format))) and the PIN code (TP-Link: U -boot PIN offset 0x01fe00 (value in Dec format))) of the device. It should also be aware that the ** art ** section used with EEPROM information for the wireless communication chip must match the wireless chip of the device being restored. \\ For example: ** art ** section of MR3420 router (WiFi Chip: AR9287) does not fit to MR3220 router (WiFi Chip: AR9285) and vice versa. |
| |
| === Используемые команды OpenOCD === | ==== The OpenOCD commands used ==== |
| |
| <code>reset</code> | <code> reset </code> |
| //В примере представленном в этом разделе, команда используется как - определение идентификатора и состояние устройства, не более. Обычно, при выполнении этой команды задействуется пин **nSRST**, но в нашем случае **RST** пин - не одно и то же.// | //B In the example presented in this section, the command is used as - identification of the identifier and device status, not more. Usually, when this command is executed, the ** nSRST ** is activated, but in our case ** RST ** pin is not the same .// |
| |
| \\ | \\ |
| |
| <code>halt</code> | <code> halt </code> |
| //Переводит процессор в режим отладки (прием команд).// | // Put the processor into debugging mode (accepting commands) .// |
| |
| \\ | \\ |
| |
| <code>reset init</code> | <code> reset init </code> |
| //После выполнения этой команды, будет выполнен скрипт для этого события (заключенного в фигурные скобки), который находится в конфиг. файле (отправка команд в процессор).// | // After executing this command, the script for this event (enclosed in braces) will be executed, which is in the config. file (sending commands to the processor) .// |
| |
| \\ | \\ |
| |
| <code> | <code> |
| dump_image <имя файла> <стартовый адрес в области памяти или флешки> <размер> | dump_image <file name> <start address in memory area or flash drive> <size> |
| </code> | </code> |
| //Эта команда сохраняет дамп **из** памяти/флешки устройства в файл. Команда может быть выполнена до инициализации процессора и памяти устройства. Для чтения флеш-памяти, используйте адрес ''0x9f000000''// | // This command saves the dump ** from ** the device's memory / flash drive to a file. The command can be executed before the processor and the device memory are initialized. To read flash memory, use the address '' 0x9f000000 '' // |
| |
| \\ | \\ |
| |
| <code> | <code> |
| load_image <имя файла> <адрес в области только памяти> <формат файла> | load_image <file name> <address in memory area only> <file format> |
| </code> | </code> |
| //Эта команда загружает файл **в** память устройства. Команда должна выполнятся **после** инициализации процессора и памяти устройства.// | // This command loads the ** file into ** the device memory. The command must be executed ** after ** initializing the processor and device memory. // |
| |
| \\ | \\ |
| |
| <code> | <code> |
| resume <адрес в области памяти или флешки> | resume <address in memory area or flash drive> |
| </code> | </code> |
| //Эта команда запускает загрузчик, аналог **go** в uboot’е// | // This command starts the loader, analog ** go ** in uboot'e // |
| |
| \\ | \\ |
| |
| == init-ar7240.cfg == | === init-ar7240.cfg === |
| <code> | <code> |
| # Atheros AR724x MIPS 24Kc SoC. | # Atheros AR724x MIPS 24Kc SoC. |
| # | # |
| # configure file for AR7200 boards (32/64 MB ram) | # configure file for AR7200 boards (32/64 MB ram) |
| # this settings format for OpenOCD was changed/taken from source of settings for OCD Commander | # this settings format for OpenCD was changed / taken from source of settings for OCD Commander |
| # source: http://www.cpx.cz/dls/wpe72_WPE72NX_MMJ5N26E/wp72_loader_jtag.zip | # source: http://www.cpx.cz/dls/wpe72_WPE72NX_MMJ5N26E/wp72_loader_jtag.zip |
| |
| jtag_ntrst_delay 100 | jtag_ntrst_delay 100 |
| |
| reset_config trst_only separate ;# or use only "reset_config none" | reset_config trst_only separate; # or use only "reset_config none" |
| |
| set CHIPNAME ar724x | set CHIPNAME ar724x |
| |
| jtag newtap $CHIPNAME cpu -irlen 5 -ircapture 0x1 -irmask 0x1f -expected-id 1 | jtag newtap $ CHIPNAME cpu -irlen 5 -ircapture 0x1 -irmask 0x1f -expected-id 1 |
| |
| set TARGETNAME $CHIPNAME.cpu | set TARGETNAME $ CHIPNAME.cpu |
| target create $TARGETNAME mips_m4k -endian big -chain-position $TARGETNAME | target create $ TARGETNAME mips_m4k -endian big -chain-position $ TARGETNAME |
| |
| $TARGETNAME configure -event reset-init { | $ TARGETNAME configure -event reset-init { |
| # WAR for the bug#55574: Set the CKE (bit 7 in DDR_CONFIG2 register) | # WAR for the bug # 55574: Set the CKE (bit 7 in DDR_CONFIG2 register) |
| # to low initially | # to low initially |
| mww 0xB8000004 0x99D10628 | mww 0xB8000004 0x99D10628 |
| |
| # set PLL | # set PLL |
| mww 0xb8050000 0x00040828 | mww 0xb8050000 0x00040828 |
| |
| # update PLL | # update PLL |
| mww 0xb8050008 0x1 | mww 0xb8050008 0x1 |
| sleep 10 | sleep 10 |
| mww 0xb8050008 0x0 | mww 0xb8050008 0x0 |
| # disable flash remap | # disable flash remap |
| mww 0xbf000004 0x43 | mww 0xbf000004 0x43 |
| | |
| # DDR | |
| mww 0xb8000000 0xC7BC8CD0 | |
| mww 0xB8000004 0x9DD0E6A8 | |
| mww 0xB8000010 0x00000008 | |
| mww 0xB8000008 0x00000133 | |
| sleep 10 | |
| mww 0xB8000010 0x00000001 | |
| mww 0xB800000C 0x00000000 | |
| mww 0xB8000010 0x00000002 | |
| mww 0xB8000010 0x00000008 | |
| mww 0xB8000008 0x00000033 | |
| mww 0xB8000010 0x00000001 | |
| mww 0xB8000014 0x00004F10 | |
| mww 0xB8000018 0x000000FF | |
| mww 0xB800001C 0x00000007 | |
| mww 0xB8000020 0x00000007 | |
| |
| # | # DDR |
| # UART Test | mww 0xb8000000 0xC7BC8CD0 |
| # | mww 0xB8000004 0x9DD0E6A8 |
| mww 0xB8040028 0x000480FA | mww 0xB8000010 0x00000008 |
| mww 0xB802000C 0x00000083 | mww 0xB8000008 0x00000133 |
| mww 0xB8020000 0x0000006D | sleep 10 |
| mww 0xB8020004 0x00000000 | mww 0xB8000010 0x00000001 |
| mww 0xB802000C 0x00000003 | mww 0xB800000C 0x00000000 |
| mww 0xB8020008 0x00000001 | mww 0xB8000010 0x00000002 |
| mww 0xB8020000 0x00000030 | mww 0xB8000010 0x00000008 |
| mww 0xB8020000 0x00000031 | mww 0xB8000008 0x00000033 |
| mww 0xB8020000 0x00000032 | mww 0xB8000010 0x00000001 |
| mww 0xB8020000 0x00000033 | mww 0xB8000014 0x00004F10 |
| mww 0xB8020000 0x00000034 | mww 0xB8000018 0x000000FF |
| mww 0xB8020000 0x00000035 | mww 0xB800001C 0x00000007 |
| mww 0xB8020000 0x00000036 | mww 0xB8000020 0x00000007 |
| mww 0xB8020000 0x00000037 | |
| mww 0xB8020000 0x00000038 | # |
| mww 0xB8020000 0x00000039 | # UART Test |
| mww 0xB8020000 0x0000000D | # |
| mww 0xB8020000 0x0000000A | mww 0xB8040028 0x000480FA |
| | mww 0xB802000C 0x00000083 |
| | mww 0xB8020000 0x0000006D |
| | mww 0xB8020004 0x00000000 |
| | mww 0xB802000C 0x00000003 |
| | mww 0xB8020008 0x00000001 |
| | mww 0xB8020000 0x00000030 |
| | mww 0xB8020000 0x00000031 |
| | mww 0xB8020000 0x00000032 |
| | mww 0xB8020000 0x00000033 |
| | mww 0xB8020000 0x00000034 |
| | mww 0xB8020000 0x00000035 |
| | mww 0xB8020000 0x00000036 |
| | mww 0xB8020000 0x00000037 |
| | mww 0xB8020000 0x00000038 |
| | mww 0xB8020000 0x00000039 |
| | mww 0xB8020000 0x0000000D |
| | mww 0xB8020000 0x0000000A |
| } | } |
| |
| # setup working area somewhere in RAM | # setup working area somewhere in RAM |
| $TARGETNAME configure -work-area-phys 0xa0600000 -work-area-size 0x20000 | $ TARGETNAME configure -work-area-phys 0xa0600000 -work-area-size 0x20000 |
| |
| # serial SPI capable flash | # serial SPI capable flash |
| \\ | \\ |
| |
| ===== Пример восстановления ===== | ===== Recovery example ===== |
| |
| Восстановление условного загрузчика **u-boot** и **art** раздела, на роутере MR3220(4M) в операционной системе Windows. При желании, таким же образом, дополнительно, можно прошить **firmware** образ или целиком всю флеш-память - **fullflash**. | Restore the boot loader ** u-boot ** and ** art ** section, on the MR3220 (4M) router in the Windows operating system. If desired, in the same way, in addition, you can flash ** firmware ** image or the entire flash memory - ** fullflash **. |
| |
| * Распаковываем собранную версию "openocd-0.5.0.zip" в удобную для нас папку. | * Unpack the assembled version of "openocd-0.5.0.zip" into a folder convenient for us. |
| |
| * Перемещаем или копируем из папки ''bin'' (папка расположена в корневой директории OpenOCD), все содержимое в корневую директорию OpenOCD. | * Move or copy from the folder '' bin '' (the folder is located in the root directory of OpenOCD), all the contents to the root directory of OpenOCD. |
| |
| * Создаем файл ''ar724x.bat'' (можно использовать любое другое имя) в той же корневой директории OpenOCD со следующим содержимым: \\ <code> | * Create the file '' ar724x.bat '' (you can use any other name) in the same root directory of OpenOCD with the following contents: \\ <code> |
| openocd-0.5.0.exe -f interface/parport.cfg -f target/init-ar7240.cfg | openocd-0.5.0.exe -f interface / parport.cfg -f target / init-ar7240.cfg |
| pause | pause |
| </code>//Если Вы используете другой JTAG адаптер, то название **parport.cfg** должно быть изменено на соответствующее название конфигурационного файла для Вашего JTAG адаптера.// | </code> // If you use another JTAG adapter, then the name ** parport.cfg ** should be changed to the appropriate configuration file name for your JTAG adapter. // |
| |
| * Подключаем JTAG к компьютеру и **отключенному** роутеру. | * Connect JTAG to the computer and ** disconnected ** the router. |
| |
| * Подключаем UART к компьютеру и **отключенному** роутеру, также следует открыть **PuTTY** (программа должна быть настроена на параллельный порт Вашего компьютера с соответствующими настройками для Вашего роутера). | * We connect the UART to the computer and ** the unplugged ** router, also follows from |
| | * * Connect JTAG to the computer and ** disconnected ** the router. |
| |
| ==== Работа с программой OpenOCD ==== | * Connect the UART to the computer and ** the unplugged ** router, also open ** PuTTY ** (the program must be configured on the parallel port of your computer with the appropriate settings for your router). |
| |
| *Запускаем **ar724x.bat**, практически сразу можно включить роутер, цель обнаружить идентификатор ''0x00000001'' (стандартный идентификатор процессоров Atheros):<code> | ==== Working with the OpenOCD program ==== |
| D:\Free\OpenOCD\0.5.0>openocd-0.5.0.exe -f interface/parport.cfg -f target/init-ar7240.cfg | |
| Open On-Chip Debugger 0.5.0 (2012-04-06-14:30) | * Run ** ar724x.bat **, almost immediately you can turn on the router, the goal is to find the identifier '' 0x00000001 '' (standard identifier of Atheros processors): <code> |
| | D: \ Free \ OpenOCD \ 0.5.0> openocd-0.5.0.exe -f interface / parport.cfg -f target / init-ar7240.cfg |
| | Open On-Chip Debugger 0.5.0 (2012-04-06-14: 30) |
| Licensed under GNU GPL v2 | Licensed under GNU GPL v2 |
| For bug reports, read | For bug reports, read |
| http://openocd.berlios.de/doc/doxygen/bugs.html | http://openocd.berlios.de/doc/doxygen/bugs.html |
| Warn : Adapter driver 'parport' did not declare which transports it allows; assuming legacy JTAG-only | Warn: Adapter driver 'parport' did not declare which transports it allows; assuming legacy JTAG-only |
| Info : only one transport option; autoselect 'jtag' | Info: only one transport option; autoselect 'jtag' |
| parport port = 0x378 | parport port = 0x378 |
| 6000 kHz | 6000 kHz |
| none separate | none separate |
| 131072 | 131072 |
| Info : clock speed 500 kHz | Info: clock speed 500 kHz |
| Info : JTAG tap: ar724x.cpu tap/device found: 0x00000001 (mfg: 0x000, part: 0x0000, ver: 0x0) | Info: JTAG tap: ar724x.cpu tap / device found: 0x00000001 (mfg: 0x000, part: 0x0000, ver: 0x0) |
| Info : accepting 'telnet' connection from 4444 | Info: accepting 'telnet' connection from 4444 |
| </code>//Если не получилось определить идентификатор сразу, попробуйте перейти к следующему пункту и набрать в консоли "''reset''". Если все равно программа не определяет идентификатор процессора, то нужно проверить подключение кабеля JTAG на возможные ошибки, также причина неполадок может заключаться в длине используемого кабеля. // | </code> // If it was not possible to determine the identifier at once, try going to the next item and typing "'' reset ''" in the console. If the program does not detect the processor identifier anyway, you need to check the connection of the JTAG cable for possible errors, and the cause of the problem can be the length of the cable used. // |
| |
| *Если все прошло успешно, необходимо запустить консоль ''telnet'' или еще одно окно **PuTTY** используя адрес ''127.0.0.1:4444'', после подключения в консоли должна отобразится строка ввода:<code> | * If everything went well, you need to start the console '' telnet '' or another window ** PuTTY ** using the address '' 127.0.0.1:4444 '', after connecting to the console, the input line should appear: <code> |
| Open On-Chip Debugger | Open On-Chip Debugger |
| > | > |
| </code>\\ | </code> \\ |
| *Дальше необходимо ввести команды: \\ \\ <code> | * Then enter the commands: \\ \\ <code> |
| > reset | > reset |
| JTAG tap: ar724x.cpu tap/device found: 0x00000001 (mfg: 0x000, part: 0x0000, ver: 0x0) | JTAG tap: ar724x.cpu tap / device found: 0x00000001 (mfg: 0x000, part: 0x0000, ver: 0x0) |
| > | > |
| </code>//Эта команда не должна влиять на состояние процессора, т.к. **RST** мы не используем. Однако команда очередной раз определяет идентификатор и состояние процессора.// \\ \\ \\ <code> | </code> // This command should not affect the state of the processor. ** RST ** us we do not handle. However, the command once again determines the identifier and the state of the processor. // \\ \\ \\ <code> |
| > halt | > halt |
| target state: halted | target state: halted |
| target halted in MIPS32 mode due to debug-request, pc: 0xbfc03860 | target halted in MIPS32 mode due to debug-request, pc: 0xbfc03860 |
| > | > |
| </code>//Эта команда переводит процессор из состояния "running", в состояние "halted" - в этом состоянии, процессор принимает команды от оператора.// \\ \\ \\ <code> | </code> // This command switches the processor from the "running" state to the "halted" state - in this state, the processor receives commands from the operator .// \\ \\ \\ <code> |
| > reset init | > reset init |
| JTAG tap: ar724x.cpu tap/device found: 0x00000001 (mfg: 0x000, part: 0x0000, ver: 0x0) | JTAG tap: ar724x.cpu tap / device found: 0x00000001 (mfg: 0x000, part: 0x0000, ver: 0x0) |
| target state: halted | target state: halted |
| target halted in MIPS32 mode due to debug-request, pc: 0xbffd0ac0 | target halted in MIPS32 mode due to debug-request, pc: 0xbffd0ac0 |
| > | > |
| </code>//Инициализация основного скрипта в конфигурационном файле **[[#init-ar7240.cfg|init-ar7240.cfg]]**. В данном случае, скрипт послал группу команд заключенных в фигурные скобки для события ''init''. После этого мы можем полноценно работать с процессором и памятью устройства.// \\ \\ \\ <code> | </code> // Initialize the main script in the configuration file ** [[# init-ar7240.cfg | init-ar7240.cfg]] **. In this case, the script sent a group of prisoners' commands to curly braces for the '' init '' event. After that, we can fully work with the processor and device memory. // \\ \\ \\ <code> |
| > load_image backup_uboot.bin 0x81000000 bin | > load_image backup_uboot.bin 0x81000000 bin |
| 131072 bytes written at address 0x81000000 | 131072 bytes written at address 0x81000000 |
| downloaded 131072 bytes in 12.250000s (10.449 KiB/s) | downloaded 131072 bytes in 12.250000s (10.449 KiB / s) |
| > load_image backup_art.bin 0x81020000 bin | > load_image backup_art.bin 0x81020000 bin |
| 65536 bytes written at address 0x81020000 | 65536 bytes written at address 0x81020000 |
| downloaded 65536 bytes in 5.440000s (11.765 KiB/s) | downloaded 65536 bytes in 5.440000s (11.765 KiB / s) |
| > load_image 8Muboot_RAM_version.bin 0x80000000 bin | > load_image 8Muboot_RAM_version.bin 0x80000000 bin |
| 262144 bytes written at address 0x80000000 | 262144 bytes written at address 0x80000000 |
| downloaded 262144 bytes in 21.639999s (11.830 KiB/s) | downloaded 262144 bytes in 21.639999s (11.830 KiB / s) |
| > | > |
| </code>//Заранее загружаем куда-нибудь в память, загрузчик **u-boot** и **art** раздел – позже, эти данные необходимо будет скопировать на флеш-память. \\ Основное, что мы делаем - мы загружаем **8Muboot_RAM_version.bin** загрузчик в область памяти 0x80000000 – загрузчик был скомпилирован с привязкой к этому адресу.// \\ \\ **Примечание:** Возможно обойтись только загрузчиком **8Muboot_RAM_version.bin** (в области памяти 0x80000000) - используя этот загрузчик, можно прошить флеш-память с помощью [[:ru:toh:tp-link:tl-mr3420#прошивка.с.помощью.tftp|tftp метода]]. \\ Следует знать особенности tftp, в этом загрузчике: | </code> // We load in advance somewhere into the memory, the loader ** u-boot ** and ** art ** section - later, this data will need to be copied to the flash memory. \\ The main thing we do is we load ** 8Muboot_RAM_version.bin ** the loader into the memory area 0x80000000 - the loader was compiled with reference to this address. // \\ \\ ** Note: ** It is possible to do only with the loader ** 8Muboot_RAM_version.bin ** (in the memory area 0x80000000) - using this bootloader, you can flash the flash using [[: en: toh: tp-link: tl-mr3420 # firmware.with the help.tftp | tftp method]] . \\ You should know the features of tftp, in this bootloader: |
| *Для доступа к загрузчику, в консоли необходимо успеть ввести **tt** | * To access the bootloader, you need to enter ** tt ** |
| *IP адрес компьютера, при этом, должен быть - 192.168.1.23 (или воспользуйтесь командой ''setenv'', чтобы изменить значение ''serverip''). | * The IP address of the computer, at the same time, should be - 192.168.1.23 (or use the '' setenv '' command to change the value of '' serverip ''). |
| *Следующая команда, запустит загрузчик из области SDRAM памяти, одновременно с этим процессом, должна быть запущена еще одна консоль **PuTTY**, настроенная на последовательный порт:<code> | * The following command will start the loader from the SDRAM area of the memory, simultaneously with this process, another console should be started ** PuTTY **, configured on the serial port: <code> |
| resume 0x80000000 | resume 0x80000000 |
| </code>//Загрузчик попытается загрузить **firmware** из флеш-памяти, чтобы не допустить провала (и как следствие, перезагрузки роутера) - когда в окне появится надпись "Autoboot in .." нужно быстро написать в консоли **tt**.// \\ \\ | </code> // The loader will try to load ** firmware ** from the flash memory to prevent a failure (and as a result, the reboot of the router) - when the window "Autoboot in .." appears in the window, you need to quickly write in the console ** tt **.// \\ \\ |
| |
| ==== Работа в загрузчике U-boot ==== | ==== Work in the bootloader U-boot ==== |
| |
| Заключительный этап восстановления происходит через загрузчик U-Boot. Необходимо стереть рабочую область флеш-памяти, а потом скопировать ранее записанные данные на флеш-память устройства. \\ Это можно сделать следующим образом: | The final stage of recovery is via the U-boot bootloader. It is necessary to erase the working area of the flash memory, and then copy the previously recorded data to the flash memory of the device. \\ You can do this as follows: |
| <code> | <code> |
| AR7241# erase 0x9f000000 +0x20000 | AR7241 # erase 0x9f000000 + 0x20000 |
| Erase Flash from 0x9f000000 to 0x9f01ffff in Bank # 1 | Erase Flash from 0x9f000000 to 0x9f01ffff in Bank # 1 |
| First 0x0 last 0x1 sector size 0x10000 | First 0x0 last 0x1 sector size 0x10000 |
| Erased 2 sectors | Erased 2 sectors |
| AR7241# | AR7241 # |
| </code>//Стираем область во флеш-памяти для загрузчика **u-boot**.// | </code> // Erase the area in the flash memory for the boot loader ** u-boot **.// |
| |
| \\ | \\ |
| |
| <code> | <code> |
| AR7241# cp 0x81000000 0x9f000000 0x20000 | AR7241 # cp 0x81000000 0x9f000000 0x20000 |
| Copy to Flash... write addr: 9f000000 | Copy to Flash ... write addr: 9f000000 |
| done | done |
| AR7241# | AR7241 # |
| </code>//Копируем из области SDRAM памяти, ранее записанный **u-boot** загрузчик, во флеш-память.// | </code> // Copy from the SDRAM area of the memory, previously written ** u-boot ** bootloader, into the flash memory .// |
| |
| \\ | \\ |
| |
| <code> | <code> |
| AR7241# erase 0x9f3F0000 +0x10000 | AR7241 # erase 0x9f3F0000 + 0x10000 |
| Erase Flash from 0x9f3f0000 to 0x9f3fffff in Bank # 1 | Erase Flash from 0x9f3f0000 to 0x9f3fffff in Bank # 1 |
| First 0x3f last 0x3f sector size 0x10000 | First 0x3f last 0x3f sector size 0x10000 |
| Erased 1 sectors | Erased 1 sectors |
| AR7241# | AR7241 # |
| </code>//Стираем область во флеш-памяти для **art** раздела (флеш-память **4M**).// | </code> // Erase the area in the flash memory for the ** art ** section (flash memory ** 4M **) .// |
| |
| \\ | \\ |
| |
| <code> | <code> |
| AR7241# cp 0x81020000 0x9f3F0000 0x10000 | AR7241 # cp 0x81020000 0x9f3F0000 0x10000 |
| Copy to Flash... write addr: 9f3f0000 | Copy to Flash ... write addr: 9f3f0000 |
| done | done |
| AR7241# | AR7241 # |
| </code>//Копируем из области SDRAM памяти, ранее записанный **art** раздел, во флеш-память.// | </code> // Copy from the SDRAM area of the memory, previously written ** art ** section, into the flash memory .// |
| |
| Загрузчик для SDRAM и исходные коды можно найти в [[https://forum.openwrt.org/viewtopic.php?id=33205|этом разделе форума]]. | |
| |
| Расширенные логи работы с программой и используемый материал можно найти на [[https://forum.openwrt.org/viewtopic.php?id=34993|форуме]]. | The loader for SDRAM and the source code can be found in the [[https://forum.openwrt.org/viewtopic.php?id=33205|this section of the forum]]. |
| |
| ===== Дополнительная информация ===== | Extended logs for working with the program and the material used can be found at [[https://forum.openwrt.org/viewtopic.php?id=34993|for forum]]. |
| |
| Универсальный загрузчик [[docs:techref:bootloader:myloader#myloram|Myloram]] для устройств Compex на базе процессоров AR71xx и AR724x. Загрузчик может работать на устройствах сторонних производителей с этими процессорами. Описание восстановления устройств в соответствующей инструкции по ссылке. | ===== More Information ===== |
| |
| | Universal loader [[docs:techref:bootloader:myloader#myloram|Myloram]] for Compex devices based on AR71xx and AR724x processors. The loader can work on third-party devices with these processors. Description of device recovery in the corresponding instructions by reference. |