立即注册
查看: 6408|回复: 30

[MTK软件经验分享] MTK入门指导

已绑定手机
发表于 2017-11-25 14:25:04 | 显示全部楼层 |阅读模式 来自 广东省深圳市宝安区
MTK入门导读
作者:韩宇
时间:2005-6-30

文档内容:
-》MTK软件架构
-》如何编译
-》开发目录结构解析
-》开发工具的了解
-》程序入口,程序导读
-》MMI的制作

1. MTK软件构架参考文档:MT6218_SW_releaseNote.pdf
MTK为MediaTek公司提供的GSM软件方案。它包含5个部分:
-》L1协议
-》设备驱动
-》协议栈
-》MMI
-》WAP应用
MediaTek为用户提供3个工具:
-》Catcher
-》META
-》MCT
MTK软件架构图:
file:///C:\Users\ADMINI~1\AppData\Local\Temp\ksohtml\wps6AE5.tmp.jpg
下面3个部分组成该软件方案:
1. MS Executable Software, which is the software running on the MS, includes the following modules
- OS: Nucleus OS.
- L1 Protocol Stack: GSM physical layer.
- Drivers: device driver, like SIM, UART, GPIO, etc.
- L2/L3 protocol stack: GSM protocol stack layer.
- MMI: man-machine interface.
- WAP: Wireless application protocol.
- JAVA: J2ME Software
2. The Mobile Engineering Testing Architecture, also known as META
3. Catcher
-》OS
MediaTek采用Nucleus OS实时操作系统。KAL OS层为MediaTek’s软件和Nucleus操作系统的接口。它为任务提供许多系统服务函数,比如计时器,队列,内存管理,事件等等。
-》L1 Protocol Stack
The physical layer or Layer 1 supports the transfer of bit streams on the radio medium according to the Technical Specifications of the 05-series. It provides service to upper layers and control the mapping and scheduling between the logical and physical channels. The TDMA framing and radio control parts are also implemented.
file:///C:\Users\ADMINI~1\AppData\Local\Temp\ksohtml\wps6AF6.tmp.jpg
� Layer 1 Asynchronous: handles the message request from upper layers and forward the result generated by layer 1 to upper layer.
� Surrounding Cell Engine: handles the neighbor cell power measurement and neighbor cell synchronization information acquisition.
� Layer 1 Control: handles the TDMA scheduling on the radio environment, including timing advance and power control command from serving base station.
� Layer 1 Driver: handles the DSP and Radio control


-》Drivers
MCU外围设备的驱动,如下:
� SIM: Subscriber Identity Module
� UART: Universal Asynchronous Receiver/Transmitter
� SPI: Serial Port Interface
� LCD: Liquid Crystal Display
� GPIO: General Purpose Input/Output
� gpt: General Purpose Timer
� RTC: Real Time Clock
� WDT: Watch Dog Timer
� PWM: Pulse Width Modulation
� Alerter
� keypad
� PMIC: Power Management IC
� bmt: Battery Charging Management task
� AUX task: Auxiliary task
� ADC Sched.: Analog to Digital Converter Scheduler
� USB task: The USB 1.1 protocol and driver
� IrDA task: The IrDA and driver
� Camera: Camera driver for integrating with 3rd party camera module
� MSDC: Memory card driver, supporting SD, MMC cards and Memory Stick
� JPEG Decoder: Software for controlling hardware JPEG decoder

file:///C:\Users\ADMINI~1\AppData\Local\Temp\ksohtml\wps6B07.tmp.jpg
-》L2/L3/L4 Protocol Stack
这部分包含大量的GSM/GPRS需求以及提供一个优秀的GSM/GPRS平台给应用程序。本地MMI和远程PC通过AT命令可以方便的使用该软件平台。详细的结构如下:
� RMI: 远程MMI,比如PC端,可以使用AT命令通过串口与协议栈进行通讯。
� FMI: Feature rich MMI, described in the above section. This is the production co-worked with Pixtel.

� L4: Layer 4. L4 is a task through which FMI and/or RMI communicate with PS. L4 task includes several sub-modules.
� ATCI: AT command interpreter. Interprets the AT commands from PC side and commands the L4C to do the relative actions.
� L4A: L4 adaptation layer for FMI. The SAP between FMI and L4A is primitive base.
� L4C: L4 control entity. Handles all applications request and response.
� UEM: User equipments adaptation. Adaptation for drivers, like Keypad, LED, GPIO, Audio…etc.
� PHB: Phone book management. Handles the phone books related processing, like: sorting…etc.
� SMU: SIM management unit. Handle the security management, and STK.
� CSM: Circuit switching protocol stack management.
� RAC: Registration access control.
� SMSAL: Short message service application layer.
� TCM: Terminal context management.
� NVRAM: Non-volatile RAM. This is adaptation layer to flash memory.
� SIM: Subscriber identity module. Handle SIM behavior as ETSI 11.11 description.

� DATA: Circuit switched data service. Data task includes several sub-modules.
� FAX: Group 3 Facsimile.
� TDT: Transparent circuit switching data.
� L2R: Layer 2 relay protocol for non-transparent circuit switching data.
� RLP: Radio link protocol for non-transparent circuit switching data.
� CC: Circuit-switched call control.
� SS: Supplementary service.

� SMS: Short message service.

� SM: Session management.

� MM/GMM: Mobility management/GPRS mobility management.

� SNDCP: Subnetwork dependent convergence protocol.

� LLC: Logical link control.

� RR: Radio resource management. RR task includes several sub-modules.
� RRM: Handles cell selection and PLMN selection.
� RMPC: Handles the procedures in Idle/Dedicated state including the surrounding cell scheme and measurement reporting.
� LAPDM: Handles the procedure defined in GSM layer 2.
� RLC: Radio link control protocol.
� MAC: Medium access control protocol.
� MPAL: Adaptation layer for RR and L1A.

� PPP: Point to Point protocol layer. This is client PPP layer.

file:///C:\Users\ADMINI~1\AppData\Local\Temp\ksohtml\wps6B18.tmp.jpg
-》MMI
这部分包括用户的接口架构,应用以及和协议栈的通讯。

file:///C:\Users\ADMINI~1\AppData\Local\Temp\ksohtml\wps6B19.tmp.jpg
� Framework: This covers that
� OSL: OS adaptation layer
� Task: communication with L4 task.
� File system: communication with storage device.
� GUI: This covers that
� Theme
� UI component
� Category screen
� Font
� Editor
� T9 or Ezi input method.
� Access LCD driver.
� Customization tool.
� Application
� Phonebook
� Messages (SMS, EMS 4.0, CB)
� Call history
� Setting. (Phone setting, network setting, security setup)
� 5 kinds of user profiles
� Fun and games
� Organizers
� services
� Shortcuts
� In call management.
� Interrupt events, like charging , alarm.

-》WAP
2. 如何编译
参考文档:wcr-MTK_MakeBuild_Design_Customer_040930.pdf
    操作系统:Windows 2000, WiNXP. 推荐Windows 2000 with SP2 or later.
    编译器:ADS (Arm Developer Suite) v1.2.
    Perl解析:ActivePerl.推荐使用ActivePerl 5.6.1版本
-》make.bat
    It will parse command line to determine project name, platform, and action. Meanwhile, checking \make directory exist or not and checking command line argument is legal or not. After checking, to execute build script GSM2.mak build script to perform action.
使用:
Usage: Make [custom=customername] <project> <platform> <action> [module]"
custom = Monza
project = GPRS (GSM only)
action = new (clean, scan, compile, link) (default)
= update (scan, compile, link)
= remake (compile, link)
= clean (clean)
module = component module name (nucleus, l1, ...)

Example:
To make/build new GPRS project, clean all old objects, libraries, and log files etc., the new action also creates necessary directories and reMOVes all temporary files, and flushes log files automatically.
d:>\pvcs\maui\mcu\Make custom=Monza GPRS new
To update project dependency, and compile changed modules, link. Notice that, update and remake action won’t remove temporary files, and flush log file. Build results will be append after last log file.
d:>\pvcs\maui\mcu\Make custom=Monza GPRS update
To recompile changed files, and link
d:>\pvcs\maui\mcu\Make custom=Monza GPRS remake
To clean all objects, temporary files, libraries, and executable binaries. Meanwhile log file will also be flushed.
d:>\pvcs\maui\mcu\Make custom=Monza GPRS clean
To clean dedicated init modules’ objects libraries. Meanwhile log file will also be flushed.
d:>\pvcs\maui\mcu\Make custom=Monza GPRS clean init

-》how to customize your build environment
!!!To add some modules into or remove some modules from the building procedure.
To complete this kind of configuration, it is necessary to understand the following variables in the make file
Monza_GPRS.mak
&#65533; COMPLIST: list all source code modules can be built to .lib. In initial custom release, COMPLIST
should be the sum of CUS_REL_SRC_COMP and CUS_REL_PAR_SRC_COMP. The following is the initial setting in custom release.
ifeq ($(strip $(CUSTOM_RELEASE)),TRUE)
COMPLIST = $(strip $(CUS_REL_SRC_COMP))
COMPLIST += $(strip $(CUS_REL_PAR_SRC_COMP))
endif
&#65533; CUS_REL_MTK_COMP: list all modules provided with .lib only. These .lib are put in \mcu\mtk_lIBS.
&#65533; If you want to add a source module
1. add the module "xyz" (in lower case) into COMPLIST.
ifeq ($(strip $(CUSTOM_RELEASE)),TRUE)
COMPLIST = $(strip $(CUS_REL_SRC_COMP))
COMPLIST += $(strip $(CUS_REL_PAR_SRC_COMP))
COMPLIST += xyz
endif
2. add a folder “mcu\make\xyz” for xyz.lis, xyz.inc, xyz.pth, xyz.def.
-》编译生成的文件以及log
   1.编译的log在目录C:\code_100\build\a100中的MT6218B.log。目录C:\code_100\build\a100\log下的log文件为各个模块编译时生成的log。
   2.编译生成的bin为C:\code_100\build\a100下的a100_PCB01_gprs_MT6218B_FN.W05_12.bin。
   3.编译生成的目标文件在C:\code_100\build\a100\gprs\MT6218Bo目录中。

3. 开发目录结构解析参考文档:wcr-MTK_MakeBuild_Design_Customer_040930.pdf
目录结构:
目录名称
目录描述
build
Generated object, libraries, executable binary and log files directory. The directory will be created
automatically. For details, see “Generated Objects, Libraries, Executable Binary and Log Files” sections.
make
Main build scripts and option file directory.

nucleus

Nucleus Plus RTOS source codes directory include C, Assembly, and included header files.

init

System boot and hardware dependent initialization directory. Meanwhile, exception handling, and interrupt service routine dispatcher are also placed here.

inc

System boot, initialization, layer1, and driver modules common included header files directory.

l1

Layer 1 source codes directory.

drv

Driver modules source codes directory.

custom

Custom’s task/modules’ sources and header files

Fast_DL

Cmm files for fast download

tools

Miscellaneous tools used in build/make and customer release procedures

mtk_libs

Component libraries provided my MediaTek.

tst

Database for trace

verno

Source code for keeping version information


4. 开发工具的了解参考目录《工具》中的文件。
   工具:
-》Catcher
Catcher is a PC-side tool for MTK GSM/GPRS Products. The main purpose of Catcher is for logging primitives and debug information. Engineers can use Catcher to analyze the behavior of mobile phones.
-》META
META (Mobile Engineering Testing Architecture) is designed to provide the functionality of RF testing, NVRAM access testing, speech related testing of advanced feature – melody and voice memo.
-》MCT
UI制作工具,包括菜单制作,图片制作,字体制作等等。
file:///C:\Users\ADMINI~1\AppData\Local\Temp\ksohtml\wps6B2A.tmp.jpg

5. 程序入口,程序导读
-》MMI任务入口:
C:\code_100\plutommi\mmi\Framework\Tasks\TasksSrc
中文件MMITask.c函数MMI_task。
-》MMI任务的建立:
C:\code_100\plutommi\mmi\Framework\Osl\OslSrc
中文件pixtelMMI.c函数WinMain调用InitApplication函数,在该函数中建立MMI任务,建立任务的接口函数为:osl_create_task。
-》MMI任务信息:
        {"MMI TASK"(任务名称), "MMI Q"(队列名称), 127(优先级), 4096(堆栈大小), MAX_PRT_NODES(队列结点个数), MMI_task(任务入口)},
-》MMI模块入口:
目录C:\code_100\plutommi\mmi中为MMI各个模块的代码。比如闹钟模块,源代码在C:\code_100\plutommi\mmi\Alarm\AlarmSrc中,头文件在C:\code_100\plutommi\mmi\Alarm\AlarmInc中。首先找到初始化闹钟的函数AlmInit,该函数定义在选择闹钟菜单项时调用函数HighlightAlmMenu进入闹钟功能。
6. MMI的制作
参考文档:
文件名
文件内容描述
API For Writing Applications Using Pixtel MMI Platform.pdf

各类窗口列表
Writing Applications Using Pixtel MMI Platform.pdf
如何写应用程序
MMI 2.0 Design DOC和MMI Design Doc目录中对MMI中的各个模块进行描述,因此在研究某一模块时可以在这两个文件夹中找到该模块的介绍,通过这些文档可以加速对该模块编码的理解。
MMI的模块在路径C:\code_100\plutommi中。
-》设计一个应用程序的流程如下: -
1. Write an Initialization function to register the various event handlers.
2. Write a populate function to register various string and image elements for the
application.
3. Write highlight handlers for function registered.菜单项的功能,当用户选择菜单项后执行的函数。
4. Write the Entry functions。入口函数
5. Write the Exit function。出口函数
6. Write the business logic to call between various entry functions.
已绑定手机
发表于 2017-12-1 11:39:23 | 显示全部楼层 来自 上海市
ddddddddddddddd
发表于 2018-6-13 18:56:11 | 显示全部楼层 来自 内蒙古
好资料
已绑定手机
发表于 2018-6-13 19:10:09 | 显示全部楼层 来自 广东省深圳市
thanks
已绑定手机
发表于 2018-6-14 09:39:30 来自手机 | 显示全部楼层 来自 江苏省扬州市
谢谢分享经验
已绑定手机
发表于 2018-6-16 09:52:05 | 显示全部楼层 来自 广东省深圳市
谢谢分享
已绑定手机
发表于 2018-6-19 10:39:25 | 显示全部楼层 来自 广东省深圳市
已绑定手机
发表于 2018-6-20 09:47:19 | 显示全部楼层 来自 浙江省杭州市
谢谢分享
发表于 2018-6-20 10:28:20 | 显示全部楼层 来自 广东省深圳市
?????????????????
已绑定手机
发表于 2018-6-30 09:38:01 | 显示全部楼层 来自 广东省中山市
vb v jap gjgjsda
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

合作/建议

TEL: 19168984579

工作时间:
周一到周五 9:00-11:30 13:30-19:30
  • 扫一扫关注公众号
  • 扫一扫打开小程序
Copyright © 2013-2024 一牛网 版权所有 All Rights Reserved. 帮助中心|隐私声明|联系我们|手机版|粤ICP备13053961号|营业执照|EDI证
在本版发帖搜索
扫一扫添加微信客服
QQ客服返回顶部
快速回复 返回顶部 返回列表