In Simulink,How to change the Code's flash address?

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

In Simulink,How to change the Code's flash address?

Jump to solution
1,266 Views
eautopower
Contributor IV

 hi:

  Use CAN boot loader to update the program,and the Application  development using Simulink,  but i don't know how to change the Flash address in simulink.

can you help me ?

0 Kudos
1 Solution
1,047 Views
eautopower
Contributor IV

S32K144 MBD 2.0 version

pastedImage_1.png

This is the mot file I created for the Simulink model, but the first address is 0x0000, and now I want to change this address.

like this:

pastedImage_2.png

View solution in original post

0 Kudos
7 Replies
1,047 Views
dumitru-daniel_
NXP Employee
NXP Employee

Hello,

I'm not use i understand your request. 

So, for the moment, if you compile a Simulink model you are able to download that model/application to the target via RAppID_boolloader set to communicate via CAN with the device.

And now you want to change the flash memory layout for the Simulink model in order to have the application saved in flash at different addresses ? Is that what you want ?

Can you tell us the toolbox version you are using ?

Thank you!

Daniel

0 Kudos
1,047 Views
eautopower
Contributor IV

I'm using my own CAN bootloader PC to send the Simulink file generated by mot. How can I download the ASCII code of the mot file to the specified FLASH address? If I are writing C code, I can change the flash.ld file in the compiler, but I don't know what Simulink does. Is the PC add a address offset before send?

0 Kudos
1,047 Views
dumitru-daniel_
NXP Employee
NXP Employee

Within Simulink form linker point of view is the same procedure as a normal C application written by hand.

Simulink generates the C-code and then the Compiler toolchain is invoked to generate the ELF and then the MOT file (that is is used by CAN bootloader).

We can modify the linker command file used by Simulink to any layout you want. 

If you could tell me which toolbox version you use - i could then tell you the exact location of the linker command file (e.g. flash.ld) you need to change.

Best regards,
Daniel

0 Kudos
1,048 Views
eautopower
Contributor IV

S32K144 MBD 2.0 version

pastedImage_1.png

This is the mot file I created for the Simulink model, but the first address is 0x0000, and now I want to change this address.

like this:

pastedImage_2.png

0 Kudos
1,047 Views
dumitru-daniel_
NXP Employee
NXP Employee

Hello, 

Ok, please have a look into this folder: ...MBDToolbox\mbdtbx_S32K\mbdtbx_s32k14\src\linker\

There you will find directories for each of the compilers supported. 

When you invoke the Simulink Code Generation (build button) - the toolbox picks the default linker file from one of these folders (depending on the selections you have in the Simulink Model Configuration Block) and copy-paste it into the generated folder where is used by the Compiler/Linker to build the application.

You need to modify the default linker file in order to change the address in the final application.

Good luck and let us know if you manage to made it link.

Best regards,

Daniel

0 Kudos
1,047 Views
eautopower
Contributor IV

Hi:

   yes,it is OK now,thank you very much!

Do you know the FLASH write/erase C code for MPC5744P?

0 Kudos
1,047 Views
dumitru-daniel_
NXP Employee
NXP Employee

Unfortunately, i do not have access to that code.

Perhaps you could ask on MPCxxx community if such code exists and available for download.

Best regards,
Daniel

0 Kudos