Difference between revisions of "Linux Debug"
m (→Changing processor registers from Linux user space with imxregs) |
(board independant) |
||
Line 3: | Line 3: | ||
==Introduction== | ==Introduction== | ||
− | On this page, you will find usefull informations for debugging | + | On this page, you will find usefull informations for debugging your Linux kernel/drivers. |
==Testing your custom Linux kernel before flashing it== | ==Testing your custom Linux kernel before flashing it== | ||
Line 9: | Line 9: | ||
You can test a linux kernel you've generated without having to reflash your board and destroy your currently working image. | You can test a linux kernel you've generated without having to reflash your board and destroy your currently working image. | ||
Indeed Linux kernel images can be loaded and started from SDRAM with U-Boot: | Indeed Linux kernel images can be loaded and started from SDRAM with U-Boot: | ||
− | BIOS> tftp | + | <pre class="apf"> |
− | BIOS> bootm | + | BIOS> tftp ${loadaddr} ${board_name}-linux.bin |
+ | BIOS> bootm ${loadaddr} | ||
+ | </pre> | ||
==Changing processor registers from Linux user space with imxregs== | ==Changing processor registers from Linux user space with imxregs== | ||
− | This tool allows you to access i. | + | This tool allows you to access i.MX registers from Linux userspace/console. This way you debug your driver or access i.MX hardware functionnalities directly from Linux console. |
* First, you have to enable this tool in Buildroot (package selection for target -> Hardware handling / blockdevices and filesystem maintenance -> imxregs): | * First, you have to enable this tool in Buildroot (package selection for target -> Hardware handling / blockdevices and filesystem maintenance -> imxregs): | ||
+ | <pre class="host"> | ||
$ make menuconfig | $ make menuconfig | ||
+ | </pre> | ||
Once done, compile it: | Once done, compile it: | ||
+ | <pre class="host"> | ||
$ make | $ make | ||
+ | </pre> | ||
− | The generated file is located in | + | The generated file is located in $ARMADEUS_ROOTFS_DIR/usr/bin/. You can copy it directly on your target or reflash your rootfs. |
− | * To use it, you must clear i. | + | * To use it, you must clear i.MX PAR_1 & PAR_2 registers (registers access rights) '''before''' launching Linux kernel, so in U-Boot type (example here is for APF9328): |
+ | <pre class="apf"> | ||
BIOS> mw.l 0x00200008 0 | BIOS> mw.l 0x00200008 0 | ||
BIOS> mw.l 0x00210008 0 | BIOS> mw.l 0x00210008 0 | ||
+ | </pre> | ||
− | If you use it frequently, | + | If you use it frequently, a small script ''unlock_regs'' has been defined in U-Boot, and you can call before launching your kernel: |
− | + | <pre class="apf"> | |
− | + | ||
− | and call | + | |
BIOS> run unlock_regs | BIOS> run unlock_regs | ||
+ | </pre> | ||
* Then in Linux console/terminal, launch ''imxregs'' like that: | * Then in Linux console/terminal, launch ''imxregs'' like that: | ||
+ | <pre class="apf"> | ||
# imxregs REGISTER_NAME (give it the register name as printed in iMX Ref Manual or just the begining of the name) | # imxregs REGISTER_NAME (give it the register name as printed in iMX Ref Manual or just the begining of the name) | ||
+ | </pre> | ||
or | or | ||
+ | <pre class="apf"> | ||
# imxregs (to dump all supported registers) | # imxregs (to dump all supported registers) | ||
+ | </pre> | ||
===Examples:=== | ===Examples:=== | ||
* Show OCR1 registers of each GPIO Port: | * Show OCR1 registers of each GPIO Port: | ||
+ | <pre class="apf"> | ||
# imxregs OCR1 | # imxregs OCR1 | ||
+ | </pre> | ||
* Write 0x00000123 to OCR1_D register: | * Write 0x00000123 to OCR1_D register: | ||
+ | <pre class="apf"> | ||
# imxregs OCR1_D 123 | # imxregs OCR1_D 123 | ||
+ | </pre> | ||
==Changing FPGA IP's registers from Linux user space with fpgaregs== | ==Changing FPGA IP's registers from Linux user space with fpgaregs== | ||
Line 54: | Line 69: | ||
* http://tree.celinuxforum.org/CelfPubWiki/PatchArchive | * http://tree.celinuxforum.org/CelfPubWiki/PatchArchive | ||
− | + | {{LanguageBar|Linux_Debug|Débogage Linux|Linux_Debug}} |
Revision as of 08:57, 15 April 2009
Tips to do debugging under Linux.
Contents
Introduction
On this page, you will find usefull informations for debugging your Linux kernel/drivers.
Testing your custom Linux kernel before flashing it
You can test a linux kernel you've generated without having to reflash your board and destroy your currently working image. Indeed Linux kernel images can be loaded and started from SDRAM with U-Boot:
BIOS> tftp ${loadaddr} ${board_name}-linux.bin BIOS> bootm ${loadaddr}
Changing processor registers from Linux user space with imxregs
This tool allows you to access i.MX registers from Linux userspace/console. This way you debug your driver or access i.MX hardware functionnalities directly from Linux console.
- First, you have to enable this tool in Buildroot (package selection for target -> Hardware handling / blockdevices and filesystem maintenance -> imxregs):
$ make menuconfig
Once done, compile it:
$ make
The generated file is located in $ARMADEUS_ROOTFS_DIR/usr/bin/. You can copy it directly on your target or reflash your rootfs.
- To use it, you must clear i.MX PAR_1 & PAR_2 registers (registers access rights) before launching Linux kernel, so in U-Boot type (example here is for APF9328):
BIOS> mw.l 0x00200008 0 BIOS> mw.l 0x00210008 0
If you use it frequently, a small script unlock_regs has been defined in U-Boot, and you can call before launching your kernel:
BIOS> run unlock_regs
- Then in Linux console/terminal, launch imxregs like that:
# imxregs REGISTER_NAME (give it the register name as printed in iMX Ref Manual or just the begining of the name)
or
# imxregs (to dump all supported registers)
Examples:
- Show OCR1 registers of each GPIO Port:
# imxregs OCR1
- Write 0x00000123 to OCR1_D register:
# imxregs OCR1_D 123
Changing FPGA IP's registers from Linux user space with fpgaregs
see FPGA_register
Links
- http://www-users.cs.umn.edu/~boutcher/kprobes/
- http://tree.celinuxforum.org/CelfPubWiki/PatchArchive
Other languages: | |
---|---|
English • Français |