K60建立工程
新手操作建立KEIL和IAR項目及配置
- 一、在Keil建立項目并配置;
- 二、在IAR建立項目并配置
一、在Keil建立項目并配置;
1.建立KEIL項目,右擊項目名,manage Project items,在Groups 中添加項目文件夾startup(啟動頭文件存放位置)、user(用戶文件,主要是main.c);
2.把芯片的啟動文件(
startup_MK60D10.s
system_MK60D10.c
system_MK60D10.h
MK60D10.h
)拷貝到項目文件夾內(nèi)(可以建一個專門的文件夾);
3.在Manage Project items 中把2里的啟動文件
startup_MK60D10.s
system_MK60D10.c
添加到startup目錄下,建一個main.c文件添加在main目錄下;
5.在軟件安裝目錄CMSIS\Include中找到芯片的編譯文件(
core_cm4.h
core_cmFunc.h
core_cmInstr.h
core_cmSimd.h
)拷貝到startup文件夾內(nèi);
4.點option for taget
①Device 可選擇芯片型號;
②C/C++ 點NO Auto include ,然后把在Include Paths 中關(guān)聯(lián)startup文件夾(5.里面的);
③Debug 右邊use 選J-Link/J-TRACE Cortex (使用J-Link仿真)點旁邊的setting,可以設(shè)置J-Link仿真的模式 JTAG or SW 設(shè)置速度;
④Utilities 在Ues Target Driver for Flash Programming 點settings,Erase 擦除,Sectors 一部分,點reset and run,在下面ADD 芯片搭載的Flash,確定。
⑤下載并允許,如果報錯verify failed,在option/utilities/settings 中關(guān)掉verify;不影響程序運行。
Keil基本配置完成。
二、在IAR建立項目并配置
1.create new project,工具欄Project/Add group 添加startup、user 兩個下級目錄;
2.把芯片的啟動文件(
startup_MK60D10.s
system_MK60D10.c
system_MK60D10.h
MK60D10.h
以及
core_cm4.h
core_cmFunc.h
core_cmInstr.h
core_cm4_simd.h
)拷貝到項目文件夾內(nèi)(可以建一個專門的文件夾);除startup_MK60D10.s這個文件與keil不一樣,其他三個是一樣的;
3.在項目的startup 條目上右擊ADD,添加
startup_MK60D10.s
system_MK60D10.c
這兩個文件。
4.在user中添加main.c 文件;
5.項目上右擊option,在General Options 在中把Device 改成
MK60DN512XXX10;
6.同5,在C/C++ comiler 中選擇 Preprocessor 在Additional include directories 中添加內(nèi)核文件(core_cm4.h、core_cmFunc.h、core_cmInstr.h、core_cm4_simd.h)的路徑項目文件夾內(nèi)startup文件夾。選用相對路徑。
7.同5,在Assembler 中選擇 Preprocessor 在在Additional include directories 中添加路徑startup,選用相對路徑;
8.最后OK.
9.Projiec/Download/Download active application,下載到板子,或者點Download and debug.在線調(diào)試。
總結(jié)
- 上一篇: 基于stc15f2k60s2芯片单片机编
- 下一篇: [html] 写一个三栏布局,两边固定