刚刚碰到一样的问题,看了一下,基本说明问题,大家参考一下(感谢下论坛上的另外一位忘记名字的朋友)
kiel c51函数定义中不支持存储位置说明符,如data, idata,xdata等,但貌似指针的目标类型可以声明,如果需要指定参数和内部变量的存储位置,可以使用small、large、compact对函数进行说明,这样可以将参数和局部变量分配在对应的存储空间
例如: char Func1(char idata* addr,char counter)small;
需要时局部变量可以特殊说明存储位置类型,具体可以参考keil软件的帮助文档或使用说明,Erro258的说明,摘抄一下,E文好的朋友可以自己理解
Error/Warning C258
memory-space Illegal on Struct/Union Member
Summary *** Error/Warning C258
memory-space Illegal on Struct/Union Member
memory-space on Parameter Ignored
Description Memory types may not be specified for members of struct and union types or for function parameters. Objects referenced by pointers may contain a memory type.
Cause A memory type (code, xdata, data, ...) was specified for a struct or union member or for a function argument. For example:
unsigned char function (
unsigned int xdata parm_1,
unsigned char data parm_2)
{
}
Resolution Remove the memory type from the struct, union, or function definition. These objects have very specific storage requirements which may not be altered using memory types.
Example struct vp { char code c; int xdata i; };
generates error 258.
struct v1 { char c; int xdata *i; };
is the correct declaration for the struct.
Copyright (c) Keil Software, Inc. and Keil Elektronik GmbH. All rights reserved.
详情回复
发表于 2016-3-17 17:31
Error/Warning C258
memory-space Illegal on Struct/Union Member
Summary *** Error/Warning C258
memory-space Illegal on Struct/Union Member
memory-space on Parameter Ignored
Description Memory types may not be specified for members of struct and union types or for function parameters. Objects referenced by pointers may contain a memory type.
Cause A memory type (code, xdata, data, ...) was specified for a struct or union member or for a function argument. For example:
unsigned char function (
unsigned int xdata parm_1,
unsigned char data parm_2)
{
}
Resolution Remove the memory type from the struct, union, or function definition. These objects have very specific storage requirements which may not be altered using memory types.
Example struct vp { char code c; int xdata i; };
generates error 258.
struct v1 { char c; int xdata *i; };
is the correct declaration for the struct.
Copyright (c) Keil Software, Inc. and Keil Elektronik GmbH. All rights reserved.