Avr-libc 升级导致的代码兼容问题

内核编译和嵌入式产品的设计与开发
回复
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

Avr-libc 升级导致的代码兼容问题

#1

帖子 eexpress » 2014-06-01 15:43

2年前的代码,突然不能编译了。显示

error: variable ‘alltone’ must be const in order to be put into read-only section by means of ‘__attribute__((progmem))’
error: unknown type name ‘prog_char’

error: wide character array initialized from non-wide string

大概这3类错误。



"-Wno-deprecated-declarations -D__PROG_TYPES_COMPAT__" 加入CFLAGS 只能去掉某些警告。



重要的是 prog_char 被废弃了。必须改成

const char va0[] PROGMEM ="B7";



最终自己定义

+#define prog_char PROGMEM const char
+#define prog_byte PROGMEM const unsigned char
+#define prog_int PROGMEM const int
● 鸣学
回复