How to build a CodeWarrior project using codes  generated by toolbox

cancel
Showing results for 
Search instead for 
Did you mean: 

How to build a CodeWarrior project using codes  generated by toolbox

561 Views
hjhjhj
Contributor IV

Hi,

     I want to  build a MPC5643L CodeWarrior project using codes  generated by toolbox,   but there're some errors I never met .Can somebody help me?

186577_186577.PNG170612.PNG

Thank you!

Hj

Original Attachment has been moved to: can_simple_block_rappid_rtw.rar

0 Kudos
9 Replies

134 Views
dumitru-daniel_
NXP Employee
NXP Employee

The thread continued in the CW community: https://community.nxp.com/message/915334?et=watches.email.thread 

134 Views
dumitru-daniel_
NXP Employee
NXP Employee

Hi hjhjhj‌,

I presume the compilation works fine with the Toolbox but fails when you try to reuse the files in the CodeWarrior right ?

A first observation - it looks like in CodeWarrior you are using a different startup file than the one used by the Toolbox.

In the toolbox generated files i see in crt0.s that the actual code is:

 _start:
e_li r5, 0
mfmsr r5
e_lis r6, MSR_Mask@h
e_or2i r6, MSR_Mask@l
se_or r5,r6
mtmsr r5
se_isync  

Are you sure you have configured the CodeWarrior project correctly to use all the files from the Toolbox generated code and all the compiler/linker flags that the toolbox is using ?

Hope this helps!

Best regards,
Daniel

0 Kudos

134 Views
hjhjhj
Contributor IV

Hi Daniel,

     Can you give me some suggestion to configured the CodeWarrior project?I'm not familiar with startup file.

Thank you!

Hj

0 Kudos

134 Views
dumitru-daniel_
NXP Employee
NXP Employee

Hi hjhjhj‌,

I looked over this - but i'm afraid we will need to ask this question to the CodeWarrior community.

What i noticed is that CW does not take into consideration the macro VLE_IS_ON for the assembly

# Set the MSR[SPE] bit so code can use "evmergelo" instruction.
.equ MSR_Mask, 0x02000000

.ifdef VLE_IS_ON
.section .text_vle,text_vle ; The "text" generates symbols for debug
_start:
e_li r5, 0
mfmsr r5
e_lis r6, MSR_Mask@h
e_or2i r6, MSR_Mask@l
se_or r5,r6
mtmsr r5
se_isync

;# 1. 32 64-bit GPR0-31
e_lis r1, 0 ;# Initialize the lower 32-bits of GPR1 to 0
.else
.section .text,text
_start:
lis r5, 0
mfmsr r5
lis r6, MSR_Mask@h
ori r6, r6, MSR_Mask@l
or r5, r5,r6
mtmsr r5
isync

;# 1. 32 64-bit GPR0-31
lis r1, 0 ;# Initialize the lower 32-bits of GPR1 to 0
.endif

If you remove/comment out the .else part it seems to work.

The toolbox is using this these macros: 

ASSEMBLY_TOOL_OPTS= -vle -DVLE_IS_ON $(TOOL_OPTS) -list -gccincludes -nostdinc to it cleary needs to by specified via CW too - but i can't find any places to add this to the CW ASSEMBLY via IDE. 

Hope this helps!

Daniel

0 Kudos

134 Views
hjhjhj
Contributor IV

Hi Daniel,

     I have added all the files to the project ,but it seems that there 're still other errors.Can you help me solve it ?111.PNG1.PNG

Thank you!

Hj

0 Kudos

134 Views
dumitru-daniel_
NXP Employee
NXP Employee

Hi hjhjhj‌,

Glad to see you managed to build the project.

Looks like you are now able to enter in debug. From your screenshot and the map file you have generated, i think the problem is related with linking against a different start symbol defined - most likely the default one from the library *.a

In the debugger it shows __start while the crt0.s entry point is _start (one _ instead of _ _ )

I can't test momentarily the generated elf on the real HW but can you please do the following modification in your project and test it again. Basically you need to tell the linker to use the _start symbol defined in the crt0.s file.

1.PNG 

Hope this helps!

Best regards,
Daniel

0 Kudos

134 Views
hjhjhj
Contributor IV

Hi Daniel,

     The linker can identify the entry point now,but  I guess it stops somewhere and the project does not run.Do you konw the reason?

11.PNG

Thank you!

Hj

0 Kudos

134 Views
dumitru-daniel_
NXP Employee
NXP Employee

Try to run step by step (instruction by instruction) and see where it stops.

0 Kudos

134 Views
hjhjhj
Contributor IV

Hi Daniel,

    When running on Assembly Level step,the project runs in the code window but only PC register runs in the CPU window.While on Source step ,the project stops as the screenshot shows and  only PC register runs .

11.PNG

Thank you!

Hj

0 Kudos