macro define of S32R274 .spt file

cancel
Showing results for 
Search instead for 
Did you mean: 

macro define of S32R274 .spt file

Jump to solution
236 Views
Durant-Harden-Irving
Contributor III
Hello,
 
My question background:
Compiler: GreenHills 7
SPT tool version: D:\NXP\S32DS_Power_v2.1\S32DS\build_tools\SPT2
Purpose: to define the macro in .spt file.
I tried 3 cases, as below:
 
case1(no error and no warnings. ) : 
 .macro __mod .mod24
 .endm
 
case2( error ) : 
 .macro __mod .mod24
 .endm
add.immed .noshift __mod WR_4, (OR_0_0_0), WR_19     //This line is with error 
 
case3(no error and no warnings. ) : 
add.immed .noshift .mod24 WR_4, (OR_0_0_0), WR_19  
 
Primary conclusion: The macro define seems well, no error and no warning, but do not work.
I do not know why.  
But finally, I replaced all the __mod with .mod24,  pass the compile, no warning.  
 
My question:
Is my macro define code correct?
If yes, why do not work? 
 
Thanks very much! 
MF
0 Kudos
1 Solution
194 Views
GaryRK
NXP Employee
NXP Employee

Hello MF,

Thanks for your patience and sorry for delay. The SPT assembler is based on GNU assembler (GAS) which does not support macro expansion in operands. Luckily the SPT tools has support for preprocessor (same as GNU C preprocessor) so we can use #define to achieve what you need:

 

#define __mod .mod24
add.immed .noshift __mod WR_4, (OR_0_0_0), WR_19

-> Expands to after preprocessor stage ->

add.immed .noshift .mod24 WR_4, (OR_0_0_0), WR_19

 

The SPT assembly file needs to use .pspt extension. I assume you are using S32DS which automatically applies the preprocessor as part of the SPT build chain, so just make sure you are on the latest version of S32DS for PowerArch from NXP.com for the most up-to-date SPT tools.

Regards,

Gary

View solution in original post

5 Replies
195 Views
GaryRK
NXP Employee
NXP Employee

Hello MF,

Thanks for your patience and sorry for delay. The SPT assembler is based on GNU assembler (GAS) which does not support macro expansion in operands. Luckily the SPT tools has support for preprocessor (same as GNU C preprocessor) so we can use #define to achieve what you need:

 

#define __mod .mod24
add.immed .noshift __mod WR_4, (OR_0_0_0), WR_19

-> Expands to after preprocessor stage ->

add.immed .noshift .mod24 WR_4, (OR_0_0_0), WR_19

 

The SPT assembly file needs to use .pspt extension. I assume you are using S32DS which automatically applies the preprocessor as part of the SPT build chain, so just make sure you are on the latest version of S32DS for PowerArch from NXP.com for the most up-to-date SPT tools.

Regards,

Gary

View solution in original post

180 Views
Durant-Harden-Irving
Contributor III

Thanks!

Now we are using the GreenHills compiler.

Now successfully pass the compile and link, next step is to do the test.

MF
170 Views
GaryRK
NXP Employee
NXP Employee

You are welcome, thanks for the kudos.

Even when using GreenHills as the toolchain for PowerArch development the SPT assembler is still the same tool as integrated with S32DS and used with NXP GCC so the same technique should still work.

Granted there may be slight differences between the GCC C pre-processor and the GHS version but I don't expect the behaviour of basic macro definition to be different. Let us know if your test is successful.

 

- Gary

0 Kudos
137 Views
Durant-Harden-Irving
Contributor III

Hello Gary,

My test is successful, the SPT can work under GHS compiler. (Just the primary test, I can see the object can be detected, and range changes. So I guess It works.)

MF
224 Views
petervlna
NXP Employee
NXP Employee

Hello,

Let me talk to application engineer first.

I will come back to you ASAP.

Best regards,

Peter

0 Kudos