新聞中心

EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > 使用IAR如何修改STM8S庫(一)

使用IAR如何修改STM8S庫(一)

作者: 時(shí)間:2016-11-24 來源:網(wǎng)絡(luò) 收藏
注意:以下修改在IAR for STM8 1.10 SP3下驗(yàn)證,庫文件為IAR自帶的1.1.1

1、選擇CPU類型(支持STM8S系列設(shè)備)

本文引用地址:http://butianyuan.cn/article/201611/320848.htm

stm8s.h

...

/* Uncomment the line below according to the target STM8S device used in your

application.

Tip: To avoid modifying this file each time you need to switch between these

devices, you can define the device in your toolchain compiler preprocessor. */

#if !defined (STM8S208) && !defined (STM8S207) && !defined (STM8S105) && !defined (STM8S103) && !defined (STM8S903)

#define STM8S208

/* #define STM8S207 */

/* #define STM8S105 */

/* #define STM8S103 */

/* #define STM8S903 */

#endif

根據(jù)你的CPU類型選擇宏定義,比如我這里用的是105系列,則修改為:

/* #define STM8S208 */

/* #define STM8S207 */

#define STM8S105

/* #define STM8S103 */

/* #define STM8S903 */

選擇好CPU類型后,還需查看選擇的類型中哪些外設(shè)是包含的哪些外設(shè)沒有包含,將沒有包含的外設(shè)驅(qū)動(dòng)c文件在工程中去掉

如105系列沒有adc2、can、uart1、uart3

2、修改stm8s_conf.h文件

選擇好CPU類型后,接下來就是選擇要使用的外設(shè)了,stm8s_conf.h就是外設(shè)驅(qū)動(dòng)選擇開關(guān),在用戶函數(shù)中,只需包含此頭文件即可。

比如程序中需要使用到SPI外設(shè),則將此文件的

/************************************* SPI ************************************/
/* #define _SPI (1) */

修改為:

/************************************* SPI ************************************/
#define _SPI (1)



關(guān)鍵詞: IARSTM8S

評(píng)論


技術(shù)專區(qū)

關(guān)閉