找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開(kāi)始

搜索
查看: 4498|回復(fù): 0
打印 上一主題 下一主題
收起左側(cè)

IAR與STM32上移植uC/OS II時(shí)0x1000000內(nèi)存溢出錯(cuò)誤已解決,不知道原因

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
ID:89763 發(fā)表于 2015-9-10 00:50 | 只看該作者 回帖獎(jiǎng)勵(lì) |倒序?yàn)g覽 |閱讀模式
編譯鏈接都能通過(guò),但是在simulator里面就是一直有錯(cuò)誤。

lcf文件的設(shè)置采用系統(tǒng)默認(rèn)的.intvec start 0x08000000;

內(nèi)存ROM劃分:從0x08000000開(kāi)始


調(diào)試了幾天都出現(xiàn)這個(gè)錯(cuò)誤:0x1000000內(nèi)存溢出的錯(cuò)誤。


uC/OS II運(yùn)行到這里出現(xiàn)的如上錯(cuò)誤:
;********************************************************************************************************
;                                         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


終于通過(guò)修改vector table和ROM地址從 0x00000000開(kāi)始,程序可以正常跑了。


還不知道原因,后續(xù)還要仔細(xì)看下芯片手冊(cè)。
分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享淘帖 頂 踩
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表