netxduo icon indicating copy to clipboard operation
netxduo copied to clipboard

nx_packet_allocated return false for RISCV-64 bits arch

Open Alexbruliau opened this issue 1 year ago • 1 comments
trafficstars

Hello,

I am encountering an issue when I used nx_packet_allocate because ULONG is considered to be 8 bytes for the RISCV-64 bits architecture. It worked perfectly on my previous target CORTEX-R4F.

Any idea ?

image

Alexbruliau avatar Jun 26 '24 12:06 Alexbruliau

In ThreadX, ULONG (and LONG) should be 32 bits. On other 64-bit processors ULONG is a defined to unsigned int, but not for RISCV64.

This is a bug in ThreadX, but I don't have access to a working RISCV-64 system to check that making this change doesn't cause any other issues.

Are you able to test this?

You need to change the definition of LONG and ULONG in tx_port.h for the riscv-64 port

https://github.com/eclipse-threadx/threadx/blob/485a02faec6edccef14812ddce6844af1d7d2eef/ports/risc-v64/gnu/inc/tx_port.h#L103

to match the correct implementation for a 64-bit processor:

https://github.com/eclipse-threadx/threadx/blob/485a02faec6edccef14812ddce6844af1d7d2eef/ports/cortex_a77/gnu/inc/tx_port.h#L86

Adrian-Skerratt avatar Jul 11 '24 09:07 Adrian-Skerratt