|
From: | David Bourgeois |
Subject: | [avr-gcc-list] First steps with avr-gcc |
Date: | Fri, 21 Oct 2005 20:00:01 +0200 |
User-agent: | Opera M2/8.50 (Win32, build 7700) |
Hello,I'm pretty new at avr-gcc and the GNU suite. I'm using WinAVR integrated with AVR Studio 4.12 (RC1).
Here's the simple function I'm using and the asm code generated (I should better do a macro out of it).
uint8_t getSwitches(void) { return (PINB & SW_MK); } @00000074: getSwitches 24: { +00000074: B183 IN R24,0x03 In from I/O location +00000075: 2799 CLR R25 Clear Register 26: }+00000076: 718D ANDI R24,0x1D Logical AND with immediate +00000077: 7090 ANDI R25,0x00 Logical AND with immediate
+00000078: 9508 RETavr-gcc -mmcu=atmega88 -Wall -gdwarf-2 -DF_CPU=8000000 -O2 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wp,-M,-MP,-MT,main.o,-MF,dep/main.o.d -c ../main.c -o main.o
My questions:- The C code is not complete in the list file. Usually, the next line after a '{' is missing. Is there something wrong on my side or should it simply be like this? - the function uses 2 registers (16 bits) while it should only use 8 bits. Is there something wrong on the make settings I used (generated by AVR Studio btw) or something else? - I'm surely lacking some knowledge here, should I first start reading the make manual, the gcc one or simply improve my C knowledge?
Thanks, David
[Prev in Thread] | Current Thread | [Next in Thread] |