--- In AVR-Chat@yahoogroups.com, "Steve Hodge" <steve@...> wrote: > what do you do to pass C arrays and C structs? The assembly knows nothing about C structures or even simple C types. Consequently, you have to write the code manually to index arrays and access structure elements. I've posted a simple example available at the link below. http://dl.dropbox.com/u/43035239/struct_array.S If you're going to write C-callable subroutines in assembly language, you'll need to read the avr-libc FAQ entry describing which registers may be modified and which must be preserved. http://www.nongnu.org/avr-libc/user-manual/FAQ.html#faq_reg_usage When you're getting started, it is often helpful to write some equivalent code in C, compile it, and look at the code generated. That will show you how to define variables in particular memory areas (.bss, .data, .noinit) as well as one way to implement the C logic. Don Kinzer ZBasic Microcontrollers http://www.zbasic.net
Message
Re: Mixing C and assembly with special requirements.
2012-03-28 by Don Kinzer
Attachments
- No local attachments were found for this message.