conversion structure from PSoC3 to PSoC5

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
EvPa_264126
Level 7
Level 7
500 replies posted 250 replies posted 100 likes received

Hello. How can I configure psoc_creator to create a structure similar to PSoC3 and PSoC5
An example of the problem:
Structure{
unsigned int  dta1; //  0806
unsigned int  dta2; //  0001
unsigned int  dta3; //  0800
unsigned char data3; // 06
}
in PSoC3 i see in memory: 08,06, 00,01, 08,00, 06       - OK
in PSoC5 i see in memory: 06,08,00,00,01,00,00,08,00,06 - swapped bytes and int32
thank you.

0 Likes
9 Replies
Anonymous
Not applicable
        Maybe, the Linker has a custom option for this issue.   
To order packing allocation, that could be.   
Please check it.   
0 Likes
Anonymous
Not applicable
        Oh! I was wrong.   
That is difference of endian.   
So sorry.   
0 Likes
Anonymous
Not applicable
        There are different ways to swap bytes. Can you tell us what you want to do?   
0 Likes
EvPa_264126
Level 7
Level 7
500 replies posted 250 replies posted 100 likes received

I'm trying to change the project
of Kmmancad  для PSoC5:
http://www.cypress.com/?app=forum&id=2492&rID=72859
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.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

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.

   

 

   

Bob

0 Likes
EvPa_264126
Level 7
Level 7
500 replies posted 250 replies posted 100 likes received

Thank you. 
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?

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

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.

   

 

   

Bob

0 Likes
EvPa_264126
Level 7
Level 7
500 replies posted 250 replies posted 100 likes received

I will look how this problem is solved in the project avast: github.com/lrds/lwip-psoc5
http://www.cypress.com/?app=forum&id=2232&rID=49032
Unfortunately, this project is too complicated for me. But I will try.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

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.

   

 

   

Bob

0 Likes