simavr
13 years agocore: Fix MULS register
Michel Pollet [Mon, 5 Jul 2010 10:08:08 +0000 (11:08 +0100)]
core: Fix MULS register

MULS uses 16+ registers.

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agoADC: Fix ADLAR bit handling
Michel Pollet [Fri, 25 Jun 2010 08:17:19 +0000 (09:17 +0100)]
ADC: Fix ADLAR bit handling

Was shifting when zero, not one.

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agotimer: Also reconfigure on writing the WGM bits
Michel Pollet [Sun, 20 Jun 2010 10:25:53 +0000 (11:25 +0100)]
timer: Also reconfigure on writing the WGM bits

Some broken code configure the clock source before
setting the waveform bits.

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agoioports: Cleanup and implement PINx toggle
Michel Pollet [Sun, 20 Jun 2010 10:24:54 +0000 (11:24 +0100)]
ioports: Cleanup and implement PINx toggle

Turns out writing 1 to PINx register toggles the
bit in PORTx. Did'nt know it worked like that...

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agouart: Now use avr_clear_interrupt_if
Michel Pollet [Tue, 11 May 2010 11:36:26 +0000 (12:36 +0100)]
uart: Now use avr_clear_interrupt_if

New function simplifies clearing pending bits

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agotimer: Allow clearing of the interupts
Michel Pollet [Tue, 11 May 2010 11:35:46 +0000 (12:35 +0100)]
timer: Allow clearing of the interupts

Allow exclicit clearing of interupts by writing 1
to the pending bit.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agointerrupts: Mark interupts as pending even if not enabled...
Michel Pollet [Tue, 11 May 2010 11:34:35 +0000 (12:34 +0100)]
interrupts: Mark interupts as pending even if not enabled...

.. Then trigger them as soon as they are enabled again

There is a bit of performance hit on this, since the bitmask
array used before can now be full of pending bits that won't
ever be cleared..

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoICP: Added Input capture pin support to timers
Michel Pollet [Thu, 29 Apr 2010 10:51:45 +0000 (11:51 +0100)]
ICP: Added Input capture pin support to timers

Added (untested as of now) Input Pin Capture to the 16 bits
timers. The "edge" flag is also handled. The code is untested
for now, it will need an "example" board that will be
checked in later.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agocores: Added tinyX5 and mega128 ADC bits
Michel Pollet [Wed, 14 Apr 2010 21:59:23 +0000 (22:59 +0100)]
cores: Added tinyX5 and mega128 ADC bits

Not tested

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agomisc: Warning fix
Alessio Igor Bogani [Wed, 14 Apr 2010 18:17:36 +0000 (20:17 +0200)]
misc: Warning fix

Makes gcc happy

Signed-off-by: Alessio Igor Bogani <abogani@texware.it>
Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agomisc: More warning fixes
Alessio Igor Bogani [Wed, 14 Apr 2010 18:17:24 +0000 (20:17 +0200)]
misc: More warning fixes

#warning "This file has been moved to <util/delay.h>."

Signed-off-by: Alessio Igor Bogani <abogani@texware.it>
Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agomisc: Fix warning replacing %d with %zu for size_t
Alessio Igor Bogani [Wed, 14 Apr 2010 18:17:01 +0000 (20:17 +0200)]
misc: Fix warning replacing %d with %zu for size_t

Warning fixes.

Signed-off-by: Alessio Igor Bogani <abogani@texware.it>
Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agodoc: Updated callgraph .pdf
Michel Pollet [Wed, 14 Apr 2010 19:43:14 +0000 (20:43 +0100)]
doc: Updated callgraph .pdf

Hadn't been updated for some time...

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agocore: Fixes SBCI
Michel Pollet [Wed, 14 Apr 2010 19:42:46 +0000 (20:42 +0100)]
core: Fixes SBCI

Thanks to <evgeny.chukreev@gmail.com>

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agotest: Add a test/example for the ADC subsystem
Michel Pollet [Wed, 14 Apr 2010 17:15:23 +0000 (18:15 +0100)]
test: Add a test/example for the ADC subsystem

Loads ADC values, also reads the V1.1 reference voltage of an Atmega644

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agocores: Add (some) of the ADC mux data
Michel Pollet [Wed, 14 Apr 2010 17:14:27 +0000 (18:14 +0100)]
cores: Add (some) of the ADC mux data

Add ADC Mux data to the x8 and x4 cores. The others still needs
to be done. Also filled the reference voltages.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoADC: Fully functional core
Michel Pollet [Wed, 14 Apr 2010 17:13:21 +0000 (18:13 +0100)]
ADC: Fully functional core

simavr ADC allows external code to feed real voltages to the
simulator, and the simulator uses it's 'real' reference voltage
to do the right thing and return the 'proper' 10 bits ADC value
to the AVR firmware.

To send values to the ADC, register your code to wait for the
ADC_IRQ_OUT_TRIGGER irq, and at that point send any of the
ADC_IRQ_ADC* with Millivolts as value.

External trigger is not done yet.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agocore+elf: Add fields for the MCU voltages
Michel Pollet [Wed, 14 Apr 2010 17:11:49 +0000 (18:11 +0100)]
core+elf: Add fields for the MCU voltages

You can now specify AVR_MCU_VOLTAGES(vcc, avcc, aref) in millivolts
in your firmware to set them into the simavr core.

Prerequisite for ADC VREF support.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agorun_avr: Add a way to trace just interruots vectors
Michel Pollet [Wed, 14 Apr 2010 17:09:38 +0000 (18:09 +0100)]
run_avr: Add a way to trace just interruots vectors

Calling run_avr with -ti <value> will trace the scheduling
of that pacticular vector.
You can have up to 8 traces.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agotimer: Fixed an off by one
Michel Pollet [Wed, 14 Apr 2010 17:05:12 +0000 (18:05 +0100)]
timer: Fixed an off by one

That was breaking the timers badly in corner cases

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agocores: Updated comparators
Michel Pollet [Sun, 11 Apr 2010 19:11:41 +0000 (20:11 +0100)]
cores: Updated comparators

Also filled up the ones for tinyx5, megax4, tiny2313

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agotimer: Changed timer config feom a bit array to a normal regbit
Michel Pollet [Sun, 11 Apr 2010 19:11:00 +0000 (20:11 +0100)]
timer: Changed timer config feom a bit array to a normal regbit

Since all the timer seems to have these 2 bits declared
in the same way anyway...

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoELF: Fixes a bad malloc
Michel Pollet [Sun, 11 Apr 2010 18:38:24 +0000 (19:38 +0100)]
ELF: Fixes a bad malloc

How it didn't crash before, no idea...

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agomega128: Fixes timer comparators
Michel Pollet [Sun, 11 Apr 2010 18:36:59 +0000 (19:36 +0100)]
mega128: Fixes timer comparators

Bits are in the right order now

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agotwi: Stripped down TWI module to fix compile
Michel Pollet [Sat, 10 Apr 2010 17:05:30 +0000 (18:05 +0100)]
twi: Stripped down TWI module to fix compile

New system will take it's place soon

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoexample: Added OC2A to timer test
Michel Pollet [Sat, 10 Apr 2010 12:19:19 +0000 (13:19 +0100)]
example: Added OC2A to timer test

Uses OC2A toggle with a VCD trace to demo the new compators.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agocores: Refactored timer comparators
Michel Pollet [Sat, 10 Apr 2010 12:18:30 +0000 (13:18 +0100)]
cores: Refactored timer comparators

Based on patch by <tomi.leppikangas@gmail.com> but fixed the other
cores to fix a few cut/paste issues.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agotimer: Added comparator modes for pins
Michel Pollet [Sat, 10 Apr 2010 12:16:37 +0000 (13:16 +0100)]
timer: Added comparator modes for pins

Refactored the comparators code, Added the 3 common modes of pin
toggles.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoioport: Added a way to get to the IRQ via register addresses
Michel Pollet [Sat, 10 Apr 2010 12:15:09 +0000 (13:15 +0100)]
ioport: Added a way to get to the IRQ via register addresses

Now can do a ioctl to get the port IRQs by oassing the address of
a PORT/PIN/DDR register and a pin number.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoioport: Aded a way to specify the output value via IRQ
Michel Pollet [Sat, 10 Apr 2010 12:14:12 +0000 (13:14 +0100)]
ioport: Aded a way to specify the output value via IRQ

Adding 0x100 to the IRQ value simulates a pin output change
and not just a pin input change.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoioport: No longer need pcint to change the value
Michel Pollet [Sat, 10 Apr 2010 10:35:32 +0000 (11:35 +0100)]
ioport: No longer need pcint to change the value

IRQ callback changes the AVR memory even if the pcint is
not present.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoTWI: Temp TWI changes with new IRQ system
Michel [Sun, 4 Apr 2010 14:36:17 +0000 (15:36 +0100)]
TWI: Temp TWI changes with new IRQ system

Signed-off-by: <>
14 years agoextint: Add more extints IRQs
Michel Pollet [Mon, 5 Apr 2010 12:39:06 +0000 (13:39 +0100)]
extint: Add more extints IRQs

... and use them on the Mega128 core

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agocore: Added EIND support
Michel Pollet [Sun, 4 Apr 2010 12:43:32 +0000 (13:43 +0100)]
core: Added EIND support

Not used in any core, for now. It would still need 24 bits PC support
with return addresses to match.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agocores: Added Mega128
Michel Pollet [Sun, 4 Apr 2010 11:24:29 +0000 (12:24 +0100)]
cores: Added Mega128

Contributed by Tomi Leppikangas <tomi.leppikangas@gmail.com>

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agowatchdog/eeprom: Added declaration blocks for older cores
Michel Pollet [Sun, 4 Apr 2010 11:22:42 +0000 (12:22 +0100)]
watchdog/eeprom: Added declaration blocks for older cores

For the mega128 generation

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agotimer: Added (non functional) C interrupt block
Michel Pollet [Sun, 4 Apr 2010 11:21:45 +0000 (12:21 +0100)]
timer: Added (non functional) C interrupt block

Needs some code

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoflash: Add support for RAMPZ
Michel Pollet [Sun, 4 Apr 2010 11:20:59 +0000 (12:20 +0100)]
flash: Add support for RAMPZ

If declared...

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agocore: Add support for RAMPZ and refactor instructions
Michel Pollet [Sun, 4 Apr 2010 11:20:34 +0000 (12:20 +0100)]
core: Add support for RAMPZ and refactor instructions

Added RAMPZ as an optional IOREG for the core.
Factored the [E]I[JMP/CALL] into one blob.
Added the ELMP Instruction with RAMPZ support.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoFixed multiple warnings for -Wall
Michel Pollet [Sun, 4 Apr 2010 11:18:31 +0000 (12:18 +0100)]
Fixed multiple warnings for -Wall

Twasn't that bad really.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agorun_avr: Cosmetics
Michel [Fri, 12 Mar 2010 08:06:13 +0000 (08:06 +0000)]
run_avr: Cosmetics

Comments, prints etc.

Signed-off-by: Michel Pollet <buserro@gmail.com>
14 years agoMakefile: Include eeprom data in .hex files
Michel [Wed, 10 Mar 2010 18:08:02 +0000 (18:08 +0000)]
Makefile: Include eeprom data in .hex files

Now that the loader can load them, include the eeprom
section in the .hex files generated for the examples

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agorun_avr: Supports loading new hex files
Michel [Wed, 10 Mar 2010 18:07:07 +0000 (18:07 +0000)]
run_avr: Supports loading new hex files

Can now load .hex files multiple sections, and also allow
specifying multiple .hex files to load in flash and/or
eeprom.
./run_avr ... -ff flash.hex -ee eeprom.hex ...

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoelf: Added constants for flash & eeprom start
Michel [Wed, 10 Mar 2010 18:05:42 +0000 (18:05 +0000)]
elf: Added constants for flash & eeprom start

Added some constants for the addresses used by gcc
to link the flash and eeprom data.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agohex: Added a new reader for multiple chunks
Michel [Wed, 10 Mar 2010 18:04:53 +0000 (18:04 +0000)]
hex: Added a new reader for multiple chunks

.hex files can contain more than one section of data
this new loader handles that, allowing to have multiple
section of flash (app + bootloader) and/or eeprom.
Oh, a test unit too.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoVCD: Fixed a buffer overflow
Michel Pollet [Thu, 25 Feb 2010 22:13:11 +0000 (22:13 +0000)]
VCD: Fixed a buffer overflow

In case we're dumping 32 bits wide traces (!)

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoTWI: Work in progress
Michel Pollet [Thu, 25 Feb 2010 22:12:36 +0000 (22:12 +0000)]
TWI: Work in progress

Changed to look more like qemu

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoReadme fix
Michel Pollet [Mon, 11 Jan 2010 08:06:59 +0000 (08:06 +0000)]
Readme fix

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agocore: Simplify changes to SREG
Michel Pollet [Wed, 6 Jan 2010 22:45:30 +0000 (22:45 +0000)]
core: Simplify changes to SREG

SREG is no longer re-synthetized at every instruction,
but only when the firmware reads the register.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agomisc: Small cleanup
Michel Pollet [Wed, 6 Jan 2010 22:37:50 +0000 (22:37 +0000)]
misc: Small cleanup

Removed mutiple defined constants etc

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoeeprom: fix a less-than bug
Michel Pollet [Wed, 6 Jan 2010 22:44:15 +0000 (22:44 +0000)]
eeprom: fix a less-than bug

Prevented loading the eeprom entire size

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agowatchdog: Added a test module
Michel Pollet [Wed, 6 Jan 2010 22:38:25 +0000 (22:38 +0000)]
watchdog: Added a test module

Small module that tests the watchdog timer

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agocores: Add watchdog
Michel Pollet [Wed, 6 Jan 2010 22:37:09 +0000 (22:37 +0000)]
cores: Add watchdog

Add watchdog block to the existing cores

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agocore: Add watchdog timer support
Michel Pollet [Wed, 6 Jan 2010 22:35:51 +0000 (22:35 +0000)]
core: Add watchdog timer support

Working base support for the watchdog timer,
and the WDT instruction that resets it.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoexamples: Ported to Snow Leopard
Michel [Sat, 26 Dec 2009 14:52:59 +0000 (14:52 +0000)]
examples: Ported to Snow Leopard

Uses OSX frameworks if applicable

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agocore: Shuffled code around
Michel Pollet [Sat, 26 Dec 2009 13:34:15 +0000 (13:34 +0000)]
core: Shuffled code around

Moved cycle timer code into it's own files

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoUART: Added documentation
Michel Pollet [Sat, 26 Dec 2009 13:33:15 +0000 (13:33 +0000)]
UART: Added documentation

On how to use the xon/xoff IRQs

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agocores: Added selfprog bootloader support to x4 series
Michel Pollet [Sat, 26 Dec 2009 13:32:41 +0000 (13:32 +0000)]
cores: Added selfprog bootloader support to x4 series

Untested, but behaves the same as x8 so it should work..

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agodoc: Added a doc directory, and a callgraph generator
Michel Pollet [Sat, 26 Dec 2009 13:31:06 +0000 (13:31 +0000)]
doc: Added a doc directory, and a callgraph generator

You need ctags, graphviz and ruby to re-generate it

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agosimduino: Bootloader now works!
Michel Pollet [Thu, 24 Dec 2009 16:59:33 +0000 (16:59 +0000)]
simduino: Bootloader now works!

Can program simduino with avrdude!
See the readme for the howto

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoUART: Added a flag to disable stdio traces
Michel Pollet [Thu, 24 Dec 2009 16:58:08 +0000 (16:58 +0000)]
UART: Added a flag to disable stdio traces

Also fixed the UART when used in non-interupt mode.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoSPM: Added Self Programming Instruction & Support
Michel Pollet [Thu, 24 Dec 2009 16:56:27 +0000 (16:56 +0000)]
SPM: Added Self Programming Instruction & Support

Added the SPM support to the core, and to the x8 devices.
Tested with Arduino's bootloader.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agotimer: No longer craksh when reading TCNT with timer off
Michel Pollet [Thu, 24 Dec 2009 16:54:25 +0000 (16:54 +0000)]
timer: No longer craksh when reading TCNT with timer off

Thanks to Jon Escombe

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoSimduino: Teaser
Michel Pollet [Wed, 23 Dec 2009 22:42:51 +0000 (22:42 +0000)]
Simduino: Teaser

Forget about it, it doesn't work yet. Loads the bootloader
and thats about it.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoMakefile: minor update
Michel Pollet [Wed, 23 Dec 2009 22:28:01 +0000 (22:28 +0000)]
Makefile: minor update

Added the optional trace define

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoUART: Implement a system of flow control
Michel Pollet [Wed, 23 Dec 2009 22:27:31 +0000 (22:27 +0000)]
UART: Implement a system of flow control

+ The uart now signals (using IRQs) when it's fifo is full and
empty. This allow controling code to send new bytes, or to pause.
+ The uart also now understand the Baud rate and prints it.
+ Added new IOCTL to get/set the UART emulation flags

A new mode of the UART was made specialy for code that spinloops
waiting to get/send a byte. Now if the uart detects that, it will
insert a usleep() when the uart is idle, this will prevent
code from eating 100% cpu doing nothing.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agocore: No longer crash if "codeline" is missing
Michel Pollet [Wed, 23 Dec 2009 22:23:21 +0000 (22:23 +0000)]
core: No longer crash if "codeline" is missing

Debug macros were crashing if the symbols had not been loaded,
and they are never loaded when usin a .hex file

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agorun_avr et al. New HEX format loader
Michel Pollet [Wed, 23 Dec 2009 22:22:23 +0000 (22:22 +0000)]
run_avr et al. New HEX format loader

simavr can now load .hex files directly, It is obviously a lot
more primitive than the ELF loader, but it works.
You have to specify the MCU and the AVR frequency on the command
line to run a .hex, otherwise simavr has no clue what it's suposed
to do.

Also reworked run_avr to get rid of getopt, moved the
read_hex_string function into the new sim_hex.[ch], and now
understand that the base addresd of code is not always zero.

This allows loading of a bootloader (tada!)

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agocore: Added a new ELF tag with AVR->simavr command path
Michel Pollet [Wed, 23 Dec 2009 22:17:46 +0000 (22:17 +0000)]
core: Added a new ELF tag with AVR->simavr command path

This new mode allow the AVR firmware to specify an (unused)
AVR IO register as a "command path" to send commands back to
simavr.
It allows for example the firmware to start/stop the VCD trace
dump, exactly where it should from the ooint of view of the
firmware being ran.

See atmega88_uart_echo.c for an example.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agocomments: What don't you typo the comments, too ?
Michel Pollet [Wed, 23 Dec 2009 00:52:41 +0000 (00:52 +0000)]
comments: What don't you typo the comments, too ?

Fixed a few!

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agotimer: Implemented some of the ICR based timers
Michel Pollet [Tue, 22 Dec 2009 16:24:35 +0000 (16:24 +0000)]
timer: Implemented some of the ICR based timers

Also made a PWM and a Fast PWM mode. Fast pwm doesm't use the
interrupts, as most of the time it's never used. Aldo it kills
performanves when calling a timer every 400 cycles.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agomisc: Disabled debug traces
Michel Pollet [Tue, 22 Dec 2009 16:22:24 +0000 (16:22 +0000)]
misc: Disabled debug traces

No functionsl changes

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agocores: Also disable fuse macros
Michel Pollet [Tue, 22 Dec 2009 16:21:45 +0000 (16:21 +0000)]
cores: Also disable fuse macros

For silly ubuntu

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agotimers: Added TCNT reading/writing support
Michel Pollet [Mon, 21 Dec 2009 21:08:45 +0000 (21:08 +0000)]
timers: Added TCNT reading/writing support

TCNT read/write is now working. It is recalculated at read time.
You can also write to it to reset the timer to a fixed value, this resets
the simavr timer base accordingly.
Note that some timer modes should /not/ let the AVR write to TCNT, this
is not handled right now.

Also added an example of AVR code that uses timers, change TCNT1 and
generates a nice trace file with all the changes.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoIRQ: Made the hook structure private
Michel Pollet [Mon, 21 Dec 2009 21:07:42 +0000 (21:07 +0000)]
IRQ: Made the hook structure private

No functional changes

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agocores: Disable signatures to help compile on ubuntu
Michel Pollet [Mon, 21 Dec 2009 08:18:43 +0000 (08:18 +0000)]
cores: Disable signatures to help compile on ubuntu

Ubuntu and gento uses old avr toolchain, that lacks
the SIGNATURE defines.
So I disabled it in simavr, it was not used for
anything functional for now anyway

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoexamples: Minor updates
Michel Pollet [Sun, 20 Dec 2009 23:08:31 +0000 (23:08 +0000)]
examples: Minor updates

New timers etc...

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agocores: Added ATTiny2313
Michel Pollet [Sun, 20 Dec 2009 23:07:56 +0000 (23:07 +0000)]
cores: Added ATTiny2313

Another new core...

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agocores: Updated for 16 bits timers and ADCs
Michel Pollet [Sun, 20 Dec 2009 23:07:29 +0000 (23:07 +0000)]
cores: Updated for 16 bits timers and ADCs

Also made a macro for EXTINT declarations.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoADC: Placeholder IO module
Michel Pollet [Sun, 20 Dec 2009 23:05:38 +0000 (23:05 +0000)]
ADC: Placeholder IO module

Not doing anything for now, but the IO blocks are filled
in the core definitiond already.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agotimer: Masssive timer update. 8 & 16 bits
Michel Pollet [Sun, 20 Dec 2009 23:04:43 +0000 (23:04 +0000)]
timer: Masssive timer update. 8 & 16 bits

Re-massaged the timer code. It now works as 8 or 16 bits,
Also added a way to soecify the mode the timer run, and made
the TOV, COMPA and COMPB work as they should.
Now support the "Normal" timer mode too.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoREADME an Makefiles update
Michel Pollet [Sun, 20 Dec 2009 23:02:44 +0000 (23:02 +0000)]
README an Makefiles update

Makefiles for the examples should work in ubuntu

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agotimer_64led: Brand new example board, opengl display too
Michel Pollet [Thu, 17 Dec 2009 20:31:23 +0000 (20:31 +0000)]
timer_64led: Brand new example board, opengl display too

This example is a real board firmware that was built and
works. The firmware was adapted lightly and now runs
perfectly in simavr. It's a "stopwatch" timer with a lot
of features.
The "board" generates a very complete waveform for a LOT
of interesting signals, like the 74HC595 latches, intetupts,
SPI activity and the lot.

This example is the crown jewel of simavr development so far,
because simavr was design with the goal of being able to simulate
one's own project, for real.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoledramp: Use a larger VCD update window
Michel Pollet [Thu, 17 Dec 2009 20:27:10 +0000 (20:27 +0000)]
ledramp: Use a larger VCD update window

No longer needs a 5usec window, the timer does the job

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoMakefiles: Small updates
Michel Pollet [Thu, 17 Dec 2009 20:25:54 +0000 (20:25 +0000)]
Makefiles: Small updates

For consistency only...

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoELF: Use a much larger VCD flush window
Michel Pollet [Thu, 17 Dec 2009 20:25:01 +0000 (20:25 +0000)]
ELF: Use a much larger VCD flush window

With the new log VCD handling, a much larger timeout is
perfectly fine.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoVCD: Reworked
Michel Pollet [Thu, 17 Dec 2009 20:24:11 +0000 (20:24 +0000)]
VCD: Reworked

More or less re-did the VCD handling, now ues a "log" of signal
changes instead of a timeslice. The log is flushed at regular
interval using a timer.
The log also handles signal changes that are smaller than one usec
(the minimum time slice in our VCD).

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agointerrupts: Added a "raised" IRQ
Michel Pollet [Thu, 17 Dec 2009 20:22:10 +0000 (20:22 +0000)]
interrupts: Added a "raised" IRQ

Added a "raise" IRQ that is set to 1 when the interrupt is
scheduled, and to 0 when the handler is called.
This allows the interrupts to be traced into a VCD file
waveform, amongst other things.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agocore: Reworked the cycle timers
Michel Pollet [Thu, 17 Dec 2009 19:56:01 +0000 (19:56 +0000)]
core: Reworked the cycle timers

Ensure that a timer when called does not continue to have a
"call next" that is smaller than the current cycle, bogging
down the rest of the core.
Also ensure the cycle is always incremented by at least one
when sleeping, even if a cycle callback is called.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agocore: Added an avr_terminate() call
Michel Pollet [Thu, 17 Dec 2009 19:53:42 +0000 (19:53 +0000)]
core: Added an avr_terminate() call

This allow the VCD file to be flushed and closed properly.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agouart: Register the interupt vectors
Michel Pollet [Thu, 17 Dec 2009 19:50:37 +0000 (19:50 +0000)]
uart: Register the interupt vectors

This has no functiinal change, apart to keep the table of
"handled" interupts in the avr_t structure complete.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agotimer8: Implements "fast PWM" mode
Michel Pollet [Thu, 17 Dec 2009 19:49:17 +0000 (19:49 +0000)]
timer8: Implements "fast PWM" mode

Added IRQs that outputs the PWM duty cycle when changed
by the AVR code.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agospi: Use a timer to send the bytes out, when master
Michel Pollet [Thu, 17 Dec 2009 19:48:14 +0000 (19:48 +0000)]
spi: Use a timer to send the bytes out, when master

No longer output the bytes too fast, that could create collisions
with the SPI in IRQ.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agocores: Add a few more mega cores
Michel Pollet [Thu, 17 Dec 2009 19:46:25 +0000 (19:46 +0000)]
cores: Add a few more mega cores

Added mega164, mega324, mega328

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoFixed 'ledramp' example to reflect new loader
Michel Pollet [Wed, 16 Dec 2009 00:16:55 +0000 (00:16 +0000)]
Fixed 'ledramp' example to reflect new loader

No functional changes

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoELF: Updated example firmware to generate new traces
Michel Pollet [Tue, 15 Dec 2009 21:42:25 +0000 (21:42 +0000)]
ELF: Updated example firmware to generate new traces

Example firmware declares two traces that will generate a
trace file automaticaly when run with run_avr. The file is
created at load time using the .mmcu declarations.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoELF: Redone the .mmcu section
Michel Pollet [Tue, 15 Dec 2009 21:39:49 +0000 (21:39 +0000)]
ELF: Redone the .mmcu section

The section now uses :tags: that can be parsed regardless
of order, size, alignment and so on.
Also added tags to allow a firmware to register VCD traces
directly from macros placed in the firmware itself.

This allows very quick and painless trace generation of any IO
register/bit without having to know the real values for the
addresses.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoVCD: Traces now have the correct timestamps
Michel Pollet [Tue, 15 Dec 2009 21:38:43 +0000 (21:38 +0000)]
VCD: Traces now have the correct timestamps

Traces in multiple of the "period" and use the
correct stamps for value changes.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoUART: Delay TX interupt a few cycles
Michel Pollet [Tue, 15 Dec 2009 21:37:53 +0000 (21:37 +0000)]
UART: Delay TX interupt a few cycles

Also clear the "buffer empty" flag when UDR is written

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoAdded support for IRQ triggers on any IO register
Michel Pollet [Tue, 15 Dec 2009 21:35:02 +0000 (21:35 +0000)]
Added support for IRQ triggers on any IO register

Each IO address has it's own IRQ list now, dynamicaly
allocated when needed. It allows any code to register
an IRQ callback for any change made to any register.

Even registers that have no IO drivers (yet?) can be
monitored.

As a silver lining, this means any register or register bit
can be traced in a VCD file and displayed in gtkwave.

Signed-off-by: Michel Pollet <buserror@gmail.com>