Simulink: Assigning values at a memory location (on a DSP) to constants

1 vue (au cours des 30 derniers jours)
Chris Mounce
Chris Mounce le 31 Mai 2018
Modifié(e) : TAB le 1 Juin 2018
I'm going to be loading a hex file with preloaded constants into a DSP's flash memory, and I need to be able to have those constants be parameters for Simulink blocks. If I know the memory address of where the parameter data would be (in the DSP's flash memory), how can I have that turned into a constant that I can then plug into a Simulink block? Thanks!

Réponses (1)

TAB
TAB le 1 Juin 2018
Modifié(e) : TAB le 1 Juin 2018
  • In Simulink define those constants as Simulink.Parameter.
  • Set the storage class of those parameters so you can import them from external code (eg ImportedExternPointer or Define or GetSet etc. depends upon your DSP code.
Just a simple example:
My DSP constants are defined in c-file as below:
File: dspFlashConst.c
uint8 *CONST_DATA1 = Address1;
uint8 *CONST_DATA2 = Address2;
.....
.....
In Matlab:
CONST_DATA1 = Simulink.Parameter;
CONST_DATA1.DataType = 'uint8';
CONST_DATA1.CoderInfo.StorageClass = 'ImportedExternPointer';

Catégories

En savoir plus sur C Code Generation dans Help Center et File Exchange

Tags

Produits


Version

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by