初学者入门篇——config.bib学习

//-------------------------------------------------------------------------------------------------

// Topic:初学者入门篇——config.bib学习

// 作者:gooogleman

// 版权:桂林电子科技大学一系科协wogoyixikexie@gliet.gooogleman

// 平台:wince5.0 2440 5.0 BSP (飞凌FL2440开发板)

// 发布日期:2009年11月22日

// 最后修改:

//技术论坛:http://www.gooogleman.com/forum.php

// 注意事项:商业网站未经作者同意不能转载,否则追究责任!

//-------------------------------------------------------------------------------------------------

作者:gooogleman
   呵呵,晕死了,公司调休,今天还要上班,不过昨天我把动态调整camera的驱动和应用都做好了。QQ也没有啥人,还是写一篇入门文章吧——config.bib
   config.bib是配置wince系统内存的,呵呵。其实PB帮助写的很详细了,我现在只是补充一点个人经验而已,非常菜鸟,希望对新手有点帮助。下面就以飞凌的FL2440 BSP中的config.bib为例子。
MEMORY
    NK                                80200000  02200000  RAMIMAGE
    RAM                                82400000  01c00000  RAM
——》RAM就是 wince系统控制面板上显示的内存总量,如果还有不连续使用的内存,那么就会再次加上。PB帮助如下
Specifies the range of virtual addresses available to the kernel for allocation to running processes and the RAM-based Windows CE-based file system. The region must be contiguous. Do not reserve memory in the middle of a RAM section. Doing so creates two noncontiguous regions of memory, which is the maximum supported by Windows CE.(wince支持最大两块不连续的内存!) If you need to reserve memory in the middle of your RAM allocation, a portion of free RAM is reported in the Config.bib file and the rest is reported when the kernel calls OEMGetExtensionDRAM or pNKEnumExtensionDRAM.——有非连续内存就是用这两个函数实现,O(∩_∩)O哈哈哈~俺的128M SDRAM就是这么做成功的。RAM sections must be page aligned.——》还必须夜对齐!

——》RAMIMAGE
Specifies that the region should be treated like RAM. The memory addresses in this entry can physically correspond to RAM or to linear flash memory. This memory-type value is useful when loading the ROM image into RAM during the development process or when burning the run-time image onto a single ROM.
RAMIMAGE有点像RAM,他的内存地址入口和RAM或者线性flash内存对应。意思就是说80200000(虚拟地址)会和实际的内存地址对应上,具体是哪个要看内存映射表。这个内存用来加载ROM image 到RAM:这就是为什么wince控制面板里面显示的内存大小不是实际的物理内存大小的原因,正确的应该是=实际物理内存大小-RAMIMAGE size(如果实现了XIP ,就会节省内存,呵呵,这个我也没有做过)
------------------------------------------------------------------------
The kernel copies all writable sections for an application into RAM and fixes the memory addresses prior to starting the application process.
------------------------------------------------------------------------
The name used to describe a RAMIMAGE section must be the same name used in the .bib file that specifies the modules and files to add to the run-time image.
?这是啥意思???
-------------------------------------------------------------------------
Romimage generates one .bin file for each RAMIMAGE entry.
Romimage会给每个RAMIMAGE 项生成一个bin文件(bin文件是微软自己弄的一套格式,主要是压缩并且加入一些组织信息,以利于binfs等实现XIP)
After you run Romimage, all noncompressed executable code is fixed up to run at a virtual address in slot 0, which is an address space created by the kernel.
——》当运行Romimage的时候,所有非压缩的可执行代码就会固定到slot 0中的虚拟地址运行,(slot 0是由内核创建的地址空间,呜呜以前看过,现在都有点忘记了,呵呵,大家一起交流,一起进步!)

The actual source code resides in the address range specified in the corresponding RAMIMAGE entry.
——》实际的代码驻留在RAMIMAGE 项对应的地址范围



下面都是预留给DMA使用的,注意要连续分配,产生空洞后系统是不能使用的,会浪费掉,至于AUD_DMA 等名字是可以自己随便命名的。
并且下面的启示地址在驱动中要对应上,不然就会出问题。拿显示驱动来说吧   80100000  这个东西是要在显示驱动或者LCD buffer显示中用到的。
; Common RAM areas
        AUD_DMA             80002000  00000800  RESERVED
        SDIO_DMA            80010000  00010000  RESERVED
        ARGS                80020800  00000800  RESERVED
        DBGSER_DMA          80022000  00002000  RESERVED
        SER_DMA             80024000  00002000  RESERVED
        IR_DMA              80026000  00002000  RESERVED
        SLEEP               80028000  00002000        RESERVED
        EDBG                80030000  00020000  RESERVED
        DISPLAY             80100000  00100000  RESERVED   

CONFIG
    COMPRESSION=ON
    KERNELFIXUPS=ON

IF IMGPROFILER   
    PROFILE=ON
ELSE
    PROFILE=OFF
ENDIF

;
; ROMFLAGS is a bitmask of options for the kernel
;   ROMFLAGS    0x0001      Disallow Paging
;   ROMFLAGS    0x0002      Not all KMode
;   ROMFLAGS    0x0010      Trust Module only
;
IF IMGTRUSTROMONLY
    IF IMGNOTALLKMODE
       ROMFLAGS=12
    ELSE
       ROMFLAGS=10
    ENDIF
ELSE
    IF IMGNOTALLKMODE
       ROMFLAGS=02
    ELSE
       ROMFLAGS=00
    ENDIF
ENDIF

        ROMSTART = 80200000——》看看合RAMIMAGE有啥共同之处?一样的
        ROMWIDTH = 32
        ROMSIZE  = 02200000——》看看合RAMIMAGE有啥共同之处?一样的
据我经验这个ROMSIZE  就是nk.nb0的大小,即使你的nk.bin只有1M,他也会是等于02200000,实际运行的是nk.nb0,所以大家要注意,组件不要选的太多,否则就会打包失败!

  呵呵,还有一些细节等我以后再补充了。总之PB帮助都有的,现在想干啥,看PB帮助就OK了,很多教材都是根据他改动过来的。

  

享。
原文地址:https://www.cnblogs.com/gooogleman/p/1857167.html