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?
Solved! Go to Solution.
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.
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'
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.
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?
_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.
And 'pointer' data type? Do you know?
uchar_ptr = char * ?
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.