Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: [AVR-Chat] Best language for learning AVRs (was forth)

2006-02-09 by Russell Shaw

David Kelly wrote:
> On Wed, Feb 08, 2006 at 10:49:08PM -0600, Chuck Hackett wrote:
> 
>>I guess I'd agree with Tom that assembler forces you to KNOW your
>>hardware environment better which is a good thing.  But, just because
>>one is using a higher level language like C doesn't relieve you from
>>having to know quite a lot about the hardware - assuming you're
>>interacting with the world outside the chip which is the point in
>>microcontrollers.
> 
> When I'm asked this question I recommend the AVR, avr-gcc, and the
> original K&R C book. Then add a reminder the K&R book "teaches" C by
> implementing common library utilities. That printf(), getchar(),
> putchar(), malloc(), etc, are not C, but nothing more than functions no
> different than any other one may write.
> 
> For embedded applications stay as far away as possible from the canned
> library functions. Especially printf() and malloc().
> 
> Also spend a lot of time looking at the generated assembly output. Is
> not so important as to be able to write assembly as it is to be able to
> read and understand what the compiler thought of your instructions. This
> way you know how expensive it is to attempt to abstract the UART via
> indirection in a structure. You know that 16 bit values require two
> accesses which an interrupt may jump in between. All those little things
> that differentiate code which happens to work vs. solid code which
> always works and is easy to maintain.
> 
> One parting note, use some sort of version system. CVS, Subversion,
> something, anything, from the start. Get used to frequently updating
> your repository with concise comments as to what you were doing or what
> motivated the changes. Comments in the code are important but the
> quality of comments in your commits are just as important.

It might seem very primitive, but i just copy "myprojectdir" to "myprojectdir-NNN"
onto a second HDD, incrementing the number each time. It acts as a short-term
backup, and you can easily browse old code. There's also live backup systems
for linux where snapshots are taken hourly or whatever time interval you want.

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.