주요 콘텐츠

이 페이지는 기계 번역을 사용하여 번역되었습니다. 영어 원문을 보려면 여기를 클릭하십시오.

ARM Cortex-Mx 프로세서에서 실행 파일을 빌드하고 실행하기

R2026b

Simulink® 모델을 구성하고, 실행 파일을 빌드한 다음, ARM® Cortex®-M3/M4/M55/M7 QEMU 에뮬레이터에서 해당 실행 파일을 실행합니다.

Download and Install QEMU Emulator에 설명된 대로 QEMU 에뮬레이터를 다운로드하여 설치했는지 확인하십시오.

  1. ARM Cortex-Mx 프로세서용 모델 구성에 설명된 대로 모델을 구성하십시오.

  2. 하드웨어 탭으로 이동합니다. 빌드, 배포, 시작 드롭다운 메뉴에서 빌드 버튼을 선택하십시오. 이 작업은 모델을 기반으로 코드를 생성하고, .elf 파일을 빌드한 다음, 생성된 .elf 파일을 QEMU 에뮬레이터에서 실행합니다.

    Simulink Hardware tab showing the Build, Deploy, and Start menu with the Build option selected to generate and run code.

    이 소프트웨어는 MATLAB® 진단 뷰어에서 빌드 프로세스의 상태를 표시합니다. QEMU가 실행되고, 생성 코드가 에뮬레이터에서 실행되기 시작합니다.

    예를 들면 다음과 같습니다.

    ### Created: ../untitled1.elf
    ### Invoking postbuild tool Binary Converter ...
    arm-none-eabi-objcopy -O binary ../untitled1.elf ../untitled1.bin
    ### Done invoking postbuild tool.
    ### Invoking postbuild tool Hex Converter ...
    arm-none-eabi-objcopy -O ihex ../untitled1.elf ../untitled1.hex
    ### Done invoking postbuild tool.
    ### Invoking postbuild tool Executable Size ...
    arm-none-eabi-size ../untitled1.elf
       text	   data	    bss	    dec	    hex	filename
       2328	     20	   2136	   4484	   1184	../untitled1.elf
    ### Done invoking postbuild tool.
    ### Successfully generated all binary outputs.
    QEMU가 텍스트가 없는 창을 엽니다. QEMU가 에뮬레이션 세션을 실행하는 동안 이 창은 계속 열려 있습니다.

    QEMU emulator window launched while the generated executable runs on the emulated ARM Cortex‑M processor.

  3. QEMU 에뮬레이터에서 .elf 파일을 중지하려면 다음 MATLAB 구문을 사용하십시오:

    codertarget.arm_cortex_m.stopQemu(pid)

    명령에서 pid를 앞의 상태 메시지에 표시된 PID 번호로 대체하십시오. 예를 들어, MATLAB 명령 창에서 다음을 입력합니다:

    codertarget.arm_cortex_m.stopQemu(8500)
    

    MATLAB 명령 창에는 에뮬레이터 세션의 상태가 표시됩니다. 예를 들면 다음과 같습니다.

    Terminated QEMU process with PID 8500.
    

참고

ARM Cortex-M 프로세서용으로 생성된 코드는 Mac OS X에서 실행할 수 없습니다.

QEMU 에뮬레이터를 사용하여 MATLAB에서 생성 코드를 수동으로 실행하기

다음 MATLAB 구문을 사용하여 QEMU 에뮬레이터에서 .elf 파일을 수동으로 실행하십시오.

pid = codertarget.arm_cortex_m.runQemu('modelname.elf')

modelname.elf를 앞의 상태 메시지에 표시된 .elf 파일 이름으로 바꾸십시오. 예를 들어, MATLAB 명령 창에서 다음을 입력합니다:

pid = codertarget.arm_cortex_m.runQemu('untitled1.elf')

MATLAB 명령 창에는 에뮬레이션 세션의 프로세스 ID(PID)가 표시됩니다. 예를 들면 다음과 같습니다.

### Downloading application...untitled1.elf
Started new QEMU process with PID 8500.

pid =

        8500
QEMU가 텍스트가 없는 창을 엽니다. QEMU가 에뮬레이션 세션을 실행하는 동안 이 창은 계속 열려 있습니다.

QEMU emulator window launched while the generated executable runs on the emulated ARM Cortex‑M processor.