Handle the difference between 1 and 2-line displays in HD44780
If HD44780 is configured to have a single line of display, AC can
be in the range of 0x00..0x00+79, while with two lines, it can be
in the ranges 0x00..0x00+39 and 0x40..0x40+39.
Fix Clear Screen implementation of HD44780
Datasheet mandates filling DDRAM with spaces, setting address
counter to DDRAM address 0, and setting entry mode I/D to 1
(increment mode).
The "filling with spaces" was implemented but the rest was missing.
Now added.
Fix cursor handling in segmented DDRAM of HD44780
HD44780 has only 80 bytes of DDRAM, which consists of two 40 bytes
long segments. The segment starting at address 0x00 contains the
data for the first line of the display, while the segment starting
at address 0x40 contains the data for the second line of the
display. This means that there are invalid ranges in the 7-bit
address space of the DDRAM (0x00+40 .. 0x3f and 0x40+40 .. 0x7f).
The cursor (address counter) of the HD44780 automatically "jumps
over" these regions whenever auto-incremented/decremented. This
commit implements this behaviour.
Moreover, this commit also fixes the 4-lines mode. When in a
4-lines setup, the first 20 bytes of the first and the second
memory segments control what is displayed in the first two lines,
as usual. However, the second 20 bytes of the memory segments
contain the data for the third and fourth lines of the display.
This means that the starting addresses of lines 3 & 4 are 0x00+20
and 0x40+20.
Fix the virtual memory of the HD44780 part
In HD44780, the DDRAM has an address space of 0x80 bytes, while
CGRAM has 0x40 bytes. To ensure their proper separation, the vram
should have 0x80+0x40 bytes with the CGRAM starting at 0x80.
Merge pull request #393 from vintagepc/Timer_PWM2
Support 3rd PWM pin on timers with OCRxC
Merge pull request #392 from vintagepc/SPI-clock-rates
Clock out SPI data according to SPCR/SPSR
Support 3rd PWM pin on timers with OCRxC
Clock out SPI data according to SPCR/SPSR
Merge pull request #390 from vintagepc/unaligned-PCINTs
Support for non-aligned PCINTs
Merge pull request #389 from vintagepc/fix-adcs-over-7
Fix ADCs>7
Fix PCINT on PORTJ for 2560
Merge pull request #384 from msquirogac/fix-370
Support for GDB monitor commands
gdb monitor command clean-up
new gdb commands kill, detach and monitor
monitor parser engine supports reset and halt
Merge pull request #319 from uffejakobsen/uart_tap_symlink
Symlink for UART tap was never created during uart_pty_connect()
Merge pull request #377 from msquirogac/fix-375
Update of the display_usage function.
Merge pull request #379 from msquirogac/fix-378
used attribute for _MMCU_ , should avoid dropping the .mmcu section
used attribute for _MMCU_ , should avoid dropping the .mmcu section
Fix for issue #285
Update of the display_usage function.
Some arguments changed name to make them more like the already existent ones.
Some arguments were merged to one to reduce redundant code.
Fix issue #375
Merge pull request #373 from simark/sram
Compare address with I/O end address in _avr_set_ram
Compare address with I/O end address in _avr_set_ram
In _avr_set_ram, we check if the address is smaller than `MAX_IOs + 31`
to know if it is a register or SRAM location. In reality, many devices
have less I/Os than that, so the SRAM begins before this address.
As shown in issue #372, this causes watchpoints to not be triggered when
writing to an SRAM location that is smaller than `MAX_IOs + 31`. For
example, a global variable on an atmega328 gets placed at address 0x100,
which is less than `MAX_IOs + 31`.
Fix this by comparing the address to the `ioend` property of `avr`.
Fixes #372
Merge pull request #361 from aldobrrrr/is-instruction-32-bits-mask-fix
Fix a bug in the bitmask inside _avr_is_instruction_32_bits() function in sim_core.c file.
Merge pull request #366 from becmer/musl-tests
Don't assign stderr on non-glibc
Don't assign stderr on non-glibc
Signed-off-by: Kamil Becmer <kamil.becmer@gmail.com>
Merge pull request #364 from aykevl/lldb
Add support for debugging with LLDB
Add support for debugging with LLDB
LLDB requires the qRegisterInfo packet to work correctly. While it is
possible to specify the registers manually using a Python script, having
them directly in the emulator simplifies things a lot.
Fix a bug in the bitmask inside _avr_is_instruction_32_bits() function in sim_core.c file.
Merge pull request #358 from jcvdev/gdb-tcp-port
Optionally specify TCP listening port for -g,--gdb option (default 1234)
Allow to optionally specify gdb listening port
Merge pull request #333 from edgargrimberg/edgar_Add_ATMega64M1
Add ATMega64M1
Merge pull request #352 from ZsoltSaskovy/to_be_merged_back
Minor fix to make code compile on Windows, and separated code and mcu_t structure for Mega2560
Moved mcu_t structure declaration into separate header file
Changed the order of winsock2 and windows includes. Wrong onder caused compilation errors under Windows
Merge pull request #346 from TomasHubelbauer/patch-1
Note that it is possible to install through Aptitude
Merge pull request #321 from endofexclusive/pr/do-not-mix-tab-and-space
Do not mix tab and space in --help output
Merge pull request #349 from helargus/vcd-325
#325 Converts timescale from vcd input to internal us.
Merge pull request #348 from thecky/master
added OC0A/OC0B support for attiny13
Converts timescale from vcd input to internal us.
added OC0A/OC0B support for attiny13
.com and .com_pin settings for timer0 in section .comp were missed
Note that it is possible to install through Aptitude
I've found that there is a maintainer who publishes SimAVR for Ubuntu here:
https://packages.ubuntu.com/bionic/simavr
Seems to be kept reasonably up-to-date (the latest there is 1.15 whereasy here on GitHub it is 1.16).
I know that maintainers do not always keep in contact with the software vendor so I would not be surprised to learn you were not aware of this. If you are okay with it though and consider it to be a legit enough source, I figure it's good to call that out in the README.
Add ATMega64M1
Signed-off-by: Edgar Grimberg <edgar.grimberg@visuray.com>
Merge pull request #311 from glitchub/master
Also search for /usr/lib64/librt.so
Merge pull request #320 from endofexclusive/pr/freebsd-misc
Make simavr build on Freebsd
Merge pull request #324 from hsoft/tiny-timer1
Fix timer1 on tinyx5
Fix timer1 on tinyx5
The prescaler list for timer1 on the tinyx5 was incomplete. Moreover,
having no WGM data made the timer run in `avr_timer_wgm_none`, with a
zero size (it would overflow all the time).
Setting a default wgm_op makes time timer run in normal mode witha size
of 8 bits.
Do not mix tab and space in help output
gettimeofday() prototype is in sys/time.h
Symlink for UART tap was never created during uart_pty_connect()
Also search for /usr/lib64/librt.so
Merge pull request #301 from aznoohwee/bugfix/polling-flag-within-isr
allow polling interrupt flag within ISR
reorder check to ensure that flag is allowed to be raised within ISR, but no nested IRQs occur
allow polling interrupt flag within ISR
Merge pull request #295 from myokaski/fix-uart-pty
Fix receiving after fifo overrun
Merge pull request #299 from aznoohwee/bugfix/atmega32U4-ramend
Fix atmega32u4 RAMEND
For #276 fix atmega32u4 RAMEND
Fix receiving after fifo overrun
After fifo overrun buffer_done remains less than buffer_len and
FD_SET(p->port[ti].s, &read_set) is not called. If firmware has nothing
to send, select always returns 0 and new data is never read even if
fifo buffer gets flushed.
This patch removes check for select timeout, so the remaining data in
buffer may go to fifo.
Merge pull request #294 from dougszumski/bugfix/gcc8_warnings
Forcibly null terminate input strings
Fix GCC 8 warning for input strings
As described in issue #293 GCC 8 fails the build in the current
configuration on warnings like:
sim/run_avr.c:193:4: error: ‘strncpy’ specified bound 128
equals destination size [-Werror=stringop-truncation]
strncpy(f.tracename, argv[++pi], sizeof(f.tracename));
This isn't the only solution, but it get's the build working.
misc: Fix static analyzer warnings
Mostly intenting.
Signed-off-by: Michel Pollet <buserror@gmail.com>
Merge pull request #291 from nspring/parts-install-separately
For RHEL 6.9 without glut: Parts install separately ; add rpath to rpath-link using RELEASE=1 ; appease gcc 4.6.1, use librt
Fix installation of examples/parts to occur within the
examplesbparts makefile rather than use the simavr
makefile, allowing installation of simavr (alone) on
machines without a working glut.
Fix RELEASE=1 option to additionally specify rpath (not
just rpath-link) if simavr will be installed in a special
directory.
Add detection and use of librt when available (e.g.,
RHEL 6.9).
Merge pull request #287 from dougszumski/feature/rotary_encoder_rebase_04_2018
Rotary encoder and demo board
Merge pull request #280 from dgeelen/dgeelen/wrap_memory_accesses
On actual hardware, memory accesses seem to wrap.
Merge pull request #282 from dgeelen/dgeelen/cmdline_vcd
Add support for configuring VCD traces from the commandline.
Add more white space around expressions.
Add more white space around expressions.
If() statements should be followed by a space.
parts: add rotary encoder demo board
This connects an LED bar up to an ATMega, and uses the
rotary encoder to scroll an LED up and down the bar.
parts: add rotary encoder part
Add a rotary encoder virtual part, based on the Panasonic
EVEP rotary encoder. This could easily be extended to virtualise
other rotary encoders.
Merge pull request #275 from k3a/patch-1
Update Makefile
Merge pull request #281 from dgeelen/dgeelen/log_improvements
Improve logging
Add support for configuring VCD traces from the commandline.
Log more warnings for VCD functionality.
Log statements in avr_load_firmware() were never printed.
On actual hardware, memory accesses seem to wrap.
use READ_SREG_INTO rather than g->avr->data[R_SREG] to get current sreg status for export to gdb
Update Makefile
Update install rule to require build-simavr and build-parts. That should fix #271.
elf: Bit of cleanup
Going to clean this piece of code a little
Signed-off-by: Michel Pollet <buserror@gmail.com>
core: Added support for PC overflow
Added a special opcode at the end of flash to catch PC overflow, and
'wrap it'. Also log the condition.
This allow that case to be handled without having to add a
modulo/division for each instruction.
Signed-off-by: Michel Pollet <buserror@gmail.com>
Clean up that CLOCK mess
Generalized getting a time stamp related to the simulation. Make it
really portable.
Signed-off-by: Michel Pollet <buserror@gmail.com>
Correct x8 ADC mux modes
In all of the datasheets for ATmega44/88/168/328 devices that I've
seen, there are 8 channels of ADC selected with MUX modes 0000-0111,
and the temperature sensor is selected with MUX mode 1000.
modify avr_callback_sleep_raw() to mitigate sim time and wall clock time divergence
To avoid simulated time and wall clock time to diverge over time
this implementation tries to keep them in sync (roughly) by sleeping
for the time required to match the expected sleep deadline
in wall clock time.
The simulation will burst as fast as the host CPU will allow
until the simulated MCU sleeps, at which point avr_callback_sleep_raw()
sleeps for the time required to sync wall clock time with simulated MCU
time.
Fix a bug which causes no cores to be compiled
On some systems, including some Mac and some Linux computers, the
sim_core_config.h file will not have any cores compiled on it.
Here is the patch from #20.
I have tested this on Linux, and there are many people on #20 reporting
that it works perfectly on Mac.
Fix timer mode 14 for timers 1, 3, 4 and 5 on Atmega2560
Make sure sim_core_declare.h is included *after* avr includes, as currently dependant ifdefs never succeed
use only 12 bits for ubrr (#257)
* use only 12 bits for ubrr
* use bitmask for ubrr
* remove r_ubrr_h and r_ubrr_l
Add support for framing error in uart (#258)
* uart: Add support for a framing error. Useful for detecting breaks
* Fix spacing for "if"
ssd1306: move display vertical and horizontal mirroring to OpenGL scene setup
The idea is that the display orientation related code belongs in the
board's implementation. Prior to this commit boards which mount the
display with a different orientation would end up mirroring the pixels
twice: once when reading them from the framebuffer and again in the
OpenGL scene rendering. As a sideeffect now reading pixels from the
vram array is simplified.
ssd1306: fix pixel size constant in demo
ssd1306: fix background painting
- Take pixel size into account.
- Fix swapped coordinates passed to glVertex2f().
ssd1306: remove stray glBegin(GL_QUADS) call
ssd1306_virt: add SSD1306_VIRT_CHARGE_PUMP command (ignored)
Without this change receiving SSD1306_VIRT_CHARGE_PUMP will
make the command parser get out of sync.
extint: support cores with non-contiguous extint numbers like atmega32u4
avr_extint_exists() is used to establish if an extint index is valid
and avr_extint_count() is removed because it is not used any longer.