Part Number: MSP432P401R
Tool/software: TI C/C++ Compiler
Hi all,
TI v16.9.0 LTS compiler.
I'm having some trouble with non-aligned access. Here is an example:
typedef struct { uint8_t a_u8; uint64_t b_u64; uint8_t e_u8; } __attribute__ ((packed)) myStruct; myStruct m_st; uint8_t f_u8; uint8_t *g_u8_ptr; uint64_t c_u64; uint64_t *d_u64_ptr; // uint8_t non aligned access f_u8 = 0xaa; g_u8_ptr = &(m_st.e_u8); // e_u8 is not 32bit aligned m_st.e_u8 = f_u8; // Direct access works *g_u8_ptr = g_u8_ptr; // Indirect access works // uint64_t non aligned access c_u64 = 0xabcdabcdabcdabcd; d_u64_ptr = &(m_st.b_u64); // b_u64 is not 32bit aligned.
m_st.b_u64 = c_u64; // Direct access works
*d_u64_ptr = c_u64; // Indirect access causes crash
There is no problem with assigning (direct or indirect) a non-aligned uint8_t - the compiler knows how to handle this.
But for uint64_t I'm finding that an indirect assignment causes the micro to crash.
I'm running this in a TIRTOS project so I'm seeing a System_exit() with the following dump:
FSR = 0x0100
HFSR = 0x40000000
DFSR = 0x00000001
MMAR = 0xe000ed34
BFAR = 0xe000ed38
AFSR = 0x00000000
Cheers
Julian