Skip to content

value set/get on non-aligned address #55

@jie-ss

Description

@jie-ss

it's not 100% bug but got me stucked two days...

there are such macro definitions in lx_api.h:
...
#define LX_UTILITY_SHORT_SET(address, value) ((USHORT)(address)) = (USHORT)(value)
#define LX_UTILITY_LONG_SET(address, value) ((ULONG)(address)) = (ULONG)(value)
#define LX_UTILITY_SHORT_GET(address) (((USHORT)(address)))
#define LX_UTILITY_LONG_GET(address) (((ULONG)(address)))

in case address is not 4 bytes aligned on LONG_GET/SET, neither 2 bytes aligned on SHORT_GET/SET, you will get wrong value on many platforms such as the ARM platform.

for the universality, we should use SET/GET just as what fx_utility***_read/write did to replace these macros.

btw:

  1. although there are '16' in _fx_utility_16_unsigned_write/read, it's confused that UINT type but not USHORT parameters are used.

  2. the default nand defition is 128MB in lx_nand_flash_simulator.c, however, it's a simulated nand based on RAM, and I guess most systems running LX has less than 128MB RAM, so it's not a friendly settings to the newbies.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdiscussionFlagged for discussion during the weekly team meeting

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions