OpenEdv-开源电子网

 找回密码
 立即注册
正点原子全套STM32/Linux/FPGA开发资料,上千讲STM32视频教程免费下载...
查看: 9897|回复: 3

STM8 IAR编译问题

[复制链接]

12

主题

51

帖子

0

精华

中级会员

Rank: 3Rank: 3

积分
292
金钱
292
注册时间
2014-3-6
在线时间
31 小时
发表于 2014-8-28 10:08:18 | 显示全部楼层 |阅读模式
5金钱
最近开始学习STM8L系列的,用的是ST官方开发的STM8L-DISCOVER开发板,从ST官网下载了一些例程来学习,原来的工程因为和现在IAR版本不一致无法打开,我就自己建一个工程,添加文件发现编译之后提示
Error[Lc036]: no block or place matches the pattern "ro code section MY_RAM_FUNC in discover_functions.o" 
一直找不到原因,不知道哪位大神有没有解决的方法

附件是官网下载的例程

stsw-stm8009.zip

8.83 MB, 下载次数: 2426

正点原子逻辑分析仪DL16劲爆上市
回复

使用道具 举报

530

主题

11万

帖子

34

精华

管理员

Rank: 12Rank: 12Rank: 12

积分
165186
金钱
165186
注册时间
2010-12-1
在线时间
2106 小时
发表于 2014-8-28 23:31:36 | 显示全部楼层
回复

使用道具 举报

12

主题

51

帖子

0

精华

中级会员

Rank: 3Rank: 3

积分
292
金钱
292
注册时间
2014-3-6
在线时间
31 小时
 楼主| 发表于 2014-8-29 15:17:35 | 显示全部楼层
- For IAR Compiler:
    1- Define a location FLASH_CODE before each code function by the mean of 
    " #pragma location = "FLASH_CODE"".
    This location is defined in the stm8l15x_flash.c file, and it's conditionned
    by IAR_RAM_EXECUTION definifition.
  2- Uncomment the "#define IAR_RAM_EXECUTION  (1)" line in the stm8l15x.h file,
    or define it in IAR compiler preprocessor to enable the FLASH_CODE location 
    definition.
  3- Edit the linker file lnkstm8l15xxx.icf available under 
    "$\IAR Systems\Embedded Workbench 6.0\stm8\config\lnkstm8l15xxx.icf"
       by updating the line "initialize by copy { rw, ro section .tiny.rodata };"
       with the the following one:
       "initialize by copy { rw, ro section .tiny.rodata, section FLASH_CODE};".
  4- The speed optimization is required to ensure proper execution from RAM.
    -> In IAR Embedded workbench IDE Select roject\Options\C/C++ Compiler\Optimizations
    select speed optimization

stm8l15x_flash.c 文件里有这段说明,不这段说,而我的代码是
#pragma location="MY_RAM_FUNC"
void LPR_Ram(void)

  uint8_t i = 0;

/* To reduce consumption to minimal 
  Swith off the Flash */
  FLASH->CR1 = 0x08;
  while(((CLK->REGCSR)&0x80)==0x80);

/* Swith off the Regulator*/
  CLK->REGCSR = 0x02;
  while(((CLK->REGCSR)&0x01)==0x01);

/* Set trigger on GPIOE pin6*/ 
  WFE->CR2 = 0x04;
  GPIOE->CR2 = 0x44;
  
  for (i=0; i<100; i++);

/* To start counter on falling edge*/
//  GPIO_LOW(CTN_GPIO_PORT,CTN_CNTEN_GPIO_PIN);
  
/*Wait for end of counter */
  wfe();
  
  EXTI->SR1 |= 0x40;
  WFE->CR2 = 0x00;
  
  //Switch on the regulator
  CLK->REGCSR = 0x00;
  while(((CLK->REGCSR)&0x1) != 0x1);
}

编译之后就Error[Lc036]: no block or place matches the pattern "ro code section MY_RAM_FUNC in discover_functions.o"

上面说明的第3点无法理解,求高人帮忙看下
回复

使用道具 举报

2

主题

3

帖子

0

精华

新手入门

积分
31
金钱
31
注册时间
2014-10-9
在线时间
0 小时
发表于 2014-12-4 15:38:16 | 显示全部楼层
回复【3楼】xiaosi204:
---------------------------------
我也遇到和你一样的问题了
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则



关闭

原子哥极力推荐上一条 /2 下一条

正点原子公众号

QQ|手机版|OpenEdv-开源电子网 ( 粤ICP备12000418号-1 )

GMT+8, 2024-9-30 06:19

Powered by OpenEdv-开源电子网

© 2001-2030 OpenEdv-开源电子网

快速回复 返回顶部 返回列表