How to create bin/hex/s19 file using the MBD tool for S32

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

How to create bin/hex/s19 file using the MBD tool for S32

Jump to solution
5,208 Views
释然111
Contributor III

How to create bin/hex/s19 file using the MBD tool for S32.

1 Solution
3,751 Views
paulvlase
NXP Employee
NXP Employee

It depends on which compiler you are using.

If you are using GCC you need to replace line 450

$(ELF_TOOL) -O srec $(MODEL).elf $(MODEL).mot

with

$(ELF_TOOL) -O binary $(MODEL).elf $(MODEL).bin

For GCC you have the following options:

srec     Save as Motorola S-records

   $(ELF_TOOL) -O srec $(MODEL).elf $(MODEL).s19
binary  Save as raw binary

   $(ELF_TOOL) -O binary $(MODEL).elf $(MODEL).bin
ihex     Save as Intel hex

   $(ELF_TOOL) -O ihex $(MODEL).elf $(MODEL).hex

If you are using IAR you replace line 453

$(ELF_TOOL) $(MODEL).elf $(MODEL).mot --srec --silent

with

$(ELF_TOOL) $(MODEL).elf $(MODEL).bin --bin --silent

For IAR you have the following options:

--srec          Save as Motorola S-records

   $(ELF_TOOL) $(MODEL).elf $(MODEL).s19 --srec --silent
--ihex          Save as Intel hex

   $(ELF_TOOL) $(MODEL).elf $(MODEL).hex --ihex --silent
--bin            Save as raw binary

   $(ELF_TOOL) $(MODEL).elf $(MODEL).bin --bin --silent

ATTENTION: Lines 450 and 453 should start with a tab.

I see that you are using the old version of toolbox, MCToolbox for S32K, you can get for free the new version, MBDToolbox for S32K from NXP Motor Control Toolbox

View solution in original post

0 Kudos
7 Replies
3,751 Views
jfrey
Contributor IV

powerpc-eabivle-objcopy

If you want to automate it put it in the _make_rtw_hook.m callback.

See also:

Converting S19 Files into Binary Files with GNU objcopy | MCU on Eclipse 

objcopy - GNU Binary Utilities 

Target Selection - GNU Binary Utilities 

0 Kudos
3,751 Views
释然111
Contributor III

用MBD工具箱生成的elf文件,然后下载到板子上。现在我想知道怎么设置,能够生成bin/hex/s19文件~~~

0 Kudos
3,751 Views
dumitru-daniel_
NXP Employee
NXP Employee

Hello,

The easiest way to achieve your goal is to modify the default settings in the mbd_s32k14.tmf file within c:\MBDToolbox\mbdtbx_S32K\mbdtbx_s32k14\mbdtbx_s32k14\ folder

This file is responsible for generation the makefile used to build the model.

Inside the file, there is already a default example about how to generate a SREC from the elf. Therefore is a simple as changing the extension and the type of file you want to obtain: bin/hex/s19 etc since the toolchain is defined already.

Step1: search for any occurrences of ".mot" keyword

Step2. replace with the ".extension_you_want_to_obtain"

Step3: find the invocation of ELF_TOOL

Should look like this: 

$(MODEL).mot: $(MODEL).elf
@echo Generating S-record...
ifeq ($(TARGET_COMPILER), GCC)
$(ELF_TOOL) -O srec $(MODEL).elf $(MODEL).mot
endif
ifeq ($(TARGET_COMPILER), IAR)
$(ELF_TOOL) $(MODEL).elf $(MODEL).mot --srec --silent
endif
ifeq ($(TARGET_COMPILER), GreenHills Multi)
$(GSREC_TOOL) -auto -o $(MODEL).mot $(MODEL).elf
endif
@echo Created S-record: $(MODEL).mot

And replace it with something like this:

$(ELF_TOOL) -O binary $(MODEL).elf $(MODEL).bin

Capture.JPG

Hope it helps!

Daniel

0 Kudos
3,751 Views
释然111
Contributor III

只需要改如图的两行是把。只需要改后缀?中间的srec需要改吗?如果我想改成S19文件,应该怎么改?$3}_GF[A0]3%_0E~I_CN_H5.png

0 Kudos
3,751 Views
dumitru-daniel_
NXP Employee
NXP Employee

Hello, 

We're making efforts to understand Chinese as much as we can with Google Translate but sometimes that fails. In this case using the translate function i can't understand what are you asking.

Can you please rephrase in English.

Thank you!

Daniel

0 Kudos
3,751 Views
释然111
Contributor III

Hello, 

sorry,my English is very bad.Can you help me to creat .s19 file in IAR .thank you very much.

3,752 Views
paulvlase
NXP Employee
NXP Employee

It depends on which compiler you are using.

If you are using GCC you need to replace line 450

$(ELF_TOOL) -O srec $(MODEL).elf $(MODEL).mot

with

$(ELF_TOOL) -O binary $(MODEL).elf $(MODEL).bin

For GCC you have the following options:

srec     Save as Motorola S-records

   $(ELF_TOOL) -O srec $(MODEL).elf $(MODEL).s19
binary  Save as raw binary

   $(ELF_TOOL) -O binary $(MODEL).elf $(MODEL).bin
ihex     Save as Intel hex

   $(ELF_TOOL) -O ihex $(MODEL).elf $(MODEL).hex

If you are using IAR you replace line 453

$(ELF_TOOL) $(MODEL).elf $(MODEL).mot --srec --silent

with

$(ELF_TOOL) $(MODEL).elf $(MODEL).bin --bin --silent

For IAR you have the following options:

--srec          Save as Motorola S-records

   $(ELF_TOOL) $(MODEL).elf $(MODEL).s19 --srec --silent
--ihex          Save as Intel hex

   $(ELF_TOOL) $(MODEL).elf $(MODEL).hex --ihex --silent
--bin            Save as raw binary

   $(ELF_TOOL) $(MODEL).elf $(MODEL).bin --bin --silent

ATTENTION: Lines 450 and 453 should start with a tab.

I see that you are using the old version of toolbox, MCToolbox for S32K, you can get for free the new version, MBDToolbox for S32K from NXP Motor Control Toolbox

0 Kudos