Introduction
When running relatively recent versions of U-Boot, such as v2019.xx and v2020.xx, connected to the Arm® DS (formerly DS-5) debugger, JTAG-related errors may appear and operations from the debugger may not work.
This article describes the errors that may occur, their causes & countermeasures.
1. Error contents
- Error message
ERROR 87 returned when flushing to JTAG server
ERROR 35 unlocking DAP, OpenID 0xXXXXXXXX- Image of the screen when the error occurs
Figure 1. Display of JTAG-related errors
2. Cause of Error
The error is caused by the process of rewriting the following registers implemented in the U-Boot code.
Reference: Cyclone V HPS Register Address Map and Definitions - sysmgr.ctrl register
Figure 2. Scan Manager Group register (sysmgr.ctrl) under System Mangaer
By setting the fpgajtagen field of the Scan Manager Group register (sysmgr.ctrl) under System Mangaer to 0x1, the JTAG control is switched from the FPGA JTAG pins to the Scan Manager.
As a result, the debugger connected via the JTAG pin will not be able to control the device.
As an example, the relevant process implemented in U-Boot 2020.10 is the following part of the arch/arm/mach-socfpga/scan_manager.c file.
- Target file : arch/arm/mach-socfpga/scan_manager.c
- Causative process (in the red frame)
Figure 3. Corresponding processing section in scan_manager.c file
3. Countermeasures
The countermeasure was to change the configuration of the U-Boot so that the process that caused the problem is not the target of the build.
The following is an example of the countermeasure in U-Boot 2020.10. Change the following two sections (1) and (2).
(1) Disable CONFIG_DISPLAY_CPUINFO in the configs/socfpga_xxx_defconfig file in the U-Boot source tree.
If your socfpga_xxx_defconfig file contains a description of CONFIG_DISPLAY_CPUINFO, comment it out by adding # at the beginning.
Even if there is no description of CONFIG_DISPLAY_CPUINFO in your socfpga_xxx_defconfig file, explicitly append CONFIG_DISPLAY_CPUINFO=n to disable it.
Note: The figure below shows an example of socfpga_cyclone5_defconfig.
Figure 4. Appending CONFIG_DISPLAY_CPUINFO=n to socfpga_xxx_defconfig file
(2) In the arch/arm/Kconfig file of the U-Boot source tree, change the description so that ARCH_MISC_INIT is not enabled when DISPLAY_CPUINFO is disabled.
Note: The following figure shows an example for cyclone5.
(Before change) select ARCH_MISC_INIT if !TARGET_SOCFPGA_ARRIA10(After change) select ARCH_MISC_INIT if DISPLAY_CPUINFO && !TARGET_SOCFPGA_ARRIA10
Figure 5. Changed the description in the Kconfig file
(3) After implementing measures (1) and (2) above, execute the following command to build U-Boot again using the modified socfpga_xxx_defconfig file.
$ make socfpga_xxx_defconfig
$ make -j 24If the Arm® DS (DS-5) debugger does not generate any errors, you should see the figure below.
Figure 6. Display when the debugger does not generate errors after the countermeasure is implemented
Conclusion
Although it has been confirmed that the error can be avoided by the method introduced here, please consider this as a tentative solution.
Please note that there is a possibility that the countermeasure will be implemented in future U-Boot versions, in which case, please respond according to the countermeasure applied to the new U-Boot version.