Add preprocessor directive __attribute__((packed)) to cromfs_node_s

This directive tells the compiler that cromfs_node_s might be located at a memory
address which is not word aligned. This resolves the hardFault caused by unaligned
memory access on armv6-m architecture which doesn't support it.
This commit is contained in:
vxj9800 2022-05-31 07:40:55 -05:00 committed by Xiang Xiao
parent 39f174908f
commit bfde3c007d

View File

@ -102,7 +102,7 @@ struct cromfs_volume_s
* Return 0
*/
struct cromfs_node_s
begin_packed_struct struct cromfs_node_s
{
uint16_t cn_mode; /* File type, attributes, and access mode bits */
uint16_t cn_pad; /* Not used */
@ -116,6 +116,6 @@ struct cromfs_node_s
uint32_t cn_link; /* Offset to an arbitrary node (for hard link) */
uint32_t cn_blocks; /* Offset to first block of compressed data (for read) */
} u;
};
} end_packed_struct; /* Use packed access since cromfs nodes may be unaligned */
#endif /* __FS_CROMFS_CROMFS_H */