I am implementing a boot-loader for the Xmega. Actually I have a working
boot-loader, but I had to do some ugly things that I am sure there are
proper ways to do if I were not so ignorant.
Pointers to FAQ, samples or replies appreciated. I did find the libc FAQ
and the gnu documentation on thi
Strange rcalls are a fast way to allocate four bytes on the stack for a local...
-Original Message-
From: avr-gcc-list-bounces+larry=barello@nongnu.org
[mailto:avr-gcc-list-bounces+larry=barello@nongnu.org] On Behalf Of Thomas
D. Dean
Sent: Wednesday, December 29, 2010 11:56 AM
st look at the
record definitions.
In your specific case, you will end up with a short record between the low
and high hex stuff with the new base address (or segment). Records
following will start at 0.
-Original Message-
From: avr-gcc-list-bounces+larry=barello@nongnu.org
[mailto:av
ine useful
#define _INLINE_ static inline __attribute__((always-inline))
as in
_INLINE_ void SomeFunction(void) {}
-Original Message-
From: avr-gcc-list-bounces+larry=barello@nongnu.org
[mailto:avr-gcc-list-bounces+larry=barello@nongnu.org] On Behalf Of
Royce Pereira
Sent: Monda
It appears GCC and treats bool's as ints with the expected code
hit. Using "uint8_t" instead of bool gives better code.
Also illustrated is poor Boolean handling of i/o registers. maybe that is
something inherent in GCC, but wouldn't it be much more straightforward to
code (((~PINE)&_BV(6))
input type "uint8_t"
and moved on. If I was not in a hurry I would have made the constants type
explicit. I'll probably pay for that decision sometime in the future when
the code breaks and I spend an hour or four figuring it out, again. Oh,
yeah: Job security!
YMMV
Is the cLib, in general, written as reentrant code? Specifically floating
point (yes), printf and friends?, small string functions (strcat_P(), etc)?
intrinsic like div() and ldiv()?
I realize there are issues with the stdio stuff since the file descriptors
are static and it is up to the i/o ro
What follows is a pretty typical sequence for a vararg function on the
XMEGA. In particular, why does the code generator do the funky double
"call" rather than just subtract the right number from the SP? I am
guessing this is a left-over code from the early XMEGA stack handling.
Also typical
deem appropriate... Usually the speed I am
worried about is how long it takes to download another version while debugging
:)
Anyway, thanks for the pointers and I am glad I spent 20 minutes trying them
out!
Cheers!
-Original Message-
From: avr-gcc-list-bounces+larry=barello@nongnu
Uh, I cut that out of the v10 xmega patch file, changed SPH/L but didn't
change the A/B. So yeah, your way looks like it would work :)
-Original Message-
From: Weddington, Eric [mailto:ewedding...@cso.atmel.com]
Sent: Thursday, February 05, 2009 9:04 PM
To: larry barello; avr-gcc
I just got email from Atmel verifying that the two instruction sequence for
updating SP is correct.
-Original Message-
From: Anatoly Sokolov [mailto:ae...@post.ru]
Sent: Wednesday, February 04, 2009 11:27 AM
To: larry barello; avr-gcc-list@nongnu.org
Subject: Re: [avr-gcc-list] WinAvr
The Xmega support involves a convoluted mechanism to update the SP after a
var-arg procedure call.
return (AS2 (mov,__tmp_reg__,r24) CR_TAB
+ AS2 (ldi,r24,0xD8)
CR_TAB
+
Is anyone successfully using WinAvr and Xmega (and fp/printf) in a
significant project? I already corrected the vararg problem and have my
project running, but there is a rare stack corruption problem with the xmega
that I don't see on the mega series (mega128 and mega1280). Interrupts and
i/o c
e const in
your declaration will fix the problems.
-Original Message-
From: avr-gcc-list-bounces+larry=barello@nongnu.org
[mailto:avr-gcc-list-bounces+larry=barello@nongnu.org] On Behalf Of
Vincent Trouilliez
Sent: Thursday, January 22, 2009 8:20 AM
To: avr-gcc-list@nongnu.org
Subject
n't really know c++
Finally, I bet there are better forums for this kind of discussion as this
isn't very particular to avr-gcc!
-Original Message-
From: avr-gcc-list-bounces+larry=barello@nongnu.org
[mailto:avr-gcc-list-bounces+larry=barello@nongnu.org] On Behalf O
Use a struct tag, rather than the typdef tag for your storage type, as:
typedef struct _TMenu
{
...
struct _TMenuItem items[];
}
TMenu;
typedef struct _TMenuItem
{
...
struct _TMenu *ptr;
...
}
MenuItem;
-Original Message-
Subject: [avr-gcc-list] T
Sokolov; larry barello; avr-gcc-list@nongnu.org
Subject: RE: [avr-gcc-list] Funny business with latest WinAvr20081205+
xmega128A1 and stdio
Ah, thanks Anatoly! I thought it was that bug.
Larry, I'm planning on a WinAVR release sometime in early February, and it
will include Anatoly's fix fo
It looks like all fprintf/sprintf/etc. for the xmega is broken in this
release. No matter how I craft it the same code pattern is repeated with
the mangling of the stack on clean-up.
Sigh.
From: avr-gcc-list-bounces+larry=barello@nongnu.org
[mailto:avr-gcc-list-bounces+larry=barello
I have hit this roadblock in porting over my application from my mega128
test bed to the xmega. As far as I can tell the compiler completely wedges
a very simple routine (and it worked earlier, so it *must* be something I am
doing.)
Anyway, the code is below. The compiler fails to re-load R24
Read the data sheet.
http://www.atmel.com/dyn/resources/prod_documents/doc8077.pdf
-Original Message-
From: avr-gcc-list-bounces+larry=barello@nongnu.org
[mailto:avr-gcc-list-bounces+larry=barello@nongnu.org] On Behalf Of
Colin D Bennett
Sent: Wednesday, January 14, 2009 9:48 AM
M
To: larry barello; AVR GCC List
Subject: RE: [avr-gcc-list] xmega support
> -Original Message-
> From:
> avr-gcc-list-bounces+eweddington=cso.atmel@nongnu.org
> [mailto:avr-gcc-list-bounces+eweddington=cso.atmel@nongnu.
> org] On Behalf Of larry barello
> Sen
I am trying to bring a project developed on a mega128 up on an xmega128A1.
Aside from the very different I/O structure (which is actually pretty nice)
the non-volatile memory stuff is totally different.
Is there some libc support for reading/writing the EEPROM? How about
self-programming support
AvrX has been around since the late 90's
www.barello.net/Avrx
www.yahoogroups.com/group/avrx
I originally wrote it for the at90S2313 with 128 bytes of stack. Later I
modified it for larger chips (16 bit stack). It is almost entirely in
assembly. There is no active development or maintenance
I just adjusted the initial bit time by a few counts to offset the delay.
Subsequent bits were sampled/output through the same code path so I just
continued to add the bit time to the OCxx register for the next interrupt.
In my code I used TIMER3 as CPU/8. I had to adjust my initial delays by 10
Thanks for the tip on google... Doh!
http://www.madwizard.org/extern/winavr-vista/
It works, but really crawls. I may yet switch back to XP...
-Original Message-
From: Eric Weddington [mailto:[EMAIL PROTECTED]
You're a bit late to the game. There are at least two major threads abo
Ok, I give up. What environment variables do I need to specify so WinAvr
can operate successfully under Vista?
I just took the default installation under c:\WinAVR
I added c:\WinAVR\libexec\gcc\avr\4.1.1 to the path and now the compiler at
least runs. But it can't find the include files..
I have the following:
#define BOOTSTART 0x1F800
#define BL_SERIAL 2
#define BL_SMB 4
So I can say
((void (*)(void))((BOOT_START+BL_SERIAL)/2))();
When I want to jump into my bootloader at the serial download entry point.
In last years WinAvr that code breaks. It generates:
One thing that still bothers me, maybe I just missed it: Why is char !=
int8_t at this point? I sort of see why, but that is just an artifact of
libc written with non-portable "char". The compiler is letting me know that
I can't make any assumptions about the signedness of char.
It seems wron
Ok, this is the most interesting answer and begs another question: Are you
just saying use either signed or unsigned (I typically use uint8_t except
when the signedness counts) or is "char" a distinct type that has defined
behavior across portable systems?
I don't like the -funsigned-char because
This is a new warning with the latest WinAvr. What does it mean and how do
I silence it? It is highly annoying that the buffers are even concerned
whether a byte value is signed or not when dealing with characters.
TetherTask.c:191: warning: pointer targets in passing argument 1 of
'sscanf_P' di
ll empty space?
// crc = _crc16_update (crc, pgm_read_byte_far(adx));
crc = _crc_xmodem_update (crc, pgm_read_byte_far(adx));
return (crc == pgm_read_word_far(BOOT_START-2));
}
_
From: Schwichtenberg, Knut [mailto:[EMAIL PROTECTED]
Sent: Thursday, Ap
I am updating my boot-loader to perform a CRC check across the application -
it will stay in the BL if the CRC is bad.
I am trying to use srec_cat to generate the CRC value. I am having no
success getting the CRC value to match what the bootloader calculates.
Since srec_cat operation is opaque
In the past it was difficult to debug stuff in the upper 64k of FLASH using
Atmel Studio. I thought with the latest studio that was fixed. Does that
require the latest WinAvr as well? I have the previous version, being
scared off of upgrading due to various problems reported in this list.
An
Does anyone have the AVR equivalent routine for one of the CRC16 generated
with "srecord" they would share? I would like to modify my boot loader to
check the application code before running so corrupted downloads don't wedge
my application.
I know there are plenty of examples on the web (I have
For those of us in the dark, what are "trampolines" in the context of GCC?
_
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Stu
Bell
Sent: Tuesday, March 20, 2007 4:06 PM
To: avr-gcc-list@nongnu.org
Subject: [avr-gcc-list] Why is there 1200 bytes of zeroes in my code?
Declaring N as volatile is a good solution.
The alternative is to disenable optimization on GCC (-o0) but I don't think
you will like the results.
Another solution is to put
asm("nop");
In your loop body. That will force the compiler to implement the loop.
There might be some fancier
gcc-armxxx places "volatile" data outside the cache... so it must be a
compiler dependent feature. Always best to examine the resulting assembly
to make sure your assumptions are correct :)
| -Original Message-
| From: [EMAIL PROTECTED] [mailto:avr-gcc-
| [EMAIL PROTECTED] On Behalf Of G
This is somewhat a compiler issue since it is both a necessary keyword, yet
insufficient to write correct code. It is a problem that vexes many
newcomers (and old farts like me who forget every now and then) and is
discussed in the FAQ, but is worth burning space here as well.
The GCC compiler is
ce doesn't work. Finally,
you can specify an input pin to force the bootloader to take control.
Just look at the source. The linker magic is all in the makefile.
Cheers!
_
From: Trampas [mailto:[EMAIL PROTECTED]
Sent: Saturday, November 25, 2006 10:11 AM
To: 'Larr
Thanks!
IIRC you can cut out the EEPROM support and the boot loader fits into 256
words.
While paring down the size I cut out the C startup (there is no "main()") &
runtime support and moved statics/globals into automatics assuming they
would go onto the stack. However that clever compi
I took Jason Kyle's boot-loader and reworked it to fit in 512 words. A
version that should be relatively easy to modify for your needs can be found
in the files section of Yahoogroups "avrrobotcontrol" You will need to sign
up for Yahoogroups to see it & download. it is a stand-alone program usi
Although a bit wordy, the following produces good code under a lot of
different circumstances. It allows the compiler to shove things around &
optimize.
static inline uint16_t ByteSwap(uint16_t data)
{
union byteswap
{
uint16_t word;
struct
Thank you. I suspected this, because that is what avr-gcc does. I Googled
around a bit for the answer but must have not used the right terms. This
knowledge allows me to mix bit and logical operations safely and GCC
compiles nice code as a result.
For other responses: '^^' is not a valid C oper
when mixing bit-wise and logical operations, is it safe to assume that (!0
== 1) is true?
Specifically I was looking for an efficient way to encode
(bSomeBool ^ (SomeBitMask & SomeVariable))
to get a true/false output. Of course, expressed, as above, doesn't work
too well when bit-wise exclusi
themega88?
|
| "larry barello" <[EMAIL PROTECTED]> wrote:
|
| > The overt symptoms are that the clock doesn't bump up reliably. I
| > suspect that it doesn't bump down reliably either, but at 11mhz &
| > 50hz timer tick I wouldn't notice the code t
The code, above, of course, resolves into two back-to-back STS instructions,
which, with interrupts off should do the trick.
| -Original Message-
| From: Eric Weddington [mailto:[EMAIL PROTECTED]
| Sent: Tuesday, October 03, 2006 8:12 AM
| To: 'larry barello'; 'AVR GCC List
I am having difficulty with reliable transition between clock speeds. I
have been using various AVR chips for years so I doubt I am doing something
stupid, but, one never knows.
Please, reply direct rather than on the list.
Cheers!
___
AVR-GCC-l
puts_P() using putchar(), and THAT appended the
bloody 0x0A...
---
Larry Barello
www.barello.net
___
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list
Try pgm_read_byte() defined in
#include
---
Larry Barello
www.barello.net
| -Original Message-
| From: [EMAIL PROTECTED] [mailto:avr-gcc-
| [EMAIL PROTECTED] On Behalf Of Paulo da Silva
| Sent: Tuesday, July 11, 2006 8:53 PM
| To: avr-gcc-list@nongnu.org
| Subject: [avr-gcc
I updated about 20 minutes ago and it seems that ~1/2 the time the DOS box
hangs - typically when it is "creating a load file".
Is this a known condition with a simple fix? Or am I just too sleep
deprived?
-------
Larry Barello
www.b
3.4.5 winavr produces nice tidy code. Even the compares with 0 reduce to
tight sbic/jmp pairs.
---
Larry Barello
www.barello.net
| -Original Message-
| From: [EMAIL PROTECTED] [mailto:avr-gcc-
| [EMAIL PROTECTED] On Behalf Of James L. Evans
| Sent: Tuesday, May 16, 2006 3:47
ACI
interrupts have selectable leading/falling edge select, so even with a small
chip you can get quite a few encoders going.
---
Larry Barello
www.barello.net
| -Original Message-
| Beside, do you really need two external interrupts ?
| I use a quadrature encoder in my current
tocol or plain text).
-------
Larry Barello
www.barello.net
| -Original Message-
| From: [EMAIL PROTECTED] [mailto:avr-gcc-
| [EMAIL PROTECTED] On Behalf Of Larsen, Morten
| ActeNO
| >
| > We have been facing a random problem where data sent to the
| > ATMega128 on one of the U
y was that and SIGNAL depreciated? Is it
safe to continue to use the "interrupt" attribute?
---
Larry Barello
www.barello.net
___
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list
FYI I have been using the beta and this is *much* better than previous
releases. The docking system is super: all docked windows can auto-shrink
to the side (top/bottom) with tabs - click on a tab and the window you want
slides open: source, registers, i/o, etc. Really, really slick.
-Origi
SARTs) and could
use channels beyond four. Or is this already implemented and I just need to
RTFM?
A second question: is stdio written to be re-entrant? I.e. No static data
(other than the file descriptor)? The first question is sort of moot if
stdio is not re-entrant (for me at least).
----
Lar
prefer to just type in "&foo" when calling routines.
Larry Barello
www.barello.net
___
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list
Sorry for the blizzard of email...
Using bitfields was almost as optimal as manual shift & mask:
Resulting .text for my application:
Using frames: 14282 (odd size bitfield forces parameter onto stack..)
Using Shift/mask: 14002
Using bitfield: 14008
I'll use bitfields as it is easier to layout n
Well, dang. Making it a uint32_t bitfield didn't work. Adding a dummy 13
bit field to force alignment to a dword worked and the union was passed in
registers.
That made a 280 byte difference is a tiny SPI EEPROM driver...
___
AVR-GCC-list mailing
te:
> --
>
> Message: 8
> Date: Wed, 24 Aug 2005 00:19:08 -0700
> From: "Larry Barello" <[EMAIL PROTECTED]>
> Subject: [avr-gcc-list] Union as parameter
> To: "AVR GCC List"
> Message-ID: <[EMAIL PROTECTED]>
&g
;
Uint16_t word[2];
Uint8_t byte[4];
Struct
{
Uint16_t offset:7;
Uint16_t page:10;
Uint16_t bank:2;
} bits;
}
Addr_u;
Larry Barello
www.barello.net
___
AVR-GCC-list
nt of access higher level routines like getc() putc()...)
I thought I was responding to a message to the avr-chat list. Obviously
this kind of message isn't appropriate for the Gcc compiler list. I
apologize in advance :)
-Original Message-----
From: Larry Barello [mailto:[EMAIL PROTEC
-Original Message-
From: Parthasaradhi Nayani
...
How does one avoid putting interrupt table and cleanup
code in the bootloader section? (this is what I am
looking for)
-nostdlib on the linker command line will drop all library support and
rename "main
Simple: get a previous version of studio, look in the STK500 directory
and click on "upgrade". There might be a few more steps involved, but it
shouldn't be difficult to figure out. You might need to put the STK500 in
"download" mode by pressing the "program" button and cycling
power.
SFIOR, bit 4 "ADHSM" is missing from the latest WinAvr headers files.
BTW it was annoying to have old (albeit wrong) names abruptly removed &
replaced with new names. For example the m128 headers kept the old ones in
place...
I didn't check the other headers...
x27;t
understand.
-Original Message-
From: Haase Bjoern (PT-BEU/EMT) * [mailto:[EMAIL PROTECTED]
Sent: Monday, May 23, 2005 7:31 AM
To: Larry Barello; Joerg Wunsch; avr-gcc-list@nongnu.org
Subject: AW: [avr-gcc-list] Compiler error
I was able to reproduce your problem.
I assume that the under
It is a limitation of the current dwarf-2 support in Astudio. It only loads
".text" segments and ignores all others. It will be very nice when dwarf-2
support is fully fleshed out and working (particularly for >64k memory).
You can put named segments anywhere, but, as noted above, astudio won't
Nope, my problem seems much worse and is in the "asm" constraints handling.
Attached is all details.
-Original Message-
From: Joerg Wunsch ...
What's the actual error message? (And which compiler version?)
Maybe it's related to
https://savannah.nongnu.org/bugs/?func=detailitem&item_id
adc %B0, %B0\n"
"\tadc %C0, %C0\n"
: :"r" (bar) );
return bar.byte[3];
}
Larry Barello
http://www.barello.net
foo.c
Description: Binary data
___
AVR-GCC-list mailing list
AVR-GCC-list@no
works fine for my application which is in low
memory...
I am using the latest winavr release (Feb-2005)
Larry Barello
http://www.barello.net
___
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc
%0\n"
"\tsbrc r25, 0\n"
"\trjmp .-8\n"
"\tsts %0, r24\n"
"\tspm\n"
: "=m" (SPMCR) );
#endif
}
Larry Barello
http://www.barello.net
___
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list
How about a zero cost parallel port programmer? For example, the BASCOM
SAMPLE programmer ('bascom' in Avrdude) can be little more than a cut up
line printer cable. You can dig the schematic out of the bascom help, or,
look at the schematic on the last page of:
http://www.barello.net/ARC/ARC1.1.
This is simple: you set the reset vector to the beginning of the boot sector
(see the fuse settings in STK500, or the data sheet). The boot sector has
vectors, or not, your choice. When the boot code determines that in fact
you want to run your application, it jumps to location 0 where the real (
essential
tidbit I am missing?
-Original Message-
From: Šak Andrej [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 17, 2005 11:49 PM
To: Larry Barello; AVR GCC List
Subject: RE: [avr-gcc-list] How to skip c-runtime init
You can try -nostartfiles option for linking.
from man avr-gcc:
-no
I would like to use GCC and skip the c-runtime init module completely (I'll
initialize my few variables at the start of "main()"). I am writing a
bootloader, of course...
I vaguely recall doing this in the past, but cannot remember how it is done,
nor find it in the libc FAQ.
T
One, big hole, IMHO, with the DWARF2 mechanism is the complete inability to
debug assembly code. There is no mechanism to write an assembly module and
generate any symbolic information.
Please correct me if I am wrong!
At least one could tell COFF what file the assembly was in and you could set
So, this is all facinating reading, but what, if anything, is a NULL pointer
in the AVR context? Address 0 is certainly valid. Or is it simply
convention that 0 is "null".
I didn't understand everything that was said, but it seemed clear to me that
having the construct
char *foo;
if (foo && (*
tion to substitute a list?
Larry Barello
http://www.barello.net
___
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list
Thanks for all the pointers and suggestions.
Target dependent variables seemed like an ideal solution, but unfortunately
I couldn't figure out how to make them work! I am using the previous WinAVR
release with make 3.78.1 which should support them (at least it didn't
barf).
The solution, for me,
tion to substitute a list?
Larry Barello
http://www.barello.net
___
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list
Sorry, I misspoke: none of the variables are substituted... I know how to
set variables on the command line (make MCU=atmega128... target). but how
to pass a list like the C source to do custom builds with one makefile?
TIA
-Original Message-
From: Larry Barello [mailto:[EMAIL
81 matches
Mail list logo