typedef struct __attribute__((__packed__))
{
uint8_t op_code;
uint8_t flags;
uint32_t logical_block_addr;
uint8_t group_num;
uint16_t tx_length;
uint8_t control;
} SCSI_READ10_t;
when I am assigning some value to tx_length core is showing some exception. Is the assembly of tx_length assignment compiler is putting strh/ldrh(half-byte) instruction throwing error its not 2 byte aligned . But not aligned accesses are enabled. So my question is : -
Q1. Can I access not aligned memory with strh/ldrh (suppose addr :- 0xxxx37) if non aligned accesses are enabled for core ?
Q2. Do compiler take care of these no aligned access and will convert not aligned half word into two 1 byte accesses ?
It depends how the memory pages are mapped. Unaligned accesses are not allowed to "strongly ordered" or "device" memory types, and will generate exceptions, even if the core has unaligned accesses enabled.
The compiler can't know the page table settings, so it would be a global change for the whole program, but yes, I believe it is possible although I've not tried in years ...
HTH, Pete