How to download program automatically

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to download program automatically

Jump to solution
3,732 Views
zhouj-fnst
Contributor I

I'm developing the MPC5741P. I want to download the elf/hex file to the hardware ECU automatically.

For example, i do not want to select Debug Configuration dialog, all these configurations can be runned automatically.

So S32 Design Studio hase any API for me to download automatically?

0 Kudos
Reply
1 Solution
3,237 Views
jiri_kral
NXP Employee
NXP Employee

Hi,

in attachment is post_built.bat script which is working for me. You need to start separate terminal windows: 

pastedImage_2.png

Add script into post build steps in project properties: 

pastedImage_3.png

Here is result:

pastedImage_1.png

If you need to close these terminal windows automatically (after timeout for example 30 sec)- you can use windows batch commands: 

timeout /t 30

taskkill /im powerpc-eabivle-gdb.exe

taskkill /im pegdbserver_power_console.exe

hope it helps. 

Jiri 

View solution in original post

0 Kudos
Reply
8 Replies
3,237 Views
jiri_kral
NXP Employee
NXP Employee

Hi, 

you can use command line for elf upload. If you add commands into .bat file - you can execute this file as post build step. 

https://community.nxp.com/message/1048305 

Hope it helps. 

Jiri 

0 Kudos
Reply
3,237 Views
zhouj-fnst
Contributor I

Hi, Jiri

Before I make a mistake.

Now I connect the board to the PC with PE Micro MULTILINK UNIVERSAL.

Method 1:

I ues the following commands:

target remote localhost:7224
load E:\download/examples_r2015.elf

but something error:

2.PNG

The error message(Japanse) means: You tried to connect a drive to a directory on a drive that is already connected.

Method 2:

In S32 Design Studio installed path(C:\NXP\S32DS_Power_v2017.R1\eclipse\plugins\com.pemicro.debug.gdbjtag.ppc_1.7.2.201709281658\win32), I execute following command:

pegdbserver_power_console.exe -startserver -device=MPC5744P

Then I execute the commands I descriped in Method 1, the cmd figure is shown as following:

3.PNG

I don't know the difference between above two methods.

And another question,  in method 2, When I see the message (Transfer rate: 4 KB/sec, 882 bytes/write.)

Does it mean that the program is uploaded into the board? The program is running ? If I want to stop the run of program, I just use 'stop' in CMD window?

0 Kudos
Reply
3,237 Views
jiri_kral
NXP Employee
NXP Employee

Hi, 

the error is probably caused by backslash in your load command - E:\ . The gdb client comes from Linux where is used normal slash for directory separator. It should work with load E:/download/examples... 

Yes, program was uploaded into device. Here is summary of most common commands: 

Linux Tutorial - GNU GDB Debugger Command Cheat Sheet 

Hope it helps. 

Jiri 

0 Kudos
Reply
3,237 Views
zhouj-fnst
Contributor I

HI Jiri

Now I connect the board to the PC with PE Micro MULTILINK UNIVERSAL.

I ues the following commands:

target remote localhost:7224
load E:\download/examples_r2015.elf

 

but something error:

2.PNG

The error message(Japanse) means: You tried to connect a drive to a directory on a drive that is already connected.

So my question is : how to specify the already connected target?

0 Kudos
Reply
3,237 Views
jiri_kral
NXP Employee
NXP Employee

Hi, 

i did some tests - and the strange message:

pastedImage_1.png

means, that there is no gdb-server running. 

First of all - you need to start gdb server: 

pastedImage_2.png

Jiri

0 Kudos
Reply
3,237 Views
zhouj-fnst
Contributor I

Hi Jiri

I think start gdb server is needed before I upload the .elf into the board.

But here is a question.

As you do, I need to open two cmd window when I use commands to upload the program manually.

Step1

Start gdb server. (I could not close the dos window before I open an another dos window to execute step2)

Step2

open an another dos window to enter gdb mode to execute following commands:

powerpc-eabivle-gdb --command=E:/download/my_commands.txt

So how can I do the above steps in one script?

For example, I write test1.bat for step1 and test2.bat for step2.

I also write test.bat to call test1.bat and test2.bat.

The result is dos window is always as following:

4.PNG

The scripte is still in test1.dat, can not run to test2.dat.

0 Kudos
Reply
3,238 Views
jiri_kral
NXP Employee
NXP Employee

Hi,

in attachment is post_built.bat script which is working for me. You need to start separate terminal windows: 

pastedImage_2.png

Add script into post build steps in project properties: 

pastedImage_3.png

Here is result:

pastedImage_1.png

If you need to close these terminal windows automatically (after timeout for example 30 sec)- you can use windows batch commands: 

timeout /t 30

taskkill /im powerpc-eabivle-gdb.exe

taskkill /im pegdbserver_power_console.exe

hope it helps. 

Jiri 

0 Kudos
Reply
3,237 Views
zhouj-fnst
Contributor I

Hi, Jiri.

Thank you for your answer.

By your method, I have some trouble.

I use the command to flash the .elf into the MPC5741P board with PE micro MULTLINK UNIVERSAL.

commands I used are as following:

target exec E:\download/examples_r2015.elf
load E:\download/examples_r2015.elf

but something error occurs:

1.png

so how can i download the .elf file into the board and debug the program.

Is there any document I can read related with the command?

0 Kudos
Reply