Bin
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # 論文紀錄 --- :::info ## Goal - 在 兩顆 OR1200 CPU 的 URduino FPGA 板子上執行自己的 "多核心作業系統"。 ::: --- ## 單核 & 多核 作業系統考量的差異 - 多核需要比單核多用到那些機制? - 中斷後每個 CPU 的 Tick 是否會相同? - 多核心獨立運作以及一起運作的差異? - 如果有兩顆 CPU 那一個 CPU 一個 Main 檔,每個 CPU 跑自己的 TASK,那有關需要用到同一個 "腳位" 等等問題時,控制模式是什麼? - 如果一個 Main 檔沒有 Create Task,OS 一樣可以 Work 嗎? - 中斷都給同一個 CPU 和分配給兩個 CPU 的差異? - 決定哪顆 CPU 執行中斷之後,另外一顆 CPU 會先繼續執行他自己的工作嘛? - 在 Context Switch 時,有與沒有 PageTable 的差別 ? ( Switch Process,Task ) --- ## 多核心需要的重點 - BootMain , BootOther 的必要性。 - 分配中斷(System Call,Exception,Interrupt)給 CPU (xv6 中的 trap()) - 成大接手的程式碼也可以跑多核心,XV6 也是跑多核心,那兩者一樣都可以跑,那差異到底再哪? - 因為用到多核心以及 Shared Memory ,在 Kernal 中需要使用 Lock 來做保護機制,在 Lock 的使用上必須謹慎小心。 --- ## 細節 - 受限於硬體設計 : xv6 中使用 xchg (Intel 獨有指令) 組語指令告知其他CPU他已準備好,大家可以啟動了,我再 or1200 中要用什麼方式? - Spin Lock 撰寫程式的使用該如何? - 中斷中做的事越少越好要怎麼修改? 【 UrSwitchContext()、UrTimeDispos() 】 --- ## 前綴工作 1. [閱讀 OpenRISC 1000](https://openrisc.io/or1k.html) 2. [閱讀 OpenRISC 1200](ftp://ftp.gwdg.de/pub/misc/opencores/cores/or1k/openrisc1200_spec.pdf) 3. [閱讀 WISHBONE](https://hackmd.io/LD3cRQV2TJWKW3Vwpw-Quw) 4. [閱讀 FreeRTOS](https://hackmd.io/1pUKb29sScGbs9RO6UU3tA) 5. [閱讀 XV6](https://hackmd.io/F9yPrBCeRFy8HBf_xa20Ow) --- ## Step 1 : 摸索 [URrduino 摸索筆記](https://hackmd.io/MYFg7CCmBmAmsFpoE4zQVAjAIwdgbJAMwLwAcAhvgKzAUQghA===#urrduino-%E6%91%B8%E7%B4%A2%E7%AD%86%E8%A8%98) --- ## Step 2 : 設置 Shared Memmory [設置 Shared Memmory (20180126 Meeting)](https://hackmd.io/ySAOnEdaRfKhk4spnAUs5g?view) --- ## Step 3 : 自製 OS - UrOS [自製 OS - UrOS (20180129 Meeting)](https://hackmd.io/9A5fl3lPRmqqMVEeTww9Sw) --- ## Step 4 : 替換成新的 OS 並測試單核心 [替換成新的 OS 並測試單核心基本 Context Switch](https://hackmd.io/wiebVQ5PRN-zb0D1q5eu-Q) --- ## Step 5 : 修改 Link Script (與 Step 4 同時進行) - 設定記憶體到 Shared Memory 區域使得兩顆 CPU 皆看的到 :::info - 為了燒入時只要燒錄到 1 顆 CPU 即可兩顆 CPU 互相排程,但 Task Code 會放在被燒錄 CPU (Core 0) 的記憶體區間當中,此時當另一顆 CPU (Core 1) Context Switch 發生時,要運行在 CPU (Core 0) 記憶體區間中的程式碼所以無法正常運行。 - 記憶體區間 ( SRAM ) - Core 0 : 0x00000~0x38000 - Core 1 : 0x38000~0x70000 ::: --- | Problem | File | Solution | | -------- | -------- | -------- | | 如何將 Function Code 放至指定記憶體 | arch/link_build_sys.ld | [SolutionURL](http://forum.andestech.com/viewtopic.php?f=23&t=183) | | 如何放至指定記憶體 以及 得到 Link Script Symbol | arch/link_build_sys.ld | [SolutionURL](https://mcuoneclipse.com/2016/11/01/getting-the-memory-range-of-sections-with-gnu-linker-files/) | | 只要將 Task Main Code 放在 .bss 的 Section 之後就會當掉 | arch/link_build_sys.ld | 依照下列接續 Debug | | Debug : 在開機程式測試在哪裡不 Work | arch/reset.S | [Debug Detail](https://hackmd.io/EbAcHYGYFNkhaAZtAnI+AWUAGa9QDGwAbPEQTIqNACYrHBA=#Debug-%EF%BC%9A-%E5%9C%A8%E5%93%AA%E5%80%8B%E7%92%B0%E7%AF%80%E5%87%BA%E9%8C%AF%E4%BD%BF%E5%BE%97%E8%BC%B8%E5%87%BA%E4%B8%8D%E4%BA%86%E6%96%87%E5%AD%97) | | Debug2 : 修改 Verilog | addr_decoder.v/memory_manager.v | [Debug2 Detail](https://hackmd.io/2uVnj8ihRUyjp7HsMderHg#Debug2-Detail) | | Debug3 : 生成組語檔案 | Makefule_ | [Debug3 Detail](https://hackmd.io/Nlq9qUbvQGyZ2XzUiZVpEA#Debug3--%E7%94%9F%E6%88%90%E7%B5%84%E8%AA%9E%E6%AA%94%E6%A1%88) | | Debug4 : 觀察組語檔 | rtosdemo.dis | [Debug4 Detail](https://hackmd.io/SeXZ7OtsQ3GI3G8BBzr4Mg#Debug4-Detail) | - [最終 Link Script 檔](https://hackmd.io/e-XsRjdTQj-sXSo1YzHW6g) - [產生之 Memory Map](https://hackmd.io/Wz1wnSm4TIOYUUW6BAXhEA) --- ## Step 6 : OS All Function Test [OS All Function Test](https://hackmd.io/xyNpjI_iQeuyiVfje3c3-A?both) :::warning - 強制轉換記憶體位置會跑掉 ::: --- ## 20180315 Meeting ( Detail in Step 6 ) - [x] 需新增 Current Tick ( Time Slice ) > [time=Sat, Mar 21, 2018] - [x] Ready Queue 一個 Priority 一條 (搜尋比較快) & Delay Queue 改成 Tick 小的在前面 > [time=Sat, Mar 21, 2018] - [ ] Idle Task 執行 Yield ( Garbage Collection ) - [ ] 都完成後用中斷去測試 --- ## 20180322 Meeting 報告實作進度,完成新增 Current Tick 以及 一個 Priority 一條 Queue。 ---

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully