Add avrlibc headers to simavr
This was planned to remove the dependency on the hosts avrlibc that is
often very out of date, or borken.
I copied their licence, and added a readme. I removed also most of the
headers we don't need.
Signed-off-by: Michel Pollet <buserror@gmail.com>
Merge branch 'ttyridal-misc_fixes'
whitespace: remove eol-spaces
Rename 90usb162 core file
or it will be excluded by the magic in Makefile
Update extra_board_usb
changing special* init/deinit to avr->custom
make: Enable more warnings
Merge branch 'franciscod-hd44780_not_hd77480'
Merge branch 'hd44780_not_hd77480' of https://github.com/franciscod/simavr into franciscod-hd44780_not_hd77480
Conflicts:
examples/board_hd44780/font.h
examples/board_hd77480/font.h
examples/parts/hd44780_font.h
Add missing header file to 'sim_hex.h'
'size_t' is not defined in any of the header files included in
'sim_hex.h', even though it is used in there.
You can see a list of all headers that define 'size_t' here
http://en.cppreference.com/w/c/types/size_t
parts: Move font.h for hd44780 display to parts directory
This file is referenced only by hd44780_glut.c in the parts folder,
so move it there and give it a prefix.
misc: Strip off tag prefix from the pkg-config version
For example, before this change the version would
be set as 'tag:v1.5'. After this change it will be
'v1.5'.
cores: Add support for Analog Comparator
timer: Added an IRQ for input capture trigger (ICP)
Merge pull request #223 from kostic2000/feature/add_reset_sources
Add reset flags and set power-on reset as a default when avr is initialised
Add reset flags and set power-on reset as a default when avr is initialised
vcd: Decrease the VCD resolution
From about 1GHz to 100MHz. Shouldn't have an impact on simavr proper,
but might help with Pulseview
Signed-off-by: Michel Pollet <buserror@gmail.com>
Merge pull request #216 from Premik/x4Aref
Tinyx4 core, avcc->aref
board_hd77480: rename to board_hd44780 (typo?)
https://en.wikipedia.org/wiki/Hitachi_HD44780_LCD_controller
vcd: Removed GNU dependency
Why isn't this in the standard C library, I wonder.
Signed-off-by: Michel Pollet <buserror@gmail.com>
Merge pull request #203 from kostic2000/timer_prescaler_reset_fix
Set prescaler divisor (cs_div_value) to zero when prescaler is reset,…
vcd: Added 'floating' support
Also, fixed a bug int he input file reading code.
Signed-off-by: Michel Pollet <buserror@gmail.com>
simavr: Wiggled the log levels.
Added a new LOG_OUTPUT, and a new LOG_DEBUG. Hopefully this will allow
running run_avr without -v to get the expected output.
Signed-off-by: Michel Pollet <buserror@gmail.com>
elf: Disabled some noisy traces
Not necessary, and they can't be filtered as the AVR is not populated
Signed-off-by: Michel Pollet <buserror@gmail.com>
uart: Gratuitous reformatting
New fashion!
Signed-off-by: Michel Pollet <buserror@gmail.com>
IRQs: Trace the pending vectors
Trace pending vectors, and use the new 'float' option when nothing is
pending
Signed-off-by: Michel Pollet <buserror@gmail.com>
sim_avr: Gratuitous reformatting
No functional changes
Signed-off-by: Michel Pollet <buserror@gmail.com>
irq: Added a flag for a 'floating' value
When this flag is set, the value is to be ignored.
Signed-off-by: Michel Pollet <buserror@gmail.com>
mmcu: Added tag for tracing pending IRQs
This was missing from the header.
Signed-off-by: Michel Pollet <buserror@gmail.com>
core: Cleaned up trace code.
Also fix a potential crash when using it.
Signed-off-by: Michel Pollet <buserror@gmail.com>
run_avr: Added support for --input <vcd>
Still need the backend code, let's not get overexcited here ;-)
Signed-off-by: Michel Pollet <buserror@gmail.com>
run_avr: A bit of cosmetic Also, standardize '--' for all long options
This had to be done at some point
Signed-off-by: Michel Pollet <buserror@gmail.com>
vcd: Extensive update; added support for VCD Input
Massive update here. Now allow reading from a VCD file, as long as the
traces are named in a way that allows us to connect an IRQ. Typically,
you can send pin values to for example PORTB5 by naming the trace
'iogB_5' -- you can use sigrock for example to capture traces from
real hardware, and 'replay' it in simavr.
Also since I was there, reworked the whole module to use a 'proper' FIFO
and simplified the output generation too.
There are a few 'TODO' left, but it's functional.
Signed-off-by: Michel Pollet <buserror@gmail.com>
Added sim_utils.c/h
Contains my string stripper utility. Used by the VCD input module
Signed-off-by: Michel Pollet <buserror@gmail.com>
irq: Small cleanup
Also, try to find an empty slot in the pool when adding an IRQ
Signed-off-by: Michel Pollet <buserror@gmail.com>
Set prescaler divisor (cs_div_value) to zero when prescaler is reset, i.e. timer is stopped. Otherwise when OCR is set, the tomer gets reconfigured with the old prescaler
Fix for travis build on antique ubugtu
Doesn't have proper defs for mega2560 !
Signed-off-by: Michel Pollet <buserror@gmail.com>
Updated some tests to use the new VCD macros
No functional changes
Signed-off-by: Michel Pollet <buserror@gmail.com>
Changed the port/pin trace macros to use the generic one
Simplifed the whole operation
Signed-off-by: Michel Pollet <buserror@gmail.com>
Added new VCD tags for IRQ vector tracing
Now allow cool stuff, like tracking pending IRQs, their exact execution
time, and also a global one that shows which ones are running and when
Signed-off-by: Michel Pollet <buserror@gmail.com>
mmcu: Added VCD_PORT_PIN support
Allows specing VCD traces for PORT/PIN directly in the firmware using a
MMCU macro.
Also did a bit of housekeeping in sim_elf since I was there...
Signed-off-by: Michel Pollet <buserror@gmail.com>
mmcu ELF section fixes
Fix the problem with newer gcc, annoyingly enough this is a clear
regression in the compiler to prevent that syntax; it worked for yeards
uppon years and you can /still/ do it for singleton strings anyway!
Signed-off-by: Michel Pollet <buserror@gmail.com>
Fixed typos in comments
Been there a loooong time.
Signed-off-by: Michel Pollet <buserror@gmail.com>
irq: Updated the tracing
Nothing functional there, apart from tweaking traces
Signed-off-by: Michel Pollet <buserror@gmail.com>
Added sanity check for the .mmcu section handlers
Manage to bite myself on this one.
Signed-off-by: Michel Pollet <buserror@gmail.com>
Merge pull request #194 from hovercraft-github/used_with_simutron
When UART is driven by interrupts, the reception never starts
UART: separate TX/RX pumps, sticky UDRC and RXC interrupt flags.
Fixes #104, #193 and others.
doc: Updated callgraph
Much, much more involved than in used to be. Also shows some functions
problably should be relocated.
Signed-off-by: Michel Pollet <buserror@gmail.com>
core: Removed UTF8 sequences from comments
Makes the documentation ruby script choke.
Signed-off-by: Michel Pollet <buserror@gmail.com>
Merge pull request #197 from hovercraft-github/eeprom_boundaries
Add EEPROM address boundary checks for read/write operations
Fixes #196 : Add EEPROM address boundary checks for read/write operations
Merge pull request #198 from rlpipkin/master
adc control register write
ensure that the adsrb is written to memory
process avr_adc_configure_trigger after writing the value to memory
Merge pull request #190 from pakesson/uart_fix
Workaround for UART issues when polling in some cases
Workaround for UART issues when polling in some cases
Clear interrupt instead of just the rxc bit
misc: Spacing cleanup
Trailing space removal
Signed-off-by: Michel Pollet <buserror@gmail.com>
elf: Fix elf_copy_section
How this ever worked is a wonder
Signed-off-by: Michel Pollet <buserror@gmail.com>
cores: Add RAMPZ for the 1284p core
That was missing, fixes Issue #186
Signed-off-by: Michel Pollet <buserror@gmail.com>
misc: Some more spacing issues
geany catches stray spaces
Signed-off-by: Michel Pollet <buserror@gmail.com>
Merge pull request #173 from hovercraft-github/timers-ext-clock
Add external clock pin definition and external clocking for timers.
Timers: fixes #177 (interrupt flags reset failure)
Timers: fixes #178, add timer external clock pin definition for megax cores.
Timers: added support for external clock input via a pin (Tn, TOSC1),
a variable frequency for virtual external clock sources including as2 asynchronous clock,
IO control for selecting external clock source and frequency,
external clock pin definition for most cores.
core: Fix rjmp/rcall wrapping around flash boundaries
As per PR #127, spliced
Signed-off-by: Michel Pollet <buserror@gmail.com>
regbits: Added attribute unused
As per pull request #127
Signed-off-by: Michel Pollet <buserror@gmail.com>
misc: Spacing issues fixed
Trailing spaces removed
Signed-off-by: Michel Pollet <buserror@gmail.com>
cores: fix for 1284p timer block
This is the 'approved' way to deal with optional peripherals. Check the
name, or check a register 'address' value for != 0 instead of trying to
use #ifdefs
Signed-off-by: Michel Pollet <buserror@gmail.com>
Merge pull request #181 from messani/master
Timer fix
casting to uint64_t instead of float
renamed variable cs_div_clock to cs_div_value
Merge pull request #180 from hovercraft-github/sim_gdb_fix
sim_gdb: fix for restore callbacks issue
sim_gdb: fix for restore callbacks issue
Merge pull request #172 from Lotharyx/master
Improve usage message by not listing cores by default
Changed "-list-cores" and "-help" to "--list-cores" and "--help" respectively
Formatted the usage statement to include variants (e.g. -gdb, -g; -trace, -t)
mmcu: add helper macro for sending multi-byte commands
Add helper macro SEND_SIMAVR_CMD() for sending multi-byte commands
in one line. The macro makes use of involved preprocessor trickery to
achieve recursion.
cmds: rewrite command handling and move to separate file
Move AVR command handling code to separate file and add support for
multi-byte, as well as user-defined, commands.
(cherry picked from commit
c627c3720a6dcb1f8f7a3068510f11e3fbee0ce4)
Merge pull request #165 from inio/trace_port
Provide IRQs on PORT register when updated via PIN
elf: check for error instead of crashing
Check for error when allocating memory instead of dereferencing a NULL
pointer later in the program.
(cherry picked from commit
b3ecaf43cba921c6a257132093107771074ab749)
Conflicts:
simavr/sim/sim_elf.c
elf: Clean up code duplication and fix a cast
Use the helper function elf_copy_section() to get rid of some code
duplication and use the correct printf() type so that there is no cast
necessary.
Conflicts:
simavr/sim/sim_elf.c
elf: Wire up support for Fuses and Lock Bits
Support reading fuses and lock bits from ELF files and loading them into
the simavr internals for later use.
cores: Add a field for Lock Bits and Boot Lock Bits
Add an extra byte for allowing simavr store the chip's lock bits / boot
lock bits as well as set the default value as defined in a number of
specs.
cores: Fix fuse support to handle proper byte size
avr-libc specifies platforms with only 6, 3, 2, 1, and 0 bytes of fuses.
Previously simavr only had 4 bytes available for fuses and assumed any
platform using the CORE_DECLARE macro would have 3 fuses. This change
allows the CORE_DECLARE macro to support any of the platforms supported
by avr-libc with regard to fuses. Additionally add some defines to make
it clear for users of simavr what order the fuses are in.
Merge pull request #176 from hovercraft-github/ext_int_level_triggering
Triggering by level for external interrupts
Merge pull request #161 from obra/patch-1
Small but crucial fix to Homebrew install instructions
Merge pull request #155 from neosilky/fix-memleak
Fix a small memory leak when returning after an error
Implement triggering by level for external interrupts. Fixes bug with Sense Control Bits number detection.
Embettered the usage statement; changed "--list-cores" to "-list-cores" to match "-help"
Removed core list from default usage message; added "--list-cores" command-line flag to list cores
timer: fix calculation of comp_cycles
- bsekisser was right, there must be ocr+1
timer: fixed calculation of divider when using asynchronous 32kHz timer
timer: fixed overflow and output capture interrupts
Provide IRQs on PORT register when updated via PIN
Fixes issue #164