dxxb / sim-arduboy

Arduboy board implementation using simavr
GNU General Public License v3.0
22 stars 8 forks source link

Segfault when loading .hex (issue lost when moving repo) #1

Closed dxxb closed 6 years ago

dxxb commented 6 years ago

Dave Stanley reports:

./sim_arduboy test.hex
Keymap: 1073741906,1073741905,1073741904,1073741903,122,120
Segmentation fault: 11

I'm sure its an environment issue. I used brew to install libraries and all looked to succeed as expected. Am I missing any additional dependencies?

Thanks
dxxb commented 6 years ago

Segfault happens in memcpy() and is caused by simavr's load_hex function. There was another report of this and current suspicion is that another version of libsimavr is being linked (probably a system wide installed one).

jessemillar commented 6 years ago

I'm experiencing a similar issue after updating the repo and removing osx-cross/avr/simavr in favor of libelf as mentioned here.

./sim_arduboy ../crates/crates.ino.leonardo.hex
Keymap: 1073741906,1073741905,1073741904,1073741903,122,120
[1]    44410 segmentation fault  ./sim_arduboy ../crates/crates.ino.leonardo.hex
dxxb commented 6 years ago

@jessemillar, it's hard to debug this without visibility into what happens at compile time. Removing all other copies of libsimavr.a (the ones outside the simavr subdirectory) and rebuilding from scratch should fix this. I'll check the makefile to see if it can be improved by giving the 'private' version of libsimavr priority over systemwide ones.

FYI libelf is needed to satisfy simavr build process and not used by sim_arduboy because .hex file are much simpler representation of the MCUs firmware.

dxxb commented 6 years ago

Hi @jessemillar, I just pushed some changes to the Makefile which could fix the issue. Previously the Makefile was relying on common makefile rules from simavr which may have resulted in the wrong library being linked into the final executable. Please let me know if this helps.

jessemillar commented 6 years ago

That seems to have fixed it for me. Compilation and running works both before and after running brew remove osx-cross/avr/simavr && brew untap osx-cross/avr.

dxxb commented 6 years ago

Great, if only I had a way or notifying the original creator of this issue >.<!

jessemillar commented 6 years ago

@dxxb I just posted a comment in the original issue thread pointing here and mentioned the original reporter. That's probably good enough. https://github.com/arduboy-emulator/sim-arduboy/issues/3#issuecomment-377381855