physical-computation / sunflower-embedded-system-emulator

Sunflower Full-System Hardware Emulator and Physical System Simulator for Sensor-Driven Systems. Built-in architecture modeling of Hitachi SH (j-core), RISC-V, and more.
http://sflr.org
BSD 3-Clause "New" or "Revised" License
24 stars 216 forks source link

dumpregs Segmentation fault #188

Closed Tom-Newton closed 3 years ago

Tom-Newton commented 3 years ago

Describe the bug After running my C program on sunflower it seems to run fine but after it finishes running dumpregs causes a Segmentation fault partway through.

issue.zip

To Reproduce Steps to reproduce the behavior:

  1. Download the .zip file above then run the sunflower with the run.m from the zip file.
  2. This should run without error.
  3. Run dumpregs this should show part of the dump then show a Segmentation fault error message.
tom@Toms-Laptop:~/code/sunflower-simulator/benchmarks/source/riscv/bme680/temp/original$ sf run.m 
Initialized random number generator with seed 567458732...

Sunflower 1.1 (build 11-18-2020-13:45:56-tom@Toms-Laptop-Linux)
Authored, 1999-2018: Phillip Stanley-Marbell <phillip.stanleymarbell@gmail.com>. 2018-onwards: See CONTRIBUTORS.TXT.
This software is provided with ABSOLUTELY NO WARRANTY. Read LICENSE.txt

New node created with node ID 0
Loading run.m...
New node created with node ID 1
Set memory size to 878906 Kilobytes
Loading S-RECORD to memory at address 0x8004000
[M] Done.
args = [], argc = 0
R2 = [0x3da4e7f0]
Running...

[ID=1 of 2][PC=0x8004000][3.3E+00V, 6.0E+01MHz] Instruction with opcode 0x0 is ignored

NODE 1 exiting...
User Time elapsed = 0.002055 seconds.
Simulated CPU Time elapsed = 1.266167E-04 seconds.
Simulated Clock Cycles = 7597
Cycles Spent Waiting = 1828 (24.06%)
Instruction Simulation Rate = 3696836.98 Cycles/Second.

[ID=1 of 2][PC=0x800adec][3.3E+00V, 6.0E+01MHz] dumpregs
x0      zero    0000 0000 0000 0000 0000 0000 0000 0000   [0x00000000]
x1      ra      0000 1000 0000 0000 1000 1100 1000 1000   [0x08008c88]
x2      sp      0011 1101 1010 0100 1110 0111 1110 0000   [0x3da4e7e0]
x3      gp      0000 1000 0000 0000 1101 0011 0111 0000   [0x0800d370]
x4      tp      0000 0000 0000 0000 0000 0000 0000 0000   [0x00000000]
x5      t0      0000 0000 0000 0000 0000 0000 0000 0000   [0x00000000]
x6      t1      0000 0000 0000 0000 0000 0000 0000 0000   [0x00000000]
x7      t2      0000 0000 0000 0000 0000 0000 0000 0000   [0x00000000]
x8      s0      0000 0000 0000 0000 0000 0000 0000 0000   [0x00000000]
x9      s1      0000 0000 0000 0000 0000 0000 0000 0000   [0x00000000]
x10     a0      1111 1111 1111 1111 1111 1111 1111 1111   [0xffffffff]
x11     a1      0000 0000 0000 0000 0000 0000 0000 0000   [0x00000000]
x12     a2      0000 0000 0000 0000 0000 0000 0000 0000   [0x00000000]
x13     a3      0000 0000 0000 0000 0000 0000 0000 0000   [0x00000000]
x14     a4      0000 1000 0000 0000 0110 0111 1100 1000   [0x080067c8]
x15     a5      0000 0000 0000 0000 0000 0000 0000 0000   [0x00000000]
x16     a6      0000 0000 0000 0000 0000 0000 0000 0000   [0x00000000]
x17     a7      0000 0000 0000 0000 0000 0000 0101 1101   [0x0000005d]
x18     s2      0000 0000 0000 0000 0000 0000 0000 0000   [0x00000000]
x19     s3      0000 0000 0000 0000 0000 0000 0000 0000   [0x00000000]
x20     s4      0000 0000 0000 0000 0000 0000 0000 0000   [0x00000000]
x21     s5      0000 0000 0000 0000 0000 0000 0000 0000   [0x00000000]
x22     s6      0000 0000 0000 0000 0000 0000 0000 0000   [0x00000000]
x23     s7      0000 0000 0000 0000 0000 0000 0000 0000   [0x00000000]
x24     s8      0000 0000 0000 0000 0000 0000 0000 0000   [0x00000000]
x25     s9      0000 0000 0000 0000 0000 0000 0000 0000   [0x00000000]
x26     s10     0000 0000 0000 0000 0000 0000 0000 0000   [0x00000000]
x27     s11     0000 0000 0000 0000 0000 0000 0000 0000   [0x00000000]
x28     t3      0000 0000 0000 0000 0000 0000 0000 0000   [0x00000000]
x29     t4      0000 0000 0000 0000 0000 0000 0000 0000   [0x00000000]
x30     t5      0000 0000 0000 0000 0000 0000 0000 0000   [0x00000000]
x31     t6      0000 0000 0000 0000 0000 0000 0000 0000   [0x00000000]

f0      ft0     0                       (double)          [0x0000000000000000]
f1      ft1     0                       (double)          [0x0000000000000000]
f2      ft2     0                       (double)          [0x0000000000000000]
f3      ft3     0                       (double)          [0x0000000000000000]
f4      ft4     0                       (double)          [0x0000000000000000]
f5      ft5     0                       (double)          [0x0000000000000000]
f6      ft6     0                       (double)          [0x0000000000000000]
f7      ft7     0                       (double)          [0x0000000000000000]
f8      fs0     0                       (double)          [0x0000000000000000]
f9      fs1     0                       (double)          [0x0000000000000000]
f10     fa0     37.999874               (double)          [0x4042fffbe0000000]
f11     fa1     0                       (double)          [0x0000000000000000]
Segmentation fault

Expected behavior Dump regs should run without error and show the entire dump.

Host OS (please complete the following information):

You local changes (please complete the following information):

Additional context This program is using https://github.com/BoschSensortec/BME680_driver

Tom-Newton commented 3 years ago

This was fixed by: https://github.com/physical-computation/sunflower-simulator/pull/189. Thanks