simavr
12 years agoexamples: New board_usb
Michel Pollet [Mon, 27 Feb 2012 14:21:16 +0000 (14:21 +0000)]
examples: New board_usb

Automaticaly tries to build the vhci libraries
TODO: Make the whole simavr build work even if the vhci
      compile fails, or is not linux

By: Torbjorn Tyridal <ttyridal@gmail.com>
Signed-off-by: Michel Pollet <buserror@gmail.com>
12 years agoparts: New vhci usb device bridge
Michel Pollet [Mon, 27 Feb 2012 14:19:15 +0000 (14:19 +0000)]
parts: New vhci usb device bridge

By Torbjorn Tyridal <ttyridal@gmail.com>
Signed-off-by: Michel Pollet <buserror@gmail.com>
12 years agocores: Added at90usb162
Michel Pollet [Mon, 27 Feb 2012 14:18:24 +0000 (14:18 +0000)]
cores: Added at90usb162

Straight from Torbjorn Tyridal <ttyridal@gmail.com>

Signed-off-by: Michel Pollet <buserror@gmail.com>
12 years agosimavr: Added usb slave emulation module
Michel Pollet [Mon, 27 Feb 2012 14:17:25 +0000 (14:17 +0000)]
simavr: Added usb slave emulation module

Straight from Torbjorn Tyridal <ttyridal@gmail.com> with
just a bit of source code remangling

Signed-off-by: Michel Pollet <buserror@gmail.com>
12 years agoexamples: Link against .so
Michel Pollet [Mon, 27 Feb 2012 14:00:29 +0000 (14:00 +0000)]
examples: Link against .so

If .so is present, link against that, not the static lib

Signed-off-by: Michel Pollet <buserror@gmail.com>
12 years agovhci: Fix Makefile PWD
Michel Pollet [Mon, 27 Feb 2012 13:59:27 +0000 (13:59 +0000)]
vhci: Fix Makefile PWD

Somehow PWD is wrong, it's the shell's one not the make one

Signed-off-by: Michel Pollet <buserror@gmail.com>
12 years agoMakefiles: general update
Michel Pollet [Mon, 27 Feb 2012 10:53:28 +0000 (10:53 +0000)]
Makefiles: general update

+ Now uses the shared library if present, and added some
  logic to find where it was built.
+ Added an "official" version number
+ Added a "make install DESTDIR=..." target
+ Added a "simavr.pc" pkg-config file

12 years agoall: Added -Wall to the build
Michel Pollet [Mon, 27 Feb 2012 10:51:23 +0000 (10:51 +0000)]
all: Added -Wall to the build

And fixed the warnings that poped out

Signed-off-by: Michel Pollet <buserror@gmail.com>
12 years agocycle_timers: Fix a delivery problem
Michel Pollet [Sun, 26 Feb 2012 10:58:26 +0000 (10:58 +0000)]
cycle_timers: Fix a delivery problem

If the timer was deleting/inserting timers, it wouldn't
be rescheduled properly.

Signed-off-by: Michel Pollet <buserror@gmail.com>
12 years agovhci: Added a gitignore
Michel Pollet [Sat, 25 Feb 2012 17:59:44 +0000 (17:59 +0000)]
vhci: Added a gitignore

Ignore generated files in there

Signed-off-by: Michel Pollet <buserror@gmail.com>
12 years agointerrupts: Isolated runtime data
Michel Pollet [Sat, 25 Feb 2012 17:57:59 +0000 (17:57 +0000)]
interrupts: Isolated runtime data

Split the runtime data related to interrupts into it's own
struct, and updated anyone using it directly.
Ultimately it would be the goal not to have to pass an avr_t
around to all the functions.

Signed-off-by: Michel Pollet <buserror@gmail.com>
12 years agoregbits: Moved the struct declaration
Michel Pollet [Sat, 25 Feb 2012 17:56:03 +0000 (17:56 +0000)]
regbits: Moved the struct declaration

Moved the data type to sim_avr_types.h, so it doesn't
need the full avr_t type to be used.

Signed-off-by: Michel Pollet <buserror@gmail.com>
12 years agostyle: Updated to 2012
Michel Pollet [Sat, 25 Feb 2012 17:26:33 +0000 (17:26 +0000)]
style: Updated to 2012

Changed prototypes, updared copyright etc

Signed-off-by: Michel Pollet <buserror@gmail.com>
12 years agovhci: build kernel module & library
Michel Pollet [Sat, 25 Feb 2012 16:25:30 +0000 (16:25 +0000)]
vhci: build kernel module & library

This makefile downloads the vhci bits, hack the a little
and compile them in place.
One done it's left as an excercise to the reader to install
the module where they want.

Example board can then link/compile by adding -I../vhci/include and
-L../vhci/lib to their makefile

Signed-off-by: Michel Pollet <buserror@gmail.com>
12 years agocycle_timers: Big rework
Michel Pollet [Sat, 25 Feb 2012 14:45:06 +0000 (14:45 +0000)]
cycle_timers: Big rework

Removed the old bitfield, implemented a sorted list. Timers
get added to the list by (reverse) order of execution do acts
as a stack of timers to run and pop out.

This considerably simplifies the code, and also makes the code
that test for the next timer to run very small and efficient.

This should make cycle_timers a lot more scalable, since they are
used for many more uses than they were originaly designed for.

Signed-off-by: Michel Pollet <buserror@gmail.com>
12 years agogeneral: Introduce two new headers
Michel Pollet [Sat, 25 Feb 2012 14:40:40 +0000 (14:40 +0000)]
general: Introduce two new headers

Split the cycle/usec conversion code from the cycle_timer
heacers into it's new sim_time.h

Also removed the simple types out of sim_avr.h to create
new header sim_avr_types.h

Adapted other modules to use avr_time.h

Signed-off-by: Michel Pollet <buserror@gmail.com>
12 years agotimer: Fix a problem on unconfigured comparators
Michel Pollet [Sat, 25 Feb 2012 14:37:26 +0000 (14:37 +0000)]
timer: Fix a problem on unconfigured comparators

Was trying to calculated and setup comparators that
didn't exists on some cores... confusion ensued.
This fixes the "64 led timer" example.

Signed-off-by: Michel Pollet <buserror@gmail.com>
12 years agointerrupts: Rewrote interrupt delivery
Michel Pollet [Sat, 25 Feb 2012 10:05:23 +0000 (10:05 +0000)]
interrupts: Rewrote interrupt delivery

Now uses a fifo, removed the bitfield.
This allows multiple interrupt "sources" per vector,
and should make delivery a bit quicker too.

Signed-off-by: Michel Pollet <buserror@gmail.com>
12 years agoi2ctest: Make example exit properly
Michel Pollet [Sat, 25 Feb 2012 10:05:59 +0000 (10:05 +0000)]
i2ctest: Make example exit properly

Demo was trying to exit, but the harness wasn't

Signed-off-by: Michel Pollet <buserror@gmail.com>
12 years agotests: Cleanup the test harnesses
Michel Pollet [Wed, 22 Feb 2012 12:21:27 +0000 (12:21 +0000)]
tests: Cleanup the test harnesses

Removed extra scripts, etc

Signed-off-by: Michel Pollet <buserror@gmail.com>
12 years agoadc: Fix for non updating ADC values
Michel Pollet [Wed, 22 Feb 2012 11:29:06 +0000 (11:29 +0000)]
adc: Fix for non updating ADC values

Patch from Peter Ross pross@xvid.org

Signed-off-by: Michel Pollet <buserror@gmail.com>
12 years agomakefile: Make -j works
Michel Pollet [Sat, 25 Feb 2012 10:06:34 +0000 (10:06 +0000)]
makefile: Make -j works

Was lacking dependencies

Signed-off-by: Michel Pollet <buserror@gmail.com>
12 years agomakefile: Don't track system headers
Michel Pollet [Wed, 22 Feb 2012 11:28:18 +0000 (11:28 +0000)]
makefile: Don't track system headers

Otherwise incremental make fails after system updates

Signed-off-by: Michel Pollet <buserror@gmail.com>
12 years agotests: Revert a uart patch
Michel Pollet [Wed, 14 Sep 2011 08:23:27 +0000 (09:23 +0100)]
tests: Revert a uart patch

We do need the translation, as it's not one, but generation of \n\r

Signed-off-by: Michel Pollet <buserror@gmail.com>
12 years agocores: Added mega16m1
Michel Pollet [Wed, 14 Sep 2011 08:20:03 +0000 (09:20 +0100)]
cores: Added mega16m1

Could work for megaXm1 ?

Signed-off-by: Markus Lampert <mlampert@telus.net>
Signed-off-by: Michel Pollet <buserror@gmail.com>
12 years agolin: Added module
Michel Pollet [Wed, 14 Sep 2011 08:19:15 +0000 (09:19 +0100)]
lin: Added module

- added core module for atmega16m1,
  standard peripherals and LIN-in-UART mode

Signed-off-by: Markus Lampert <mlampert@telus.net>
Signed-off-by: Michel Pollet <buserror@gmail.com>
12 years agocore: Added a log level
Michel Pollet [Wed, 14 Sep 2011 08:18:13 +0000 (09:18 +0100)]
core: Added a log level

added log_level to avr_t to control the output of the
simavr library (minimal usage)

Signed-off-by: Markus Lampert <mlampert@telus.net>
Signed-off-by: Michel Pollet <buserror@gmail.com>
12 years agouart: Do not assume all interupt vectors are available, etc
Michel Pollet [Wed, 14 Sep 2011 08:17:03 +0000 (09:17 +0100)]
uart: Do not assume all interupt vectors are available, etc

LIN uart doesn't have them (?)

- fixed uart code to only trigger rxt if more pending
  characters are in the input buffer
- fixed uart-echo test code to not get stuck in
  endless loop upon receiving '\r'

Signed-off-by: Markus Lampert <mlampert@telus.net>
Signed-off-by: Michel Pollet <buserror@gmail.com>
12 years agocore: added new states
Michel Pollet [Wed, 14 Sep 2011 08:10:39 +0000 (09:10 +0100)]
core: added new states

States cpu_Done and cpu_Crashed allow graceful exit
and cleanup of simavr applications.

Signed-off-by: Markus Lampert <mlampert@telus.net>
Signed-off-by: Michel Pollet <buserror@gmail.com>
12 years agocore: Fixed opcode printing on access violation
Michel Pollet [Wed, 14 Sep 2011 08:08:47 +0000 (09:08 +0100)]
core: Fixed opcode printing on access violation

No functional change

Signed-off-by: Markus Lampert <mlampert@telus.net>
Signed-off-by: Michel Pollet <buserror@gmail.com>
12 years agoadc: Added VCC/4 reading
Michel Pollet [Wed, 14 Sep 2011 08:07:07 +0000 (09:07 +0100)]
adc: Added VCC/4 reading

For mega16m1

Signed-off-by: Markus Lampert <mlampert@telus.net>
Signed-off-by: Michel Pollet <buserror@gmail.com>
12 years agomisc: formatting, typos
Michel Pollet [Wed, 14 Sep 2011 07:10:53 +0000 (08:10 +0100)]
misc: formatting, typos

Also removed test case that doesn't actualy test anything

Signed-off-by: Michel Pollet <buserror@gmail.com>
12 years agoioport: Added avr_iopin_t
Michel Pollet [Wed, 14 Sep 2011 07:02:44 +0000 (08:02 +0100)]
ioport: Added avr_iopin_t

Descriptor for pin name/pin number

Signed-off-by: Michel Pollet <buserror@gmail.com>
12 years agovcd: change VCD time base to 1 ns to handle higher AVR speeds (e.g. 20 MHz / max...
Stephan Veigl [Thu, 28 Jul 2011 16:03:33 +0000 (18:03 +0200)]
vcd: change VCD time base to 1 ns to handle higher AVR speeds (e.g. 20 MHz / max. frequency: 1000 MHz)
- increase VCD log size to 5kB

Signed-off-by: Stephan Veigl <veigl@gmx.net>
Signed-off-by: Michel Pollet <buserror@gmail.com>
12 years agoirq: add avr_unconnect_irq() and avr_irq_unregister_notify()
Stephan Veigl [Sun, 3 Jul 2011 16:42:58 +0000 (18:42 +0200)]
irq: add avr_unconnect_irq() and avr_irq_unregister_notify()

Signed-off-by: Stephan Veigl <veigl@gmx.net>
12 years agobitbang: add new bitbang sub-module
Stephan Veigl [Tue, 16 Aug 2011 13:05:21 +0000 (15:05 +0200)]
bitbang: add new bitbang sub-module

Signed-off-by: Stephan Veigl <veigl@gmx.net>
12 years agotest: fix test cases and add new test function
Stephan Veigl [Fri, 24 Jun 2011 12:33:02 +0000 (14:33 +0200)]
test: fix test cases and add new test function

- add tests_assert_uart_receive_avr() function (called by tests_assert_uart_receive() and test cases)
- fix DDR settings

Signed-off-by: Stephan Veigl <veigl@gmx.net>
12 years agoUpdate .gitignore.
Sami Liedes [Wed, 2 Feb 2011 17:19:20 +0000 (19:19 +0200)]
Update .gitignore.

Signed-off-by: Sami Liedes <sliedes@cc.hut.fi>
Signed-off-by: Michel Pollet <buserror@gmail.com>
12 years agovcd: change VCD time base to 1 ns to handle higher AVR speeds (e.g. 20 MHz / max...
Stephan Veigl [Thu, 28 Jul 2011 16:03:33 +0000 (18:03 +0200)]
vcd: change VCD time base to 1 ns to handle higher AVR speeds (e.g. 20 MHz / max. frequency: 1000 MHz)
- increase VCD log size to 5kB
- add test files

Signed-off-by: Stephan Veigl <veigl@gmx.net>
12 years agosimavr: change hard-coded value to define: AVR_IOPORT_OUTPUT
Stephan Veigl [Thu, 23 Jun 2011 14:20:56 +0000 (16:20 +0200)]
simavr: change hard-coded value to define: AVR_IOPORT_OUTPUT

Signed-off-by: Stephan Veigl <veigl@gmx.net>
12 years agooutput: add NO_COLOR define to disable / enable color output for simavr core messages...
Stephan Veigl [Thu, 23 Jun 2011 14:01:44 +0000 (16:01 +0200)]
output: add NO_COLOR define to disable / enable color output for simavr core messages and UART

Signed-off-by: Stephan Veigl <veigl@gmx.net>
12 years agodoc: add doxygen file
Stephan Veigl [Sun, 3 Jul 2011 16:49:28 +0000 (18:49 +0200)]
doc: add doxygen file

Signed-off-by: Stephan Veigl <veigl@gmx.net>
12 years agocores: Add mega1281
HATATANI Shinta [Thu, 8 Sep 2011 13:39:10 +0000 (22:39 +0900)]
cores: Add mega1281

Signed-off-by: HATATANI Shinta <gamaguchi@gmail.com>
Signed-off-by: Michel Pollet <buserror@gmail.com>
12 years agocores: Added mega8, old generation
Michel Pollet [Tue, 13 Sep 2011 18:38:38 +0000 (19:38 +0100)]
cores: Added mega8, old generation

Possibly would work with mega16, 32 ?

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agoexamples: Working i2c master test board
Michel Pollet [Sun, 27 Mar 2011 10:44:22 +0000 (11:44 +0100)]
examples: Working i2c master test board

Write a few bytes to an i2c eeprom, read them back...

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agoparts: Adds generic i2c eeprom slave
Michel Pollet [Sun, 27 Mar 2011 10:43:40 +0000 (11:43 +0100)]
parts: Adds generic i2c eeprom slave

This part simulates an i2c eeprom, it handles most modes, including
"multiple addresses" ones, and ones with multiple byte offset bytes.

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agotwi: Fully functional master
Michel Pollet [Sun, 27 Mar 2011 10:42:00 +0000 (11:42 +0100)]
twi: Fully functional master

Now works properly, tested against Atmel's code. See
examples/board_i2ctest for a demo

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agoexamples: Fix firmware pathnames
Michel Pollet [Wed, 23 Mar 2011 14:38:04 +0000 (14:38 +0000)]
examples: Fix firmware pathnames

Twas borken since I changed the build system. Now works

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agoexample: Added i2ctest
Michel Pollet [Tue, 15 Mar 2011 13:41:59 +0000 (13:41 +0000)]
example: Added i2ctest

This example need some polish. It simulates an AVR with an
i2c eeprom of 1024 bytes. The eeprom is "generic" an will go to the
parts/ directory when this is fully working.
Right now write the eeprom works, but there is a stray byte somewhere;
the bug /could/ be in the atmel code tho, wich I had to fix and tweak.

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agotwi: Update, 95% functional master code
Michel Pollet [Tue, 15 Mar 2011 13:40:12 +0000 (13:40 +0000)]
twi: Update, 95% functional master code

Still need a bit of polish, but the logic works. Works with the
interupt based Atmel application note code.

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agorun_avr: Added a signal handler
Michel Pollet [Tue, 15 Mar 2011 13:38:46 +0000 (13:38 +0000)]
run_avr: Added a signal handler

Catches control-C to make sure any VCD file is flushed

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agocores: Fix TWI interupt flag
Michel Pollet [Tue, 15 Mar 2011 13:38:11 +0000 (13:38 +0000)]
cores: Fix TWI interupt flag

This flag was using the wrong register

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agotest: Updated uart_echo
Michel Pollet [Tue, 15 Mar 2011 13:37:09 +0000 (13:37 +0000)]
test: Updated uart_echo

Now set a baud rate, to excersize the new logic in the uart
simulator.
Also added a VCD file

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agocores: Added UART bit rate flags
Michel Pollet [Tue, 15 Mar 2011 13:35:51 +0000 (13:35 +0000)]
cores: Added UART bit rate flags

Updated the cores that have UART(s) with extra flags.

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agouart: Added logic to regulate data rate
Michel Pollet [Tue, 15 Mar 2011 13:33:54 +0000 (13:33 +0000)]
uart: Added logic to regulate data rate

Now uses a data rate thst is proportional to speed.
Could be made a bit better by using the cycle clock count directly,
but this method is a bit clearer

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agomisc: Fixes various typos
Sami Liedes [Mon, 28 Feb 2011 19:27:29 +0000 (21:27 +0200)]
misc: Fixes various typos

Author:    Sami Liedes <sliedes@cc.hut.fi>
Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agoFix interupt -> interrupt typo, including in some function names.
Sami Liedes [Mon, 28 Feb 2011 21:37:59 +0000 (23:37 +0200)]
Fix interupt -> interrupt typo, including in some function names.

Signed-off-by: Sami Liedes <sliedes@cc.hut.fi>
13 years agoDo not let code clear the UDRE flag in USART.
Sami Liedes [Mon, 28 Feb 2011 21:33:08 +0000 (23:33 +0200)]
Do not let code clear the UDRE flag in USART.

It's a read only location and clearing it may break software that
assumes it cannot be cleared.

Signed-off-by: Sami Liedes <sliedes@cc.hut.fi>
13 years agoMerge remote-tracking branch 'sliedes/to-upstream' into dev-home
Michel Pollet [Wed, 9 Mar 2011 07:56:50 +0000 (07:56 +0000)]
Merge remote-tracking branch 'sliedes/to-upstream' into dev-home

13 years agoTweak struct avr_t to always include a pointer to trace data structure.
Sami Liedes [Mon, 28 Feb 2011 20:02:06 +0000 (22:02 +0200)]
Tweak struct avr_t to always include a pointer to trace data structure.

Previously the size of struct avr_t was dependent on whether the
preprocessor macro CONFIG_SIMAVR_TRACE was defined. This was problematic
since it meant that applications that link to simavr need to define it
the same way as it is defined in simavr Makefiles.

Change it to a single pointer to a struct, which is allocated iff
tracing is compiled in and a NULL pointer otherwise.

Signed-off-by: Sami Liedes <sliedes@cc.hut.fi>
13 years agoAutomate test cases.
Sami Liedes [Fri, 11 Feb 2011 01:02:33 +0000 (03:02 +0200)]
Automate test cases.

This patch implements a framework for test cases. Each test case is
compiled into an individual executable. All test cases can be run by
invoking the command `make run_tests', which runs the shell script
run_tests.

Signed-off-by: Sami Liedes <sliedes@cc.hut.fi>
13 years agoInclude sim_gdb.h from sim_gdb.c. Also fix prototype in .h.
Sami Liedes [Sun, 20 Feb 2011 16:55:10 +0000 (18:55 +0200)]
Include sim_gdb.h from sim_gdb.c. Also fix prototype in .h.

sim_gdb.c did not include sim_gdb.h. Also there was a slight
difference in the prototype in the header and the implementation in
the .c, causing a warning.

Signed-off-by: Sami Liedes <sliedes@cc.hut.fi>
13 years agouart: Touchup on the xon/xoff IRQs
Michel Pollet [Sun, 27 Feb 2011 20:34:07 +0000 (20:34 +0000)]
uart: Touchup on the xon/xoff IRQs

Set/reset XON & XOFF irqs following the status
of the fifo. It means they can be added to a VCD
file and help debug a "part".

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agouart: Added a comment
Michel Pollet [Thu, 24 Feb 2011 18:05:06 +0000 (18:05 +0000)]
uart: Added a comment

As to why somehow we don'r write a value in the interupt
clearing logic

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agotwi: Placeholder example board
Michel Pollet [Thu, 24 Feb 2011 18:03:24 +0000 (18:03 +0000)]
twi: Placeholder example board

Uses AVR application note implementation of master/slave mode
Placeholder, non functional

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agotwi: New master implementation
Michel Pollet [Thu, 24 Feb 2011 18:02:35 +0000 (18:02 +0000)]
twi: New master implementation

Yanked the old overengineered version, replaced it with a KISS
version. Untested, work in progress. Needs a new testing harness

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agoregbits: Added a "raw" variant to get/set
Michel Pollet [Thu, 24 Feb 2011 18:01:40 +0000 (18:01 +0000)]
regbits: Added a "raw" variant to get/set

Allows comparing to "real life" constants, used in Twi module

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agopart: Made irq_names static
Michel Pollet [Thu, 24 Feb 2011 18:01:01 +0000 (18:01 +0000)]
part: Made irq_names static

Have to to have several of them...

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agoMakefile: Fix for x86_64
Michel Pollet [Wed, 23 Feb 2011 17:56:08 +0000 (17:56 +0000)]
Makefile: Fix for x86_64

silly architecture names...

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agoMakefile updates
Michel Pollet [Wed, 23 Feb 2011 13:55:29 +0000 (13:55 +0000)]
Makefile updates

Changed the makefiles to derivate the target architecture from
gcc itself, and compile all the objects into obj-$arch. This
allows several compilers to be used to build simavr, at the same
time without interferences.

This allow arm cross compilation to live in the same tree as
the x86 one...

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agoUpdated gitignore
Michel Pollet [Wed, 23 Feb 2011 13:53:19 +0000 (13:53 +0000)]
Updated gitignore

Added obj-* and *.vcd

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agoRemove unused variable from avr_service_interrupts().
Sami Liedes [Wed, 23 Feb 2011 02:14:29 +0000 (04:14 +0200)]
Remove unused variable from avr_service_interrupts().

The done flag is nowadays redundant as it's never read after it's set.

Signed-off-by: Sami Liedes <sliedes@cc.hut.fi>
13 years agoFix LD, ST, LPM, STS, MUL to take the correct number of cycles.
Sami Liedes [Sat, 19 Feb 2011 03:35:57 +0000 (05:35 +0200)]
Fix LD, ST, LPM, STS, MUL to take the correct number of cycles.

They are now the ATMega timings. Need to figure out how to take
ATTiny into account. Before this change they weren't correct for
either.

Signed-off-by: Sami Liedes <sliedes@cc.hut.fi>
13 years agofix typos in comments.
Sami Liedes [Wed, 2 Feb 2011 17:20:31 +0000 (19:20 +0200)]
fix typos in comments.

Signed-off-by: Sami Liedes <sliedes@cc.hut.fi>
13 years agoSilence gcc warnings by using PRIu64 in CRASH() printf().
Sami Liedes [Sat, 5 Feb 2011 13:56:33 +0000 (15:56 +0200)]
Silence gcc warnings by using PRIu64 in CRASH() printf().

Actually we define a PRI_avr_cycle_count preprocessor macro in
sim_avr.h in the style of PRI* in inttypes.h.

Signed-off-by: Sami Liedes <sliedes@cc.hut.fi>
13 years agoFix compilation with TRACE on.
Sami Liedes [Wed, 23 Feb 2011 00:13:24 +0000 (02:13 +0200)]
Fix compilation with TRACE on.

The MOV instruction's TRACE() used the undefined variable vd.

Signed-off-by: Sami Liedes <sliedes@cc.hut.fi>
13 years agoFix compilation on non-32-bit platforms.
Sami Liedes [Wed, 23 Feb 2011 00:03:13 +0000 (02:03 +0200)]
Fix compilation on non-32-bit platforms.

The addition of -Werror to the compilation flags broke building on
64-bit hosts because casts between pointers and integers of different
sizes cause warnings on gcc -Wall. Fix this by always casting the
pointers to intptr_t first.

Signed-off-by: Sami Liedes <sliedes@cc.hut.fi>
13 years agoirq: Add names to most io module external irqs
Michel Pollet [Tue, 22 Feb 2011 23:20:36 +0000 (23:20 +0000)]
irq: Add names to most io module external irqs

Nothing to be shown for this work so far, the cool stuff hopefully
will come later...

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agodoc: Updated callgraph .pdf
Michel Pollet [Tue, 22 Feb 2011 17:27:45 +0000 (17:27 +0000)]
doc: Updated callgraph .pdf

Just a minor update

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agoexamples: Updated to new part prototypes
Michel Pollet [Tue, 22 Feb 2011 17:26:40 +0000 (17:26 +0000)]
examples: Updated to new part prototypes

Followup on previous checkin, the board examples now use
"names" when possible.

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agoparts: Updated to name their IRQs
Michel Pollet [Tue, 22 Feb 2011 17:25:43 +0000 (17:25 +0000)]
parts: Updated to name their IRQs

First bits of the system that provide names for the IRQs

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agosimavr: Updare simavr core to new IRQ prototypes
Michel Pollet [Tue, 22 Feb 2011 17:24:52 +0000 (17:24 +0000)]
simavr: Updare simavr core to new IRQ prototypes

Mostly prototypes changes and some gratuitous reformatting

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agoirq: Introduce a "irq pool"
Michel Pollet [Tue, 22 Feb 2011 17:23:54 +0000 (17:23 +0000)]
irq: Introduce a "irq pool"

The goal is to be able to name IRQs, so a couple fields are
added.
It is not functional for now, as the task is to first convert
all the code to the new prototype.

Also introduce a 2011 way of formatting prototypes

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agosimavr: Added -Werror and fixed warnings
Michel Pollet [Tue, 22 Feb 2011 17:21:54 +0000 (17:21 +0000)]
simavr: Added -Werror and fixed warnings

Added -Werror to compilation to make sure the next wave of changes
can't easily  break things

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agocore: Add a muxer for IO writes
Michel Pollet [Tue, 22 Feb 2011 12:50:51 +0000 (12:50 +0000)]
core: Add a muxer for IO writes

It turns out that some core (tiny85 at the very least) are competing
for IO writes on some register.
This patch introduces a muxer callback that can call multiple clients
without impacting performance for the rest of the cores.

The system could be extended for IO read if it proves necessary.

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 years agocore: Introduce run() and sleep() callbacks
Michel Pollet [Tue, 22 Feb 2011 12:48:31 +0000 (12:48 +0000)]
core: Introduce run() and sleep() callbacks

It seems that the default 'run_avr' function was penalized by
some tests made that were only useful when gdb was active.

This patch introduces two version of the critical run_avr, one for
"raw" running, and one for gdb.

It also introduces a sleep() callback for similar reasons. Ir can
also be used to run unit testing at 100% speed instead of having
random sleep code during execution.

Signed-off-by: Michel Pollet <buserror@gmail.com>
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>