macro define of S32R274 .spt file

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

macro define of S32R274 .spt file

ソリューションへジャンプ
3,018件の閲覧回数
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 件の賞賛
返信
1 解決策
2,976件の閲覧回数
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

元の投稿で解決策を見る

7 返答(返信)
2,977件の閲覧回数
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

2,962件の閲覧回数
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
2,952件の閲覧回数
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 件の賞賛
返信
2,696件の閲覧回数
wuxingdelonglong
Contributor I

Hello Gary,

I am meng Fei's colleague. At present, we found that we used GHS to compile SPT assembly, and the object speed could not be output during the test, but the direct link to LIBRsdk_SPt_kernels_gcc_s32r274.a could work normally. I would like to ask two questions:  

 1. Is there any example of S32R274 SPT working properly after compiling with GHS?  

 2. Check whether the script in the following directory is correct  

  \ NXP \ S32DS_Power_v2 1 \ S32DS \ build_tools, SPT, example, MPC5775K_SPT_GHS  

0 件の賞賛
返信
2,639件の閲覧回数
GaryRK
NXP Employee
NXP Employee

Hello wuxingdelonglong,

Can you check the SPT peripheral registers to see if there is some issue with the kernel being executed? My initial idea is that the SPT code is not correctly aligned in memory, please align on 16 bytes.

1. There is no difference between S32R274 usage of SPT in a GHS compiled application vs MPC5775K. Plus the SPT code is already assembled and part of the C lib, it should be a simple case of linking against this lib and using the exported symbols (i.e. SPT function labels) in your C code. Make sure your SPT driver is writing the correct start address of the SPT functions to SPT_PG_START_ADDR register.

2. Which script specifically do you mean? I checked the project and it looks okay, is there some error when you attempt to build it? Please let me know.

Thanks,

Gary

 

0 件の賞賛
返信
2,918件の閲覧回数
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
3,005件の閲覧回数
petervlna
NXP TechSupport
NXP TechSupport

Hello,

Let me talk to application engineer first.

I will come back to you ASAP.

Best regards,

Peter

0 件の賞賛
返信