8 years agomake uart_pty threadsafe master
lode leroy [Sun, 25 Aug 2013 21:08:26 +0000 (23:08 +0200)]
make uart_pty threadsafe

8 years agoMerge pull request #21 from bsekisser/sim_core_eicall_eijmp_bugfix
Michel Pollet [Sun, 7 Jul 2013 20:56:15 +0000 (13:56 -0700)]
Merge pull request #21 from bsekisser/sim_core_eicall_eijmp_bugfix

sim_core.c: extended data type to 32 bits for eicall/eijmp instruction.

9 years agosim_core.c: extended data type to 32 bits for eicall/eijmp instruction.
bsekisser [Tue, 2 Jul 2013 17:02:15 +0000 (13:02 -0400)]
sim_core.c: extended data type to 32 bits for eicall/eijmp instruction.

modified:   simavr/sim/sim_core.c

9 years agocore: Add an overridable logging function
ponty [Thu, 21 Feb 2013 15:54:58 +0000 (16:54 +0100)]
core: Add an overridable logging function

AVR_LOG() now uses a logging function which can be overridden as
necessary. By default, it logs to stdout/stderr.

Fixed-up-by: schuay <>
9 years agoRevert "Merge pull request #12 from ponty/logger2"
Jakob Gruber [Fri, 14 Jun 2013 18:50:31 +0000 (20:50 +0200)]
Revert "Merge pull request #12 from ponty/logger2"

This reverts commit 4a345c29fe62858693a226a3f6adbef1021236b1, reversing
changes made to 77c0525fa53ac81daaf277593767cc5659e2e43e.

9 years agoMerge pull request #12 from ponty/logger2
Michel Pollet [Fri, 14 Jun 2013 09:13:25 +0000 (02:13 -0700)]
Merge pull request #12 from ponty/logger2

new global_logger, used in AVR_LOG(), default is stdout/stderr

9 years agoio,elf: pass the trace section name to getirq
Michel Pollet [Sun, 2 Jun 2013 17:29:45 +0000 (18:29 +0100)]
io,elf: pass the trace section name to getirq

avr_iomem_getirq() now takes a 'name' for the IRQs. The elf loader now
passes down the trace name so the irq gets named properly.

Signed-off-by: Michel Pollet <>
9 years agoirq: Add a warning if the name is NULL
Michel Pollet [Sun, 2 Jun 2013 17:27:51 +0000 (18:27 +0100)]
irq: Add a warning if the name is NULL

Names are not getting important, for the scripting project

Signed-off-by: Michel Pollet <>
9 years agovcd: Initializes IRQs when needed only
Michel Pollet [Sun, 2 Jun 2013 17:27:02 +0000 (18:27 +0100)]
vcd: Initializes IRQs when needed only

Also manufacture an IRQ name with the one passed in add_signal

Signed-off-by: Michel Pollet <>
9 years agoio: Create irq names for io addresses
Michel Pollet [Sun, 2 Jun 2013 13:46:46 +0000 (14:46 +0100)]
io: Create irq names for io addresses

Set names for the io address IRQ when they are created

Signed-off-by: Michel Pollet <>
9 years agoioport: Tweak IRQ names
Michel Pollet [Sun, 2 Jun 2013 13:45:49 +0000 (14:45 +0100)]
ioport: Tweak IRQ names

Names should include the size in bits, if not 1

Signed-off-by: Michel Pollet <>
9 years agoMakefile: Removed uname -o
Michel Pollet [Sun, 2 Jun 2013 13:44:31 +0000 (14:44 +0100)]
Makefile: Removed uname -o

This break on BSDs (aka OSX), this commit will break windows build, it
will need a proper fix

Signed-off-by: Michel Pollet <>
9 years agocore: larger data type to store extended z-pointer value
Peter Ross [Sat, 1 Dec 2012 02:07:05 +0000 (13:07 +1100)]
core: larger data type to store extended z-pointer value

9 years agomisc: Add a Contributing section to
Jakob Gruber [Mon, 6 May 2013 16:27:30 +0000 (18:27 +0200)]
misc: Add a Contributing section to

9 years agomisc: Add a Documentation section to
Jakob Gruber [Mon, 6 May 2013 16:09:15 +0000 (18:09 +0200)]
misc: Add a Documentation section to

9 years agomisc: Remove outdated README
Jakob Gruber [Mon, 6 May 2013 15:59:14 +0000 (17:59 +0200)]
misc: Remove outdated README

There's no point in keeping two similar README's around, and
is better maintained.

9 years agorefactor logger
ponty [Fri, 22 Feb 2013 15:38:14 +0000 (16:38 +0100)]
refactor logger

9 years agonew global_logger, used in AVR_LOG(), default is stdout/stderr
ponty [Thu, 21 Feb 2013 15:54:58 +0000 (16:54 +0100)]
new global_logger, used in AVR_LOG(), default is stdout/stderr

9 years agoMerge pull request #10 from the-real-orca/mingw
Michel Pollet [Sun, 2 Dec 2012 17:09:44 +0000 (09:09 -0800)]
Merge pull request #10 from the-real-orca/mingw

MinGW merge, thanks!

9 years agomingw: make simavr compilable with MinGW
Stephan Veigl [Fri, 30 Nov 2012 12:31:54 +0000 (13:31 +0100)]
mingw:  make simavr compilable with MinGW

- patch makefiles to work with MinGW
- compile to run_avr.exe on windows, otherwise run_avr cannot be started from the normal windows command prompt
- add sim_network.h to encapsulate the network functions of different platforms
    (use winsock2 for Windows network functions)
- make network helper functions static
- force open() to use binary mode (on Windows default is text mode)
- do not change stderr on Windows
- exclude simduino example on Windows
- add MinGW README

Signed-off-by: Stephan Veigl <>
9 years agouart: default to 8-bit word length on reset
Peter Ross [Thu, 29 Nov 2012 12:05:51 +0000 (23:05 +1100)]
uart: default to 8-bit word length on reset

9 years agomegax4/uart: implement u2x (double uart transmission speed)
Peter Ross [Thu, 29 Nov 2012 12:05:14 +0000 (23:05 +1100)]
megax4/uart: implement u2x (double uart transmission speed)

9 years agocores: No standard include paths
Stephan Veigl [Fri, 30 Nov 2012 09:35:06 +0000 (10:35 +0100)]
cores: No standard include paths

There are problems with standard includes since the paths are ambiguous
between host and AVR. Using absolute includes does not work for multi-platform
The solution is to remove all standard includes of the host system for the
core files since there is no reason why a core definition should require
standard includes from the host system. User interaction (status messages)
is the job of the simulator and not the core definitions.

- add CORE_CFLAGS (-nostdinc) to Makefile.common
- remove <stdio.h> from core definition files
- move init message from core definition files to avr_init() in sim_avr.c

Signed-off-by: Stephan Veigl <>
9 years agowatchdog: Fix register naming
Stephan Veigl [Thu, 29 Nov 2012 10:25:20 +0000 (11:25 +0100)]
watchdog: Fix register naming

MCUSR is called MCUCSR in atmega128

Signed-off-by: Stephan Veigl <>
9 years agotests: Remove vcd files on clean
Stephan Veigl [Mon, 12 Nov 2012 11:19:50 +0000 (12:19 +0100)]
tests: Remove vcd files on clean

Remove the vcd files generated by test cases on: make clean

Signed-off-by: Stephan Veigl <>
9 years agotests: Fix number of successful tests calculation
Stephan Veigl [Fri, 9 Nov 2012 08:33:36 +0000 (09:33 +0100)]
tests: Fix number of successful tests calculation

Signed-off-by: Stephan Veigl <>
9 years agomisc: Update NO_COLOR define switch
Stephan Veigl [Fri, 9 Nov 2012 08:32:10 +0000 (09:32 +0100)]
misc: Update NO_COLOR define switch

The NO_COLOR define switch is a preparation for the Windows version.
Since the standard Windows command prompt is not able to display
ANSI color statements correctly. With this define switch it is
possible to remove any coloring of the output. This will be set
automatically in the MinGW patch.
The color definitions are moved from sim_core.c to sim_core.h since
they are used in other macros as well.

Signed-off-by: Stephan Veigl <>
9 years agoMerge pull request #7 from mali/working
Michel Pollet [Sun, 4 Nov 2012 17:51:45 +0000 (09:51 -0800)]
Merge pull request #7 from mali/working

Makefile : fix cleaning rules

9 years agoMakefile : fix cleaning rules
Laurent Navet [Mali] [Sun, 4 Nov 2012 16:13:28 +0000 (16:13 +0000)]
Makefile : fix cleaning rules

in order to leave the src tree as clean as before a build
+ add rm -f of autogenerated sim_core_config.h & sim_core_decl.h
  in simavr/Makefile
+ add rm *.hex in example/board_*/Makefile

9 years agoMakefile: Fix git tag issues
Michel Pollet [Tue, 30 Oct 2012 15:10:42 +0000 (15:10 +0000)]
Makefile: Fix git tag issues

+ Pick the correct tag for the version number
+ Do not fail if git is not there
+ Add the version to the config file

Signed-off-by: Michel Pollet <>
9 years agoMakefile: Introduce a release build
Michel Pollet [Tue, 30 Oct 2012 15:09:37 +0000 (15:09 +0000)]
Makefile: Introduce a release build

make RELEASE=1 will use rpath-link to link the executable,
preventing simavr build path to be referenced. This requires
that simavr gets installed for it to work

Signed-off-by: Michel Pollet <>
9 years agousb: Made the usb example optional
Michel Pollet [Tue, 30 Oct 2012 11:30:21 +0000 (11:30 +0000)]
usb: Made the usb example optional

Downloading extra sources is against debian policy and was
a blocker to get simavr in debian. Made the board_usb example
optional, it will require an explicit make.

Signed-off-by: Michel Pollet <>
9 years agoMakefiles: Add manual and a global doc target
Jakob Gruber [Thu, 25 Oct 2012 09:40:05 +0000 (11:40 +0200)]
Makefiles: Add manual and a global doc target

Manual generation is now included in the doc/Makefile. Additionally,
a doc target has been added to the global Makefile.

9 years agodoc: Add simavr manual
Jakob Gruber [Thu, 25 Oct 2012 09:38:01 +0000 (11:38 +0200)]
doc: Add simavr manual

This is an excerpt of the bachelor's thesis "qsimavr: Graphical
Simulation of an AVR Processor and Periphery" by Jakob Gruber. The full
thesis is available at

9 years agomisc: Point to correct simavr include dirs
Jakob Gruber [Mon, 10 Sep 2012 09:54:16 +0000 (11:54 +0200)]
misc: Point to correct simavr include dirs

9 years agomisc: Move avr_mcu_section.h to sim/avr
Jakob Gruber [Mon, 10 Sep 2012 10:22:57 +0000 (12:22 +0200)]
misc: Move avr_mcu_section.h to sim/avr

Since sim_elf.h includes avr_mcu_section.h, it needs to reference
a path which works both during simavr builds, and compilation of
external programs including sim_elf.h. Adding the avr/ subdirectory
to pkg-config cflags is not desired, to make sure it's clear that header
is shared between the sim and the firmware.

9 years agoMakefiles: Remove executable bit from headers
Jakob Gruber [Mon, 10 Sep 2012 09:57:41 +0000 (11:57 +0200)]
Makefiles: Remove executable bit from headers

9 years agoMakefiles: Separate simavr.pc and simavr-avr.pc
Jakob Gruber [Mon, 10 Sep 2012 09:38:23 +0000 (11:38 +0200)]
Makefiles: Separate simavr.pc and simavr-avr.pc

According to,
"each pkg-config file is best used to describe a single library, so each
package should have at least as many pkg-config files as they do
installed libraries."

9 years agoMakefiles: Use PREFIX instead of DESTDIR in simavr.pc
Jakob Gruber [Mon, 10 Sep 2012 09:29:35 +0000 (11:29 +0200)]
Makefiles: Use PREFIX instead of DESTDIR in simavr.pc

This is needed when DESTDIR does not equal the actual intended
destination (this usually occurs when building packages for

An example make invocation:

make DESTDIR=pkg/usr PREFIX=/usr install

9 years agocore: Deinitialize GDB in avr_terminate()
Jakob Gruber [Mon, 10 Sep 2012 08:54:00 +0000 (10:54 +0200)]
core: Deinitialize GDB in avr_terminate()

This is relevant when running multiple simavr sessions in a single

9 years agocores: Use correct extint control register
Jakob Gruber [Fri, 31 Aug 2012 08:41:03 +0000 (10:41 +0200)]
cores: Use correct extint control register

The atmega1280/atmega1281/atmega128/90usb162
have two external interrupt control registers;
EICRA for ISC[0-3]x, and EICRB for ISC[4-7]x.

9 years agoRevert "examples: hd44780 responds on falling edge of E pin"
Jakob Gruber [Fri, 31 Aug 2012 07:39:14 +0000 (09:39 +0200)]
Revert "examples: hd44780 responds on falling edge of E pin"

This reverts commit fddb2a02e9feadaefaf690b07a69a1556fb96fd1.

The hd44780 was misbehaving and bisecting ended up at this commit.

9 years agovcd: Made the trace buffer dynamic
Michel Pollet [Fri, 31 Aug 2012 07:42:34 +0000 (08:42 +0100)]
vcd: Made the trace buffer dynamic

Made the trade buffer growable, to accomadate busy tracers
Also converted the traces to AVR_LOG in that bit.

Signed-off-by: Michel Pollet <>
9 years agoioport: Restore PIN to PORT values when DDR is set to output
Jakob Gruber [Wed, 29 Aug 2012 12:16:59 +0000 (14:16 +0200)]
ioport: Restore PIN to PORT values when DDR is set to output

9 years agoioport: Use IRQ_FLAG_FILTERED instead of manual filtering
Jakob Gruber [Thu, 23 Aug 2012 11:13:25 +0000 (13:13 +0200)]
ioport: Use IRQ_FLAG_FILTERED instead of manual filtering

Manual filtering could cause us to miss pin changes when data
is written to PINs while the port is set to input mode (and thus
the PORT register is not updated).

9 years agovcd_file: Update comment to reflect correct time units
Jakob Gruber [Tue, 28 Aug 2012 13:46:59 +0000 (15:46 +0200)]
vcd_file: Update comment to reflect correct time units

9 years agotimer: Avoid infinite cycle timer on TCNT write
Jakob Gruber [Thu, 23 Aug 2012 08:57:21 +0000 (10:57 +0200)]
timer: Avoid infinite cycle timer on TCNT write

In some situations, it was possible to enter an infinite cycle timer
loop. In avr_timer_tcnt_write, the tov cycle timer registration is not
protected and can register a timer with p->tov_cycles == 0.

The following atmega1280 program demonstrates this issue:

int main() {

TCCR1A = 0;
TCCR1B = (1<<WGM12) | (1<<ICES1);
OCR1B = OCR1A = 960;

/* Start */
TCNT1 = 0;
TCCR1B |= (1<<CS11);

/* Stop */
TCCR1B &= ~(1<<CS11);
TIFR1 |= (1<<OCF1A) | (1<<OCF1B);

/* Start */
TCNT1 = 0; /**< Registers timer with tov_cycles == 0. */
TCCR1B |= (1<<CS11);

while (1) ;
return 0;

9 years agoio: Convert logging to AVR_LOG()
Jakob Gruber [Thu, 2 Aug 2012 09:08:51 +0000 (11:08 +0200)]
io: Convert logging to AVR_LOG()

9 years agointerrupts: Convert logging to AVR_LOG()
Jakob Gruber [Thu, 2 Aug 2012 09:08:34 +0000 (11:08 +0200)]
interrupts: Convert logging to AVR_LOG()

9 years agogdb: Convert logging to AVR_LOG()
Jakob Gruber [Thu, 2 Aug 2012 09:08:13 +0000 (11:08 +0200)]
gdb: Convert logging to AVR_LOG()

9 years agoelf: Convert logging to AVR_LOG()
Jakob Gruber [Thu, 2 Aug 2012 09:07:59 +0000 (11:07 +0200)]
elf: Convert logging to AVR_LOG()

9 years agocycle_timers: Convert logging to AVR_LOG()
Jakob Gruber [Thu, 2 Aug 2012 09:07:34 +0000 (11:07 +0200)]
cycle_timers: Convert logging to AVR_LOG()

9 years agocore: Convert logging to AVR_LOG()
Jakob Gruber [Thu, 2 Aug 2012 09:07:21 +0000 (11:07 +0200)]
core: Convert logging to AVR_LOG()

9 years agowatchdog: Convert logging to AVR_LOG()
Jakob Gruber [Thu, 2 Aug 2012 08:49:06 +0000 (10:49 +0200)]
watchdog: Convert logging to AVR_LOG()

9 years agousb: Convert logging to AVR_LOG()
Jakob Gruber [Thu, 2 Aug 2012 08:46:20 +0000 (10:46 +0200)]
usb: Convert logging to AVR_LOG()

A couple of these functions did not have references to avr_t, so this is

9 years agouart: Convert logging to AVR_LOG()
Jakob Gruber [Thu, 2 Aug 2012 08:45:49 +0000 (10:45 +0200)]
uart: Convert logging to AVR_LOG()

UART stdout output was left as is.

9 years agolin: Convert logging to AVR_LOG()
Jakob Gruber [Thu, 2 Aug 2012 08:45:30 +0000 (10:45 +0200)]
lin: Convert logging to AVR_LOG()

9 years agoflash: Convert logging to AVR_LOG()
Jakob Gruber [Thu, 2 Aug 2012 08:45:11 +0000 (10:45 +0200)]
flash: Convert logging to AVR_LOG()

9 years agoeeprom: Convert logging to AVR_LOG()
Jakob Gruber [Thu, 2 Aug 2012 08:33:06 +0000 (10:33 +0200)]
eeprom: Convert logging to AVR_LOG()

9 years agobitbang: Convert logging to AVR_LOG()
Jakob Gruber [Thu, 2 Aug 2012 08:30:55 +0000 (10:30 +0200)]
bitbang: Convert logging to AVR_LOG()

9 years agoadc: Convert logging to AVR_LOG()
Jakob Gruber [Thu, 2 Aug 2012 08:29:51 +0000 (10:29 +0200)]
adc: Convert logging to AVR_LOG()

9 years agotimer: Remove trace_flags
Jakob Gruber [Thu, 2 Aug 2012 08:05:02 +0000 (10:05 +0200)]
timer: Remove trace_flags

All uses have been converted to AVR_LOG().

9 years agotimer: Convert to logging to AVR_LOG()
Jakob Gruber [Wed, 1 Aug 2012 14:30:09 +0000 (16:30 +0200)]
timer: Convert to logging to AVR_LOG()

9 years agocore: Introduce a logging macro AVR_LOG()
Jakob Gruber [Thu, 2 Aug 2012 07:49:34 +0000 (09:49 +0200)]
core: Introduce a logging macro AVR_LOG()

This works in conjunction with avr->log to tune out messages we are not
interested in. LOG_ERROR is the default level.

9 years agorun_avr: Add -v argument to raise verbosity level
Jakob Gruber [Thu, 2 Aug 2012 07:41:05 +0000 (09:41 +0200)]
run_avr: Add -v argument to raise verbosity level

Pass it more than once to raise it further. This works better with the
standard conventions, which would allow passing -vvv (instead of -v -v
-v). Unfortunately, this does not work here.

The type of avr->log has been altered to accomodate values up to 3.

9 years agocores: Move static to front of declaration
Jakob Gruber [Sat, 4 Aug 2012 18:10:18 +0000 (20:10 +0200)]
cores: Move static to front of declaration

This fixes the two -Wold-style-declaration warnings reported by gcc with

9 years agomega1280: Initialize UART 2 and 3
Jakob Gruber [Sat, 4 Aug 2012 13:35:24 +0000 (15:35 +0200)]
mega1280: Initialize UART 2 and 3

These definitions already existed but were not initialized.

9 years agomega1280: Add missing timers 4 and 5
Jakob Gruber [Sat, 4 Aug 2012 13:10:05 +0000 (15:10 +0200)]
mega1280: Add missing timers 4 and 5

These are 16-bit timers similar to Timer1 and Timer3.

9 years agocore: Increase MAX_IOs for atmega1280
Jakob Gruber [Sat, 4 Aug 2012 13:28:06 +0000 (15:28 +0200)]
core: Increase MAX_IOs for atmega1280

The atmega1280 uses IO registers up to an address of 0x136.
Set MAX_IOs to (0x136 - 0x20 + 0x01) = 279.

9 years agocore: Don't sleep with pending interrupts
Jakob Gruber [Wed, 1 Aug 2012 15:01:37 +0000 (17:01 +0200)]
core: Don't sleep with pending interrupts

This avoids an issue in which we would incorrectly enter a state in
which the CPU was sleeping and interrupts were disabled. It occurred
when an interrupt was raised and a SLEEP instruction processed before
the interrupt could be serviced (due to pending wait).

There are several disadvantages: if somebody adds new code which
switches the CPU to sleeping, there's a good chance of them forgetting
to add this check. Preventing sleep even if the interrupt is masked is
probably harmless but incorrect. Finally, on a real AVR it _is_ possible
to trigger an interrupt and then go to sleep in the next instruction
before the interrupt is serviced.

I'd actually prefer fixing this by moving the CPU interrupt wakeup from
avr_raise_interrupt() to avr_service_interrupts(), but that requires
further changes to avoid sleeping during avr->run() while an interrupt
is about to be serviced.

9 years agocores: Set raise_sticky in TWI interrupt vectors
Jakob Gruber [Tue, 31 Jul 2012 10:46:59 +0000 (12:46 +0200)]
cores: Set raise_sticky in TWI interrupt vectors

9 years agointerrupts: Introduce raise_sticky flag
Jakob Gruber [Tue, 31 Jul 2012 10:43:46 +0000 (12:43 +0200)]
interrupts: Introduce raise_sticky flag

If set, the raise bit is not cleared in avr_clear_interrupt. This
corresponds to the hardware not clearing the interrupt flag when
executing the interrupt routine.

The only known example of this is the TWI Interrupt Flag TWINT.

9 years agointerrupts: Do not clear raised bit twice
Jakob Gruber [Tue, 31 Jul 2012 10:42:59 +0000 (12:42 +0200)]
interrupts: Do not clear raised bit twice

avr_regbit_clear is already called in avr_clear_interrupt.

9 years agotwi: Correct swapped twi irq names
Jakob Gruber [Tue, 31 Jul 2012 10:22:22 +0000 (12:22 +0200)]
twi: Correct swapped twi irq names

9 years agointerrupts: Typo correction (pooling -> polling)
Jakob Gruber [Tue, 31 Jul 2012 08:45:07 +0000 (10:45 +0200)]
interrupts: Typo correction (pooling -> polling)

9 years agomisc: Consistent include guards in headers
Jakob Gruber [Fri, 27 Jul 2012 11:58:13 +0000 (13:58 +0200)]
misc: Consistent include guards in headers

Changed all include guard defines to a consistent form and added them if

9 years agomisc: Add extern "C" blocks to headers
Jakob Gruber [Fri, 27 Jul 2012 11:46:28 +0000 (13:46 +0200)]
misc: Add extern "C" blocks to headers

Most headers already had these. This commit adds them where they weren't
included yet.

9 years agosimavr: Do not call avr_terminate in run callbacks
Jakob Gruber [Thu, 26 Jul 2012 11:05:21 +0000 (13:05 +0200)]
simavr: Do not call avr_terminate in run callbacks

Neither run_avr nor the examples expect avr_terminate to be called by
simavr itself.
This also caused issues for cleanup code (such as IRQ disconnections)
that did not know if avr_terminate had already been called or not.

9 years agoirq: Print errors to stderr
Jakob Gruber [Thu, 26 Jul 2012 10:46:49 +0000 (12:46 +0200)]
irq: Print errors to stderr

Trying to (dis)connect an invalid IRQ is an error. Note that the
incorrect function name printed in avr_unconnect_irq has been corrected.

9 years agotwi: Move avr_twi_irq_msg to avr_twi.c
Jakob Gruber [Thu, 26 Jul 2012 09:23:33 +0000 (11:23 +0200)]
twi: Move avr_twi_irq_msg to avr_twi.c

This fixes inclusion of avr_twi.h into C++ files.

9 years agointerrupts: Don't wake up if not sleeping
Jakob Gruber [Mon, 23 Jul 2012 16:46:48 +0000 (18:46 +0200)]
interrupts: Don't wake up if not sleeping

This caused the CPU to wake up even if it was explicitly set to

9 years agoMakefile: Create .deb files using fpm
Michel Pollet [Wed, 25 Jul 2012 08:24:39 +0000 (09:24 +0100)]
Makefile: Create .deb files using fpm

Handy way of creating debian packages quickly

Signed-off-by: Michel Pollet <>
9 years agoexamples: Correct instructions for timer_64led example
Jakob Gruber [Fri, 20 Jul 2012 19:52:05 +0000 (21:52 +0200)]
examples: Correct instructions for timer_64led example

9 years agorun_avr: Abort if firmware could not be read
Jakob Gruber [Fri, 20 Jul 2012 12:47:06 +0000 (14:47 +0200)]
run_avr: Abort if firmware could not be read

Otherwise, simavr continues and tries to process whichever random memory
content is located in the flash memory section even when the file could
not be read.

9 years agoexamples: hd44780 responds on falling edge of E pin
Jakob Gruber [Fri, 20 Jul 2012 12:19:48 +0000 (14:19 +0200)]
examples: hd44780 responds on falling edge of E pin

The example itself works both ways, but the actual HD44780 chip
processes data on the falling edge - see the data sheet.

9 years agoexamples: Fix frequency of ac_input signal
Jakob Gruber [Thu, 19 Jul 2012 22:10:39 +0000 (00:10 +0200)]
examples: Fix frequency of ac_input signal

The comment in ac_input.h specifies 50 Hz, but it was actually 500 Hz.

This off-by-one-zero error probably went unnoticed because of inaccurate
sleep handling (which was fixed in the previous commit).

9 years agosimavr: Improved accuracy of sleep durations
Jakob Gruber [Thu, 19 Jul 2012 21:37:02 +0000 (23:37 +0200)]
simavr: Improved accuracy of sleep durations

This commit solves (or at least improves) an issue that occurs when
short sleep times are requested in avr_callback_sleep_*. The operating
system cannot accurately handle short sleep requests, and sending many
short requests takes significantly longer than requesting the equivalent
time in longer bursts. This can be observed by running the board_hd77480
example - the counter is much slower when vcd recording is turned on
(= short sleep requests) than when it is turned off (= long sleep

We improve this situation by accumulating sleep requests until a certain
minimum count of pending usecs is reached which can be handled somewhat
accurately (200 microseconds worked well for me).

9 years agogdb: Read/write SREG values correctly
Jakob Gruber [Wed, 18 Jul 2012 10:37:50 +0000 (12:37 +0200)]
gdb: Read/write SREG values correctly

Accessing SREG through gdb seems to have been broken since SREG is no
longer synthesized at each instruction (2f67001d). As a quick fix, make
SREG accessors public and use them in sim_gdb.

Note that invalid avr->sreg values no longer trigger the CRASH macro.

9 years agotests: Correct expected output of atmega88_uart_echo
Jakob Gruber [Wed, 18 Jul 2012 08:16:14 +0000 (10:16 +0200)]
tests: Correct expected output of atmega88_uart_echo

Carriage return generation was added back to the file handler in
a26a2e43fc4b547090f3069e121713702593261d. Since the string is actually
passed through uart_putchar twice, the received string has a duplicate
'\r' character.

9 years agoMerge pull request #4 from schuay/markdown_syntax
Michel Pollet [Mon, 16 Jul 2012 17:21:03 +0000 (10:21 -0700)]
Merge pull request #4 from schuay/markdown_syntax

Markdown syntax

9 years agomisc: Update repository URL in README
Jakob Gruber [Mon, 16 Jul 2012 17:05:55 +0000 (19:05 +0200)]
misc: Update repository URL in README

9 years agomisc: Fix broken links in
Jakob Gruber [Mon, 16 Jul 2012 17:00:31 +0000 (19:00 +0200)]
misc: Fix broken links in

9 years agomisc: Github markdown uses indentation to mark code blocks
Jakob Gruber [Mon, 16 Jul 2012 16:57:51 +0000 (18:57 +0200)]
misc: Github markdown uses indentation to mark code blocks

9 years agomisc: Minor wording changes in
Jakob Gruber [Mon, 16 Jul 2012 17:08:35 +0000 (19:08 +0200)]
misc: Minor wording changes in

9 years agomisc: Github markdown uses underscores to italicize words
Jakob Gruber [Mon, 16 Jul 2012 16:47:49 +0000 (18:47 +0200)]
misc: Github markdown uses underscores to italicize words

9 years agoMerge pull request #2 from schuay/watchpoints
Michel Pollet [Mon, 16 Jul 2012 16:07:32 +0000 (09:07 -0700)]
Merge pull request #2 from schuay/watchpoints


9 years agoMerge pull request #3 from schuay/not_known
Michel Pollet [Mon, 16 Jul 2012 14:35:41 +0000 (07:35 -0700)]
Merge pull request #3 from schuay/not_known

misc: Fix confusing typo in error message

9 years agomisc: Fix confusing typo in error message
Jakob Gruber [Mon, 16 Jul 2012 14:30:06 +0000 (16:30 +0200)]
misc: Fix confusing typo in error message

9 years agogdb: Use early termination in gdb_watch_find*
Jakob Gruber [Mon, 16 Jul 2012 13:32:56 +0000 (15:32 +0200)]
gdb: Use early termination in gdb_watch_find*

9 years agogdb: Implemented watchpoint handling
Jakob Gruber [Fri, 13 Jul 2012 12:22:51 +0000 (14:22 +0200)]
gdb: Implemented watchpoint handling

Per data access, we never signal more than one watchpoint. Possible
scenarios are several watchpoints at the same address (for example
WATCH_ACCESS and WATCH_WRITE) or overlapping watchpoint ranges. This is
not completely correct.