Zynq cap debugging Summary

Source: Internet
Author: User

Problems and Solutions

1. After ramdisk is started, you must first ls the file to open it.

Problem Locating Method: GDB, display stack.

Problem location: the open function calls the kunmap function in the kernel, while the kumap function cannot be called in the interrupt context (in the kunmap function, there is bug_on (in_interrupt ());), f ilp_open is called in the interrupt context, so an error occurs.

Solution: Start the kernel thread to open the file.

2. The structure address is inexplicably modified.

Problem Locating Method: Print

Problem location: the structure address is stored in a local variable (on the kernel stack). When a large local variable is defined in the kernel, the kernel stack may be full, to overwrite other variables on the stack.

Solution: Replace the array with a pointer.

Conclusion: The Kernel stack is limited and should not be used excessively. This is common sense.

3. the kernel is stored in the synchronize_irq function.

How to locate the problem: GDB and print the stack.

Problem location: synchronize_irq is called by disalbe_irq. Generally, disalbe_irq is called in the interrupt handler function registered by the driver to enable nested interrupt processing. The problem is that synchronize_irq determines

Irqd_irq_inprogress flag, and irqd_irq_inprogress will be set in the interrupt processing process (handle_irq_event function) before calling the interrupt processing function registered by the driver, resulting in a deadlock.

Solution: replace disalbe_irq with disable_irq_nosync.

Conclusion: It is more reliable to use disable_irq_nosync later.

4. Timer interruption

Problem description: I want to write a timer driver in the kernel. The interrupt is established through setup_irq. When timer is interrupted, the kernel will die.

Problem location: In the code logic, the Interrupt Processing Process of the timer is found to be different from the Interrupt Processing of the timer on the benchmark Q platform. The disjunction must be added to arch/arm/include/asm/entry-macro-multi.S and cannot be created using the setup_irq function. Of course, do not forget to enable interruption in the init function.

Solution: add the following code in arch/arm/include/asm/entry-macro-multi.S:

36 ____ test_for_gt irq r0, r6, r5, lr

37 ____ movne ___ r0, sp

38 ____ adrne ___ lr, BSYM (1b)

39 ____ bne_internal_t imer2_int

Where test _ for_gt irq is:

76 ____. macro test _ for_gt irq, irqnr, irqstat, base, tmp

77 ____ bic _ \ irqnr, \ irqstat, #0x1c00

78 ____ mov ____ \ tmp, #0

79 ____ cmp _ \ irqnr, #27

80 ____ moveq ___ \ tmp, #1

81 ____ streq ___ \ irqstat, [\ base, # GIC_CPU_EOI]

82 ____ cmp _ \ tmp, #0

5. Remember that the current serial port driver uses a timer wheel to send and receive data, rather than an interrupt method.

6. file systems cannot be mounted to the kernel.

Problem location: After the kernel is started to the mounted file system, it will die. experiment shows that the ramdisk space may be washed out when the kernel image is too large to load, however, the size of the image is 2 MB larger than that of the normal image. Later, check the System. map, it is found that although the size of the image does not change much, but the address of some variables changes greatly, using the ramdisk space.

Solution: In uboot, the starting address of ramdisk is moved back.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.