We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
We are evaluation Keil uVision V4.10 and ARMCC V4.1.0.481.
Our first test run didn't go so well.
With no optimisation, everything worked OK. Using optimisation 1 or above, the test failed.
For various reasons, I can not disclose the test source code. However, I will attempt to create a small self-contained example later on. The part of the test code that caused the problem is setting up an multi dimensional array, setting each element to '1' (ie. Array[x][y] = 1 with a for loop for both x and y).
In the meantime, I wonder if anyone has had a similar problem?
Using optimisation -O3, the assembler code in the debugger looks like this:
48: for ( y= 0 ; y < 8 ; y++ ) 0x80000AAC E5C02000 STRB R2,[R0] 0x80000AB0 E2822001 ADD R2,R2,#0x00000001 0x80000AB4 E3A0C001 MOV R12,#0x00000001 0x80000AB8 E20220FF AND R2,R2,#0x000000FF 0x80000ABC E7C3C001 STRB R12,[R3,R1] 0x80000AC0 E5C02001 STRB R2,[R0,#0x0001] 0x80000AC4 EAFFFFFC B 0x80000ABC -- Isn't this an infinite loop???
Something tell me you made a rash, premature decision!
It is rather difficult to comment as no real code is provided, but it is very likely that the root cause is faulty code, a missing volatile type qualifier etc. I'm am already working on a second product consisting of about 150000 - 200000 lines of code, with components (namely bootloaders and some application code) heavily optimized. I don't believe the compiler is at fault here. Did you ask Keil support before making such a commitment?