Unaligned problem when porting rtems for arm

Peng Fan van.freenix at gmail.com
Thu Apr 25 06:34:36 UTC 2013


Hi,
Thanks for all your advice.
I use arm-rtemseabi4.11-gdb to debug the code. The test bsp is arm1136jfs
I add such test code in hello sample:

char *tmp = "/";
char dest[10];
dest[0] = 'a';
dest[1] = '\0';
printf("dest %x, len %x\n", dest, strlen(dest));
strncat(dest, tmp, 10);

printf outputs :  dest 1b6bc, len 1

gcc optimize strncat function.

The step debug log is listed below:
Breakpoint 2, 0x00000814 in Init (ignored=<optimized out>)
    at
../../../../../../../rtems/c/src/../../testsuites/samples/hello/init.c:32
32 strncat(dest, tmp, 10);
1: x/i $pc
=> 0x814 <Init+68>: strh r3, [r4, r0]  *//r4+r0 is unaligned.*
(gdb) i r r0
*r0             0x1 1*
(gdb) i r r4
*r4             0x1b6bc 112316*
(gdb) i r r3
r3             0x2f 47
(gdb) c       *//It is ok*
Continuing.
*** HELLO WORLD TEST ***
Hello World
*** END OF HELLO WORLD TEST ***
[Inferior 1 (process 42000) exited with code 05]

No error msg with "strh r3, [r4, r0]", when arm-rtemseabi4.11-run
hello.exe. I do not know why.

Regards,
Peng.


2013/4/24 Sebastian Huber <sebastian.huber at embedded-brains.de>

> On 04/24/2013 05:30 PM, Joel Sherrill wrote:
>
>> On 4/24/2013 10:26 AM, Sebastian Huber wrote:
>>
>>> On 04/24/2013 04:05 PM, Peng Fan wrote:
>>>
>>>> Version: arm-rtems4.10-gcc ---- gcc version 4.4.7 20120313
>>>>
>>>> is okay.
>>>>
>>>>  This version does not use the EABI version 5 and is horribly out of
>>> date.
>>>
>>> If you don't want unaligned load/store instructions, then use the
>>> -mno-unaligned-access GCC option.
>>>
>>>  Asking out of ignorance, is there a chance newilb will include some?
>>
>>
> This is possible, yes.  GCC assumes cores for the ARMv6 and later can cope
> with unaligned access.
>
>
> --
> Sebastian Huber, embedded brains GmbH
>
> Address : Dornierstr. 4, D-82178 Puchheim, Germany
> Phone   : +49 89 189 47 41-16
> Fax     : +49 89 189 47 41-09
> E-Mail  : sebastian.huber at embedded-**brains.de<sebastian.huber at embedded-brains.de>
> PGP     : Public key available on request.
>
> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
> ______________________________**_________________
> rtems-users mailing list
> rtems-users at rtems.org
> http://www.rtems.org/mailman/**listinfo/rtems-users<http://www.rtems.org/mailman/listinfo/rtems-users>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20130425/a7403080/attachment-0001.html>


More information about the users mailing list