Linux Debug
Tips to do debugging under Linux.
Contents
Introduction
On this page, you will find usefull informations for debugging Armadeus under Linux
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 8000000 apf9328-linux.bin BIOS> bootm 8000000
Changing processor registers from Linux user space with imxregs
This tool allows you to access i.MXL registers from Linux userspace/console. This way you debug your driver or access i.MXL 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 buildroot/build_arm/imxregs-1.0/. Now you can copy it on your target.
- To use it, you must clear i.MXL PAR_1 & PAR_2 registers (registers access rights) before launching Linux kernel, so in U-Boot type:
BIOS> mw.l 0x00200008 0 BIOS> mw.l 0x00210008 0
If you use it frequently, you can define a small script in U-Boot:
BIOS> setenv unlock_regs mw.l 0x00200008 0\; mw.l 0x00210008 0 BIOS> saveenv
and call it like that 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