I2c_demo application problem

(Hyungyun Moon) #1


I’m working on Freedom-e300-arty platform.

I want to program i2c_demo application in my FPGA.

But, I have a problem. The following error message appears on the serial monitor.

Unhandled Trap:
Program has excied with code: 0x00000005

What does the Error code: 0x00000005 mean?

Thank you for reading my question.

(Jim Wilson) #2

You can find the source code in bsp/env/freedom-e300-arty/init.c in the function handle_trap. Exit is called with 1+mcause. You can find mcause values in the privilege spec in the machine cause register section.

(Hyungyun Moon) #3

Thank you for your answer.

In privilege manual, error code is mcause + 1 value. So, my mcause vaule is 4.

Error code 4 means “Load address misaligned”.

I used Freedom by reducing the DCache from 16K to 4K, and there was no problem in other applications.

When compiling the software, I modified the RAM LENGTH of the flash.lds file from 16K to 4K and the __stack_size from 2K to 1K.

Then, Can you tell me what caused this problem???

Thank you.

(Jim Wilson) #4

I don’t have an arty or hifive1, so I don’t know much about working with them, I just happened to have seen the handle_trap stuff before. Maybe there is a way to get the value of the trapping PC and then map it back to the instruction that failed?