This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Memory alignment issue with third party library module

Hi, 

I am working on STM32G0 micro-controller. In this project, we are using one third party library file(.a file). This library module is allocating one uint32 variable. Once I compile the code with this library, this variable inside the library is not always aligned to 32 bit address. This mis-alignment causes hard fault in my code.

To solve this problem, I defined RAM block of 4 bytes and allocated this block to this file using file->options->zero initialized data.

I just wanted to know if there is some better efficient way of doing it i.e.

1. some options in project settings which can force this uint32 variable to be 4 byte aligned.

2. some options in project settings for the library file (.a file) which can force its variable to 4 byte aligned.

I will prefer not to create separate RAM section for doing it.