lowRISC / lowRISC/ibex

Exception occuring when calling cryptographic function

Open
#2,159 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Type:Question
Dominant language
SystemVerilog
Stars
2.1k
Forks
810
Avg merge
5d 23h
Merged PRs (30d)
9

Description

I am trying to execute the cryptographic algorithm on ibex. AES works fines but when adding bigger algorithm I am getting exception when calling cryptographic function. This algorithm requires memcpy etc. so I have removed --nostdlib flag. I am getting no clue of starting point of this problem because that code is running on other cores in simulation as well as on host.

```
Hello simple system
EXCEPTION!!!
============
MEPC: 0x0011683E
MCAUSE: 0x0000000B
MTVAL: 0x00000000
```
My embedded firmware memory requirements are as follows but I expect that is quite well under memory requirements
```
riscv32-unknown-elf-size --format=berkeley examples/sw/simple_system/hello_test/hello_test.elf
text data bss dec hex filename
95220 1712 8644 105576 19c68 examples/sw/simple_system/hello_test/hello_test.elf
```

The execution fails as you can see below and it is due to above exception.
```
./build/lowrisc_ibex_ibex_simple_system_0/sim-verilator/Vibex_simple_system [-t] --meminit=ram,examples/sw/simple_system/hello_test/hello_test.elf
Simulation of Ibex
==================

Tracing can be toggled by sending SIGUSR1 to this process:
$ kill -USR1 1826827

Simulation running, end by pressing CTRL-c.
TOP.ibex_simple_system.u_top.u_ibex_tracer.unnamedblk2.unnamedblk3: Writing execution trace to trace_core_00000000.log
Terminating simulation by software request.

```

## My Environment

**Operating system:**

Ubuntu Linux 22.xx
**Version of the Ibex source code:**

I am using IBEX head revision of last week.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure using the Verilator command and examples/sw/simple_system/hello_test/hello_test.elf, then inspect the execution around MEPC 0x0011683E and MCAUSE 0x0000000B. Compare the cryptographic firmware path with the working AES case and verify that the firmware runs without the reported exception.

Written by the indexing model from the issue text.

Assessment

Domain
embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.