Not run in SDRAM when Icache disabled, cpsr err when enable

Hi,

In my S3C2440 board, I use openocd to load a bin file to the internal RAM, and run it.

I found:

  1. I initialize the SDRAM controller, disable the Icache, and then copy the code to SDRAM, jump to SDRAM.

The program can’t run ok. But if I enable the Icache, every thing is ok.

  1. In anothre program, I use openocd to load it to the internal RAM, and run it. It does not run in SDRAM yet.

It has this instruction :

" halt_loop:

b halt_loop "

When I enabel ICache, a error will occur in openocd:

invalid mode value encountered

cpsr contains invalid mode value - communication failure

But If I disable ICache, it is ok: I halt it ,and its PC is alway point to the “halt_loop” .

So, if I want to run in SDRAM, I have to enable ICache; but if I enable ICache, some errors such as “invalid mode value encountered cpsr contains invalid mode value - communication failure” may occur.

I don’t know why.

My english is poor, I home you can understand me.

It is the power’s problem.

I use usb cable for power, and its current is limit as 100mA.

I change it, and it is ok now.