Skip to content

assembler instruction in endian.h not working #12

Open
@skye-AL

Description

@skye-AL

@mcharleb, @jywilson
using the inline functions defined in dspal/include/endian.h, e.g. __htonl(x), leads to errors

/tmp/i2c_test_imp-2ab05a.s:78:2: error: invalid operand for instruction
eor r2, r16, r16, ror #16
^
/tmp/i2c_test_imp-2ab05a.s:79:1: error: invalid operand for instruction
bic r2, r2, #0x00ff0000
^
/tmp/i2c_test_imp-2ab05a.s:80:1: error: invalid operand for instruction
mov r16, r16, ror #8
^
/tmp/i2c_test_imp-2ab05a.s:81:1: error: invalid operand for instruction
eor r16, r16, r2, lsr #8

unfortunately I don't know anything about assembler instructions, so I don't know really how to fix it, but a workaround is to use something like this instead:

static __inline __uint32_t
__bswap32_var(__uint32_t val)
{
    return ((((val) >> 24) & 0x000000FF) | (((val) >>  8) & 0x0000FF00) | \
            (((val) <<  8) & 0x00FF0000) | (((val) << 24) & 0xFF000000));
}

can you confirm this issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions