标题: IAR与STM32上移植uC/OS II时0x1000000内存溢出错误已解决,不知道原因 [打印本页]

作者: liuzhu    时间: 2015-9-10 00:50
标题: IAR与STM32上移植uC/OS II时0x1000000内存溢出错误已解决,不知道原因
编译链接都能通过,但是在simulator里面就是一直有错误。

lcf文件的设置采用系统默认的.intvec start 0x08000000;

内存ROM划分:从0x08000000开始


调试了几天都出现这个错误:0x1000000内存溢出的错误。


uC/OS II运行到这里出现的如上错误:
;********************************************************************************************************
;                                         START MULTITASKING
;                                      void OSStartHighRdy(void)
;
; Note(s) : 1) This function triggers a PendSV exception(essentially, causes a context switch) to cause
;             the first task to start.
;
;          2) OSStartHighRdy() MUST:
;             a) Setup PendSV exception priority to lowest;
;             b) Set initial PSP to 0, to tell context switcher this is firstrun;
;             c) Set OSRunning to TRUE;
;             d) Trigger PendSV exception;
;             e) Enable interrupts (tasks will run with interruptsenabled).
;********************************************************************************************************

OSStartHighRdy
   LDR    R0,=NVIC_SYSPRI14                                 ; Set the PendSV exception priority
   LDR    R1, =NVIC_PENDSV_PRI
   STRB    R1,[R0]

   MOVS    R0,#0                                             ; Set the PSP to 0 for initial context switch call
   MSR    PSP, R0

   LDR    R0,=OSRunning                                     ; OSRunning = TRUE
   MOVS    R1,#1
   STRB    R1,[R0]

   LDR    R0,=NVIC_INT_CTRL                                 ; Trigger the PendSV exception (causes context switch)
   LDR    R1, =NVIC_PENDSVSET
   STR    R1, [R0]

   CPSIE  I                                                  ; Enable interrupts at processor level

OSStartHang
   B      OSStartHang                                        ; Should never get here


终于通过修改vector table和ROM地址从 0x00000000开始,程序可以正常跑了。


还不知道原因,后续还要仔细看下芯片手册。





欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1