EMS,硬件设计文件以及软件功能验证程序

This commit is contained in:
张鹏
2024-11-19 17:24:00 +08:00
parent 068b96a0ca
commit 3e80f8466a
351 changed files with 1109995 additions and 57 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,101 @@
/*
* File: ert_main.c
*
* Code generated for Simulink model 'led'.
*
* Model version : 1.1
* Simulink Coder version : 9.8 (R2022b) 13-May-2022
* C/C++ source code generated on : Wed Dec 27 10:44:19 2023
*
* Target selection: ert.tlc
* Embedded hardware selection: Custom Processor->Custom Processor
* Code generation objectives: Unspecified
* Validation result: Not run
*/
#include <stddef.h>
#include <stdio.h> /* This example main program uses printf/fflush */
#include "led.h" /* Model header file */
/*
* Associating rt_OneStep with a real-time clock or interrupt service routine
* is what makes the generated code "real-time". The function rt_OneStep is
* always associated with the base rate of the model. Subrates are managed
* by the base rate from inside the generated code. Enabling/disabling
* interrupts and floating point context switches are target specific. This
* example code indicates where these should take place relative to executing
* the generated code step function. Overrun behavior should be tailored to
* your application needs. This example simply sets an error status in the
* real-time model and returns from rt_OneStep.
*/
void rt_OneStep(void);
void rt_OneStep(void)
{
static boolean_T OverrunFlag = false;
/* Disable interrupts here */
/* Check for overrun */
if (OverrunFlag) {
rtmSetErrorStatus(led_M, "Overrun");
return;
}
OverrunFlag = true;
/* Save FPU context here (if necessary) */
/* Re-enable timer or interrupt here */
/* Set model inputs here */
/* Step the model */
led_step();
/* Get model outputs here */
/* Indicate task complete */
OverrunFlag = false;
/* Disable interrupts here */
/* Restore FPU context here (if necessary) */
/* Enable interrupts here */
}
/*
* The example main function illustrates what is required by your
* application code to initialize, execute, and terminate the generated code.
* Attaching rt_OneStep to a real-time clock is target specific. This example
* illustrates how you do this relative to initializing the model.
*/
int_T main(int_T argc, const char *argv[])
{
/* Unused arguments */
(void)(argc);
(void)(argv);
/* Initialize model */
led_initialize();
/* Attach rt_OneStep to a timer or interrupt service routine with
* period 0.2 seconds (base rate of the model) here.
* The call syntax for rt_OneStep is
*
* rt_OneStep();
*/
printf("Warning: The simulation will run forever. "
"Generated ERT main won't simulate model step behavior. "
"To change this behavior select the 'MAT-file logging' option.\n");
fflush((NULL));
while (rtmGetErrorStatus(led_M) == (NULL)) {
/* Perform application tasks here */
}
/* Terminate model */
led_terminate();
return 0;
}
/*
* File trailer for generated code.
*
* [EOF]
*/

View File

@@ -0,0 +1,16 @@
set MATLAB=D:\Program Files\MATLAB\R2022b
call "\\DESKTOP-OPT7PK4\D$\Program Files\MATLAB\R2022b\bin\win64\checkMATLABRootForDriveMap.exe" "\\DESKTOP-OPT7PK4\D$\Program Files\MATLAB\R2022b" > mlEnv.txt
for /f %%a in (mlEnv.txt) do set "%%a"\n
cd .
if "%1"=="" ("D:\Program Files\MATLAB\R2022b\bin\win64\gmake" MATLAB_ROOT=%MATLAB_ROOT% ALT_MATLAB_ROOT=%ALT_MATLAB_ROOT% MATLAB_BIN=%MATLAB_BIN% ALT_MATLAB_BIN=%ALT_MATLAB_BIN% -f led.mk all) else ("D:\Program Files\MATLAB\R2022b\bin\win64\gmake" MATLAB_ROOT=%MATLAB_ROOT% ALT_MATLAB_ROOT=%ALT_MATLAB_ROOT% MATLAB_BIN=%MATLAB_BIN% ALT_MATLAB_BIN=%ALT_MATLAB_BIN% -f led.mk %1)
@if errorlevel 1 goto error_exit
exit /B 0
:error_exit
echo The make command returned an error of %errorlevel%
exit /B 1

View File

@@ -0,0 +1,65 @@
/*
* File: led.c
*
* Code generated for Simulink model 'led'.
*
* Model version : 1.1
* Simulink Coder version : 9.8 (R2022b) 13-May-2022
* C/C++ source code generated on : Wed Dec 27 10:44:19 2023
*
* Target selection: ert.tlc
* Embedded hardware selection: Custom Processor->Custom Processor
* Code generation objectives: Unspecified
* Validation result: Not run
*/
#include "led.h"
#include "rtwtypes.h"
/* Block states (default storage) */
DW_led_T led_DW;
/* External outputs (root outports fed by signals with default storage) */
ExtY_led_T led_Y;
/* Real-time model */
static RT_MODEL_led_T led_M_;
RT_MODEL_led_T *const led_M = &led_M_;
/* Model step function */
void led_step(void)
{
boolean_T rtb_Delay;
/* Delay: '<Root>/Delay' */
rtb_Delay = led_DW.Delay_DSTATE[0];
/* Outport: '<Root>/Out1' incorporates:
* Delay: '<Root>/Delay'
*/
led_Y.Out1 = led_DW.Delay_DSTATE[0];
/* Update for Delay: '<Root>/Delay' incorporates:
* Logic: '<Root>/Logical Operator'
*/
led_DW.Delay_DSTATE[0] = led_DW.Delay_DSTATE[1];
led_DW.Delay_DSTATE[1] = !rtb_Delay;
}
/* Model initialize function */
void led_initialize(void)
{
/* (no initialization code required) */
}
/* Model terminate function */
void led_terminate(void)
{
/* (no terminate code required) */
}
/*
* File trailer for generated code.
*
* [EOF]
*/

View File

@@ -0,0 +1,92 @@
/*
* File: led.h
*
* Code generated for Simulink model 'led'.
*
* Model version : 1.1
* Simulink Coder version : 9.8 (R2022b) 13-May-2022
* C/C++ source code generated on : Wed Dec 27 10:44:19 2023
*
* Target selection: ert.tlc
* Embedded hardware selection: Custom Processor->Custom Processor
* Code generation objectives: Unspecified
* Validation result: Not run
*/
#ifndef RTW_HEADER_led_h_
#define RTW_HEADER_led_h_
#ifndef led_COMMON_INCLUDES_
#define led_COMMON_INCLUDES_
#include "rtwtypes.h"
#endif /* led_COMMON_INCLUDES_ */
/* 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
/* Forward declaration for rtModel */
typedef struct tag_RTM_led_T RT_MODEL_led_T;
/* Block states (default storage) for system '<Root>' */
typedef struct {
boolean_T Delay_DSTATE[2]; /* '<Root>/Delay' */
} DW_led_T;
/* External outputs (root outports fed by signals with default storage) */
typedef struct {
boolean_T Out1; /* '<Root>/Out1' */
} ExtY_led_T;
/* Real-time Model Data Structure */
struct tag_RTM_led_T {
const char_T * volatile errorStatus;
};
/* Block states (default storage) */
extern DW_led_T led_DW;
/* External outputs (root outports fed by signals with default storage) */
extern ExtY_led_T led_Y;
/* Model entry point functions */
extern void led_initialize(void);
extern void led_step(void);
extern void led_terminate(void);
/* Real-time Model object */
extern RT_MODEL_led_T *const led_M;
/*-
* These blocks were eliminated from the model due to optimizations:
*
* Block '<Root>/Scope' : Unused code path elimination
*/
/*-
* The generated code includes comments that allow you to trace directly
* back to the appropriate location in the model. The basic format
* is <system>/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('<S3>') - opens system 3
* hilite_system('<S3>/Kp') - opens and selects block Kp which resides in S3
*
* Here is the system hierarchy for this model
*
* '<Root>' : 'led'
*/
#endif /* RTW_HEADER_led_h_ */
/*
* File trailer for generated code.
*
* [EOF]
*/

View File

@@ -0,0 +1,334 @@
###########################################################################
## Makefile generated for component 'led'.
##
## Makefile : led.mk
## Generated on : Wed Dec 27 10:44:28 2023
## Final product: $(RELATIVE_PATH_TO_ANCHOR)/led.exe
## Product type : executable
##
###########################################################################
###########################################################################
## MACROS
###########################################################################
# Macro Descriptions:
# PRODUCT_NAME Name of the system to build
# MAKEFILE Name of this makefile
# CMD_FILE Command file
PRODUCT_NAME = led
MAKEFILE = led.mk
MATLAB_ROOT = D:/Program Files/MATLAB/R2022b
MATLAB_BIN = D:/Program Files/MATLAB/R2022b/bin
MATLAB_ARCH_BIN = $(MATLAB_BIN)/win64
START_DIR = F:/desktop/simulink
SOLVER =
SOLVER_OBJ =
CLASSIC_INTERFACE = 0
TGT_FCN_LIB = ISO_C
MODEL_HAS_DYNAMICALLY_LOADED_SFCNS = 0
RELATIVE_PATH_TO_ANCHOR = ..
CMD_FILE = led.rsp
C_STANDARD_OPTS =
CPP_STANDARD_OPTS =
###########################################################################
## TOOLCHAIN SPECIFICATIONS
###########################################################################
# Toolchain Name: LCC-win64 v2.4.1 | gmake (64-bit Windows)
# Supported Version(s): 2.4.1
# ToolchainInfo Version: 2022b
# Specification Revision: 1.0
#
#-----------
# MACROS
#-----------
SHELL = cmd
LCC_ROOT = $(MATLAB_ROOT)/sys/lcc64/lcc64
LCC_BUILDLIB = $(LCC_ROOT)/bin/buildlib
LCC_LIB = $(LCC_ROOT)/lib64
MW_EXTERNLIB_DIR = $(MATLAB_ROOT)/extern/lib/win64/microsoft
MW_LIB_DIR = $(MATLAB_ROOT)/lib/win64
TOOLCHAIN_INCLUDES = -I$(LCC_ROOT)/include64
TOOLCHAIN_SRCS =
TOOLCHAIN_INCS =
TOOLCHAIN_LIBS =
#------------------------
# BUILD TOOL COMMANDS
#------------------------
# C Compiler: Lcc-win64 C Compiler
CC_PATH = $(LCC_ROOT)/bin
CC = "$(CC_PATH)/lcc64"
# Linker: Lcc-win64 Linker
LD_PATH = $(LCC_ROOT)/bin
LD = "$(LD_PATH)/lcclnk64"
# Archiver: Lcc-win64 Archiver
AR_PATH = $(LCC_ROOT)/bin
AR = "$(AR_PATH)/lcclib64"
# MEX Tool: MEX Tool
MEX_PATH = $(MATLAB_ARCH_BIN)
MEX = "$(MEX_PATH)/mex"
# Download: Download
DOWNLOAD =
# Execute: Execute
EXECUTE = $(PRODUCT)
# Builder: GMAKE Utility
MAKE_PATH = %MATLAB%\bin\win64
MAKE = "$(MAKE_PATH)/gmake"
#-------------------------
# Directives/Utilities
#-------------------------
CDEBUG = -g
C_OUTPUT_FLAG = -Fo
LDDEBUG =
OUTPUT_FLAG = -o
ARDEBUG =
STATICLIB_OUTPUT_FLAG = /out:
MEX_DEBUG = -g
RM = @del /F
ECHO = @echo
MV = @move
RUN =
#----------------------------------------
# "Faster Builds" Build Configuration
#----------------------------------------
ARFLAGS =
CFLAGS = -c -w -noregistrylookup -nodeclspec -I$(LCC_ROOT)/include64
DOWNLOAD_FLAGS =
EXECUTE_FLAGS =
LDFLAGS = -s -L$(LCC_LIB) $(LDFLAGS_ADDITIONAL)
MEX_CPPFLAGS =
MEX_CPPLDFLAGS =
MEX_CFLAGS =
MEX_LDFLAGS =
MAKE_FLAGS = -f $(MAKEFILE)
SHAREDLIB_LDFLAGS = -dll -entry LibMain -s -L$(LCC_LIB) $(LDFLAGS_ADDITIONAL) $(DEF_FILE)
###########################################################################
## OUTPUT INFO
###########################################################################
PRODUCT = $(RELATIVE_PATH_TO_ANCHOR)/led.exe
PRODUCT_TYPE = "executable"
BUILD_TYPE = "Top-Level Standalone Executable"
###########################################################################
## INCLUDE PATHS
###########################################################################
INCLUDES_BUILDINFO = -I$(START_DIR) -I$(START_DIR)/led_ert_rtw -I$(MATLAB_ROOT)/extern/include -I$(MATLAB_ROOT)/simulink/include -I$(MATLAB_ROOT)/rtw/c/src -I$(MATLAB_ROOT)/rtw/c/src/ext_mode/common -I$(MATLAB_ROOT)/rtw/c/ert
INCLUDES = $(INCLUDES_BUILDINFO)
###########################################################################
## DEFINES
###########################################################################
DEFINES_BUILD_ARGS = -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0
DEFINES_CUSTOM =
DEFINES_OPTS = -DTID01EQ=0
DEFINES_STANDARD = -DMODEL=led -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0
DEFINES = $(DEFINES_BUILD_ARGS) $(DEFINES_CUSTOM) $(DEFINES_OPTS) $(DEFINES_STANDARD)
###########################################################################
## SOURCE FILES
###########################################################################
SRCS = $(START_DIR)/led_ert_rtw/led.c
MAIN_SRC = $(START_DIR)/led_ert_rtw/ert_main.c
ALL_SRCS = $(SRCS) $(MAIN_SRC)
###########################################################################
## OBJECTS
###########################################################################
OBJS = led.obj
MAIN_OBJ = ert_main.obj
ALL_OBJS = $(OBJS) $(MAIN_OBJ)
###########################################################################
## PREBUILT OBJECT FILES
###########################################################################
PREBUILT_OBJS =
###########################################################################
## LIBRARIES
###########################################################################
LIBS =
###########################################################################
## SYSTEM LIBRARIES
###########################################################################
SYSTEM_LIBS =
###########################################################################
## ADDITIONAL TOOLCHAIN FLAGS
###########################################################################
#---------------
# C Compiler
#---------------
CFLAGS_BASIC = $(DEFINES) $(INCLUDES)
CFLAGS += $(CFLAGS_BASIC)
###########################################################################
## INLINED COMMANDS
###########################################################################
###########################################################################
## PHONY TARGETS
###########################################################################
.PHONY : all build buildobj clean info prebuild download execute
all : build
@echo "### Successfully generated all binary outputs."
build : prebuild $(PRODUCT)
buildobj : prebuild $(OBJS) $(PREBUILT_OBJS)
@echo "### Successfully generated all binary outputs."
prebuild :
download : $(PRODUCT)
execute : download
@echo "### Invoking postbuild tool "Execute" ..."
$(EXECUTE) $(EXECUTE_FLAGS)
@echo "### Done invoking postbuild tool."
###########################################################################
## FINAL TARGET
###########################################################################
#-------------------------------------------
# Create a standalone executable
#-------------------------------------------
$(PRODUCT) : $(OBJS) $(PREBUILT_OBJS) $(MAIN_OBJ)
@echo "### Creating standalone executable "$(PRODUCT)" ..."
$(LD) $(LDFLAGS) -o $(PRODUCT) @$(CMD_FILE) $(subst /,\,$(SYSTEM_LIBS)) $(subst /,\,$(TOOLCHAIN_LIBS))
@echo "### Created: $(PRODUCT)"
###########################################################################
## INTERMEDIATE TARGETS
###########################################################################
#---------------------
# SOURCE-TO-OBJECT
#---------------------
%.obj : %.c
$(CC) $(CFLAGS) -Fo"$@" $(subst /,\,"$<")
%.obj : $(RELATIVE_PATH_TO_ANCHOR)/%.c
$(CC) $(CFLAGS) -Fo"$@" $(subst /,\,"$<")
%.obj : $(START_DIR)/%.c
$(CC) $(CFLAGS) -Fo"$@" $(subst /,\,"$<")
%.obj : $(START_DIR)/led_ert_rtw/%.c
$(CC) $(CFLAGS) -Fo"$@" $(subst /,\,"$<")
%.obj : $(MATLAB_ROOT)/rtw/c/src/%.c
$(CC) $(CFLAGS) -Fo"$@" $(subst /,\,"$<")
%.obj : $(MATLAB_ROOT)/simulink/src/%.c
$(CC) $(CFLAGS) -Fo"$@" $(subst /,\,"$<")
ert_main.obj : $(START_DIR)/led_ert_rtw/ert_main.c
$(CC) $(CFLAGS) -Fo"$@" $(subst /,\,"$<")
led.obj : $(START_DIR)/led_ert_rtw/led.c
$(CC) $(CFLAGS) -Fo"$@" $(subst /,\,"$<")
###########################################################################
## DEPENDENCIES
###########################################################################
$(ALL_OBJS) : rtw_proj.tmw $(MAKEFILE)
###########################################################################
## MISCELLANEOUS TARGETS
###########################################################################
info :
@echo "### PRODUCT = $(PRODUCT)"
@echo "### PRODUCT_TYPE = $(PRODUCT_TYPE)"
@echo "### BUILD_TYPE = $(BUILD_TYPE)"
@echo "### INCLUDES = $(INCLUDES)"
@echo "### DEFINES = $(DEFINES)"
@echo "### ALL_SRCS = $(ALL_SRCS)"
@echo "### ALL_OBJS = $(ALL_OBJS)"
@echo "### LIBS = $(LIBS)"
@echo "### MODELREF_LIBS = $(MODELREF_LIBS)"
@echo "### SYSTEM_LIBS = $(SYSTEM_LIBS)"
@echo "### TOOLCHAIN_LIBS = $(TOOLCHAIN_LIBS)"
@echo "### CFLAGS = $(CFLAGS)"
@echo "### LDFLAGS = $(LDFLAGS)"
@echo "### SHAREDLIB_LDFLAGS = $(SHAREDLIB_LDFLAGS)"
@echo "### ARFLAGS = $(ARFLAGS)"
@echo "### MEX_CFLAGS = $(MEX_CFLAGS)"
@echo "### MEX_CPPFLAGS = $(MEX_CPPFLAGS)"
@echo "### MEX_LDFLAGS = $(MEX_LDFLAGS)"
@echo "### MEX_CPPLDFLAGS = $(MEX_CPPLDFLAGS)"
@echo "### DOWNLOAD_FLAGS = $(DOWNLOAD_FLAGS)"
@echo "### EXECUTE_FLAGS = $(EXECUTE_FLAGS)"
@echo "### MAKE_FLAGS = $(MAKE_FLAGS)"
clean :
$(ECHO) "### Deleting all derived files..."
$(RM) $(subst /,\,$(PRODUCT))
$(RM) $(subst /,\,$(ALL_OBJS))
$(ECHO) "### Deleted all derived files."

View File

@@ -0,0 +1,2 @@
ert_main.obj
led.obj

View File

@@ -0,0 +1,4 @@
Simulink Coder project for led using . MATLAB root = D:\Program Files\MATLAB\R2022b. SimStruct date: 26-7月-2022 02:34:02
This file is generated by Simulink Coder for use by the make utility
to determine when to rebuild objects when the name of the current Simulink Coder project changes.
The rtwinfomat located at: ..\slprj\ert\led\tmwinternal\binfo.mat

View File

@@ -0,0 +1,156 @@
/*
* File: rtwtypes.h
*
* Code generated for Simulink model 'led'.
*
* Model version : 1.1
* Simulink Coder version : 9.8 (R2022b) 13-May-2022
* C/C++ source code generated on : Wed Dec 27 10:44:19 2023
*
* Target selection: ert.tlc
* Embedded hardware selection: Custom Processor->Custom Processor
* 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: Custom Processor->Custom Processor
* 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
*=======================================================================*/
/*=======================================================================*
* 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 long ulong_T;
typedef char char_T;
typedef unsigned char uchar_T;
typedef char_T byte_T;
/*===========================================================================*
* Complex number type definitions *
*===========================================================================*/
#define CREAL_T
typedef struct {
real32_T re;
real32_T im;
} creal32_T;
typedef struct {
real64_T re;
real64_T im;
} creal64_T;
typedef struct {
real_T re;
real_T im;
} creal_T;
#define CINT8_T
typedef struct {
int8_T re;
int8_T im;
} cint8_T;
#define CUINT8_T
typedef struct {
uint8_T re;
uint8_T im;
} cuint8_T;
#define CINT16_T
typedef struct {
int16_T re;
int16_T im;
} cint16_T;
#define CUINT16_T
typedef struct {
uint16_T re;
uint16_T im;
} cuint16_T;
#define CINT32_T
typedef struct {
int32_T re;
int32_T im;
} cint32_T;
#define CUINT32_T
typedef struct {
uint32_T re;
uint32_T im;
} cuint32_T;
/*=======================================================================*
* Min and Max: *
* 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 *
*=======================================================================*/
#define MAX_int8_T ((int8_T)(127))
#define MIN_int8_T ((int8_T)(-128))
#define MAX_uint8_T ((uint8_T)(255U))
#define MAX_int16_T ((int16_T)(32767))
#define MIN_int16_T ((int16_T)(-32768))
#define MAX_uint16_T ((uint16_T)(65535U))
#define MAX_int32_T ((int32_T)(2147483647))
#define MIN_int32_T ((int32_T)(-2147483647-1))
#define MAX_uint32_T ((uint32_T)(0xFFFFFFFFU))
/* Block D-Work pointer type */
typedef void * pointer_T;
#endif /* RTWTYPES_H */
/*
* File trailer for generated code.
*
* [EOF]
*/

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<MF0 version="1.1" packageUris="http://schema.mathworks.com/mf0/SlCache/19700101">
<slcache.FileAttributes type="slcache.FileAttributes" uuid="7bdb0ba1-872d-4302-8f9e-8bf171dbb789">
<checksum>t587k1ya0Vk/sxGpVDbVaqCT87D5oJQ8oem+VHxJROFTR/iP2e1FnbEiKbCOpH+wV5o+NSgDKm5CANZnBZukkw==</checksum>
</slcache.FileAttributes>
</MF0>

Binary file not shown.