Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

RE: [AVR-Chat] Re: Mixing C and assembly with special requirements.

2012-03-28 by Steve Hodge

Thanks a lot for the info, Don.   I'll check it out later today
(side-tracked on something else right now).   Steve

 

From: AVR-Chat@yahoogroups.com [mailto:AVR-Chat@yahoogroups.com] On Behalf
Of Don Kinzer
Sent: Wednesday, March 28, 2012 11:33 AM
To: AVR-Chat@yahoogroups.com
Subject: [AVR-Chat] Re: Mixing C and assembly with special requirements.

 

  



--- In AVR-Chat@yahoogroups.com <mailto:AVR-Chat%40yahoogroups.com> , "Don
Kinzer" <dkinzer@...> wrote:
> I've posted a simple example available at the link below.
After reviewing the example, it will probably be obvious that the structure
offset/size definitions for the assembly language code represent a double
maintenance issue - if a structure is changed one must remember to update
the offset and size definitions.

In our code base we use a special syntax to define structures that contains
special tags that are used by an awk script to automatically generate the
structure offset and structure size definitions. The awk script is run
(automatically by make) whenever any of the applicable include files is
changed thus ensuring that the offset/size information is always current.
The only remaining issue is code that indexes by a structure's size. To
protect against errors arising from structure size changes (and even
differences in structure size on different AVR devices, if applicable), we
add preprocessor directives to validate the size and issue a compile error
if it is unexpected. An example of this is in the example code I posted.

Don Kinzer
ZBasic Microcontrollers
http://www.zbasic.net





[Non-text portions of this message have been removed]

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.