simavr
13 years agoFix SBIS etc trace output.
Sami Liedes [Sun, 20 Feb 2011 16:52:32 +0000 (18:52 +0200)]
Fix SBIS etc trace output.

SBIS used to print the io register wrong. The other fixes add spaces
in the correct places in "Will branch" and "Will not branch" messages.

Signed-off-by: Sami Liedes <sliedes@cc.hut.fi>
13 years agoavr_loadcode(): If too much code, bail out instead of crashing.
Sami Liedes [Sat, 19 Feb 2011 03:25:53 +0000 (05:25 +0200)]
avr_loadcode(): If too much code, bail out instead of crashing.

Check that the code to be loaded actually fits in the flash.

Signed-off-by: Sami Liedes <sliedes@cc.hut.fi>
13 years agoavr_register_io_[read,write](): fail if overriding earlier registration.
Sami Liedes [Fri, 18 Feb 2011 20:09:24 +0000 (22:09 +0200)]
avr_register_io_[read,write](): fail if overriding earlier registration.

The avr_register_io_*() functions do not maintain a chain of
callbacks. This can be confusing if someone like me tries to use them
to listen to some I/O events (for which you should use the avr_irq_*
stuff).

Make this more explicit by checking in the register functions if we
already have a callback and failing with an error message if so.

Signed-off-by: Sami Liedes <sliedes@cc.hut.fi>
13 years agoboard_hd44780: New sample code
Michel Pollet [Mon, 21 Feb 2011 18:05:44 +0000 (18:05 +0000)]
board_hd44780: New sample code

Emulated a complete HD44780 LCd screen, and uses a standard
AVR driver to write on it.

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agovcd: Increase trace buffer size
Michel Pollet [Mon, 21 Feb 2011 18:02:03 +0000 (18:02 +0000)]
vcd: Increase trace buffer size

Ran into the 128 limit at some point..

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agoMakefiles: Some fixups
Michel Pollet [Mon, 21 Feb 2011 18:01:17 +0000 (18:01 +0000)]
Makefiles: Some fixups

+ add -fPIC to -shared for the shared library
+ .axf rule try to comoile all dependencies

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agoMerge git://gitorious.org/~luki/simavr/lukis-simavr into dev-home
Michel Pollet [Sun, 20 Feb 2011 10:20:52 +0000 (10:20 +0000)]
Merge git://gitorious.org/~luki/simavr/lukis-simavr into dev-home

13 years agoMakefile: Add building of shared library on linux
Martin Glueck [Sat, 19 Feb 2011 18:55:43 +0000 (19:55 +0100)]
Makefile: Add building of shared library on linux

Disabled for non linux platform, as it need more work
than just a gcc -shared

Author:    Martin Glueck <martin@mangari.org>
Edit:    Michel Pollet <buserror@gmail.com>

13 years agocore: Added ATtiny x4
Martin Glueck [Sat, 19 Feb 2011 18:20:18 +0000 (19:20 +0100)]
core: Added ATtiny x4

Untested. Also added to sim_avr.c

Author:    Martin Glueck <martin@mangari.org>
Edit:    Michel Pollet <buserror@gmail.com>

13 years agocore: Remove the run() callback
Michel Pollet [Sat, 19 Feb 2011 00:21:53 +0000 (00:21 +0000)]
core: Remove the run() callback

run() callback was unused but was still using cycles

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agoMakefiles: Explicitely link opengl
Michel Pollet [Fri, 18 Feb 2011 15:52:52 +0000 (15:52 +0000)]
Makefiles: Explicitely link opengl

needed with modern linker

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agotimer: Fix a subtle off-by-one bug in TCNT reading.
Sami Liedes [Thu, 17 Feb 2011 19:47:00 +0000 (21:47 +0200)]
timer: Fix a subtle off-by-one bug in TCNT reading.

There's a subtle bug in TCNT (timer counter) reading which only causes
the counter to ever run from 0 to TOP-1, while it should stay in the
TOP value for a full timer cycle before resetting to 0 (but the
interrupt needs to come when TOP is first reached).

Interestingly, this causes Arduino's micros() function to occasionally
return incorrect values. micros() function relies on TCNT0 not
transitioning from <= 254 to 0 in only a few cycles with /64
prescaler.

Signed-off-by: Sami Liedes <sliedes@cc.hut.fi>
13 years agotimers: don't reconfigure for minor changes
Michel Pollet [Wed, 16 Feb 2011 00:03:28 +0000 (00:03 +0000)]
timers: don't reconfigure for minor changes

Prevents the timer to be reset when changing non important
bits, like the edge detector etc

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agotimers: Print a warning on unsuported timer modes
Michel Pollet [Wed, 16 Feb 2011 00:02:01 +0000 (00:02 +0000)]
timers: Print a warning on unsuported timer modes

and also don't [rint one for "mormal" mode

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agoStore the next cycle count where the earliest cycle timer needs to be run.
Sami Liedes [Tue, 15 Feb 2011 23:21:38 +0000 (01:21 +0200)]
Store the next cycle count where the earliest cycle timer needs to be run.
This speeds up cycle timer processing significantly and almost doubles
the speed of the overall simulation.

Signed-off-by: Sami Liedes <sliedes@cc.hut.fi>
13 years agoRework avr_service_interrupts() to use ffs() too for speed.
Sami Liedes [Fri, 4 Feb 2011 23:46:08 +0000 (01:46 +0200)]
Rework avr_service_interrupts() to use ffs() too for speed.

13 years agoUse ffs() for finding timers from cycle timer map.
Sami Liedes [Fri, 4 Feb 2011 22:26:54 +0000 (00:26 +0200)]
Use ffs() for finding timers from cycle timer map.

This optimization speeds up avr_cycle_timer_process() considerably. It
used to be a major bottleneck in my test case (52% of CPU time spent
in that routine), now it's about half that.

13 years agoReturn zeros when GDB reads just past end of stack.
Sami Liedes [Wed, 2 Feb 2011 20:18:04 +0000 (22:18 +0200)]
Return zeros when GDB reads just past end of stack.

GDB likes to read the topmost value of stack when using the
"stepi" (step instruction) command. Unfortunately this does not work
when the stack is empty, causing an error message and GDB confusion.

Hack the GDB stub code to just return zeros if GDB tries to read two
bytes just past the end of stack.

NOTE: This may need to be modified to support also longer reads for
bigger AVRs where code pointers are longer than two bytes (e.g.
ATMega2560). As simavr doesn't support atm2560 yet, I'm implementing
it this way now.

13 years agoEnable interrupt handling for Fast PWM timers too
Sami Liedes [Wed, 2 Feb 2011 17:23:45 +0000 (19:23 +0200)]
Enable interrupt handling for Fast PWM timers too

Arduino seems to use that.

13 years agoUART: Fixed UDRC/E behaviour
Michel Pollet [Fri, 14 Jan 2011 10:19:28 +0000 (10:19 +0000)]
UART: Fixed UDRC/E behaviour

The interrupt is suposed to fire as soon as it is
enabled is the UDR is empty.

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agocycle timers: Added avr_cycle_timer_status()
Michel Pollet [Fri, 14 Jan 2011 10:18:40 +0000 (10:18 +0000)]
cycle timers: Added avr_cycle_timer_status()

Allows verification wether a timer is running, and
until when it is.

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agosimduino: added init/deinit functions for avr_t initialization
Christian Balles [Tue, 19 Oct 2010 22:00:28 +0000 (00:00 +0200)]
simduino: added init/deinit functions for avr_t initialization

fixes a crash (free of mmap'ed memory)
nicer cleanup by munmap + close the file

Signed-off-by: Christian Balles <code@ballessay.de>
13 years agocore: added extra init/deinit functions to avr_t
Christian Balles [Tue, 19 Oct 2010 21:45:58 +0000 (23:45 +0200)]
core: added extra init/deinit functions to avr_t

allows programs like the simduino example to modify the init/deinit function
to fix a crash

Signed-off-by: Christian Balles <code@ballessay.de>
13 years agomisc: Typos
Michel Pollet [Mon, 25 Oct 2010 11:53:29 +0000 (12:53 +0100)]
misc: Typos

Fixed a few comments

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agocore: Added a bit of documentation
Michel Pollet [Tue, 12 Oct 2010 09:03:43 +0000 (10:03 +0100)]
core: Added a bit of documentation

Fixed some of the copy/paste errors in comments

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agogdb: Adds the 'reset' command
Michel Pollet [Tue, 12 Oct 2010 09:02:55 +0000 (10:02 +0100)]
gdb: Adds the 'reset' command

Apparently needed for compatibility with AVRStudio debugger

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agoconsole: Implement debug console register
Michel Pollet [Tue, 12 Oct 2010 09:02:03 +0000 (10:02 +0100)]
console: Implement debug console register

Used in pair with the console register declaration, just
prints what's sent to that debug register.

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agomcu_section: Added New CONSOLE Tag
Michel Pollet [Tue, 12 Oct 2010 09:00:33 +0000 (10:00 +0100)]
mcu_section: Added New CONSOLE Tag

CONSOLE tag allow declaring a register for dumping debug output
oh the terminal without using an UART

Also cleaned up and documented the header file further

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agotests: Update them so they work...
Michel Pollet [Thu, 2 Sep 2010 12:01:25 +0000 (13:01 +0100)]
tests: Update them so they work...

They relied on bugs that were fixed in simavr since..

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agoIOs: Use new IRQ alloc function
Michel Pollet [Thu, 2 Sep 2010 12:00:48 +0000 (13:00 +0100)]
IOs: Use new IRQ alloc function

All converted to the brand new way...

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agoIRQs: A bit of sanity when freeing
Michel Pollet [Thu, 2 Sep 2010 11:59:59 +0000 (12:59 +0100)]
IRQs: A bit of sanity when freeing

Check the parameters...

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agosimavr: Deallocate resources
Michel Pollet [Thu, 2 Sep 2010 11:56:29 +0000 (12:56 +0100)]
simavr: Deallocate resources

Deallocate memory and IO modules at teardown

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agoeeprom: Added a dealloc function
Michel Pollet [Thu, 2 Sep 2010 11:55:40 +0000 (12:55 +0100)]
eeprom: Added a dealloc function

frees the eeprom memory at teardown time

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agoios: Added a way to set and teardown modules IRQs
Michel Pollet [Thu, 2 Sep 2010 11:55:05 +0000 (12:55 +0100)]
ios: Added a way to set and teardown modules IRQs

Added a function to set the io module IRQ, and added a way
to deallocate them at teardown time.

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agomisc: Made (most) of the headers c++ friendly
Michel Pollet [Thu, 2 Sep 2010 10:59:07 +0000 (11:59 +0100)]
misc: Made (most) of the headers c++ friendly

No functional changes

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agomisc: Fixed clang static analizer warnings
Michel Pollet [Tue, 31 Aug 2010 11:31:37 +0000 (12:31 +0100)]
misc: Fixed clang static analizer warnings

One genuine bug too. The rest was cosmetic.

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agoioport: Added an IRQ for the port pin direction changes
Michel Pollet [Tue, 31 Aug 2010 10:55:29 +0000 (11:55 +0100)]
ioport: Added an IRQ for the port pin direction changes

New IRQ for client code (ie "board code") will be called
when the AVR firmware changes the DDR register.

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agoioport: Add an ioctl to get the port state
Michel Pollet [Tue, 31 Aug 2010 10:48:44 +0000 (11:48 +0100)]
ioport: Add an ioctl to get the port state

Example:
for (int i = 'A'; i <= 'F'; i++) { avr_ioport_state_t state;
if (avr_ioctl(AVR_IOCTL_IOPORT_GETSTATE(i), &state) == 0)
printf("PORT%c %02x DDR %02x PIN %02x\n",
state.name, state.port, state.ddr, state.pin);
}

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agomisc: Typos etc
Michel Pollet [Tue, 31 Aug 2010 10:30:49 +0000 (11:30 +0100)]
misc: Typos etc

Makefile now uses $(CC) so it works with clang static analyzer.

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agocore: CALL/RET instructions fix
Michel Pollet [Wed, 25 Aug 2010 15:07:31 +0000 (16:07 +0100)]
core: CALL/RET instructions fix

Swap LSB and MSB of return address on the stack.
Thanks to "Peter" on the simavr mailing list.

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agocore: Add PORTA support for Attiny2313
Michel Pollet [Tue, 10 Aug 2010 21:51:31 +0000 (22:51 +0100)]
core: Add PORTA support for Attiny2313

The Attiny2313 has a PORTA, the pins for it are normally used for
reset and the crystal, but it is possible to use them if you use the
internal R/C oscilator.
Simavr didn't support this port on a Attiny2313 yet, so I added it myself.

Signed-off-by: Wander Winkelhorst <w.winkelhorst@gmail.com>
Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agotimer: Fix for older AVRs & tinies
Michel Pollet [Mon, 2 Aug 2010 21:38:44 +0000 (22:38 +0100)]
timer: Fix for older AVRs & tinies

They lack WGM bits

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agocore: Fix SBRS/C for 32 bits instructions
Michel Pollet [Mon, 5 Jul 2010 10:09:20 +0000 (11:09 +0100)]
core: Fix SBRS/C for 32 bits instructions

Untested, but matches the datasheet

Signed-off-by: Michel Pollet <buserror@gmail.com>
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 agoexample using a hd44780 lcd simulator added.
luki [Sat, 23 Jan 2010 15:25:47 +0000 (16:25 +0100)]
example using a hd44780 lcd simulator added.

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>