- Download gEDA binary suite from here(HTTP) or here(FTP). If those two links don't work anymore, please refer to the gEDA download page: gEDA Binary Suite section
- Unzip the file using:
# tar xvjf gedasuite-linux-x86-0.0.2.tar.bz2
- The tarred file will produce gedasuite-linux-x86-<version> directory. Inside the directory, there's a script to install the software: install.sh
- Run the script and answer the questions:
# ./install.sh
- Add the gEDA directory to your path:
# echo "export PATH=your_geda_installation_dir:$PATH" >> $HOME/.bashrc
Showing posts with label tutorial. Show all posts
Showing posts with label tutorial. Show all posts
Friday, April 18, 2008
Installing gEDA less than 3-minutes
Here's the recipe for instant gEDA in your Linux:
Wednesday, April 16, 2008
Logging Serial Port Data in Linux
Serial port is usually used to log embedded device's report. This is very important to diagnose your problem.
If you're using Linux/Solaris/BSD, you can use script from this site to make serial port log with timestamp, like this:
Check the details of its usage in here.
If you're using Linux/Solaris/BSD, you can use script from this site to make serial port log with timestamp, like this:
2007-09-21,11:54:54: E0SamplingTimer fired
2007-09-21,11:54:56: E6Logged data :E67F000000FFFFFFFF0D016B00C0FF0000CC4E
2007-09-21,11:54:56: E0Data logged
2007-09-21,11:55:06: E3Packet received
2007-09-21,11:55:06: E2Download packet received
2007-09-21,11:55:06: E6Dump dataflash from time1 to time2
2007-09-21,11:55:06: E6Read data :E61F000000FFFFFFFFF9005D00C0FF0000CB4F
2007-09-21,11:55:06: E2Dump data :E20B1C7B0F5C040A1F000000FFFFFFFFF9005D00C0FF0000CB4F
2007-09-21,11:55:06: E2Sent data :E2220400000000001F000000FFFFFFFFF9005D00C0FF0000CB4F
2007-09-21,11:55:06: E2Send download protocol reply
2007-09-21,11:55:06: E2Send download protocol done
Check the details of its usage in here.
Programming Timeout / Retry
Programming timeout or number of retry is needed to make sure your program won't stuck it that part of code. Here's a template of how to do it :
For Java :
long startTime = System.currentTimeMillis();
long elapsedTime;
do {
//Do your job here, but do not loop for input/event
elapsedTime = System.currentTimeMillis() - startTime;
} while ((elapsedTime < TIMEOUT_VALUE) &&
(event != true));
For C/C++ (Under GCC Linux/Cygwin/BSD) :
#include <time.h>
uint32_t startTime = time(NULL);
uint32_t elapsedTime;
do {
//Do your job here, but do not loop for input/event
elapsedTime = difftime(time(NULL), startTime);
} while ((elapsedTime < TIMEOUT_VALUE) &&
(event != true));
For retry counter, just replace the elapsedTime with retryCounter..Something like:
// do {
// result = do_your_work();
// if (result != OK) retryCounter++;
// } while ((retryCounter < MAX_RETRY) && (result != OK))
Notes on Timer Resolution
For C/C++ under GCC, the method's timer resolution is second (usually enough for most of applications, but I'll post again on how to produce microsecond resolution later).
For Java, only Linux side that can give you millisecond resolution. Windows implementation is not that good. I haven't found the patch yet. I'll post again after I find it.
Tuesday, April 8, 2008
avr-as Usage Tutorial
It's very embarrassing to know that most of AVR newbies in Linux get stuck with the avr-assembler / avr-studio (which is purely written for MS-Windows). Plus, it's more annoying that nobody seems care enough to write about how to use avr-as, as replacement of the atmel avr-assembler.
I'll show you a bit of how to use avr-as in Linux. I'm using Ubuntu 6.06 while writing this blog and doing my experiment with avr-as.
# Installing avr-as
avr-as is part of avr-binutils package, and if you have installed avr-gcc in your Linux before it means you've installed this software too.
If you haven't install avr-gcc, these are the links to help you:
The demo is simple: Set PORTB0 mode to output, and set its value to HIGH. Here's the demo program:
The .equ syntax assign PORTB and DDRB to 0x18 and 0x17. The syntax makes the code easier to read. The rest of the program is the standard avr assembly. You can view the datasheet for the complete assembly syntax and its meaning.
# Compiling Demo Program
I'll show you a bit of how to use avr-as in Linux. I'm using Ubuntu 6.06 while writing this blog and doing my experiment with avr-as.
# Installing avr-as
avr-as is part of avr-binutils package, and if you have installed avr-gcc in your Linux before it means you've installed this software too.
If you haven't install avr-gcc, these are the links to help you:
- Building AVR GCC The process is applicable for most of Linux distribution.
- For debian / ubuntu:
- apt-get install avr-binutils avr-gcc avr-libc avrdude
- For SLED 10 / OpenSUSE:
- Use Yast to find avr-gcc. For SLED 10, you need to install OpenSUSE repo first
The demo is simple: Set PORTB0 mode to output, and set its value to HIGH. Here's the demo program:
.equ PORTB,0x18
.equ DDRB, 0x17
.org 0x00
reset:
rjmp main;
rjmp defaultInt;
rjmp defaultInt;
rjmp defaultInt;
rjmp defaultInt;
rjmp defaultInt;
rjmp defaultInt;
rjmp defaultInt;
rjmp defaultInt;
rjmp defaultInt;
rjmp defaultInt;
rjmp defaultInt;
rjmp defaultInt;
rjmp defaultInt;
rjmp defaultInt;
defaultInt:
reti;
main:
sbi DDRB, 0;
cbi DDRB, 0;
end:
rjmp end;
The .equ syntax assign PORTB and DDRB to 0x18 and 0x17. The syntax makes the code easier to read. The rest of the program is the standard avr assembly. You can view the datasheet for the complete assembly syntax and its meaning.
# Compiling Demo Program
- Save into *.s file (in this demo we call it: simpleIo.s)
- Assembly the file using:
avr-as -mmcu=attiny15 -o simpleIo.o simpleIo.s
- Link the file using:
avr-ld -o simpleIo.elf simpleIo.o
- Generate hex file:
avr-objcopy --output-target=ihex simpleIo.elf simpleIo.ihex
- Program the hex file
Subscribe to:
Posts (Atom)