Open errikosmes opened 2 months ago
This seems to verify my concern with the R5 port and the TX_THREAD struct.
On the cortex A9 port, TX_THREAD_EXTENSION_2
is defined to be ULONG tx_thread_vfp_enable;
Link. This allocates a flag to store the vfp enable. See tx_api.h
On the cortex R5 port, TX_THREAD_EXTENSION_2
is defined to nothing. So TX_THREAD
+ 144 points to the next thing in the struct which is tx_thread_filex_ptr
, see here
So it makes sense that vfp_enable is going to break FileX since it'll write over the tx_thread_filex_ptr value.
You can try to update the line here on the cortex R5 to match the A9 port like this:
#define TX_THREAD_EXTENSION_2 ULONG tx_thread_vfp_enable;
This should allocate space for that flag in the TX_STRUCT but not sure if it's going to throw off any other offsets.
Description
logical_sector
infx_directory_entry_read.c:236
calculation being wrong. FX struct corruption ?tx_thread_schedule.S
modifies a field inTX_THREAD
with an offset of 144 but there is no dedicated vfp field.TX_THREAD
saying that "Nothing after this point is referenced by the target-specific assembly language. ". The 144 offset violates thatTX_THREAD
fields can move depending on ifdefs and/or compiler padding. But the vfp context handling relies on a fixed offset to an undefined location.Environment
To Reproduce
include "fx_api.h"
include "tx_api.h"
include "tx_zynqmp.h"
include "xparameters.h"
extern VOID _fx_ram_driver(FX_MEDIA *media_ptr); // Define RAM device driver entry.
define STACK_SIZE 10000
define KERNEL_BYTE_POOL_SIZE 20000
// Memory used for the thread stacks. ARM-R5 stacks need to be aligned 64-bit static uint8_t s_memoryPool[KERNEL_BYTE_POOL_SIZE] attribute((aligned(8)));
TX_BYTE_POOL g_kernelPool; static TX_THREAD s_thread;
void thread_entry(uint32_t thread_input);
void tx_application_define(void first_unused_memory) { char threadStackPointer; threadStackPointer = (char *)first_unused_memory; // Put first available memory address // into a character pointer. uint32_t txStatus;
}
int main(void) { tx_zynqmp_gic_init(); // Initialize global interrupt controller tx_zynqmp_malloc_init(); // Use a mutex when calling malloc tx_kernel_enter(); // Enter the ThreadX kernel. }
define RAMDISK_SECTOR_SIZE 128
define RAMDISK_NB_SECTORS 256
FX_MEDIA g_RamDisk; ///< RAM disk handler static uint8_t s_ramDiskMem[RAMDISK_NB_SECTORS * RAMDISK_SECTOR_SIZE]; ///< RAM disk memory static uint8_t s_ramDiskCache[RAMDISK_SECTOR_SIZE]; ///< RAM disk cache
void thread_entry(uint32_t thread_input) { tx_thread_vfp_enable(); uint32_t fxStatus = FX_SUCCESS;
}