Content originally posted in LPCWare by sicotc on Tue Jan 06 09:18:12 MST 2015
Hello,
I'm using LPC11E14 with lpcxpresso V7.4.0 [Build 229]
Without any optimisation code, everything works.
But when I use "optimize for size", the software stop.
After searching, I saw a bug in the assembler code, adr=4bc, 'jump to itself" :
000004ac <delay_ms>:
4ac:b510 push{r4, lr}
4ae:4c06 ldrr4, [pc, #24]; (4c8 <delay_ms+0x1c>)
4b0:1c01 addsr1, r0, #0
4b2:1c20 addsr0, r4, #0
4b4:f7ff fff2 bl49c <timer_reset>
4b8:7923 ldrbr3, [r4, #4]
4ba:2b02 cmpr3, #2
4bc:d000 beq.n4c0 <delay_ms+0x14>
[color=#f33]4be:e7fe b.n4be <delay_ms+0x12>[/color]
4c0:2301 movsr3, #1
4c2:7123 strbr3, [r4, #4]
4c4:bd10 pop{r4, pc}
4c6:46c0 nop; (mov r8, r8)
4c8:10000018 .word0x10000018 |
the source code is :
void delay_ms(uint16_t time)
{
timer_reset(& delay_ms_v,time);
while(timer_expired_task(& delay_ms_v)==0)
{
}
} |
find attached the workspace directory with the simplified project.
In debug mode, it is easy to locate where the code stop.
Is it possible to have a solution for this problem ?
Thanks
Sicotc
Original Attachment has been moved to: workspace_testBUG.zip