levelx icon indicating copy to clipboard operation
levelx copied to clipboard

value set/get on non-aligned address

Open jie-ss opened this issue 9 months ago • 1 comments

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.

jie-ss avatar Mar 29 '25 08:03 jie-ss

Hi @jie-ss. Thank you for raising this issue. We will discuss it during our weekly meeting later today.

@eclipse-threadx/iot-threadx-committers and @eclipse-threadx/iot-threadx-contributors: Please provide feedback.

fdesbiens avatar Apr 15 '25 13:04 fdesbiens