C podozrenie na bug compilera
Stano
stano.hw na gmail.com
Čtvrtek Únor 28 15:43:34 CET 2013
Ano zda sa ze naozaj keca debugger, funkcia sa sprava korektne a aj
debug vypis cez usart je spravny.
Dakujem za nakopnutie spravnym smerom.
Jan Waclawek wrote / napísal(a):
> V tom disassembleri nevidim ziadny zasadnejsi problem; samozrejme zalezi na
> hodnote stack pointra (co zrejme ukazuje na zaciatok predtym vytvoreneho
> stack frame) a registra r4 (ktory zase zrejme ukazuje na pole buf[]); ale
> silne pochybujem, ze by tam bol nejaky problem.
>
> Skor verim tomu, ze kecia nastroj, ktorym to pozerate, ci je to uz
> simulator alebo nejaky iny debugger. Skuste nejaku nezavislu metodu -
> poslat hodnotu premennej cez seriak do PC, vypisat ho na nejaky pripojeny
> displej, alebo take nieco.
>
> wek
>
>
> ----- Original Message ---------------
>
>
>> Keil MDK470a
>> uint16_t radress, rquantity;
>>
>> buf[0] = 0x87;
>> buf[1] = 0x65;
>> buf[2] = 0x43;
>> buf[3] = 0x21;
>> radress = (uint16_t)buf[0] << 8;
>> radress |= buf[1];
>> rquantity = (uint16_t)buf[2] << 8;
>> rquantity |= buf[3];
>>
>> prelozil ako:
>> 382: buf[0] = 0x87;
>> 0x08000B82 2087 MOVS r0,#0x87
>> 0x08000B84 7020 STRB r0,[r4,#0x00]
>> 383: buf[1] = 0x65;
>> 0x08000B86 2065 MOVS r0,#0x65
>> 0x08000B88 7060 STRB r0,[r4,#0x01]
>> 384: buf[2] = 0x43;
>> 0x08000B8A 2043 MOVS r0,#0x43
>> 0x08000B8C 70A0 STRB r0,[r4,#0x02]
>> 385: buf[3] = 0x21;
>> 0x08000B8E 2021 MOVS r0,#0x21
>> 0x08000B90 70E0 STRB r0,[r4,#0x03]
>> 386: radress = (uint16_t)buf[0] << 8;
>> 0x08000B92 7820 LDRB r0,[r4,#0x00]
>> 0x08000B94 0200 LSLS r0,r0,#8
>> 0x08000B96 9003 STR r0,[sp,#0x0C]
>> 387: radress |= buf[1];
>> 0x08000B98 7860 LDRB r0,[r4,#0x01]
>> 0x08000B9A 9903 LDR r1,[sp,#0x0C]
>> 0x08000B9C 4308 ORRS r0,r0,r1
>> 0x08000B9E 9003 STR r0,[sp,#0x0C]
>> 388: rquantity = (uint16_t)buf[2] << 8;
>> 0x08000BA0 78A0 LDRB r0,[r4,#0x02]
>> 0x08000BA2 0205 LSLS r5,r0,#8
>> 389: rquantity |= buf[3];
>> 0x08000BA4 78E0 LDRB r0,[r4,#0x03]
>> 0x08000BA6 4305 ORRS r5,r5,r0
>>
>> rquantity je OK, radress hodnota 0x0001
>> MCU core cortex M0
>>
>> Jan Waclawek wrote / napísal(a):
>>
>>> Aky kompilator, aka verzia, ake su command-line options, ako vyzera
>>> disassembly funkcie?
>>>
>>> wek
>>>
>>>
>>>
>>> ----- Original Message ---------------
>>>
>>>
>>>
>>>
>>>
>>>> Zdravim konferenci, mam nasledovny problem:
>>>>
>>>> void funkcia (uint8_t *buf, uint8_t len, uint32_t *coils){
>>>> uint16_t radr;
>>>> radr = buf[0];
>>>> ...
>>>> }
>>>>
>>>> A v debuggeri do radr priradi 0x0102, cize 16bit cislo. Optimalizacie su
>>>> vypnute a priznam sa, nechapem.
>>>> Ako je nieco take vobec mozne?
>>>>
>>>>
>
> _______________________________________________
> HW-list mailing list - sponsored by www.HW.cz
> Hw-list na list.hw.cz
> http://list.hw.cz/mailman/listinfo/hw-list
>
Další informace o konferenci Hw-list