Maybe, the Linker has a custom option for this issue.
To order packing allocation, that could be.
Please check it.
Oh! I was wrong.
That is difference of endian.
There are different ways to swap bytes. Can you tell us what you want to do?
I'm trying to change the project
of Kmmancad для PSoC5:
I found only switching Register/memory here:
Project-->Build Settings-->...Compiler-->Code Generator --> Struct Return Metod
It does not help.
Replacement unsigned int uint16 helps to get 2 bytes but swapped.
PSoC3 and PSoC5 (8051 and ARM Cortex) have different endianess.
As long as you do not rely on data collected from one of them and red-in by the other you will not notice any difference. When sending binary data from one to the other you will have to swap the bytes before further processing them.
I assumed that i can change this in the psoc_creator with the settings.
For PSoC3 / 5 i try to use arrays instead of structures , but it will be ugly.
Maybe there are other options?
No other options.
I would start to solve the problem with the following thoughts:
The sender always knows WHAT it is sending and should know whether to transform it to a different endianess.
So the problem can be solved solely at the sender's side making the things a bit easier.
I will look how this problem is solved in the project avast: github.com/lrds/lwip-psoc5
Unfortunately, this project is too complicated for me. But I will try.
If you are dealing with ethernet: the endianess of TCP/IP is defined and fixed (Idon't know right now wheter big or little endian) so there is no need to worry.