MQX - mib2def.awk , def2c.awk - RTCS tools outdated

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

MQX - mib2def.awk , def2c.awk - RTCS tools outdated

跳至解决方案
2,096 次查看
thiagow
Contributor III

Hello,

I'm trying to use mib2def and def2c awk scripts to generate the C source code for my project using RFC-1628 mib file ( https://www.ietf.org/rfc/rfc1628.txt )   .

It looks that def2c.awk script has some bugs. For example the script generate "uint_32", "_PTR_", "pointer" data types that don't exists and I can't compile.

This mib file have some tables and traps and I believe that the script can't work with complex mib files. Is is truth?

标签 (1)
标记 (6)
0 项奖励
回复
1 解答
1,760 次查看
matthewkendall
Contributor V

It's just a pointer to void.

typedef void _PTR_     pointer;  /* Machine representation of a pointer */

That again comes from psptypes.h. Copy from MQX 4.0.1 attached. This is for Cortex M. If you are using something else you may want to just download an old version of MQX and poke about yourself.

在原帖中查看解决方案

0 项奖励
回复
6 回复数
1,760 次查看
thiagow
Contributor III

See below a bit of the source code and errors:

boolean MIB_find_upsOutputEntry  (uint_32, pointer, pointer _PTR_);   

Error:   unknown type 'boolean' expected ')' before '_PTR_'

boolean MIB_instance_upsAlarmEntry   (RTCSMIB_WALK_PTR, uint_32, boolean (_CODE_PTR_)(uint_32, pointer, pointer _PTR_), boolean _PTR_, pointer _PTR_);

Error: unknown type 'boolean', unknown type 'uint_32' , unknown type 'boolean', unknown type 'boolean' , unknown type 'pointer'

0 项奖励
回复
1,760 次查看
matthewkendall
Contributor V

One of the changes in MQX 4.1 was moving from non-standard types (such as uint_32) to the standard types from stddef.h (e.g. uint32_t). So if the tool is producing code with uint_32 in it, it probably has not been updated.

0 项奖励
回复
1,760 次查看
thiagow
Contributor III

And about _PTR_ and pointer data types? This problem occours on MQX 4.1.0 too. Does anybody know when these AWK scripts will be corrected and updated? Or any suggestion of how can I generate my source code using SNMP tables on MQX 4.1.1?

0 项奖励
回复
1,760 次查看
matthewkendall
Contributor V

_PTR_ used to be an alias for *. boolean used to be a typedef name for unsigned long. Both came from psptypes.h:

#define _PTR_      *

...

typedef unsigned long  boolean;  /* Machine representation of a boolean */

This all got changed in MQX 4.1 and now standard types are used.

I think your options are either wait for Freescale to fix the awk scripts; fix them yourself; or create a header file with the necessary definitions to get the generated code to compile. I think I would probably choose the third option.

0 项奖励
回复
1,760 次查看
thiagow
Contributor III

And 'pointer' data type? Do you know?

uchar_ptr = char * ?

0 项奖励
回复
1,761 次查看
matthewkendall
Contributor V

It's just a pointer to void.

typedef void _PTR_     pointer;  /* Machine representation of a pointer */

That again comes from psptypes.h. Copy from MQX 4.0.1 attached. This is for Cortex M. If you are using something else you may want to just download an old version of MQX and poke about yourself.

0 项奖励
回复