STVD -> 报错:#error cpstm8 ..\inc\stm8s.h:75 “Please select first the target STM8S/A device used...

文章描述了在STM8S微控制器的开发过程中遇到的编译错误,具体是由于在stm8s.h头文件中没有选择正确的STM8S/A设备宏导致。解决方案是进入stm8s.h文件,根据所使用的STM8S型号(如STM8S003)取消对应宏的注释,以启用正确的设备定义。
摘要由CSDN通过智能技术生成

报错信息:

#error cpstm8 ..\inc\stm8s.h:75 "Please select first the target STM8S/A device used in your application (in stm8s.h file)" #error cpstm8 ..\inc\stm8s.h:2708 can't open stm8s_conf.h

报错

代码:

/* MAIN.C file
 * 
 * Copyright (c) 2002-2005 STMicroelectronics
 */
#include "stm8s.h"
void main(void)
{
	while (1);
}

#ifdef USE_FULL_ASSERT

/**
  * @brief  Reports the name of the source file and the source line number
  *   where the assert_param error has occurred.
  * @param file: pointer to the source file name
  * @param line: assert_param error line source number
  * @retval None
  */
void assert_failed(uint8_t* file, uint32_t line)
{ 
  /* User can add his own implementation to report the file name and line number,
     ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */

  /* Infinite loop */
  while (1)
  {
  }
}
#endif

/**
  * @}
  */


/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

原因:

  • 由报错信息得知,虽然包含了stm8.h,但未开启该头文件中关于MCU类型的宏

解决方案:

  • 进入stm8.h头文件,发现在未定义下述宏时,会报错
    在这里插入图片描述
  • 根据自己的STM8S型号(本文用到的是STM8S003),在stm8.h头文件中找到被注释的宏,取消注释
    MCU宏定义列表
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值