Quantcast
Channel: Microcontrollers
Viewing all articles
Browse latest Browse all 233186

Forum Post: RE: AM263P4-Q1: MATLAB integration with Code composer d

$
0
0
I am uploading the code here the zip file from my previous reply has all the files generated from MATLAB ert_Main.c /* * * File: ert_main.c * * Code generated for Simulink model 'TestfrCCS2'. * * Model version : 1.9 * Simulink Coder version : 24.2 (R2024b) 21-Jun-2024 * C/C++ source code generated on : Fri Jan 10 09:24:25 2025 * * Target selection: ert.tlc * Embedded hardware selection: ARM Compatible->ARM Cortex * Code generation objectives: Unspecified * Validation result: Not run */ #include "TestfrCCS2.h" #include "rtwtypes.h" #include "MW_target_hardware_resources.h" volatile int IsrOverrun = 0; static boolean_T OverrunFlag = 0; void rt_OneStep(void) { /* Check for overrun. Protect OverrunFlag against preemption */ if (OverrunFlag++) { IsrOverrun = 1; OverrunFlag--; return; } __enable_irq(); TestfrCCS2_step(); /* Get model outputs here */ __disable_irq(); OverrunFlag--; } volatile boolean_T stopRequested; volatile boolean_T runModel; int main(int argc, char **argv) { float modelBaseRate = 4.0; float systemClock = 100; /* Initialize variables */ stopRequested = false; runModel = false; am263px_My_HardwareInit_Fcn(); rtmSetErrorStatus(TestfrCCS2_M, 0); TestfrCCS2_initialize(); TickConfig(modelBaseRate); runModel = rtmGetErrorStatus(TestfrCCS2_M) == (NULL); __enable_irq(); while (runModel) { stopRequested = !( rtmGetErrorStatus(TestfrCCS2_M) == (NULL)); runModel = !(stopRequested); } /* Terminate model */ TestfrCCS2_terminate(); return 0; } /* * File trailer for generated code. * * [EOF] */ testfrccs.c /* * * File: TestfrCCS2.c * * Code generated for Simulink model 'TestfrCCS2'. * * Model version : 1.9 * Simulink Coder version : 24.2 (R2024b) 21-Jun-2024 * C/C++ source code generated on : Fri Jan 10 09:24:25 2025 * * Target selection: ert.tlc * Embedded hardware selection: ARM Compatible->ARM Cortex * Code generation objectives: Unspecified * Validation result: Not run */ #include "TestfrCCS2.h" #include "MW_GPIOOUT.h" /* Block states (default storage) */ DW_TestfrCCS2_T TestfrCCS2_DW; /* Real-time model */ static RT_MODEL_TestfrCCS2_T TestfrCCS2_M_; RT_MODEL_TestfrCCS2_T *const TestfrCCS2_M = &TestfrCCS2_M_; /* Model step function */ void TestfrCCS2_step(void) { GPIOOutputStepStruct gpioout_step_struct; /* MATLABSystem: ' /GPIO OUTPUT' incorporates: * Constant: ' /Constant' */ /* %% Define input properties */ /* Call C-function implementing device output */ /* coder.ceval('sink_output',u); */ gpioout_step_struct.GPIOBaseAddress = TestfrCCS2_DW.obj.GPIOInstanceAddress; gpioout_step_struct.pinInstance = 22U; gpioout_step_struct.input_signal = 1.0; GPIOOutput_step(&gpioout_step_struct); } /* Model initialize function */ void TestfrCCS2_initialize(void) { { GPIOOutputSetupStruct gpioout_init_struct; /* Start for MATLABSystem: ' /GPIO OUTPUT' */ /* Constructor */ /* Support name-value pair arguments when constructing the object. */ TestfrCCS2_DW.obj.matlabCodegenIsDeleted = false; TestfrCCS2_DW.obj.isInitialized = 1; /* %% Define input properties */ /* Call C-function implementing device initialization */ /* coder.cinclude('sink.h'); */ /* coder.ceval('sink_init'); */ TestfrCCS2_DW.obj.GPIOInstanceAddress = CSL_GPIO0_U_BASE; gpioout_init_struct.GPIOBaseAddress = TestfrCCS2_DW.obj.GPIOInstanceAddress; gpioout_init_struct.pinInstance = 22U; gpioout_init_struct.trigType = 0U; gpioout_init_struct.EnableInterrupt = false; GPIOOutput_setup(&gpioout_init_struct); /* Move to init.c */ /* coder.ceval('util_iomux_config_for_gpio', obj.GPIO_PINS); */ TestfrCCS2_DW.obj.isSetupComplete = true; } } /* Model terminate function */ void TestfrCCS2_terminate(void) { GPIOOutputReleaseStruct gpio_release_struct; /* Terminate for MATLABSystem: ' /GPIO OUTPUT' */ if (!TestfrCCS2_DW.obj.matlabCodegenIsDeleted) { TestfrCCS2_DW.obj.matlabCodegenIsDeleted = true; if ((TestfrCCS2_DW.obj.isInitialized == 1) && TestfrCCS2_DW.obj.isSetupComplete) { /* Call C-function implementing device termination */ /* coder.ceval('sink_terminate'); */ has popup testfrccs.h /* * * File: TestfrCCS2.h * * Code generated for Simulink model 'TestfrCCS2'. * * Model version : 1.9 * Simulink Coder version : 24.2 (R2024b) 21-Jun-2024 * C/C++ source code generated on : Fri Jan 10 09:24:25 2025 * * Target selection: ert.tlc * Embedded hardware selection: ARM Compatible->ARM Cortex * Code generation objectives: Unspecified * Validation result: Not run */ #ifndef TestfrCCS2_h_ #define TestfrCCS2_h_ #ifndef TestfrCCS2_COMMON_INCLUDES_ #define TestfrCCS2_COMMON_INCLUDES_ #include "rtwtypes.h" #include "math.h" #include "MW_GPIOOUT.h" #endif /* TestfrCCS2_COMMON_INCLUDES_ */ #include "TestfrCCS2_types.h" #include /* Macros for accessing real-time model data structure */ #ifndef rtmGetErrorStatus #define rtmGetErrorStatus(rtm) ((rtm)->errorStatus) #endif #ifndef rtmSetErrorStatus #define rtmSetErrorStatus(rtm, val) ((rtm)->errorStatus = (val)) #endif /* user code (top of header file) */ #include "gpio.h" /* Block states (default storage) for system ' ' */ typedef struct { GPIO_OUT_TestfrCCS2_T obj; /* ' /GPIO OUTPUT' */ } DW_TestfrCCS2_T; /* Real-time Model Data Structure */ struct tag_RTM_TestfrCCS2_T { const char_T * volatile errorStatus; }; /* Block states (default storage) */ extern DW_TestfrCCS2_T TestfrCCS2_DW; /* Model entry point functions */ extern void TestfrCCS2_initialize(void); extern void TestfrCCS2_step(void); extern void TestfrCCS2_terminate(void); /* Real-time Model object */ extern RT_MODEL_TestfrCCS2_T *const TestfrCCS2_M; extern volatile boolean_T stopRequested; extern volatile boolean_T runModel; /*- * The generated code includes comments that allow you to trace directly * back to the appropriate location in the model. The basic format * is /block_name, where system is the system number (uniquely * assigned by Simulink) and block_name is the name of the block. * * Use the MATLAB hilite_system command to trace the generated code back * to the model. For example, * * hilite_system(' ') - opens system 3 * hilite_system(' /Kp') - opens and selects block Kp which resides in S3 * * Here is the system hierarchy for this model * * ' ' : 'TestfrCCS2' */ #endif /* TestfrCCS2_h_ */ /* * File trailer for generated code. * has popup tesfrccs2_private.h /* * * File: TestfrCCS2.h * * Code generated for Simulink model 'TestfrCCS2'. * * Model version : 1.9 * Simulink Coder version : 24.2 (R2024b) 21-Jun-2024 * C/C++ source code generated on : Fri Jan 10 09:24:25 2025 * * Target selection: ert.tlc * Embedded hardware selection: ARM Compatible->ARM Cortex * Code generation objectives: Unspecified * Validation result: Not run */ #ifndef TestfrCCS2_h_ #define TestfrCCS2_h_ #ifndef TestfrCCS2_COMMON_INCLUDES_ #define TestfrCCS2_COMMON_INCLUDES_ #include "rtwtypes.h" #include "math.h" #include "MW_GPIOOUT.h" #endif /* TestfrCCS2_COMMON_INCLUDES_ */ #include "TestfrCCS2_types.h" #include /* Macros for accessing real-time model data structure */ #ifndef rtmGetErrorStatus #define rtmGetErrorStatus(rtm) ((rtm)->errorStatus) #endif #ifndef rtmSetErrorStatus #define rtmSetErrorStatus(rtm, val) ((rtm)->errorStatus = (val)) #endif /* user code (top of header file) */ #include "gpio.h" /* Block states (default storage) for system ' ' */ typedef struct { GPIO_OUT_TestfrCCS2_T obj; /* ' /GPIO OUTPUT' */ } DW_TestfrCCS2_T; /* Real-time Model Data Structure */ struct tag_RTM_TestfrCCS2_T { const char_T * volatile errorStatus; }; /* Block states (default storage) */ extern DW_TestfrCCS2_T TestfrCCS2_DW; /* Model entry point functions */ extern void TestfrCCS2_initialize(void); extern void TestfrCCS2_step(void); extern void TestfrCCS2_terminate(void); /* Real-time Model object */ extern RT_MODEL_TestfrCCS2_T *const TestfrCCS2_M; extern volatile boolean_T stopRequested; extern volatile boolean_T runModel; /*- * The generated code includes comments that allow you to trace directly * back to the appropriate location in the model. The basic format * is /block_name, where system is the system number (uniquely * assigned by Simulink) and block_name is the name of the block. * * Use the MATLAB hilite_system command to trace the generated code back * to the model. For example, * * hilite_system(' ') - opens system 3 * hilite_system(' /Kp') - opens and selects block Kp which resides in S3 * * Here is the system hierarchy for this model * * ' ' : 'TestfrCCS2' */ #endif /* TestfrCCS2_h_ */ /* * File trailer for generated code. * has popup testfrccs2_types.h /* * * File: TestfrCCS2_types.h * * Code generated for Simulink model 'TestfrCCS2'. * * Model version : 1.9 * Simulink Coder version : 24.2 (R2024b) 21-Jun-2024 * C/C++ source code generated on : Fri Jan 10 09:24:25 2025 * * Target selection: ert.tlc * Embedded hardware selection: ARM Compatible->ARM Cortex * Code generation objectives: Unspecified * Validation result: Not run */ #ifndef TestfrCCS2_types_h_ #define TestfrCCS2_types_h_ #include "rtwtypes.h" /* Custom Type definition for MATLABSystem: ' /GPIO OUTPUT' */ #include "MW_GPIOOUT.h" #include "MW_GPIOOUT.h" #include "MW_GPIOOUT.h" #ifndef struct_tag_0PhTFesxrI8SkRHYv7ghUF #define struct_tag_0PhTFesxrI8SkRHYv7ghUF struct tag_0PhTFesxrI8SkRHYv7ghUF { boolean_T matlabCodegenIsDeleted; int32_T isInitialized; boolean_T isSetupComplete; uint32_t GPIOInstanceAddress; }; #endif /* struct_tag_0PhTFesxrI8SkRHYv7ghUF */ #ifndef typedef_GPIO_OUT_TestfrCCS2_T #define typedef_GPIO_OUT_TestfrCCS2_T typedef struct tag_0PhTFesxrI8SkRHYv7ghUF GPIO_OUT_TestfrCCS2_T; #endif /* typedef_GPIO_OUT_TestfrCCS2_T */ /* Forward declaration for rtModel */ typedef struct tag_RTM_TestfrCCS2_T RT_MODEL_TestfrCCS2_T; #endif /* TestfrCCS2_types_h_ */ /* * File trailer for generated code. * * [EOF] */ has popup rtwtypes.h /* * * File: rtwtypes.h * * Code generated for Simulink model 'TestfrCCS2'. * * Model version : 1.9 * Simulink Coder version : 24.2 (R2024b) 21-Jun-2024 * C/C++ source code generated on : Fri Jan 10 09:24:25 2025 * * Target selection: ert.tlc * Embedded hardware selection: ARM Compatible->ARM Cortex * Code generation objectives: Unspecified * Validation result: Not run */ #ifndef RTWTYPES_H #define RTWTYPES_H /* Logical type definitions */ #if (!defined(__cplusplus)) #ifndef false #define false (0U) #endif #ifndef true #define true (1U) #endif #endif /*=======================================================================* * Target hardware information * Device type: ARM Compatible->ARM Cortex * Number of bits: char: 8 short: 16 int: 32 * long: 32 * native word size: 32 * Byte ordering: LittleEndian * Signed integer division rounds to: Zero * Shift right on a signed integer as arithmetic shift: on *=======================================================================*/ #ifdef PORTABLE_WORDSIZES /* PORTABLE_WORDSIZES defined */ /*=======================================================================* * Host information * Number of bits: char: 8 short: 16 int: 32 * long: 32 * long long: 64 * native word size: 64 *=======================================================================*/ /*=======================================================================* * Fixed width word size data types: * * int8_T, int16_T, int32_T - signed 8, 16, or 32 bit integers * * uint8_T, uint16_T, uint32_T - unsigned 8, 16, or 32 bit integers * * real32_T, real64_T - 32 and 64 bit floating point numbers * *=======================================================================*/ typedef signed char int8_T; typedef unsigned char uint8_T; typedef short int16_T; typedef unsigned short uint16_T; typedef int int32_T; typedef unsigned int uint32_T; typedef float real32_T; typedef double real64_T; /*===========================================================================* * Generic type definitions: boolean_T, char_T, byte_T, int_T, uint_T, * * real_T, time_T, ulong_T. * *===========================================================================*/ typedef double real_T; typedef double time_T; typedef unsigned char boolean_T; typedef int int_T; typedef unsigned int uint_T; typedef unsigned int ulong_T; typedef char char_T; typedef unsigned char uchar_T; typedef char_T byte_T; #else /* PORTABLE_WORDSIZES not defined */ /*=======================================================================* * Fixed width word size data types: * * int8_T, int16_T, int32_T - signed 8, 16, or 32 bit integers * has popup and few other files like rtwmodel.h, MW_GPIOOUT.c, MW target hardwre resource .h, am26px_init.c, am263px_multitasking.c, am263px_tick.c, gpio.c

Viewing all articles
Browse latest Browse all 233186

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>