Difference between revisions of "JTAG via OpenOCD"
(→Configuration file) |
|||
(10 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
To use OpenOCD, you first need a corresponding [[JTAG_ARM|Jtag-adaptor]] to connect to the hardware. A pre-patched version of the software can be found on a recent version of the support-CD for your board. | To use OpenOCD, you first need a corresponding [[JTAG_ARM|Jtag-adaptor]] to connect to the hardware. A pre-patched version of the software can be found on a recent version of the support-CD for your board. | ||
+ | |||
+ | === OpenOCD driver on Windows === | ||
+ | |||
+ | When using Windows you need to install the appropriate libusb-1.0 (WinUSB) drivers: | ||
+ | |||
+ | # Visit [http://zadig.akeo.ie/ zadig.akeo.ie] and download the latest zadig software. | ||
+ | # Plug in your interface | ||
+ | # Start zadig.exe (you may be asked by UAC to allow this application to change system settings - click Yes) | ||
+ | # If your device is visible in drop-down list go to step 6 | ||
+ | # Check Options > List All Devices | ||
+ | # Select your device in drop-down list ("Dual RS232") | ||
+ | # From the right (active) selector choose WinUSB (...) driver | ||
+ | # Click Install Driver or Replace Driver below (you may be asked by OS to accept driver installation - click Yes) | ||
+ | # Click Close in the message box that will appear informing you about success | ||
+ | |||
+ | * you need to install the driver for both interfaces of your OpenOCD programmer (Interface 0 & Interface 1). | ||
+ | * (this guide was provided by [http://www.freddiechopin.info/]) | ||
=== Configuration file === | === Configuration file === | ||
− | Before OpenOCD can be used a configuration-file suitable to the actual setup has to be generated. Using the [http://shop.in-circuit.de/products/Home/Programmieradapter/16/ICprog-OpenOCD ICprog OpenOCD] and a [http://shop.in-circuit.de/ | + | Before [[Programmer#ICprog_OpenOCD|OpenOCD]] can be used a configuration-file suitable to the actual setup has to be generated. Using the [http://shop.in-circuit.de/products/Home/Programmieradapter/16/ICprog-OpenOCD ICprog OpenOCD] and a [http://shop.in-circuit.de/product_info.php?cPath=24_34&products_id=132 ICnova SAM9G45 OEM], the following lines should be saved in a file called openocd.cfg: |
source [find interface/openocd-usb.cfg] | source [find interface/openocd-usb.cfg] | ||
Line 10: | Line 27: | ||
Afterwards OpenOCD can be used by specifying this file on the command line. The devices should be connected as shown on the picture below. | Afterwards OpenOCD can be used by specifying this file on the command line. The devices should be connected as shown on the picture below. | ||
− | [[File: | + | [[File:Icprog_openocd.jpg|400px]] |
== Commands == | == Commands == | ||
Line 18: | Line 35: | ||
=== Writing the bootloader === | === Writing the bootloader === | ||
− | Using a ICnova SAM9G45 OEM, the following commandline will write the bootloader into the flash. | + | Using a [[ICnova SAM9G45 OEM]], the following commandline will write the bootloader into the flash. |
openocd -f openocd.cfg -c “flash erase_sector 0 0 2” -c “flash write_image norflash_icnova_arm9.bin 0x10000000” -c “flash write_image u-boot.bin 0x10020000” -c shutdown | openocd -f openocd.cfg -c “flash erase_sector 0 0 2” -c “flash write_image norflash_icnova_arm9.bin 0x10000000” -c “flash write_image u-boot.bin 0x10020000” -c shutdown | ||
Line 30: | Line 47: | ||
[[Category:Debugging for ARM]] | [[Category:Debugging for ARM]] | ||
+ | [[Category:HowTo]] |
Latest revision as of 16:16, 9 February 2017
To use OpenOCD, you first need a corresponding Jtag-adaptor to connect to the hardware. A pre-patched version of the software can be found on a recent version of the support-CD for your board.
Contents |
[edit] OpenOCD driver on Windows
When using Windows you need to install the appropriate libusb-1.0 (WinUSB) drivers:
- Visit zadig.akeo.ie and download the latest zadig software.
- Plug in your interface
- Start zadig.exe (you may be asked by UAC to allow this application to change system settings - click Yes)
- If your device is visible in drop-down list go to step 6
- Check Options > List All Devices
- Select your device in drop-down list ("Dual RS232")
- From the right (active) selector choose WinUSB (...) driver
- Click Install Driver or Replace Driver below (you may be asked by OS to accept driver installation - click Yes)
- Click Close in the message box that will appear informing you about success
- you need to install the driver for both interfaces of your OpenOCD programmer (Interface 0 & Interface 1).
- (this guide was provided by [1])
[edit] Configuration file
Before OpenOCD can be used a configuration-file suitable to the actual setup has to be generated. Using the ICprog OpenOCD and a ICnova SAM9G45 OEM, the following lines should be saved in a file called openocd.cfg:
source [find interface/openocd-usb.cfg] source [find target/at91sam9g45.cfg]
Afterwards OpenOCD can be used by specifying this file on the command line. The devices should be connected as shown on the picture below.
[edit] Commands
The following section will provide some example commands.
[edit] Writing the bootloader
Using a ICnova SAM9G45 OEM, the following commandline will write the bootloader into the flash.
openocd -f openocd.cfg -c “flash erase_sector 0 0 2” -c “flash write_image norflash_icnova_arm9.bin 0x10000000” -c “flash write_image u-boot.bin 0x10020000” -c shutdown
The parameter -f openocd.cfg specifies the configuration file. Any occurence of -c will tell openocd to execute the command. The commands flash erase_sector 0 0 2 deletes the the first 3 Sectors (0, 1 and 2) of the NOR-Flash (with ID 0). To delete just the U-Boot (sectors 1 and 2) flash erase_sector 0 1 2 has to be used. The command flash write_image norflash_icnova_arm9.bin 0x10000000 writes the content of the file norflash_icnova_arm9.bin into the memory at address 0x10000000. As this is the NOR-Flashs start-address, the first sector will be used. The command shutdown stops openocd. Otherwise the openocd would start its server-functionality and wait for a suitable connection.
The exact commands for other modules can be found in the corresponding Memory map for that device.