1

我在使用 AVR Studio 6 编译 Procyon 库时遇到了一些麻烦。我使用的代码完全适用于 AVR Studio 4。

以下行无法在此公共库中编译:

//! prints a string stored in program rom
/// \note This function does not actually store your string in
/// program rom, but merely reads it assuming you stored it properly.
void rprintfProgStr(const prog_char str[]);

导致错误:

Error   1   unknown type name 'prog_char' D:\AVRTests\ProcyonLibTest\ProcyonLibTest\rprintf.h   85  1   ProcyonLibTest

此功能的减速还有另一个错误。下一个是:

// use this to store hex conversion in RAM
//static char HexChars[] = "0123456789ABCDEF";
// use this to store hex conversion in program memory
//static prog_char HexChars[] = "0123456789ABCDEF";
static char __attribute__ ((progmem)) HexChars[] = "0123456789ABCDEF";

导致错误:

Error   2   variable 'HexChars' must be const in order to be put into read-only section by means of '__attribute__((progmem))'  D:\AVRTests\ProcyonLibTest\ProcyonLibTest\rprintf.c 45  39  ProcyonLibTest

这是一个标准库,从研究中每个人似乎都在工作。关于为什么会发生这种情况的任何想法?

4

1 回答 1

1

错误 1 ​​似乎与不包括有关<avr/pgmspace.h>。或者版本不兼容。您可能必须制作自己的 typedef 才能使其正常工作。

错误 2 看起来像是由更新的编译器版本引起的错误。您可以修改文件以使变量为 const。

如果您不想调整这些文件,那么您需要获得所有内容的兼容版本。

于 2013-01-22T07:55:51.787 回答