simavr
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>
14 years agoAdded support for external interrupts (ie INT0 etc)
Michel Pollet [Tue, 15 Dec 2009 21:32:03 +0000 (21:32 +0000)]
Added support for external interrupts (ie INT0 etc)

Small module to implement the INT0 .. INT3 interrupts.
These hook up in ioport pin IRQs to trigger the
vectors.
Added vectors for the existing cores.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoMissing bits from previous commit...
Michel Pollet [Tue, 15 Dec 2009 00:06:16 +0000 (00:06 +0000)]
Missing bits from previous commit...

Key maps etc..

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoUpdated "ledramp" to demo the VCD gtkwave traces
Michel Pollet [Mon, 14 Dec 2009 21:03:18 +0000 (21:03 +0000)]
Updated "ledramp" to demo the VCD gtkwave traces

This patch is all that is needed to allow the demo "board"
to dump a file that will display graphicaly in gtkwave.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoAdds VCD (Value Change Dump) file output support (gtkwave)
Michel Pollet [Mon, 14 Dec 2009 21:00:04 +0000 (21:00 +0000)]
Adds VCD (Value Change Dump) file output support (gtkwave)

This subsystem is not called by the core itself, it is
an utility available to other "boards".

Allows the simulator to dump graphical traces readable
in gtkwave.
The subsystem allows any number of trace files in parallel,
any sampling periods, and a maximum of 32 traces per file.

See updated "ledramp.c" example for a very simple way to use
the code.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoStreamlined avr_irq subsystem
Michel Pollet [Mon, 14 Dec 2009 20:57:55 +0000 (20:57 +0000)]
Streamlined avr_irq subsystem

Made the IRQ subsytem even more generic, allows
IRQs to be directly connected to other IRQ without
the glue callback.
Also added flags to allow changing IRQ polarity, and
to enable/disable a "filter" that won't trigger the
callbacks when the IRQ value is the same as before.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoDisable the debugging traces
Michel Pollet [Mon, 14 Dec 2009 20:55:48 +0000 (20:55 +0000)]
Disable the debugging traces

Added a (Disabled by default) compile flag for the
heavy-duty debugger that helped debug the core. No
longer needed in full builds since 1) it works
2) gdb works for user code..

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoCleanup of the Makefiles
Michel Pollet [Mon, 14 Dec 2009 20:54:27 +0000 (20:54 +0000)]
Cleanup of the Makefiles

General cleanup, updated comments

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoAdded a real example on how to integrate simavr, etc
Michel Pollet [Mon, 7 Dec 2009 19:45:17 +0000 (19:45 +0000)]
Added a real example on how to integrate simavr, etc

+ OpenGL app loads, runs a firmware and interacts with it.
  See the README in examples/ledramp
+ Updated Makefiles & Readme
  Streamlined the makefiles, so they use the Makefile.common
  rules and so on.  Also updated README to bring it up to date.
+ Adding TWI - work in progress
  Non working implementation skeleton. Defines a "slave" and a "bus"
  And the AVR twi interface that has one of each

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoAdded a typedef for IO addresses
Michel Pollet [Sun, 6 Dec 2009 23:12:23 +0000 (23:12 +0000)]
Added a typedef for IO addresses

Used to be 8 bits only in the code, but bit megas use 9 bits,
so the new type is uint16_t.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoAdded tiny13
Michel Pollet [Sun, 6 Dec 2009 10:41:23 +0000 (10:41 +0000)]
Added tiny13

And macros to declare eeprom with 8 bits address.

Signed-off-by: Jon Escombe <lists@dresco.co.uk>
Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoMany more changes, timed callbacks etc
Michel Pollet [Fri, 4 Dec 2009 22:27:46 +0000 (22:27 +0000)]
Many more changes, timed callbacks etc

Now have functions to convert from/to cycles & usecs, use them for
implementing the new "one shot" timer callbacks.
IO modules now use "one shots" to implement "call later" subsystems,
like eeprom, uart, timers and so on.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agotiny25/45 cores added
Michel Pollet [Thu, 3 Dec 2009 23:56:57 +0000 (23:56 +0000)]
tiny25/45 cores added

Same method as the mega48/88/168...

Signed-off-by: Jon Escombe <lists@dresco.co.uk>
Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoPolished gdb support, etc
Michel Pollet [Thu, 3 Dec 2009 23:31:42 +0000 (23:31 +0000)]
Polished gdb support, etc

GDB handler re-done, removed the thread, removed the pauses,
Now as fast as possible for stepping trhu code.
Note you /need/ the dwarf-2 debug symbols for gdb to work
properly, a simple '-g' will not work.

Also added a mode that starts the gdb server and waits if the
AVR core detects a "crash". Added a piece if test unit to
test just that.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoGDB working, some more source massaging
Michel Pollet [Wed, 2 Dec 2009 21:50:09 +0000 (21:50 +0000)]
GDB working, some more source massaging

Big news is gdb support, you can trace, breakpoint,
resume, inspect (including eeprom addresses!).
You can't modify variables on the fly yet.
It's not very fast rignt now, but some very obvious
changes will help that a lot.

Other changes are more moving, shuffling. "simavr"
is gone, replaced by a simple "run_avr" that does
the same, but no longer has any emulation specific
code.

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoBuild works on Snow Leopard, using Arduino toolchain
Michel [Wed, 2 Dec 2009 00:02:16 +0000 (00:02 +0000)]
Build works on Snow Leopard, using Arduino toolchain

Tried the make system on Snow Leopard with a change in the
Makefiles to go and get avr-gcc and such in the Arduino.app
bundle.
Also fixed the .mmcu ELF header to be compatible with x86_64

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agouart, ioports, etc. Many more changes
Michel Pollet [Tue, 1 Dec 2009 21:47:48 +0000 (21:47 +0000)]
uart, ioports, etc. Many more changes

+ Reorganized source, split simavr.c
+ IRQ support added to IO modules
+ timer8: fixed a bug related to disabling clock
+ uart:
  - Added support for txen/rxen flags
  - Added a receive fifo, and the rx interupt
  - added a "atmega88_uart_echo" test case
+ simavr: hook rx & tx irqs on first uart, for tests

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoCores, decoder, uart, ioports - lots of changes
Michel Pollet [Mon, 30 Nov 2009 21:36:55 +0000 (21:36 +0000)]
Cores, decoder, uart, ioports - lots of changes

+ Cores now use eeprom declare macro
+ Cores now use the "TXCE" etc bits
+ Uart now raise TXC interupt/flag
+ ioports now use new internal IRQ system
+ New command line options for mcu, freq and trace
+ Decoder updates:
  - Fixed the last known "crash" bug.
  - Added cycles to most multi-cycle opcodes.
  - Added optional stack frame watcher
  - Skip instruction now handle 32 bits skips

Signed-off-by: Michel Pollet <buserror@gmail.com>
14 years agoInitial Commit
Michel Pollet [Tue, 24 Nov 2009 13:11:54 +0000 (13:11 +0000)]
Initial Commit

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