[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-libc-dev] [bug #41435] math library functions in uril/delay.h
From: |
Cameron Tacklind |
Subject: |
[avr-libc-dev] [bug #41435] math library functions in uril/delay.h |
Date: |
Tue, 4 Jul 2017 17:14:29 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36 |
Follow-up Comment #1, bug #41435 (project avr-libc):
This caused a bunch of confusion for me until I realized that ffreestanding
was causing _delay_ms to fail to compile for a ATmega32u4 device.
For reference, here are the errors I saw. It took a while to figure out that
_STDC_HOSTED_, set by ffreestanding, was making _delay_ms use old incompatible
assembly.
{standard input}: Assembler messages:
{standard input}:19: Error: constant value required
{standard input}:19: Error: register number above 15 required
The above was gcc error output from compiling this simple file:
#include <util/delay.h>
void foobar() {
_delay_ms(1);
}
For reference, this is the output if I tell g++ to just compile to assembly:
.file "test.cpp"
__SP_H__ = 0x3e
__SP_L__ = 0x3d
__SREG__ = 0x3f
__tmp_reg__ = 0
__zero_reg__ = 1
.text
.global _Z6foobarv
.type _Z6foobarv, @function
_Z6foobarv:
/* prologue: function */
/* frame size = 0 */
/* stack size = 0 */
.L__stack_usage = 0
ldi r24,lo8(-96)
ldi r25,lo8(15)
/* #APP */
; 110 "c:\program files
(x86)\avr8-gnu-toolchain\avr\include\util\delay_basic.h" 1
1: subi r24A,1
brne 1b
; 0 "" 2
/* #NOAPP */
ret
.size _Z6foobarv, .-_Z6foobarv
.ident "GCC: (AVR_8_bit_GNU_Toolchain_3.5.4_1709) 4.9.2"
_______________________________________________________
Reply to this item at:
<http://savannah.nongnu.org/bugs/?41435>
_______________________________________________
Message sent via/by Savannah
http://savannah.nongnu.org/
- [avr-libc-dev] [bug #41435] math library functions in uril/delay.h,
Cameron Tacklind <=