Hi everybody,

I hope this is not inappropriate question for this list, since internet provides "some" means to get it done:
        
https://stackoverflow.com/questions/8259447/give-structure-offset-attribute-to-assembler,
        
https://forum.microchip.com/s/topic/a5C3l000000M24UEAS/t238022?comment=P-1892766,
        https://www.avrfreaks.net/s/topic/a5C3l000000UGsnEAG/t078691
Still, this problem is not really well resolved by any of those suggestions.

Having the following "C" source:
-----------------
struct driver_s {
        struct driver_s *next, *current;
};
----------------

IMHO "the most comfortable" assembler source matching the above would look like this:
-----------------
        .struct 0
driver_next: .struct driver_next+4      ; "4" being the sizeof(void*)
driver_current: .struct driver_current+4 ; same as above
....
-----------------

Although it could possibly be more "traditional" like this:
-----------------
#define driver_next_offset 4
#define driver_current_offset 8
....
-----------------

Which is less readable because sizes of fields disappear from assembler sources. But functionally, it would do.

So I was wondering, is there (or may be could it be there) a compiler option, that would make it spit out the offsets into an assembler source (like in form of the above code snippet) much like today "-MM" option provides "C" source file dependency list?

I'd like to point out, that within the embedded world, this use case (integration of large assembler portions of code with equally large "C" sources) is so extensive, that may be it should be supported by a compiler option directly?

With kind regards,

-R
PS: pls respond directly to my address, as I'm not a regular subscriber of the list.

Reply via email to