本帖最后由 夏日的冰74 于 2016-10-14 10:17 编辑
CCS环境点亮LED根据IAR开发环境的思路,CCS也一样,先导入D:AM335X_StarterWarebuild ARMv7accs下的四个驱动工程,编译。然后导入gpio工程,右键工程proper ties,设置include(默认设置好)、还有编译器、芯片型号。 主意调试的时候把M3核的勾去掉,否则调试时会出错。
新建属于自己的CCS工程编译成库的形式 1、新建工程编译drivers,新建空的工程并选择输出lib文件,这里选择TI编译器。需要在工程中添加am335x 和am335x_15x15的宏定义,右键工程build->ARM Compiler->Advanced Options->Predefine设置全局宏定义。 2、添加include的路径,build->ARM Compiler->include,主意使用全局变量设置路径,方便移植。 3、然后在build->ARM Compiler中的Summand of flag set的编译选项中如果没有--gcc的选项需要加上,否则编译也会出错。 4、后续编译其他的库也需要参照例程上的编译选项设置,然后设置lib输出路径Build->ARM Archiver->Basic 5、其他的3个工程system、platform、utils一样的步骤。 6、新建app工程,类似上面的步骤,另外需要将u***lib/include的库文件也需要包含进来。 7、主意debug和release的设置是分开的,需要设置两次。 8、所有的include路径和全局宏定义、编译参数都参照StarterWare是不会有错的。 9、重新建完全源文件的工程,没有lib库,编译命令(后来又新建一个没有lib的工程,把lib的c文件一起编译)
下面是配置好之后编译的GCC命令,可以在ARM Compiler选项中查看
-mv7A8 --code_state=32 --abi=eabi -me --include_path="D:/ccs6.0/ccsv6/tools/compiler/arm_5.1.5/include" --include_path="C:/Users/jimy/Desktop/AM335x_v0.2/Lib/include" --include_path="C:/Users/jimy/Desktop/AM335x_v0.2/Lib/include/armv7a" --include_path="C:/Users/jimy/Desktop/AM335x_v0.2/Lib/include/armv7a/am335x" --include_path="C:/Users/jimy/Desktop/AM335x_v0.2/Lib/include/hw" --include_path="C:/Users/jimy/Desktop/AM335x_v0.2/BSP/inc" --include_path="C:/Users/jimy/Desktop/AM335x_v0.2/Lib/u***lib/include" -g --gcc --define=am335x --define=am335x_15x15 --define=DMA_MODE --display_error_number --diag_warning=225 --neon --unaligned_access=on --enum_type=packed
如果不想将各种源文件编译成库怎么办?在自己新建一个工程后,将这些库的源文件全都提取出来放在自己的工程目录下,我将他们全放置在我的Lib目录下,配置方面也有些区别:(稍后会将工程上传至github)
1、Include OPtion 添加 "${PROJECT_LOC}/../Lib/include" "${PROJECT_LOC}/../Lib/include/armv7a" "${PROJECT_LOC}/../Lib/include/armv7a/am335x" "${PROJECT_LOC}/../Lib/include/hw" "${PROJECT_LOC}/../BSP/inc" "${PROJECT_LOC}/../Lib/u***lib/include"
2、Predefined Symbols 添加 am335x am335x_15x15 DMA_MODE
3、Build->steps->post build 修改
//这里为什么要这样修改,在后续的文章在分析。
"${CCS_INSTALL_ROOT}/utils/tiobj2bin/tiobj2bin.bat" "../../../../../../../binary/armv7a/cgt_ccs/am335x/beaglebone/gpio/${ConfigName}/${ProjName}.out" "../../../../../../../binary/armv7a/cgt_ccs/am335x/beaglebone/gpio/${ConfigName}/${ProjName}.bin" "${CG_TOOL_ROOT}/bin/armofd.exe" "${CG_TOOL_ROOT}/bin/armhex.exe" "${CCS_INSTALL_ROOT}/utils/tiobj2bin/mkhex4bin.exe" & "../../../../../../../tools/ti_image/tiimage.exe" "0x80000000" "NONE" "../../../../../../../binary/armv7a/cgt_ccs/am335x/beaglebone/gpio/${ConfigName}/${ProjName}.bin" "../../../../../../../binary/armv7a/cgt_ccs/am335x/beaglebone/gpio/${ConfigName}/${ProjName}_ti.bin"
改成:
"${CCS_INSTALL_ROOT}/utils/tiobj2bin/tiobj2bin.bat" "${PROJECT_LOC}/${ConfigName}/${ProjName}.out" "${PROJECT_LOC}/${ConfigName}/${ProjName}.bin" "${CG_TOOL_ROOT}/bin/armofd.exe" "${CG_TOOL_ROOT}/bin/armhex.exe" "${CCS_INSTALL_ROOT}/utils/tiobj2bin/mkhex4bin.exe" & "${PROJECT_LOC}/../tools/ti_image/tiimage.exe" "0x80000000" "NONE" "${PROJECT_LOC}/${ConfigName}/${ProjName}.bin" "${PROJECT_LOC}/${ConfigName}/${ProjName}_ti.bin"
4、Basic Option 修改 "../../../../../../../binary/armv7a/cgt_ccs/am335x/beaglebone/gpio/${ConfigName}/${ProjName}.out"
改成:
"${PROJECT_LOC}/${ConfigName}/${ProjName}.out"
去掉--stack和--heap的值
5、Linker Output 修改 "../../../../../../../binary/armv7a/cgt_ccs/am335x/beaglebone/gpio/${ConfigName}/${ProjName}_linkInfo.xml"
改成:
"${PROJECT_LOC}/${ConfigName}/${ProjName}_linkInfo.xml"
6、ARM Compiler添加 --unaligned_access=on --enum_type=packed --neon
7、ARM Linker
-m"${ProjName}.map" -i"${CG_TOOL_ROOT}/lib" -i"${CG_TOOL_ROOT}/include" --reread_libs --warn_sections --xml_link_info="${PROJECT_LOC}/${ConfigName}/${ProjName}_linkInfo.xml" --ram_model
8、Build -> Builder 去掉User default build command的勾
|