sifive / freedom-e-sdk

Open Source Software for Developing on the Freedom E Platform - Deprecated
Other
581 stars 209 forks source link

Should include 'C' extension in the Makefile #15

Closed mwachs5 closed 7 years ago

mwachs5 commented 7 years ago

The current FE300 systems support the 'C' compressed extension, but the Makefile doesn't use it. Modify the Makefile to use compressed extension.

timsifive commented 7 years ago

I don't think gdb knows how to set breakpoints in compressed code yet.

Tim

On Mon, Dec 5, 2016 at 8:51 AM, Megan Wachs notifications@github.com wrote:

The current FE300 systems support the 'C' compressed extension, but the Makefile doesn't use it. Modify the Makefile to use compressed extension.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sifive/freedom-e-sdk/issues/15, or mute the thread https://github.com/notifications/unsubscribe-auth/APYH7WoyvwOmecpYGVccwlbZ6AC9uSs1ks5rFEEVgaJpZM4LEdIv .

timsifive commented 7 years ago

For reference, this hack “fixes” it but will break gdb on cores that don’t support the C extension:

diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c index d788e33..3b56b9a 100644 --- a/gdb/riscv-tdep.c +++ b/gdb/riscv-tdep.c @@ -165,9 +165,13 @@ riscv_breakpoint_from_pc (struct gdbarch gdbarch, { / TODO: Support C.EBREAK for compressed (16-bit) insns. / / TODO: Support NOPs for >=6 byte insns. */

Tim ​

On Mon, Dec 5, 2016 at 10:22 AM, Tim Newsome tim@sifive.com wrote:

I don't think gdb knows how to set breakpoints in compressed code yet.

Tim

On Mon, Dec 5, 2016 at 8:51 AM, Megan Wachs notifications@github.com wrote:

The current FE300 systems support the 'C' compressed extension, but the Makefile doesn't use it. Modify the Makefile to use compressed extension.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sifive/freedom-e-sdk/issues/15, or mute the thread https://github.com/notifications/unsubscribe-auth/APYH7WoyvwOmecpYGVccwlbZ6AC9uSs1ks5rFEEVgaJpZM4LEdIv .

hirooih commented 7 years ago

Thank you for the fix.

It seems that there is a better fix on the upstream. https://github.com/riscv/riscv-binutils-gdb/blob/riscv-next/gdb/riscv-tdep.c

timsifive commented 7 years ago

Yes, the latest gdb now has proper support for debugging compressed code. I'm still waiting to commit the relevant tests since for some reason I haven't been able to build a working set of tools lately.

mwachs5 commented 7 years ago

@timsifive I've tried bumping to the version of GDB as noted above, but it still doesn't seem to work if breakpoints are set at unaligned addresses. Does this need corresponding support in OpenOCD?

timsifive commented 7 years ago

It shouldn't. Can you confirm that your gdb has code to read misa here: https://github.com/riscv/riscv-binutils-gdb/blob/riscv-next/gdb/riscv-tdep.c#L161

mwachs5 commented 7 years ago

Actually it does work, I was just using an out-of-date elf file. Sorry for the false alarm.

On Thu, Jan 26, 2017 at 1:17 PM, Tim Newsome notifications@github.com wrote:

It shouldn't. Can you confirm that your gdb has code to read misa here: https://github.com/riscv/riscv-binutils-gdb/blob/riscv- next/gdb/riscv-tdep.c#L161

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/sifive/freedom-e-sdk/issues/15#issuecomment-275516500, or mute the thread https://github.com/notifications/unsubscribe-auth/ARCAJKxskLWNkQ9JUS_Q6ZlUYiJvelmQks5rWQ1QgaJpZM4LEdIv .

-- Megan A. Wachs Engineer | SiFive, Inc 300 Brannan St, Suite 403 San Francisco, CA 94107 megan@sifive.com

mwachs5 commented 7 years ago

The GDB Version is bumped now and should work. "C" extension was already enabled by default a while ago.