ASMUtils
所属分类:处理器开发
开发工具:Assembly
文件大小:26KB
下载次数:0
上传日期:2020-03-28 20:58:53
上 传 者:
sh-1993
说明: AVR ATmega328和ATmega2560微控制器的汇编程序实用程序
(Assembler utilities for AVR ATmega328 and ATmega2560 microcontrollers)
文件列表:
LICENSE (1089, 2020-03-29)
a2d.S (5457, 2020-03-29)
a2d.h (1461, 2020-03-29)
delayMS.S (3710, 2020-03-29)
delayMS.h (1417, 2020-03-29)
delayS.S (3570, 2020-03-29)
delayS.h (1417, 2020-03-29)
delayUS.S (3556, 2020-03-29)
delayUS.h (1433, 2020-03-29)
divU16by16.S (2295, 2020-03-29)
divU16by16.h (1430, 2020-03-29)
divU8by8.S (1993, 2020-03-29)
divU8by8.h (1419, 2020-03-29)
enableSPI.S (2276, 2020-03-29)
enableSPI.h (1385, 2020-03-29)
multU16by16.S (2645, 2020-03-29)
multU16by16.h (1509, 2020-03-29)
multU16by8.S (2385, 2020-03-29)
multU16by8.h (1504, 2020-03-29)
usart0s.S (2872, 2020-03-29)
usart0s.h (1422, 2020-03-29)
# ASMUtils
This is a collection of assembler routines that provide commonly needed functionality
for programming AVR microcontrollers in assembler. These routines are designed for the
AVR ATmega328 and ATmega2560 8-bit microcontrollers (commonly available on the Arduino Uno and
Arduino Mega). I put this together because I didn't find a convenient location with a good set
of compile-ready routines.
These routines are written for the AVR-GCC assembler (`avr-as`) and follow its conventions (which are
different in small but significant ways from the Atmel assembler conventions). In particular, the routines
in the ASMUtils collection are coded as `*.S` files and make liberal use of the GCC preprocessor. More
information on the AVR-GCC assembler can be found in the
[AVR Libc User Manual](http://www.nongnu.org/avr-libc/user-manual/pages.html).
A perhaps unique feature of this collection is that by setting the preprocessor symbol `C_COMPAT_ASM_CODE` to
a non-zero value at compile time, all the ASMUtils routines will follow the
[GCC register usage and calling conventions](http://www.nongnu.org/avr-libc/user-manual/FAQ.html#faq_reg_usage),
which means they can be called from C or C++ code. Suitable header files are included in the collection for this
purpose. This feature, when activated, may introduce overhead into some of the routines,
usually in the form of preserving registers by pushing and popping. This inefficiency only affects a few
of the routines because I wrote routines to be compatible with the GCC calling conventions and
register usage rules whenever I could do so without introducing inefficiencies, (e.g., `divU8by8.S`
is compatible with C as written). Only a few routines cannot be written to be compatible "out of the box". This
was generally either because the routines could not avoid trashing a register that GCC calling conventions required
them to preserve (e.g., `multU16by8.S` uses the `mul` instruction which trashes register `r1`), or
because return values could not be constructed in place in the registers required by the GCC conventions (thus
requiring extra instructions to move the result into the appropriate registers).
I originally coded this feature to facilitate testing (it's much easier to drive tests using a test harness
written in C), but it has proven useful enough to retain as a standard feature of this collection.
Documentation is provided directly as comments in the various files. The routines are not
always written in the most general way (e.g., the USART0 routines are hard coded for serial communications at
115,200 baud, 8-bits, no parity, 1 stop bit). The contents of the
collection are driven entirely by the needs of the various AVR projects I work on in my spare time. It will
grow and evolve over time driven by those needs and my interests, which may resemble a random walk. If you
have a particular need, let me know and I will do what I can.
近期下载者:
相关文件:
收藏者: