Git Product home page Git Product logo

traumflug / simulavr Goto Github PK

View Code? Open in Web Editor NEW
40.0 40.0 26.0 2.72 MB

A fork of SimulAVR (http://www.nongnu.org/simulavr/) for handling contributions. The practical SIMINFO mechanism implemented here wasn't accepted upstream, but is crucial for Teacup Firmware simulations, so this fork will stay ... and follow upstream. Default branch is 'traumflug', master here matches master on nongnu.org.

License: GNU General Public License v2.0

Shell 0.72% Python 12.23% C 3.40% C++ 80.09% Verilog 0.32% Assembly 0.18% Standard ML 0.02% Makefile 0.69% M4 2.08% Tcl 0.05% SWIG 0.23%

simulavr's People

Contributors

mhx avatar miso- avatar onnokort avatar petrhluzin avatar sphamradio avatar tomk-xx avatar traumflug avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

simulavr's Issues

Eclipse cannot connect avr-gdb operation timed out

When I'm trying use of simulavr in Eclipse it does not work. Below debug information from simulavr:
Waiting on port 1234 for gdb client to connect...
Connection opened by host 127.0.0.1, port -14041.
gdb -> Ack
Recv: "$qSupported:qRelocInsn+#9a"
Ack -> gdb
Sent: $PacketSize=800;qXfer:features:read+#a3
gdb -> Ack
Recv: "$Hg0#df"
Ack -> gdb
gdb* set thread 0
Sent: $OK#9a
gdb -> Ack
Recv: "$qXfer:features:read:target.xml:0,7fb#4a"
Ack -> gdb
Sent: $l

avr #84

gdb -> Ack
Recv: "$?#3f"
Ack -> gdb
Sent: $S05#b8
gdb -> Ack
Recv: "$Hc-1#09"
Ack -> gdb
Sent: $#00
gdb -> Ack
Recv: "$qC#b4"
Ack -> gdb
gdb get current thread: 1
Sent: $QC01#f5
gdb -> Ack
Recv: "$qAttached#8f"
Ack -> gdb
gdb query 'qAttached' not supported
Sent: $#00
gdb -> Ack
Recv: "$qOffsets#4b"
Ack -> gdb
gdb query 'qOffsets' not supported
Sent: $#00
gdb -> Ack
Recv: "$g#67"
Ack -> gdb
Sent: $aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa00000000000000#e0
gdb -> Ack
Recv: "$qSymbol::#5b"
Ack -> gdb
gdb query 'qSymbol::' not supported
Sent: $#00
gdb -> Ack
Recv: "$qTStatus#49"
Ack -> gdb
gdb query 'qTStatus' not supported
Sent: $#00
gdb -> Ack
Recv: "$X0,0:#1e"
Ack -> gdb
gdb command 'X0,0:' not supported
Sent: $#00
gdb -> Ack
Recv: "$M0,3f0:12c02cc02bc02ac029c028c027c026c025c0c0c023c022c021c020c01fc01ec01dc01cc01bc011241fbecfe5d4e0debfcdbf10e0a0e6b0e0eae5f6e002c005900d92ae36b107d9f720e0aee6b0e001c01d92a837b207e1f73fd0fdc2d1cfcf93df93cdb7deb784e390e024e330e0f90120812863fc01208384e390e024e330e0f90120812760fc01208381e390e021e330e0f90120812160fc01208381e390e021e330e0f90120812e61fc01208383e590e023e530e0f90120812260fc01208389e590e029e530e0f90120812160fc012083df91cf910895ef92ff920f931f93cf93df931f92cdb7deb7b9df789487e0898320917200309173008981882f90e0880f991f880f991f820f931ffc0180819181a281b3810097a105b10589f520917400309175008981882f90e0820f931ffc018081882321f582e590e0fc018081882f90e023d2e0907400f09075008981082f10e018d2282fc701800f911ffc012083e0907600f09077008981082f10e00ad2282f2170c701800f911ffc01208389819fef980f9983882319f487e08983b0cfafcf1f920f9200905f000f9211242f933f934f935f936f937f938f939f93af93bf93ef93ff93cf93df93cdb7deb780916e00882309f071c082e390e022e330e0f90120812e7ffc01208385e390e025e330e0f9012081277cfc01208385e390e025e330e0f9012081287ffc01208385e390e025e330e0f901308120916800232bfc012083209176003091770080916800882f90e0820f931ffc018081882349f082e390e022e330e0f90120812160fc01208381e080936e0020916f003091700080916800882f90e0609174007091750040916800442f50e0460f571ffa014081820f931ffc014083209172003091730080916800882f90e0880f991f880f991f820f931ffc0180819181a281b381805a9f4ffc0180818093710020916f003091700080916800882f90e0a901480f591ffa0140815fef540f820f931ffc015083442309f05ec0209172003091730080916800482f50e0ca01880f991f880f991f820f931ffc0180819181a281b3810196a11db11d440f551f440f551f240f351ff90180839183a283b38388309105a105b105f8f0209172003091730080916800882f90e0880f991f880f991f820f931ffc011082118212821382209174003091750080916800882f90e0820f931ffc01108220916f003091700080916800882f90e0609174007091750040916800442f50e0460f571ffa014081820f931ffc014083209176003091770080916800882f90e0820f931ffc018081882309f474c0809171008073882351f485e390e025e330e0f90120812f7dfc01208319c085e390e025e330e0f90120812062fc0120838091710082958f7083708d5f8370#76"
Ack -> gdb
Sent: $OK#9a
gdb -> Ack
Recv: "$M3f0,26a:83708295807f909171009f7c892b80937100809171008c70882351f485e390e025e330e0f90120812f7efc01208319c085e390e025e330e0f90120812061fc012083809171008695869583708d5f83708370880f880f90917100937f892b80937100809171008370882351f485e390e025e330e0f9012081277ffc01208315c085e390e025e330e0f90120812860fc0120838091710083708d5f83708370909171009c7f892b809371008091690081508093690080916900882381f484e08093690010926e00809168009fef980f90936800882319f487e080936800df91cf91ff91ef91bf91af919f918f917f916f915f914f913f912f910f9000925f000f901f9018958f929f92af92bf92cf92df92ef92ff92cf93df93ec01688179818a819b81611571058105910521f464e279ed8be597e02de133ef41e050e03ad049015a019b01ac01a7eab1e44fd06b017c01aceeb4efa501940154d0c60ed71ee81ef91ef7fe06c081e0c81ad108e10880e8f80ac882d982ea82fb82c6019f77df91cf91ff90ef90df90cf90bf90af909f908f900895b7cf8ae690e0b4cfa0e0b0e080936a0090936b00a0936c00b0936d000895052e97fb16f400940fd057fd05d024d007fc02d046f408c050954095309521953f4f4f4f5f4f089590958095709561957f4f8f4f9f4f089531d0a59f900db49f900da49f800d911d11240895b7fff4cff3df821b930b0895a1e21a2eaa1bbb1bfd010dc0aa1fbb1fee1fff1fa217b307e407f50720f0a21bb30be40bf50b661f771f881f991f1a9469f760957095809590959b01ac01bd01cf010895a29fb001b39fc001a39f01d0b29f700d811d1124911d0895f894ffcf#38"
Ack -> gdb
Sent: $OK#9a
gdb -> Ack
Recv: "$M65a,e:0001061b2e392410070401000000#b4"
Ack -> gdb
Sent: $OK#9a
gdb -> Ack
Recv: "$qTStatus#49"
Ack -> gdb
gdb query 'qTStatus' not supported
Sent: $#00
gdb -> Ack
Recv: "$qTStatus#49"
Ack -> gdb
gdb query 'qTStatus' not supported
Sent: $#00
gdb -> Ack
Recv: "$qTStatus#49"
Ack -> gdb
gdb query 'qTStatus' not supported
Sent: $#00
gdb -> Ack
Recv: "$qTStatus#49"
Ack -> gdb
gdb query 'qTStatus' not supported
Sent: $#00
gdb -> Ack
Recv: "$T1#85"
Ack -> gdb
gdb is thread 1 alive
Sent: $OK#9a
gdb -> Ack
Recv: "$qfThreadInfo#bb"
Ack -> gdb
gdb get thread info
Sent: $m1#9e
gdb -> Ack
Recv: "$qsThreadInfo#c8"
Ack -> gdb
Sent: $l#6c
gdb -> Ack
Recv: "$qThreadExtraInfo,1#b6"
Ack -> gdb
gdb query 'qThreadExtraInfo,1' not supported
Sent: $#00
gdb -> Ack
Recv: "$qP0000001f0000000000000001#79"
Ack -> gdb
gdb query 'qP0000001f0000000000000001' not supported
Sent: $#00
gdb -> Ack
Recv: "$k#6b"
Ack -> gdb
Sent: $OK#9a

How-to compile and work with pysimulavr

System Ubuntu 15.04 , swig 2.0.12-1ubuntu1 - installed

git clone https://github.com/Traumflug/simulavr.git
./bootstrap
./configure LDFLAGS="-L/usr/lib/python2.7" --enable-python
make
sudo checkinstall
cd src/python 
sudo python setup.py install

python -c 'import pysimulavr'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/pysimulavr-1.1.dev0-py2.7-linux-x86_64.egg/pysimulavr.py", line 28, in <module>
    _pysimulavr = swig_import_helper()
  File "/usr/local/lib/python2.7/dist-packages/pysimulavr-1.1.dev0-py2.7-linux-x86_64.egg/pysimulavr.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pysimulavr', fp, pathname, description)
ImportError: /usr/local/lib/python2.7/dist-packages/pysimulavr-1.1.dev0-py2.7-linux-x86_64.egg/_pysimulavr.so: undefined symbol: _ZTI14RWMemoryMember

What's wrong?

My awesome journey ends here

Folks, Github is about to enforce 2FA (Two Factor Authentification). That's IMHO a pretty pointless burden. Quality control in Open Source isn't established by some door lock, but by eyeballs looking at the code. Git commit IDs are enough of a verification, same ID gives always the exactly same code (and even the very same commit message). And yes, Git has also a mechanism to sign tags and commits with a GPG signature. That's as safe as public code can be.

I'm not going to mess with my phone (only way to give a second factor) when doing development, so I'll lose control over this repository in a couple of days. For this reason, this repository will be archived in a minute. All my Github activities requiring 2FA will chease for the same reason.

Should I happen to pick up development on this project again, it'll appear on GitLab, or some other appropriate public Git server. Archived repositories stay readable, and I also have my local copy.

Traumflug

premature termination on linux/amd64

simulavr terminates prematurely on linux/amd64 with message: "FATAL: file traceval.cpp: line 212: add TraceValue denied: wrong name: 'PC', scope is 'CORE.'".
This behavior is caused by if(n.find('.') != (unsigned int)-1) check, in traceval.cpp:210 because string::find() returns size_t which is unsigned long, which happens to be of different (8) size than int (4). I'v created patch miso-@7141f50 that makes simulavr work on linux/amd64. Please review.

Lots of interrupt losses since this upstream commit regarding interrupt handling

With this upstream patch applied I experience lots of interrupt losses (time 1A going full round instead of interrupting in time) with code which is known to work fine on a real controller. Code is Teacup, a 3D printer controller firmware, and pretty complex. More precisely the code in timer-avr.c, but there are other interrupts running continuously.

Now I'm wondering how I can simplify this complex firmware into a demonstration case which can be measured on the scope. I have no logic analyser, so "long time" measurements are limited to some 20'000 samples.

segfault in tcl examples

cd simple_ex1
make do
../simulavr.tcl -d at90s8515 -f fred.elf
-W 0x20,- -R 0x22,- -T exit
make: *** [do] Segmentation fault (core dumped)

compiling with -g and using core file in gdb:
Core was generated by `/usr/bin/tclsh ../simulavr.tcl -d at90s8515 -f fred.elf'.
Program terminated with signal 11, Segmentation fault.
#0 0x000000000008b0d6 in Tcl_GetVar@plt ()

Missing separate debuginfos, use: debuginfo-install glibc-2.17-20.fc19.x86_64 libgcc-4.8.2-7.fc19.x86_64 libstdc++-4.8.2-7.fc19.x86_64 tcl-8.5.14-1.fc19.x86_64 zlib-1.2.7-10.fc19.x86_64
(gdb) where
#0 0x000000000008b0d6 in Tcl_GetVar@plt ()
#1 0x00007f53bf1ce3ff in SWIG_Tcl_GetModule (interp=0x1786670)

at simulavr_wrap.cxx:1193

#2 SWIG_InitializeModule (clientdata=0x1786670) at simulavr_wrap.cxx:23212
#3 Simulavr_Init (interp=0x1786670) at simulavr_wrap.cxx:23465
#4 0x000000307f2a1249 in ?? () from /lib64/libtcl8.5.so
#5 0x000000307f234244 in ?? () from /lib64/libtcl8.5.so
#6 0x000000307f23525e in ?? () from /lib64/libtcl8.5.so
#7 0x000000307f235796 in Tcl_EvalEx () from /lib64/libtcl8.5.so
#8 0x000000307f29be72 in Tcl_FSEvalFileEx () from /lib64/libtcl8.5.so
#9 0x000000307f2a25a3 in Tcl_Main () from /lib64/libtcl8.5.so
#10 0x00000000004007d0 in ?? ()
#11 0x0000000000000000 in ?? ()

If I use the original simulavr git from clone git://git.savannah.nongnu.org/simulavr.git
the tcl example work as expected.

this is my configure:
./configure --enable-python --enable-tcl --enable-verilog --enable-dependency-tracking --with-bfd=/home/pat1/compilazioni/binutils-2.24/bfd/ --with-libiberty=/home/pat1/compilazioni/binutils-2.24/libiberty CXXFLAGS=-g CFLAGS=-g --no-create --no-recursion

and this the configuration for binutils 2.24:
./configure --prefix=/usr --libdir=/usr/lib64 --mandir=/usr/share/man --infodir=/usr/share/info --target=avr --disable-werror --disable-nls CFLAGS=-fpic CXXFLAGS=-fpic

do not work with cpp

in example/simple_serial rename .c in .c++
modify Maefile.am to compile with avr-g++

with avr-g++ I have to add -fpermissive options

Make do

avr-g++ -fpermissive -g -O2 -mmcu=atmega644 -DF_CPU=20000000 -Wl,--section-start=.siminfo=0x900000 -c -o serial.o serial.
serial.c serial.h serial.o
[root@asus-pat1 simple_serial]# avr-g++ -fpermissive -g -O2 -mmcu=atmega644 -DF_CPU=20000000 -Wl,--section-start=.siminfo=0x900000 -c -o serial.o serial.
serial.c serial.h serial.o
[root@asus-pat1 simple_serial]# avr-g++ -fpermissive -g -O2 -mmcu=atmega644 -DF_CPU=20000000 -Wl,--section-start=.siminfo=0x900000 -c -o serial.o serial.c
[root@asus-pat1 simple_serial]# avr-gcc -g -O2 -mmcu=atmega644 -DF_CPU=20000000 -Wl,--section-start=.siminfo=0x900000 -o simple_serial.elf main.o serial.o
[root@asus-pat1 simple_serial]# avr-objcopy -j .text -j .data -O ihex -R .eeprom -R .fuse -R .lock simple_serial.elf simple_serial.hex

simulavr --file simple_serial.elf

FATAL: file avrfactory.cpp: line 57: Device type not specified, use -d | --device TYPE or insert a SIMINFO_DEVICE(name) macro into your source to specify the device name

readelf -p .siminfo simple_serial.elf
readelf: Warning: Section '.siminfo' was not dumped because it does not exist!

in a different project I get:
readelf -p .siminfo .build/uno/firmware.elf

Dump delle stringhe della sezione ".siminfo":
[ 5] $
[ a] D0
[ e] %
[ 13] D1
[ 17] %

[pat1@asus-pat1 jsonrpc-mqtt]$ simulavr --file .build/uno/firmware.elf
WARNING: file avrreadelf.cpp: line 396: signature for device '��' not found

FATAL: file avrfactory.cpp: line 60: Invalid device specification: ��

support for ATmega1284p

The support for ATmega1284p does not work with Timer/Counter3. I tested in CTC mode but the interrupt routine for vector "TIMER3_COMPA_vect" (No.33) is never entered. The vector "TIMER1_COMPA_vect" (No.14) works just perfect. I verified the code on physical HW using an external logic analyzer. The code is correct and both vectors (14,33) are entered as expected.

Master is updated

See http://git.savannah.gnu.org/cgit/simulavr.git for recent history of git://git.savannah.nongnu.org/simulavr.git

One of the features I like is that it compiles on my Mac, but then I'm not sure how to invoke the standard dist and get the serial-in/serial-out like your fork provides with SIMINFO_* mechanism.

Building in Cygwin issues

Will add here more:

$ ./bootstrap
libtoolize:   error: Files
libtoolize: putting auxiliary files in '.'.
libtoolize: copying file './ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltoptions.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\${ <-- HERE ([^ \t=:+{}]+)}/ at /usr/bin/automake-1.14 line 3930.
configure.ac:51: installing './ar-lib'
configure.ac:25: installing './compile'
configure.ac:52: installing './config.guess'
configure.ac:52: installing './config.sub'
configure.ac:9: installing './install-sh'
configure.ac:9: installing './missing'
doc/Makefile.am:8: installing 'doc/mdate-sh'
regress/gtest/Makefile.am: installing './depcomp'

Configure script works ok.
But make fails with the error:

libtool: compile:  g++ -DHAVE_CONFIG_H -I. -Ielfio -g -O2 -Icmd -Iui -Ihwtimer -g -O2 -MT irqsystem.lo -MD -MP -MF .deps/irqsystem.Tpo -c irqsystem.cpp  -DDLL_EXPORT -DPIC -o .libs/irqsystem.o
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -Ielfio -g -O2 -Icmd -Iui -Ihwtimer -g -O2 -MT irqsystem.lo -MD -MP -MF .deps/irqsystem.Tpo -c irqsystem.cpp -o irqsystem.o >/dev/null 2>&1
make[3]: *** Нет правила для сборки цели «kbdgentables», требуемой для «ui/keytrans.h».  Останов.
make[3]: выход из каталога «/cygdrive/d/radare/simulavr/src»
Makefile:1009: ошибка выполнения рецепта для цели «all-recursive»
make[2]: *** [all-recursive] Ошибка 1
make[2]: выход из каталога «/cygdrive/d/radare/simulavr/src»
Makefile:554: ошибка выполнения рецепта для цели «all»
make[1]: *** [all] Ошибка 2
make[1]: выход из каталога «/cygdrive/d/radare/simulavr/src»
Makefile:495: ошибка выполнения рецепта для цели «all-recursive»
make: *** [all-recursive] Ошибка 1

using arduino libraries, baudrate appear to be wrong

using this patch:
pat1@1a918c7

and a standardard build for arduino uno
defining a serial device working at 9600 baudrate I have to use this command to get the serial stdin/stout to work well:

simulavr -d atmega328 -z -b 9600 -F 32000000 --file mqtt_ethernet.cpp.elf

but the arduino uno board is a board with 16Mhz clock

using:
simulavr -d atmega328 -z -b 9600 -F 16000000 --file mqtt_ethernet.cpp.elf
puts wrong character in the stdout serial monitor

Any suggestions ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.