MATLAB Answers

LCT (Legacy Code Tool) MEX compilation error in using TI C2000 related C code compilation

4 views (last 30 days)
Ashish Kumar Gupta
Ashish Kumar Gupta on 30 Sep 2016
Answered: Qing Liu on 10 Jul 2019
I am using Matlab2016a and MinGW 4.9.2 compiler (in Windows8.1). And, using LCT (Legacy Code Tool) to generate an Oscillator Compensation sfunction related to TI-C2000 processor. Below are the code
---------------- freqcomp.h ----------------------
#ifndef _FREQCOMP_H_
#define _FREQCOMP_H_
#include "tmwtypes.h"
void freqcomp (unsigned int u1, unsigned int y1);
#endif
---------------- freqcomp.c ----------------------
#include "freqcomp.h"
#include "DSP28x_Project.h"
#define getOsc1CoarseTrim() (*(int (*)(void))0x3D7E96)()
void freqcomp (unsigned int u1, unsigned int y1)
{
int compOscFineTrim;
EALLOW;
compOscFineTrim = 13;
SysCtrlRegs.INTOSC1TRIM.all = GetOscTrimValue(getOsc1CoarseTrim(), compOscFineTrim);
EDIS;
}
Please help me getting these mex compilation errors resolved. The unique errors are:-
----------- MEX Compilation Errors ----------------------
C:\ti\controlSUITE\device_support\f2802x\v127\DSP2802x_headers\include/DSP2802x_Device.h:51:18: error: expected '=', ',', ';',
'asm' or '__attribute__' before 'volatile' extern cregister volatile unsigned int IFR;
C:\ti\controlSUITE\device_support\f2802x\v127\DSP2802x_headers\include/DSP2802x_PieVect.h:26:19: error: expected '=', ',', ';',
'asm' or '__attribute__' before 'void' typedef interrupt void(*PINT)(void);
C:\ti\controlSUITE\device_support\f2802x\v127\DSP2802x_headers\include/DSP2802x_PieVect.h:35:7: error: unknown type name 'PINT'
PINT PIE1_RESERVED;
C:\ti\controlSUITE\device_support\f2802x\v127\DSP2802x_common\include/DSP2802x_DefaultISR.h:35:11: error: expected '=', ',',
';', 'asm' or '__attribute__' before 'void' interrupt void INT13_ISR(void); // INT13 or CPU-Timer 1
I have used following lct commands:
def = legacy_code('initialize');
def.SFunctionName = 'sfunc_freqcomp';
def.SourceFiles = {'freqcomp.c'};
def.HeaderFiles = {'freqcomp.h'};
def.OutputFcnSpec = 'void freqcomp(uint16 u1, uint16 y1)';
def.SrcPaths = {'C:\ti\controlSUITE\device_support\f2802x\v127\DSP2802x_common\source' , 'C:\ti\controlSUITE\device_support\f2802x\v127\DSP2802x_headers\source'}
def.IncPaths = {'C:\ti\controlSUITE\device_support\f2802x\v127\DSP2802x_common\include\' , 'C:\ti\controlSUITE\device_support\f2802x\v127\DSP2802x_headers\include\', 'C:\ti\controlSUITE\development_kits\~SupportFiles\F2802x_headers'}
def.LibPaths = {'C:\ti\controlSUITE\device_support\f2802x\v127\DSP2802x_common\lib'}
legacy_code('sfcn_cmex_generate', def);
legacy_code('compile', def);

  1 Comment

Sign in to comment.

Answers (1)

Qing Liu
Qing Liu on 10 Jul 2019
Hi!
`cregister` and `interrupt` are C extension keywords defined by TI, so they cannot be recognized by common compiler (MinGW in your case). I think this is the problem that causes these Compilation Errors.

  0 Comments

Sign in to comment.