How do I get the binary code of a function using MPC5604

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

How do I get the binary code of a function using MPC5604

3,260件の閲覧回数
1475849560
Contributor II

I want to convert a function to binary coded form, like this

1.bmp2.bmp

0 件の賞賛
返信
13 返答(返信)

3,245件の閲覧回数
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

I don't know which IDE you use, but I'm sure it can generate s-record file - either by default or it can be enabled. The extension of file is .mot, .s3 or something like that.

Then I have command line tool which can convert s-record to c-array. See attached. Notice that I'm providing it with no guarantees and no support, it's not official tool. Use windows command line to see what the arguments are.

You can put a function to some specific segment, so you can easily extract it from the s-record file and then you can use the tool to create c-array if needed.

Regards,

Lukas

 

0 件の賞賛
返信

3,235件の閲覧回数
1475849560
Contributor II

Thanks,the IDE tool I use is CodeWarrior 10.5.

As you said, there is a MOT file but how do I use s2C?

2.bmp

1.bmp

How do I convert a function into an array using this instruction?

0 件の賞賛
返信

3,232件の閲覧回数
lukaszadrapa
NXP TechSupport
NXP TechSupport

I do not have documentation for the tool, just follow the description of arguments. I believe you will figure it out after a couple of experiments. Example:

s2c 4 FF 100 test_c_array whatever.mot output.txt

And as I mentioned, put your function to some specific segment, so you can easily find in in the s-record ifle and then separate required part of the s-record to another file. This file then use with the tool.

Regards,

Lukas

 

 

 

 

0 件の賞賛
返信

3,200件の閲覧回数
1475849560
Contributor II

There is an error in the above image. Here is the updated image and the compiled result.

6.png

0 件の賞賛
返信

3,205件の閲覧回数
1475849560
Contributor II

Sorry, I have another problem, I can't put a function in a paragraph.I can only put one variable in a paragraph.Can you tell me how to put a function in a segment?Thank you very much!

3.png4.png

0 件の賞賛
返信

3,180件の閲覧回数
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,
this is how to put a function to specific flash segment and to specific RAM segment (the code is copied to RAM by startup files):

MEMORY
{
...
hello_test: org = ..., len = ... //flash segment
code_ram: org = ..., len = ... //RAM segment
...
}

SECTIONS
{
...
.__code_ram (VLECODE) : {} > code_ram
.__hello_test (VLECODE) LOAD(ADDR(hello_test)) : {} > hello_test
...
}

And in C file:

#pragma push
#pragma section code_type ".__hello_test" code_mode=far_abs
void test(void)
{
asm("nop");
}
#pragma pop

#pragma push
#pragma section code_type ".__code_ram" code_mode=far_abs
void test_ram(void)
{
asm("nop");
}
#pragma pop

Regards,
Lukas

 

0 件の賞賛
返信

3,230件の閲覧回数
1475849560
Contributor II

Thank you very much for your reply!
I want to try it as you said, but what do the second and third parameters mean?
How should the MPC5604B parameters be set?

0 件の賞賛
返信

3,230件の閲覧回数
1475849560
Contributor II
Thank you very much for your reply! I want to try it as you said, but what do the second and third parameters mean? How should the MPC5604B parameters be set?
0 件の賞賛
返信

3,223件の閲覧回数
lukaszadrapa
NXP TechSupport
NXP TechSupport

If there's a gap in s-record file, the gap is filled with specified character (FF in my example above). Threshold then says what is the max size of such gap. If it is more then specified, the rest of the s-record is not used.

Regards,

Lukas

 

0 件の賞賛
返信

3,116件の閲覧回数
1475849560
Contributor II

Finally, I get an array by s2c

1475849560_0-1610024322736.png

 

 

test_fun didn't work properly.

 

Looking forward to your reply,Thank you very much.

 

 

 

 

 

0 件の賞賛
返信

3,117件の閲覧回数
1475849560
Contributor II

 

 

 

0 件の賞賛
返信

3,121件の閲覧回数
1475849560
Contributor II

The program did not work normally after s2c.exe conversion.

 

 

0 件の賞賛
返信

3,254件の閲覧回数
1475849560
Contributor II

I want to convert a function to binary coded form

0 件の賞賛
返信