10.07.2015 Views

PDF version - ARM Information Center

PDF version - ARM Information Center

PDF version - ARM Information Center

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

임베디드 소프트웨어 개발예제 3-6 스택 포인터 초기화; ***************************************************************; This example does not apply to <strong>ARM</strong>v6-M and <strong>ARM</strong>v7-M profiles; ***************************************************************Len_FIQ_Stack EQU 256Len_IRQ_Stack EQU 256stack_base DCD 0x18000;Reset_Handler; stack_base could be defined above, or located in a scatter fileLDR R0, stack_base ;; Enter each mode in turn and set up the stack pointerMSR CPSR_c, #Mode_FIQ:OR:I_Bit:OR:F_Bit ; Interrupts disabledMOV sp, R0SUB R0, R0, #Len_FIQ_StackMSR CPSR_c, #Mode_IRQ:OR:I_Bit:OR:F_Bit ; Interrupts disabledMOV sp, R0SUB R0, R0, #Len_IRQ_StackMSR CPSR_c, #Mode_SVC:OR:I_Bit:OR:F_Bit ; Interrupts disabledMOV sp, R0; Leave processor in SVC mode예제 3-6에서는 FIQ 및 IRQ (인터럽트 요청) 모드에 대해 256바이트의 스택을 할당하지만 다른 실행 모드에 대해서도 동일하게 할당할 수 있습니다. 스택 포인터를 설정하려면 인터럽트가 비활성화된 상태에서 각 모드로 전환하고 스택 포인터에 적절한 값을 할당합니다.리셋 처리기에서 설정된 스택 포인터 값은 C 라이브러리 초기화 코드에 의해__user_initial_stackheap () 에 매개변수로 자동 전달됩니다. 따라서__user_initial_stackheap () 으로 이 값을 수정하지 않아야 합니다.3.5.5 하드웨어 초기화참고이 단원은 <strong>ARM</strong>v6-M 및 <strong>ARM</strong>v7-M 프로필에는 적용되지 않습니다.일반적으로 모든 시스템 초기화 코드는 주 응용 프로그램에서 분리하는 것이 좋습니다. 그러나 캐시 및 인터럽트 활성화와 같은 몇 가지 시스템 초기화 구성요소는 C 라이브러리 초기화 코드를 실행한 후에 수행되어야 합니다.3-20 Copyright © 2002-2008 <strong>ARM</strong> Limited. All rights reserved. <strong>ARM</strong> DUI 0203IKNon-Confidential

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!