Export Binary Data with Low-Level I/O

本文介绍如何使用MATLAB的低级I/O函数fwrite进行二进制数据的写入操作,包括指定文件的字节顺序、追加或覆盖现有文件内容以及处理复数数据等高级技巧。
Low-Level Functions for Exporting Data

Low-level file I/O functions allow the most direct control over reading or writing data to a file. However, these functions require that you specify more detailed information about your file than the easier-to-use high-level functions. For a complete list of high-level functions and the file formats they support, see Supported File Formats for Import and Export.

If the high-level functions cannot export your data, use one of the following:

  • Note:   The low-level file I/O functions are based on functions in the ANSI® Standard C Library. However, MATLAB® includes vectorized versions of the functions, to read and write data in an array with minimal control loops.

Write Binary Data to a File

Open Script

This example shows how to use the fwrite function to export a stream of binary data to a file.

Create a file named nine.bin with the integers from 1 to 9. As with any of the low-level I/O functions, before writing, open or create a file with fopen and obtain a file identifier.

fileID = fopen('nine.bin','w');
fwrite(fileID, [1:9]);

By default, fwrite writes values from an array in column order as 8-bit unsigned integers (uint8).

When you finish processing a file, close it with fclose.

fclose(fileID);

Create a file with double-precision values. You must specify the precision of the values if the values in your matrix are not 8-bit unsigned integers.

mydata = [pi 42 1/3];

fileID = fopen('double.bin','w');
fwrite(fileID,mydata,'double');
fclose(fileID);
Overwrite or Append to an Existing Binary File

Open Script

This example shows how to overwrite a portion of an existing binary file and append values to the file.

By default, fopen opens files with read access. To change the type of file access, use the permission specifier in the call to fopen. Possible permission specifiers include:

  • 'r' for reading

  • 'w' for writing, discarding any existing contents of the file

  • 'a' for appending to the end of an existing file

To open a file for both reading and writing or appending, attach a plus sign to the permission, such as 'w+' or 'a+'. If you open a file for both reading and writing, you must call fseek or frewind between read and write operations.

Overwrite a Portion of an Existing File

Create a file named magic4.bin, specifying permission to write and read.

fileID = fopen('magic4.bin','w+');
fwrite(fileID,magic(4));

The original magic(4) matrix is:

16     2     3    13
 5    11    10     8
 9     7     6    12
 4    14    15     1

The file contains 16 bytes, 1 for each value in the matrix.

Replace the values in the second column of the matrix with the vector, [44 44 44 44]. To do this, first seek to the fourth byte from the beginning of the file using fseek.

fseek(fileID,4,'bof');

Write the vector [44 44 44 44] using fwrite.

fwrite(fileID,[44 44 44 44]);

Read the results from the file into a 4-by-4 matrix.

frewind(fileID);
newdata = fread(fileID,[4,4])
newdata =

    16    44     3    13
     5    44    10     8
     9    44     6    12
     4    44    15     1

Close the file.

fclose(fileID);

Append Binary Data to Existing File

Append the values [55 55 55 55] to magic4.bin. First. open the file with permission to append and read.

fileID = fopen('magic4.bin','a+');

Write values at end of file.

fwrite(fileID,[55 55 55 55]);

Read the results from the file into a 4-by-5 matrix.

frewind(fileID);
appended = fread(fileID, [4,5])
appended =

    16    44     3    13    55
     5    44    10     8    55
     9    44     6    12    55
     4    44    15     1    55

Close the file.

fclose(fileID);
Create a File for Use on a Different System

Different operating systems store information differently at the byte or bit level:

  • Big-endian systems store bytes starting with the largest address in memory (that is, they start with the big end).

  • Little-endian systems store bytes starting with the smallest address (the little end).

Windows® systems use little-endian byte ordering, and UNIX® systems use big-endian byte ordering.

To create a file for use on an opposite-endian system, specify the byte ordering for the target system. You can specify the ordering in the call to open the file, or in the call to write the file.

For example, to create a file named myfile.bin on a big-endian system for use on a little-endian system, use one (or both) of the following commands:

  • Open the file with

    fid = fopen('myfile.bin', 'w', 'l')
  • Write the file with

    fwrite(fid, mydata, precision, 'l')

where 'l' indicates little-endian ordering.

If you are not sure which byte ordering your system uses, call the computer function:

[cinfo, maxsize, ordering] = computer

The returned ordering is 'L' for little-endian systems, or 'B' for big-endian systems.

Open Files with Different Character Encodings

Encoding schemes support the characters required for particular alphabets, such as those for Japanese or European languages. Common encoding schemes include US-ASCII or UTF-8.

The encoding scheme determines the number of bytes required to read or write char values. For example, US-ASCII characters always use 1 byte, but UTF-8 characters use up to 4 bytes. MATLAB automatically processes the required number of bytes for eachchar value based on the specified encoding scheme. However, if you specify a uchar precision, MATLAB processes each byte as uint8, regardless of the specified encoding.

If you do not specify an encoding scheme, fopen opens files for processing using the default encoding for your system. To determine the default, open a file, and call fopen again with the syntax:

[filename, permission, machineformat, encoding] = fopen(fid);

If you specify an encoding scheme when you open a file, the following functions apply that scheme: fscanf, fprintf, fgetl, fgets, fread, and fwrite.

For a complete list of supported encoding schemes, and the syntax for specifying the encoding, see the fopen reference page.

Write and Read Complex Numbers

Open Script

This example shows how to write and read complex numbers in binary files.

The available precision values for fwrite do not explicitly support complex numbers. To store complex numbers in a file, separate the real and imaginary components and write them separately to the file. There are two ways to do this:

  • Write all real components followed by all imaginary components

  • Interleave the components

Use the approach that allows you to read the data in your target application.

Separate Real and Imaginary Components

Create an array that contains complex values.

nrows = 5;
ncols = 5;
z = complex(rand(nrows, ncols), rand(nrows, ncols))
z =

  Columns 1 through 4

   0.8147 + 0.7577i   0.0975 + 0.7060i   0.1576 + 0.8235i   0.1419 + 0.4387i
   0.9058 + 0.7431i   0.2785 + 0.0318i   0.9706 + 0.6948i   0.4218 + 0.3816i
   0.1270 + 0.3922i   0.5469 + 0.2769i   0.9572 + 0.3171i   0.9157 + 0.7655i
   0.9134 + 0.6555i   0.9575 + 0.0462i   0.4854 + 0.9502i   0.7922 + 0.7952i
   0.6324 + 0.1712i   0.9649 + 0.0971i   0.8003 + 0.0344i   0.9595 + 0.1869i

  Column 5

   0.6557 + 0.4898i
   0.0357 + 0.4456i
   0.8491 + 0.6463i
   0.9340 + 0.7094i
   0.6787 + 0.7547i

Separate the complex values into real and imaginary components.

z_real = real(z);
z_imag = imag(z);

Write All Real Components Follwed By Imaginary Components

Write all the real components, z_real, followed by all the imaginary components, z_imag, to a file named complex_adj.bin.

adjacent = [z_real z_imag];

fileID = fopen('complex_adj.bin', 'w');
fwrite(fileID,adjacent,'double');
fclose(fileID);

Read the values from the file using fread.

fileID = fopen('complex_adj.bin');
same_real = fread(fileID, [nrows, ncols], 'double');
same_imag = fread(fileID, [nrows, ncols], 'double');
fclose(fileID);

same_z = complex(same_real, same_imag);

Interleave Real and Imaginary Components

An alternative approach is to interleave the real and imaginary components for each value. fwrite writes values in column order, so build an array that combines the real and imaginary parts by alternating rows.

First, preallocate the interleaved array.

interleaved = zeros(nrows*2, ncols);

Alternate real and imaginary data.

newrow = 1;
for row = 1:nrows
    interleaved(newrow,:) = z_real(row,:);
    interleaved(newrow + 1,:) = z_imag(row,:);
    newrow = newrow + 2;
end

Write the interleaved values to a file named complex_int.bin.

fileID = fopen('complex_int.bin','w');
fwrite(fileID, interleaved, 'double');
fclose(fileID);

Open the file for reading and read the real values from the file. The fourth input to fread tells the function to skip the specified number of bytes after reading each value.

fileID = fopen('complex_int.bin');
same_real = fread(fileID, [nrows, ncols], 'double', 8);

Return to the first imaginary value in the file. Then, read all the imaginary data.

fseek(fileID, 8, 'bof');
same_imag = fread(fileID, [nrows, ncols], 'double', 8);
fclose(fileID);

same_z = complex(same_real, same_imag);
中文分析FAILED: out/target/product/khandala/obj/KERNEL_MODULES/mwgifker.ko_intermediates/LINKED/mwgifker.ko out/target/product/khandala/obj/KERNEL_MODULES/mwgifker.ko_intermediates/LINKED/Module.symvers /bin/bash -c "(source out/var_export.sh && cd out/target/product/khandala/obj/KERNEL_MODULES/mwgifker.ko_intermediates/BUILT && source /home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/device/mediatek/build/tasks/env.sh;make -j \$(cat /proc/cpuinfo |grep processor|wc -l) -C /home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/vendor/mediatek/tv/kernel/5.15_14 CC=/home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/prebuilts/clang/host/linux-x86/clang-r475365b/bin/clang ARCH=arm CROSS_COMPILE=/home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/prebuilts/mtk_toolchain/gcc-arm-linux-gnu-5.5.0-ubuntu/x86_64/bin/arm-linux-gnueabi- O=/home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/out/target/product/khandala/KERNEL_OBJ_5.15 LD=/home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/prebuilts/clang/host/linux-x86/clang-r475365b/bin/ld.lld M=/home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/out/target/product/khandala/obj/KERNEL_MODULES/mwgifker.ko_intermediates/BUILT LOCAL_PATH=/home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/vendor/mediatek/tv/misdk/stbmsapi/gif KBUILD_EXTRA_SYMBOLS=\"/home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/out/target/product/khandala/obj/KERNEL_MODULES/utpa2k.ko_intermediates/LINKED/Module.symvers\" src=/home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/vendor/mediatek/tv/misdk/stbmsapi/gif KBUILD_MODPOST_WARN=y LOCAL_MODULE=mwgifker.ko ) && (prebuilts/build-tools/linux-x86/bin/acp /home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/out/target/product/khandala/obj/KERNEL_MODULES/mwgifker.ko_intermediates/BUILT/mwgifker.ko out/target/product/khandala/obj/KERNEL_MODULES/mwgifker.ko_intermediates/LINKED/mwgifker.ko ) && (prebuilts/build-tools/linux-x86/bin/acp /home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/out/target/product/khandala/obj/KERNEL_MODULES/mwgifker.ko_intermediates/BUILT/Module.symvers out/target/product/khandala/obj/KERNEL_MODULES/mwgifker.ko_intermediates/LINKED/Module.symvers ) && (mkdir -p out/target/product/khandala/symbols/ko/ ) && (prebuilts/build-tools/linux-x86/bin/acp /home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/out/target/product/khandala/obj/KERNEL_MODULES/mwgifker.ko_intermediates/BUILT/mwgifker.ko out/target/product/khandala/symbols/ko/mwgifker.ko )" out/var_export.sh: line 62: export: `apollo-prod-2105 -DCUSTOMER=mediatek -DVERSION=t-apollo-mp-2105-refu-1640-001-306 -DCOMPANY=mediatek -DBUILD_CMD=default -DPRODUCT_SW_VERSION=0.1.0.0.M001 -DDATA_SEPARATION_PRO_ID_PATH=/vendor/project_id -DDATA_SEPARATION_PRO_ID_FILE=project_id.ini -DDATA_SEPARATION_DATAINDEX_PATH=/vendor/cusdata/config/dataIndex -DSUPPORT_FUSION_TTY -DUTOPIA_SUPPORT -DSYS_CB_RECORD_SUPPORT -DSYS_MTAL_RECORD_SUPPORT -DCONFIG_SUPPORT_OVL -DFUSION_DFB_SUPPORT -DAPP_MERGE_INTO_ONE_OSD -DMW_MERGE_INTO_ONE_OSD -DCC_MERGE_INTO_ONE_OSD -DAPP_OLED_SUPPORT -DMW_FUSION_TV_SUPPORT -DAPP_FUSION_USE_MI_SYS_PARSE_INI_FILE -DSUPPORT_FILESYSTEM_UPGRADE_PARTITION -DAPP_FUSION_APOLLO_FILE_PATH=/vendor/tvconfig/apollo -DAPP_FUSION_MI_FILE_PATH=/vendor/tvconfig/config -DAPOLLO_TO_LOGCAT=1 -DAPP_BLUE_LIGHT_SUPPORT -DAPP_HDR_SUPPORT -DAPP_LEGACY_UX_DISABLE_SUPPORT -DAPP_CUSTOMER_DEF_SOLE_HP_VOL -DAPP_SUPPORT_HEVC_10_BIT -DSYS_ANDROID_TV_TIF_SUPPORT -DCECNFY5VSTATUS -DMW_SVL_EVERY_NOTIFY -DMW_SUPPORT_2STC -DNDEBUG -DMW_SYM_SUPPORT -DSIG_TRACER_ENABLED -DCLI_LEVEL_VERBOSE -DEXT_DBG_DEV -DCLI_SUPPORT -DCC_WIFI_U2_SPEED_ON_U3PORT -DMW_DBG_SUPPORT_CHARS_COUNTER -DMW_DBG_CHARS_COUNT_DFT_ENABLE -DTIME_MEASUREMENT -DTMS_INIT_LEVEL_COMMON=TMS_LEVEL_OFF_LINE -DTIME_MEASUREMENT_DEFAULT_OFF -DCC_MTD_ENCRYPT_SUPPORT -DCC_MSDC_AES_SUPPORT -DMW_FAKE_THREAD -DAPP_FUSION_TV_SUPPORT -DMW_SUPPORT_DOLBY_VISION -DCC_SUPPORT_DOLBY_VISION -DAPP_SUPPORT_DOLBY_VISION -DDT_SUPPORT_MULTI_CLOCK -DDLM_USE_AES_MODE -DCC_DLM_V2 -DDLM_SHA_256 -DDLM_GCPU_SHA_256 -DDLM_USE_GCPU_AES -DUPGRADE_PARTITION_NO_FS -DDLM_USE_LARGE_BUFFER -DSYS_MTKTVAPI_SUPPORT -DSYS_QUIET_HOT_BOOT_SUPPORT -DMW_FAKE_THREAD -DSYS_MTK_STREAM_RPC_SUPPORT -DSYS_CMPB_RPC_SUPPORT -DSYS_MTK_DRM_RPC_SUPPORT -DMTK_DRM_SUPPORT -DHELIX_SUPPORT -DMODEL_NAME=kenai2020 -DCUST_MODEL=kenai2020 -DSERIAL_NUMBER=IDTV -DUSB_UPG_VERSION= -DDUAL_CHANNEL_SUPPORT -DSN_FLASH_USE_NAND -DREPLACE_EEPROM_WITH_EMMC -DSYS_EMMC_SUPPORT -DSYS_EMMC_SUPPORT -DSN_NAND_FLASH_2=block/platform/mstar_mci.0/by-name/cha -DSN_NAND_FLASH_4=block/platform/mstar_mci.0/by-name/chb -DSN_FLASH_PVR=block/platform/mstar_mci.0/by-name/schedpvr -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DFM_EXT_FS_SUPPORT -D_CPU_LITTLE_ENDIAN_ -DLINUX_TURNKEY_SOLUTION -DSINGLE_PROCESS -DSYS_FAST_BOOT -DSYS_NETWORK_LAZY_INIT -DSYS_HOTKEY_WAKEUP_SUPPORT -DMW_HOTKEY_WAKEUP_SUPPORT -DLINUX_MEM_SOLUTION -DRPC_ENABLE -DHEADER_COMMON_H=inc/u_common.h -DSWI_CALLBACK -DKEY_FROM_DFB -DSVCTX_SPLIT_SUPPORT -DANA_TUNER_SUPPORT -DV4L_SUPPORT -DXML_SUPPORT -DINET_SUPPORT -DUSE_SMART_FILE -DMW_IPV6_SUPPORT -DSYS_IPV6_SUPPORT -DNETFLIX_SUPPORT -DCC_NETFLIX_CE3_SUPPORT -DANDROID_DLNA_SUPPORT -DANDROID_PULL_DLNA_SUPPORT -DMW_JPG_SUPPORT -DMW_BMP_SUPPORT -DMW_PNG_SUPPORT -DMW_GIF_SUPPORT -DMW_WEBP_SUPPORT -DMW_MP3_SUPPORT -DMW_CM_PLAYBACK_SUPPORT -DVIDEO_PLAYBACK_SUPPORT -DMW_MMP_VIDEO_SUPPORT -DMM_LAST_MEMORY_SUPPORT -DENABLE_MULTIMEDIA -DMW_TV_AV_BYPASS_SUPPORT -DTIME_SHIFT_SUPPORT -DTIME_SHIFT_ENCRYPTION -DMW_PVR_PAUSE_DONOT_STOP_STC -DMW_TV_AV_BYPASS_SUPPORT -DSYS_RECORD_SUPPORT -DMW_ENABLE_TRICK_REACH_VALID_RANGE_END_MSG -DAPP_NAV_REC_SUPPORT -DENABLE_DIVX_DRM -DCMPB_DASH_SUPPORT -DCMPB_OVER_MI_MM -DSUPPORT_RATING_PVR -DAPP_AM_NO_POWER_DOWN -DAPP_BACKGROUND_MANAGER_ENABLED -DSYS_SCHED_PVR_FLASH_SUPPORT -DFIRMWARE_UPGRADE -DAPP_UPG_SUPPORT -DAPP_NET_UPG_SUPPORT -DCC_OSD_USE_FBM -DSUPPORT_FLASH_PQ -DSUPPORT_FLASH_AQ -DADSP_BIN_SUPPORT -DCHIP_SPEC_SUPPORT -DLINUX_NAND_USE_SDM -DMW_ASH_DUALMONO_RECOVER -DDISABLE_BASIC_PART -DSYS_3RD_RO -DMW_MSS_SUPPORT -DAPP_FACT_SUPPORT -DCC_SECURE_BOOT_WO_RAMDISK -DANDROID -DIMGDRV_ANDROID -DANDROID_TOOLCHAIN -DANDROID_TWO_WORLDS -DDISABLE_TV_WORLD_NW_SETTING -DCC_NATIVE_CB2_NOTIFY -DCC_PDWNC_REBOOT_NOTIFY -DMW_SUPPORT_MTK_ANDROID_RM -DAPP_SUPPORT_MTK_ANDROID_RM -DAPP_SUPPORT_4K2K -DMW_SUPPORT_4K2K -DAPP_3D_PHOTO_SUPPORT -DMW_PHOTO_SHOW_ON_VDP -DAPP_SUPPORT_STR_CORE_OFF -DMW_SUPPORT_STR -DAPP_DOLBY_AUD_SUPPORT -DMW_DOLBY_AUD_SUPPORT -DAPP_DOLBY_AUD_SUPPORT_MS12B -DAPP_NAV_COMP_WW_ENABLE_CHECK_SUPPORT -DAPP_IF_MTAL_MULTIPROCESS_CALLBACK -DAPP_MPEG_NR_SUPPORT -DAPP_DI_SUPPORT -DAPP_GAME_MODE_SUPPORT -DAPP_MERGE_INTO_ONE_OSD -DMW_MERGE_INTO_ONE_OSD -DCC_MERGE_INTO_ONE_OSD -DAPP_MTK_MVIEW_SUPPORT -DFUSION_DFB_SUPPORT -DAPP_MENU_SUPPORT_DYNAMIC_LIFE_CYCLE -DAPP_IMG_UI -DAPP_537X_SUPPORT -DAPP_CFG_EEPROM_SUPPORT -DAPP_NAV_IPTS_LST -DAPP_NAV_IPTS_LST_BAR_ACTIVE -DAPP_NAV_IPTS_LST_BAR_DISABLE -DAPP_INPUT_SRC_HOTKEY -DAPP_EPG_ICON_MSG -DAPP_NAV_FRZ_SUPPORT -DAPP_NAV_MISC_COMP -DAPP_EPG_FULL_VIDEO -DAPP_MLM_S639_TO_LANGIDX_SUPPORT -DAPP_HV_POS_MODIFICATION_SUPPORT -DAPP_NAV_IPTS_DISABLE_XNG_CH_AS_FOCUS_AV -DAPP_SUPPORT_AM_DEFAULT_KEY_HANDLER -DAPP_5893_MHL_SUPPORT_PORT -DAPP_MENU_STORE_CH_LST_BY_AGENT -DAPP_SINGLE_COLOR_TEMP_PATH -DAPP_SPDIF_DELAY_SUPPORT -DAPP_NETWORK_SUPPORT -DAPP_NETWORK_WIFI_SUPPORT -DAPP_NETWORK_IPV6_SUPPORT -DAPP_MMP_VIDEO_PLAYBACK_ENABLE -DMMP_FB_RC_IS_ENABLE_VIDEO_FILTER -DMMP_FB_RC_IS_ENABLE_TEXT_FILTER -DAPP_NAV_REC_SUPPORT -DAPP_NAV_REC_TSHIFT_SUPPORT -DAPP_NAV_REC_DTV_TSHIFT_SUPPORT -DAPP_NAV_REC_SUPPORT -DAPP_NAV_REC_PVR_SUPPORT -DAPP_NAV_REC_DTV_PVR_SUPPORT -DAPP_MMP_PVR_SUPPORT -DAPP_REMINDER_UTIL_SUPPORT -DAPP_NAV_REC_PVR_SCH_SUPPORT -DAPP_SCHED_PVR_FLASH_SUPPORT -DAPP_VIDEO_FLIP_SUPPORT -DAPP_VIDEO_MIRROR_SUPPORT -DAPP_IMG_CENTER_SUPPORT -DAPP_NAV_USE_FRAME_AS_ROOT_WIDGET -DCONFIG_SUPPORT_OVL -DCC_FRAME_OFFSET -DCC_SOURCE_AUTO_DETECT -DFUSION_DFB_SUPPORT -DCC_MTD_SUPPORT_64_PARTITION -DCC_SUPPORT_AVB -DAPP_MERGE_INTO_ONE_OSD -DMW_MERGE_INTO_ONE_OSD -DCC_MERGE_INTO_ONE_OSD -DCC_SUPPORT_AB_UPDATE -DCC_SUPPORT_DTO -DCC_SUPPORT_DRAM_3GB -DCC_SUPPORT_DRAM_32BIT_SIZE -DPICACHU_SUPPORT -DCC_FBM_TWO_4K2K -DCC_SUPPORT_DOLBY_VISION -DCC_SUPPORT_SMI -DCC_SUPPORT_EMI -DCC_SUPPORT_M4U -DCC_DTVDRV_RUNTIME_PM -DCC_NO_BIM_INTR -DCC_SYM_SUPPORT -DSIG_TRACER_ENABLED -DCC_FBM_SUPPORT_SWDMX -DCC_KERNEL_HS400_SUPPORT -DCC_EMMC_HS400 -DCC_HDMI_2_0_HDCP_BIN -DCC_HDMI_2_0_SUPPORT -DCC_QUIET_HOT_BOOT_SUPPORT -DCC_BT_WAKEUP_SUPPORT -DCC_SUPPORT_CHIPID -DREPLACE_EEPROM_WITH_EMMC -DSYS_EMMC_SUPPORT -DCC_WIFI_WOWLAN_SUPPORT -DCC_WIFI_WOWLAN_LOW_ACTIVE -DCC_FBM_MAPPING_ONE_BY_ONE -DCC_VDEC_FBM_DYNAMIC_MAPPING -DCC_JPEG_FBM_DYNAMIC_MAPPING -DCC_UBOOT_MINIGUNZIP_SUPPORT -DCC_ENABLE_SEAMLESS_FOR_2D -DCC_ENABLE_SEAMLESS_FOR_MVC -DCC_SECURE_BOOT_WO_RAMDISK -DCC_SUPPORT_2STC -DDLM_USE_AES_MODE -DCC_DLM_V2 -DDLM_SHA_256 -DDLM_GCPU_SHA_256 -DDLM_USE_GCPU_AES -DUPGRADE_PARTITION_NO_FS -DDLM_USE_LARGE_BUFFER -DCC_ENABLE_SEAMLESS_FOR_MVC -DSYS_ANDROID_TV_TIF_SUPPORT -DCECNFY5VSTATUS -DMW_FAKE_THREAD -DCC_LOADER_LOGO_SUPPORT -DCC_SUPPORT_BL_DLYTIME_CUT -DCC_LOADER_LOGO_LONG_TIME -DCC_EMMC_UPGRADE_SUPPORT -DCC_SDMMC_EMMC_SUPPORT_USB_RECOVERY -DCC_MTD_ENCRYPT_SUPPORT -DCC_MSDC_AES_SUPPORT -DCC_UBOOT_QUIET_BOOT -DNDEBUG -DCC_KERNEL_NO_LOG -DOSAI_FOR_NUCLEUS -DLOADER_USB_UPGRADE -DAUTO_USB_UPGRADE_ENABLE=1 -DCC_DUALLOADER_SUPPORT -DCC_SUPPORT_STR -DCC_SUPPORT_STR_CORE_OFF -DCC_SUPPORT_STR_TEMP -DCC_SUPPORT_STR_DEBUG -DCC_STR_ONOFF_TEST_ENABLE -DTIME_MEASUREMENT -DLINUX_NAND_USE_SDM -DCC_NETFLIX_CMPB_SUPPORT -DNETFLIX_SUPPORT -DCC_NETFLIX_CE3_SUPPORT -DCC_FBM_TWO_FBP -DCC_SECOND_B2R_SUPPORT -DCC_SUPPORT_PRINT_MEM_INFO -DLINUX_TURNKEY_SOLUTION -DKEY_FROM_DFB -DSUPPORT_FLASH_PQ -DSUPPORT_FLASH_AQ -DADSP_BIN_SUPPORT -DCC_USE_2TB_EMMC -DCC_ENABLE_SKB -DCC_MSDC_ENABLE -DCC_EMMC_BOOT -DSN_FLASH_UBOOT_ENV=mmcblk0p3 -DTUNER_SUPPORT_MULTI_SYS_TV -DSUPPORT_MULTI_SYSTEM -DCC_H264_SUPPORT -DCC_IPV6_SUPPORT -DJPG_ENABLE -DCC_H264_SUPPORT -DENABLE_MULTIMEDIA -DTIME_SHIFT_SUPPORT -DSYS_RECORD_SUPPORT -DCC_AUD_MMP_FULL_SUPPORT -DCC_OSD_USE_FBM -DCHIP_SPEC_SUPPORT -DCC_DISABLE_BASIC_PART -DCC_FLIP_MIRROR_SUPPORT -DCC_FLIP_MIRROR_FROM_EEPROM -DCC_FLIP_ENABLE -DCC_FLIP_MIRROR_SUPPORT -DCC_FLIP_MIRROR_FROM_EEPROM -DCC_MIRROR_ENABLE -DCC_SUPPORT_4K2K -DCC_FBM_SUPPORT_4K2K -DSUPPORT_HDMI_YCBCR444 -DCC_4K2K_PHOTO_TO_VDO_BUFFER -DSUPPORT_3D_EXT_COMP_TRL=1 -DCC_VDEC_RM_SUPPORT -DCC_SUPPORT_VDEC_PREPARSE -DCC_SUPPORT_NPTV_SEAMLESS -DCC_SUPPORT_HDMI_FBOOTING -DCC_HDMI_ARC_SPDIF_CTRL -DCECNFY5VSTATUS -DCC_FBM_SUPPORT_DMXPID -DCC_3RD_RO -DANDROID -DCC_MIXSOUND_GAIN_NOT_SYNC_WITH_VOL -DCC_EMMC_ERASE_SIZE_ALIGNMENT_1M -DIMGDRV_ANDROID -DCC_ENABLE_ADECOMX -DCC_ENABLE_VDECOMX -DCC_ENABLE_VENCOMX -DVDEC_YUV_CVT_IMG -DCC_VOMX_TV_COEXIST -DCC_SECOND_B2R_SUPPORT -DCC_ENABLE_ADECOMX -DCC_SSIF_SUPPORT -DCC_3D_MM_DS_SUPPORT -DCC_SUPPORT_VSS -DCC_ENABLE_REBOOT_REASON -DANDROID_TOOLCHAIN -DCC_ANDROID_REBOOT -DCC_PDWNC_REBOOT_NOTIFY -DANDROID_TWO_WORLDS -DCC_ANDROID_TWO_WORLDS -DCC_SUPPORT_DYNAMIC_ENABLE_DFB_INPUTEVENT -DCC_SUPPORT_MTK_ANDROID_RM -DCC_SECURE_BOOT_V3 -DCC_SECURE_BOOT_SCRAMBLE -DCC_PRELOADER2_ENABLE -DCC_LOADER_VER_CHECK -DCC_MTAL_MULTIPROCESS_CALLBACK -DCC_SUPPORT_WIFI -DGAM_SUPPORT -DCC_FILMMAKER_MODE_SUPPORT -DENERGY_MODE_SUPPORT -DCC_SONYDEMOD_CXD2842 -DSONY_DEMOD_CRYSTAL_41M -DCC_EXTERNAL_DEMOD -DSUPPORT_USB30 -DCC_CONFIG_IRRX_COMMON_DRIVER_DTV -DDRV_IF_EU -DCC_NAV_DEMOD_DVBT -DCC_NAV_SCART -DUSE_ATD_IF_DEMOD -DCC_DVBT_SUPPORT -DCC_USE_MTAL -DCC_USB_SUPPORT_HUB -DCC_AUD_PWM_SAWLESS_PLL_EN -DCC_AUD_DVBT_SUPPORT -DCC_AUD_ENABLE_PLAY_MUTE_CONTROL -DCC_AUD_SILENCE_SUPPORT -DCC_MT5391_AUD_3_DECODER -DCC_MT5391_AUD_MW_AUTO_CTRL -DCC_AUD_4_DECODER_SUPPORT -DCC_AUD_DATASRAM -DCC_AUD_MIXSOUND_SUPPORT -DCC_AUD_HDMI_PARSER_2_0_SUPPORT -DCC_AUD_HDMI_PARSER_3_0_SUPPORT -DCC_AUD_SUPPORT_DUAL_DSP -DCC_AUD_DISABLE_2ND_DSP -DCC_AUD_DISABLE_2ND_DSP -DCC_AUD_ENLARGE_APROC_DRAM -DCC_AUD_ARM_SUPPORT -DCC_AUD_ARM11_SUPPORT -DCC_AUD_ARM_RENDER -DCC_AUD_RISCIEC_SUPPORT -DCC_AUD_RISCAOUT_SUPPORT -DCC_AUD_AOUT_128_SUPPORT -DCC_AUD_DSP_EU_MODEL -DCC_AUD_HP_DEPOP -DCC_AUD_RISCIEC_SUPPORT -DCC_AUD_RISCAOUT_SUPPORT -DCC_AUD_AOUT_128_SUPPORT -DCC_AUD_DOLBY_SUPPORT_MS12 -DCC_AUD_DOLBY_SUPPORT_MS12v2 -DCC_AUD_DOLBY_SUPPORT_MS12B -DCC_AUD_DOLBY_SUPPORT_DAPv2 -DCC_AUD_DOLBY_SUPPORT_MS12_RISCENC -DCC_AUD_CPUENC_SUPPORT -DCC_AUD_DOLBY_SUPPORT_DDC -DCC_AUD_DOLBY_SUPPORT_DDT -DCC_AUD_DTSM6 -DCC_AUD_NCSTOOL_SUPPORT -DCC_AUD_DSP_SUPPORT_MIXSOUND_MEMPLAY -DCC_AUD_DATA_UPLOAD_SUPPORT -DCC_AUD_SUPPORT_MS10 -DCC_AUD_SUPPORT_SPDIF_V20 -DCC_AUD_SUPPORT_NEW_TUNNEL_MODE -DCC_AUD_ENABLE_INTERNAL_LDO -DCC_SUPPORT_OD -DCC_PMIC_RICHTEK -DCC_ARM_GIC -DCC_ARM_TIMER -DNAV_CONFIG_FILE=config/nav_config_Oryx_m1v1.h -DCC_MT5893 -D_CPU_LITTLE_ENDIAN_ -DI1394_DRV_ONLY -DCC_SCPOS_EN -DCC_SRM_ON -DCC_53XX_SWDMX_V2 -Wall -Wno-format -DMT53XX_OSAI_MODULE -DMT53XX_FB_MODULE -DCC_DYNAMIC_POWER_ONOFF -DNDEBUG -Wno-unused-value -pipe -DONE_BINARY_REGION -DAPP_SEPARATE_INP_SRC_FOR_ATV_DTV -DCC_CI_PLUS_ECP_MI_SVP_SUPPORT -DCC_CI_PLUS_V20_SUPPORT -DCC_DVBT_SUPPORT -DCC_INTERNAL_CI -DCC_OPTEE_WITH_PVRKEY -DCC_PVR_PLAYBACK_USE_AESDMA -DCI_PLUS_IP_STRM_SUPPORT -DCI_PLUS_SUPPORT -DSYS_OAD_SUPPORT -DSYS_OVERRIDE_DISP_REGION_SUPPORT -DDVBT_CI_ENABLE': not a valid identifier Ubuntu OS=Ubuntu-18.04-x86_64 PATH=/home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/out/host/linux-x86/bin:/home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/vendor/mediatek/tv/tools/binary/open/build-tools:/home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/vendor/mediatek/tv/tools/binary/open/build-tools/1804:/home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/vendor/mediatek/tv/tools/binary/open/build-tools/1804/usr/bin:/mtkeda/dtv/cluster/odb:/home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/prebuilts/build-tools/path/linux-x86:/home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/out/.path ANDROID_BUILD_PATHS= ANDROID_TOP=/home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5 OS=Ubuntu-18.04-x86_64 make: Entering directory `/home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/vendor/mediatek/tv/kernel/5.15_14' make[1]: Entering directory `/home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/out/target/product/khandala/KERNEL_OBJ_5.15' CC [M] /home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/out/target/product/khandala/obj/KERNEL_MODULES/mwgifker.ko_intermediates/BUILT/middleware/zlib/adler32.o CC [M] /home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/out/target/product/khandala/obj/KERNEL_MODULES/mwgifker.ko_intermediates/BUILT/middleware/zlib/crc32.o CC [M] /home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/out/target/product/khandala/obj/KERNEL_MODULES/mwgifker.ko_intermediates/BUILT/middleware/zlib/inffast.o CC [M] /home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/out/target/product/khandala/obj/KERNEL_MODULES/mwgifker.ko_intermediates/BUILT/middleware/zlib/inflate.o CC [M] /home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/out/target/product/khandala/obj/KERNEL_MODULES/mwgifker.ko_intermediates/BUILT/middleware/zlib/inftrees.o CC [M] /home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/out/target/product/khandala/obj/KERNEL_MODULES/mwgifker.ko_intermediates/BUILT/middleware/zlib/uncompr.o CC [M] /home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/out/target/product/khandala/obj/KERNEL_MODULES/mwgifker.ko_intermediates/BUILT/middleware/zlib/zutil.o CC [M] /home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/out/target/product/khandala/obj/KERNEL_MODULES/mwgifker.ko_intermediates/BUILT/middleware/png/png.o CC [M] /home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/out/target/product/khandala/obj/KERNEL_MODULES/mwgifker.ko_intermediates/BUILT/middleware/png/pngget.o CC [M] /home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/out/target/product/khandala/obj/KERNEL_MODULES/mwgifker.ko_intermediates/BUILT/middleware/png/pngmem.o CC [M] /home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/out/target/product/khandala/obj/KERNEL_MODULES/mwgifker.ko_intermediates/BUILT/middleware/png/pngread.o CC [M] /home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/out/target/product/khandala/obj/KERNEL_MODULES/mwgifker.ko_intermediates/BUILT/middleware/png/pngrio.o CC [M] /home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/out/target/product/khandala/obj/KERNEL_MODULES/mwgifker.ko_intermediates/BUILT/middleware/png/pngrtran.o CC [M] /home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/out/target/product/khandala/obj/KERNEL_MODULES/mwgifker.ko_intermediates/BUILT/middleware/png/pngrutil.o CC [M] /home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/out/target/product/khandala/obj/KERNEL_MODULES/mwgifker.ko_intermediates/BUILT/middleware/png/pngset.o CC [M] /home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/out/target/product/khandala/obj/KERNEL_MODULES/mwgifker.ko_intermediates/BUILT/middleware/png/pngtrans.o CC [M] /home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/out/target/product/khandala/obj/KERNEL_MODULES/mwgifker.ko_intermediates/BUILT/middleware/png/readpng.o CC [M] /home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/out/target/product/khandala/obj/KERNEL_MODULES/mwgifker.ko_intermediates/BUILT/msapi_bmp_decoder.o CC [M] /home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/out/target/product/khandala/obj/KERNEL_MODULES/mwgifker.ko_intermediates/BUILT/msapi_gif_decoder.o CC [M] /home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/out/target/product/khandala/obj/KERNEL_MODULES/mwgifker.ko_intermediates/BUILT/msapi_png_decoder.o CC [M] /home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/out/target/product/khandala/obj/KERNEL_MODULES/mwgifker.ko_intermediates/BUILT/msapi_stillimage_bm.o CC [M] /home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/out/target/product/khandala/obj/KERNEL_MODULES/mwgifker.ko_intermediates/BUILT/msapi_stillimage_dataio_file.o CC [M] /home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/out/target/product/khandala/obj/KERNEL_MODULES/mwgifker.ko_intermediates/BUILT/msapi_stillimage_dlmalloc.o /home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/vendor/mediatek/tv/misdk/stbmsapi/gif/msapi_gif_decoder.c:388:9: warning: mixing declarations and code is a C99 extension [-Wdeclaration-after-statement] U8* ret = NULL; ^ /home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/vendor/mediatek/tv/misdk/stbmsapi/gif/msapi_gif_decoder.c:1195:25: warning: mixing declarations and code is a C99 extension [-Wdeclaration-after-statement] U16 u16bgColor = RGB8888_TO_1555(((pstGIFInfo[u32ObjNum]->gif89.transparent != - 1) ? 0 : 1), ^ /home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/vendor/mediatek/tv/misdk/stbmsapi/gif/msapi_gif_decoder.c:1230:29: warning: mixing declarations and code is a C99 extension [-Wdeclaration-after-statement] S32 rowstride_prev_prev_frame = 0; ^ /home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/vendor/mediatek/tv/misdk/stbmsapi/gif/msapi_gif_decoder.c:1163:24: warning: mixing declarations and code is a C99 extension [-Wdeclaration-after-statement] GIF_FRAME* prev_frame; ^ /home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/vendor/mediatek/tv/misdk/stbmsapi/gif/msapi_gif_decoder.c:1450:9: warning: mixing declarations and code is a C99 extension [-Wdeclaration-after-statement] S32 i; ^ /home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/vendor/mediatek/tv/misdk/stbmsapi/gif/middleware/png/pngrutil.c:1825:10: warning: misleading indentation; statement is not part of the previous 'else' [-Wmisleading-indentation] Dapi_png_ptr->iwidth = (Dapi_png_ptr->width + Dapi_png_pass_inc[Dapi_png_ptr->pass] - 1 - Dapi_png_pass_start[Dapi_png_ptr->pass]) / ^ /home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/vendor/mediatek/tv/misdk/stbmsapi/gif/middleware/png/pngrutil.c:1822:7: note: previous statement is here else ^ /home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/vendor/mediatek/tv/misdk/stbmsapi/gif/msapi_gif_decoder.c:2252:10: warning: mixing declarations and code is a C99 extension [-Wdeclaration-after-statement] BOOL bPhase2; ^ /home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/vendor/mediatek/tv/misdk/stbmsapi/gif/msapi_png_decoder.c:658:9: warning: mixing declarations and code is a C99 extension [-Wdeclaration-after-statement] U32 u32Remainder, u32Copied = 0;; ^ 1 warning generated. 1 warning generated. 6 warnings generated. LD [M] /home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/out/target/product/khandala/obj/KERNEL_MODULES/mwgifker.ko_intermediates/BUILT/mwgifker.o MODPOST /home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/out/target/product/khandala/obj/KERNEL_MODULES/mwgifker.ko_intermediates/BUILT/Module.symvers FATAL: modpost: parse error in symbol dump file make[2]: *** [/home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/out/target/product/khandala/obj/KERNEL_MODULES/mwgifker.ko_intermediates/BUILT/Module.symvers] Error 1 make[1]: *** [modules] Error 2 make[1]: Leaving directory `/home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/out/target/product/khandala/KERNEL_OBJ_5.15' make: *** [__sub-make] Error 2 make: Leaving directory `/home/zhouzheng/MT9629_r2u_002/mtk_rls_ref5/vendor/mediatek/tv/kernel/5.15_14'
07-04
基于STM32 F4的永磁同步电机无位置传感器控制策略研究内容概要:本文围绕基于STM32 F4的永磁同步电机(PMSM)无位置传感器控制策略展开研究,重点探讨在不依赖物理位置传感器的情况下,如何通过算法实现对电机转子位置和速度的精确估计与控制。文中结合嵌入式开发平台STM32 F4,采用如滑模观测器、扩展卡尔曼滤波或高频注入法等先进观测技术,实现对电机反电动势或磁链的估算,进而完成无传感器矢量控制(FOC)。同时,研究涵盖系统建模、控制算法设计、仿真验证(可能使用Simulink)以及在STM32硬件平台上的代码实现与调试,旨在提高电机控制系统的可靠性、降低成本并增强环境适应性。; 适合人群:具备一定电力电子、自动控制理论基础和嵌入式开发经验的电气工程、自动化及相关专业的研究生、科研人员及从事电机驱动开发的工程师。; 使用场景及目标:①掌握永磁同步电机无位置传感器控制的核心原理与实现方法;②学习如何在STM32平台上进行电机控制算法的移植与优化;③为开发高性能、低成本的电机驱动系统提供技术参考与实践指导。; 阅读建议:建议读者结合文中提到的控制理论、仿真模型与实际代码实现进行系统学习,有条件者应在实验平台上进行验证,重点关注观测器设计、参数整定及系统稳定性分析等关键环节。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值