bsp_cscope_gen.py

来源:互联网 发布:数据库字段值拆分 编辑:程序博客网 时间:2024/05/04 06:32

http://wiki.freescale.net/display/MADTools/bsp_cscope_gen.py

 

What's CSCOPE?

If you don't know what's CSCOPE then you may be missing on one of the most productive tools there are for Linux kernel/driver development or U-boot driver development.

HERE is another wiki I wrote where you can learn more about CSCOPE and integration with vim or gvim.

DOWNLOAD:

  • bsp_cscope_gen.py Version 1.0.0

Benefits of using bsp_cscope_gen.py

Why should I use bsp_cscope_gen.py considering that LTIB already offers an option to build the CSCOPE database?

  1. LTIB creates a super inefficient and large CSCOPE database file because it simply takes in consideration ALL of the Linux kernel code.
  2. As you know, Linux has been ported to many platforms and CPUs. If you build a brute force CSCOPE database and want to quickly check the definition of "board_init" function then CSCOPE will show you ALL of the "board_init" implementations: i.MXs, OMAPs, i386s, PowerPCs, etc.
  3. Wouldn't it be nice if CSCOPE will show me only the "board_init" implementation of the platform you are currently compiling for?
  4. Then bsp_cscope_gen.py is what you need.

bsp_cscope_gen.py generates the CSCOPE database exclusively from the files that were compiled. If a file is not compiled it will never show up during your code searches.

How to use bsp_cscope_gen.py?

bsp_cscope_gen.py can be used with Linux or U-boot code trees. Redboot is not supported yet.

Explanation for Linux kernel code tree:

Assume the following folder contains a compiled linux kernel tree:

/myfolder/with/linux

Assume the current directory is the same where bsp_cscope_gen.py is located.

$./bsp_cscope_gen.py /myfolder/with/linux

If everything went fine, the following files will be created under "/myfolder/with/linux":

cscope.filescscope.outcscope.out.incscope.out.po

Change your current working directory to  "/myfolder/with/linux" and VOILÁ. Now you execute CSCOPE directly, or better yet, integrate the CSCOPE database withvim.

To learn how to integrate CSCOPE with vim, check this tutorial I wrote.

Explanation for U-boot code tree:

Same as Linux case, but instead of specifying a Linux kernel tree directory you specify a U-boot code tree directory.

Example:

Let's assume you unpacked and compiled U-boot using LTIB, in a case like this your U-boot code tree will be located at something like:

..../ltib/rpm/BUILD/u-boot-2009.08

At the console execute:

$./bsp_cscope_gen.py ..../ltib/rpm/BUILD/u-boot-2009.08

If everything went fine, the following files will be created under "..../ltib/rpm/BUILD/u-boot-2009.08":

cscope.filescscope.outcscope.out.incscope.out.po

Change your current working directory to  "..../ltib/rpm/BUILD/u-boot-2009.08" and VOILÁ. Now you execute CSCOPE directly, or better yet, integrate the CSCOPE database with vim.

To learn how to integrate CSCOPE with vim, check this tutorial I wrote.