I try to make LPC3250 to boot from a built-in-FPGA RAM in the way of EMC BOOT. It's to say, I made a SRAM by using of FPGA, then connect the SRAM to LPC3250's EMC controller, the first address is 0xE0000000 by the way. Then I put "0x13579BD2" to the first word of the SRAM, and the code to the rest.
I write the code in asm. It implement a simple function to light a led, following is the code. Suppose AA is the base address of the gpio's register associate with that led, and BB is the value of the register.
main MOV R0, AA
MOV R1, BB
MOV R2, #1
loop SUB R2, R2, #1
CMP R2, #0
STR R1, [R0, #4]
The problem is, every time I add the "loop" code to the little program, the led won't be on, and the program just loop in the loop all the time although it should not loop. But if I comment the "loop" code or delete that part, the led can be light on. It means that LPC3250 do can execute some instructions corrcetly, some not, which is the jump instruction "B". I've take some other experiments, and I find that if I want the PC pointer jump backward 56 steps, it turns out that it just jump 20 steps.
I cannot figure out why this happened. Please help me.