Assembler not legal in CodeWarrior

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Assembler not legal in CodeWarrior

跳至解决方案
2,821 次查看
sijiahao
Contributor III

Hello,

 

I have a problem when compiling assembler files using mwasmeppc.exe, this is the error message:

 

* Compiling s -> o
*
### mwasmeppc.exe Assembler:
#    File: ..\output\obj\cstartup.s
# ---------------------------------
#      88:   e_and2i. r3,0xFFF@l
#   Error:   ^^^^^^^^
#   Instruction not legal for current target processor(s)
### mwasmeppc.exe Assembler:
#      99:   sub r4,r3
#   Error:       ^^^^^
#   Not enough arguments for simplified mnemonic sub
### mwasmeppc.exe Assembler:
#     114:   e_or2i r31,0x4002
#   Error:   ^^^^^^
#   Instruction not legal for current target processor(s)

 

Some commands( e_and2i.  sub  e_or2i) can not be recognized, but this file cstartup.s works with other compiler(Greenhills, Windriver, etc)

 

CodeWarrior version: for MPC55xxMPC56xx v2.10.

MCU: XPC560XB

the cpu type is -proc Zen

 

I don't know if I miss some compiler options, or I need to include some compiler files?

 

Best regards,

Sijia

标签 (1)
1 解答
2,476 次查看
martin_kovar
NXP Employee
NXP Employee

Hi Sijia,

I see a few discrepancies which probably are in the code you want to compile:

1) instructions e_and2i and e_or2i are VLE while sub is BookE. It is not possible to compile both types of instructions in one file while you use mwasmeppc.exe.

2) instruction sub has to have three parameters.

There are a few solutions:

1) Best way is to replace sub instruction with se_sub which is VLE and which takes 2 parameters. Do not forget to compile the file with -vle option.

2) You can replace the VLE instructions with BookE instructions and add the third parameter to sub instruction.

Look at the attachment, I am sending you BookE and VLE reference manuals which detail describe all instructions.

If you have any other question, please feel free to write me back.

Regards,

Martin

在原帖中查看解决方案

14 回复数
2,477 次查看
martin_kovar
NXP Employee
NXP Employee

Hi Sijia,

I see a few discrepancies which probably are in the code you want to compile:

1) instructions e_and2i and e_or2i are VLE while sub is BookE. It is not possible to compile both types of instructions in one file while you use mwasmeppc.exe.

2) instruction sub has to have three parameters.

There are a few solutions:

1) Best way is to replace sub instruction with se_sub which is VLE and which takes 2 parameters. Do not forget to compile the file with -vle option.

2) You can replace the VLE instructions with BookE instructions and add the third parameter to sub instruction.

Look at the attachment, I am sending you BookE and VLE reference manuals which detail describe all instructions.

If you have any other question, please feel free to write me back.

Regards,

Martin

2,475 次查看
sijiahao
Contributor III

Hi,

Thanks for your resolution, now I have another problem about the start code:

The CodeWarrior has its own start file __start.c and __ppc_eabi_init.c,

can I use my own startup code instead of these two files?

CodeWarrior version: for MPC55xxMPC56xx v2.10.

MCU: XPC560XB

Best Regards,

Sijia

0 项奖励
回复
2,475 次查看
martin_kovar
NXP Employee
NXP Employee

Hi Sijia,

yes, you can definitely use your own startup instead of CodeWarrior startup files.

Regards,

Martin

0 项奖励
回复
2,475 次查看
sijiahao
Contributor III

Hi,

These are the link options I use:

LINK_OPT += -proc=Zen #mcu type; generic

LINK_OPT += -char=unsigned #set sign of 'char';must match with compiler.Set to unsigned

LINK_OPT += -srec #generate an S-record file with extension .mot

LINK_OPT += -map #generate map file

LINK_OPT += -code_merging=all,aggressive #code merging optimization

LINK_OPT += -far_near_addressing #enable far to near addressing optimization

LINK_OPT += -vle_enhance_merging #enable VLE enhance code merging optimization

LINK_OPT += -vle_bl_opt

LINK_OPT += -abi eabi

LINK_OPT += -gdwarf-2

LINK_OPT += -nostdlib

LINK_OPT += -m __entry

Best Regards,

Sijia

0 项奖励
回复
2,475 次查看
martin_kovar
NXP Employee
NXP Employee

Hi Sijia,

do you use CodeWarrior IDE or mwldeppc command line tool for linking?

Reagrds,

Martin

0 项奖励
回复
2,475 次查看
sijiahao
Contributor III

Hi Martin,

I use the mwldeppc.

Best Regards,

Sijia

0 项奖励
回复
2,475 次查看
martin_kovar
NXP Employee
NXP Employee

Hi Sijia,

could you please share the map file which you generated? Why do you think your map file is not correct?

Is it possible for you to share the object files your are trying to link?

Regards,

Martin

0 项奖励
回复
2,475 次查看
sijiahao
Contributor III

Hi Martin,

These are part of .o file and map file.

Best Regards,

Sijia

0 项奖励
回复
2,475 次查看
martin_kovar
NXP Employee
NXP Employee

Hi Sijia,

the MAP file looks incomplete. Do you have any errors while linking the project? Are you able to get .elf file after linking? You shared only one object file, so I am not able to try the linking. 

So could you please write me back and eventually could you please share all object files you want to link together?

Regards,

Martin

0 项奖励
回复
2,475 次查看
sijiahao
Contributor III

Hi Martin,

I modified the lcf file, the project can generate map and elf now.

Now the lcf file still has some errors, when I debug the code using Trace32, it can’t find the startup code, how can I define the srart code(__entry) to the address 0x0?

Another issue is that I can only see assembler in Trace32, do you know how can I see the c files in Trace32?

Best Regards,

Sijia

0 项奖励
回复
2,475 次查看
martin_kovar
NXP Employee
NXP Employee

Hi Sijia,

please look at the attachment, I am sending you default linker file from some of my project generated using CW 2.10. You can use it as a guide for your linker file.

About debug information, here is part of documentation, which describes, how to add debug information to your .elf file. I hope this will help. If not, please let me know and i will try different solution.

-------------------------------------------------------------------------------
Debugging Control Options                                                      
-------------------------------------------------------------------------------
  -g[dwarf]                  # global; cased; generate DWARF 1.x debugging     
                             #   information; same as '-sym dwarf-1,full'      
  -gdwarf-2                  # global; cased; generate DWARF 2.x debugging     
                             #   information; same as '-sym dwarf-2,full'      
  -sym keyword[,...]         # global; specify debugging options               
     off                     #    do not generate debugging information;       
                             #      default                                    
     on|dwarf-1              #    turn on DWARF 1.x debugging information      
     dwarf-2                 #    turn on DWARF 2.x debugging information      
   -----------------------------------------------------------------------------------------------------

Regards,

Martin                       

0 项奖励
回复
2,475 次查看
sijiahao
Contributor III

Hi Martin,

Thanks a lot.

I have another question about assembler code here https://community.nxp.com/thread/434043 , can you have a look?

Best Regards,

Sijia

0 项奖励
回复
2,476 次查看
martin_kovar
NXP Employee
NXP Employee

Hi Sijia,

I posted the "answer" to your other thread. Please check.

Regards,

Martin

0 项奖励
回复
2,476 次查看
sijiahao
Contributor III

Hi,

OK, but now I can’t generate the right .Map file, do I need to add some link option? Or the .o file is not good?

This is part of the generated map file:

Link map of __entry

Code folded in file: C:\HaoSijia\Projects\498_XPC560XD_XB\test_base\Conformance\IN\Platforms_ConTest_RamNoInit\output\obj\Platforms_ConTest_RamNoInit.o

Code folded in file: C:\HaoSijia\Projects\498_XPC560XD_XB\test_base\Conformance\IN\Platforms_ConTest_RamNoInit\output\obj\main.o

Code folded in file: C:\HaoSijia\Projects\498_XPC560XD_XB\test_base\Conformance\IN\Platforms_ConTest_RamNoInit\output\obj\board.o

Best Regards,

Sijia

0 项奖励
回复