Global 32-bit value not writing correctly

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Global 32-bit value not writing correctly

Jump to solution
1,020 Views
Eric_racing
Contributor I

Hi everyone,

This has been driving me bonkers and I'm hoping the community can set me in the right direction. I have a MPC5554 device in which I declare a global 32-bit value and then in my main() function, I try to write it with a 32-bit value.  For one, the global value initializes strangely to 0xcececece, and then when I attempt to write my 32-bit value, it seems to just duplicate the lower half-word. I'm using the GHS environment and have attached a screenshot of the section of code along with register and memory location values.  From what I see of the assembler code, it should be writing my value correctly. I'm perplexed why it seems to only be writing half of R12 to the memory location.  Any ideas?

0 Kudos
Reply
1 Solution
1,012 Views
Eric_racing
Contributor I

So after some hard thought, I figured out the issue. I realized that this was being written to the external RAM device. Relocating to internal RAM immediately solved the issue.  Turns out that the GHS default boot code initializes the external bus in 16-bit mode and that is what was causing this behavior.  After correcting that, no issues!

So if you happen to see similar behavior, check the width setting of your external bus configuration!

View solution in original post

0 Kudos
Reply
1 Reply
1,013 Views
Eric_racing
Contributor I

So after some hard thought, I figured out the issue. I realized that this was being written to the external RAM device. Relocating to internal RAM immediately solved the issue.  Turns out that the GHS default boot code initializes the external bus in 16-bit mode and that is what was causing this behavior.  After correcting that, no issues!

So if you happen to see similar behavior, check the width setting of your external bus configuration!

0 Kudos
Reply