KITL(Kernel Independent Transport Layer)即内核独立传输层,它为我们提供了一种调试WinCE的简便方法。KITL将通信服务协议和用于通信的硬件分离开来。所以我们在创建硬件传输层时就省去很多麻烦,否则我们自己必须实现与设备进行数据交互的协议。KITL工作在硬件传输层之上,因此,它无须关心用于通信的具体硬件,我们可以用USB、Serial或者Ethernet作为KITL的调试通道。具体选择哪一个,由硬件平台和软件资源决定。有些设备没有Ethernet和Serial接口,所以只能采用USB,如Mobile设备。如果系统采用了EBOOT,则建议使用Ethernet作为调试通道。这时,配置KITL的代价相对来说也很小。无论如何,KITL相当强大,在BSP的移植过程中,花一些时间来实现KITL的功能是完全值得的。完成KITL之后,你会发现所有的时间都没有白花。由于KITL的实现,后续的调试节省了很多时间。磨刀不误砍柴工!工欲善其事,必先利其器!我深有体会!:-D以前没有认识到KITL的强大,一直没有碰它。最近在实现KITL的功能之后,随即顺利调通了几个顽固的驱动。虽然问题本身不值一提,但没有KITL时,驱动出了状况,内核就挂了,不知道挂在哪里,无从下手,也不好分析。而KITL可以帮助我们定位出现问题的位置。KITL,一用就知道是我想要的。BTW:按启动顺序来说,KITL启动应该在OAL之后,内核之前。所以,必须先完成OAL的移植,才能进一步移植KITL。
// Print banner. Will remove when KITL-over-ethernet support is dropped // (in M3) KITLOutputDebugString("\n*********************************************\n"); KITLOutputDebugString("* *\n"); KITLOutputDebugString("* This image uses KITL-over-ethernet *\n"); KITLOutputDebugString("* *\n"); KITLOutputDebugString("* PB Connectivity Options must be set to: *\n"); KITLOutputDebugString("* Download: \"Device Emulator\" *\n"); KITLOutputDebugString("* Transport: \"Ethernet\" *\n"); KITLOutputDebugString("* *\n"); KITLOutputDebugString("*********************************************\n\n");
// Look for bootargs left by the bootloader or left over from an earlier boot. // pArgs = (OAL_KITL_ARGS*)OALArgsQuery(OAL_ARGS_QUERY_KITL); szDeviceId = (CHAR*)OALArgsQuery(OAL_ARGS_QUERY_DEVID);
// If we don't have bootargs in RAM, look first in NOR flash for the information // otherwise look on the SmartMedia NAND card (in case we're peRForming a NAND-only) boot. // if (pArgs == NULL) { SectorInfo si; UINT8 maccount =0;
// Get MAC address from NAND flash // if (FMD_Init(NULL, NULL, NULL) == NULL) { KITL_RETAILMSG(ZONE_ERROR, ("ERROR: Failed to initialize NAND flash controller.\r\n")); return(FALSE); }
// If block 0 isn't reserved, we can't trust that the values we read for the MAC address are // correct. They may actually be valid logical sector numbers (we're overloading the use // of the logical sector number field). // if (!(FMD_GetBlockStatus(0) & BLOCK_STATUS_RESERVED)) { KITL_RETAILMSG(ZONE_ERROR, ("ERROR: Block 0 isn't reserved - can't trust MAC address values stored in NAND.\r\n")); return(FALSE); }
// We know the first block of NAND flash must be good, so we needn't worry about bad blocks when reading. // maccount =0; do { if (!FMD_ReadSector(maccount, NULL, &si, 1)) { KITL_RETAILMSG(ZONE_ERROR, ("ERROR: NAND flash read error (sector = 0x%x).\r\n", maccount)); return(FALSE); }
// If there isn't a device ID from the bootloader create one. // if (szDeviceId == NULL) { OALKitlCreateName(BSP_DEVICE_PREFIX, pArgs->mac, buffer); szDeviceId = buffer; }
文章评论(0条评论)
登录后参与讨论