Andes Workshop

It is currently Wed Nov 21, 2018 9:26 pm

All times are UTC + 8 hours [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: 改變ivb位址的example
PostPosted: Wed Aug 01, 2012 5:18 pm 
Offline
User avatar

Joined: Fri Mar 04, 2011 9:36 pm
Posts: 500
分享一個改變ivb位址的example 。

一般的程式,有1個vector table。

這個程式有2個vector table。
Andes cpu中的IVBASE是可以改變的。
這個程式裡設計有2個vector table,
1個在0x0,另一個在0x10000。

請看程式裡的readelf,
0x0裡的是.nds32_init,原本的vector table。
0x10000裡的是.nds32_vector2,新的vector table。

簡介做法如下:
(1)我多做一個新的vector table .nds32_vector2,放在crt1.S裡,
它的內容大致上是抄ctr0.S的內容。
只是ISR不同。

(2)要在linker script裡指定.nds32_vector2的位址。
Code:
  .nds32_vector2 ORIGIN(SDRAM) : { KEEP(*(.nds32_vector2)) } > SDRAM


(3)crt0.S裡,我把IVB和ESZ改掉。
IVB改成0x10000,ESZ改成4 bytes。
剛才這裡我debug找了很久,後來我發現ESZ的default值是16 bytes,
與我的程式不符,所以它一直跳錯地址。
Code:
! change IVB
    mfsr $r0, $ir3
    li  $r1, 0x10000
    or $r0,$r1,$r0
    mtsr $r0, $ir3
! set EZS of IVB to 0
    mfsr $r0, $ir3
    li  $r1, 0xFFFF3FFF
    and $r0,$r1,$r0
    mtsr $r0, $ir3
! jump to new _start1
    li  $r1, 0x10000
    jr $r1


(4) 程式執行結果:
Attachment:
result.png
result.png [ 6.31 KiB | Viewed 4668 times ]


(註:上面的
* ========== new HW0_ISR1 ========== *
* ==========End of HW0 ISR it takes 6 secs ==========*
這2行,是我按下GPIO按鈕後才會有的字)
Attachment:
demo-int.zip [104.88 KiB]
Downloaded 430 times


Top
 Profile Send private message E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 132 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group