MCU單晶片韌體設計

2016年10月23日 星期日

Robomong --MongoDB 前端資料庫管理界面



MongoDB – Allow remote access


MongoDB 預設只允許local (127.0.0.1) 連入操作, 改成可以遠端可以操作

(1) sudo vim /etc/mongod.conf

把 bindIp 改成 0.0.0.0 

(2) 修改後要重新啓動MongoDB

sudo service mongod restart






在 netstat 可以看到 Port 27017 在 Listen

tcp   0   0 0.0.0.0:27017           0.0.0.0:*    LISTEN



Note: 若有防火牆時, tcp port 27017 必須允許任可人連入





Robomong --MongoDB 前端資料庫管理界面


可以去下載 Robomong (https://robomongo.org/), 這是一個MongoDB 前端資料庫管理界面, 可以遠端連線到MongoDB Server上 



"Create" 新增連線", 右下方"connect" 連線到MognoDB

輸入MongoDB IP 及Port (預設27017) , 左下角有"Test"可以測試一下是否連線正常

點選你的collection, 顯示全部資料 (Documents)

選擇用Table 方式呈現

點選你的collection 按右鍵, 會顯示可以用的操作. 如Collection 更名、複製Collection、刪除Collection等, 也可以插入資料(Document)等

對Documents 中的欄位, 可以按右鍵進行文字編輯, 但須符合JSON格式 ,修改完後 "Save" 離開





How To Install MongoDB on Ubuntu 14.04










2016年10月15日 星期六

MDK-ARM (Keil uVision) +J-Link 進行開發

MDK-ARM (Keil uVision) +J-Link 進行開發



J-Link是ARM 針對Cortex-M 系列的MCU的Debugger 通用工具, 一般兩種界面,JTAG (5-wire)或SWD(2-wire),

現在大多使用後來的二線的SWD界面, 即SWDCLK及SWDIO, 一個作為clock線一個作為資料線, 類似I2C通訊方式。



J-Link 


From https://www.segger.com/


3.3V 和 GND 可以提供電源給開板子





GND, SWDCLK, SWDIO, 3.3V


Debugger設定使用J-Link 


要先安裝好J-link driver

以下說明針對J-Link SWD 的debug 方式

開啓Keil uVision , 在 Flash->Configure Flash Tools... 中, 選擇 Debug Tag 選擇, 選擇使用J-Link/J-TRACE Cortex, 並進入Setting, 在Adapter 的 port 要選擇SW而非JTAG。若此時有正確連接到Cortex-M板子, SW Device會出現訊息。







實際J-Link接線


(1) 板子電源也由J-link提供



(1) 板子電源另外由USB port 提供, J-Link僅作為SWDebug使用




(3) 接新唐NANO102SC2AN開發板 (Reset不用接)






J-Link OB

目前其實也有很多EVM 板子, 直接就附在板子上了(這樣才方便推廣晶片?!) 如STMFx系列(稱作ST-Link) 或新唐Nuvton 系列 (稱作Nu-Link)

Having a J-Link right on the eval board allows customers to fully use and test the target CPU, providing full debug capabilities. At the same time, the eval board can remain small and inexpensive (J-Link OB on eval board example). All features of the regular J-Link can be used, including download into Flash memory.



From https://www.segger.com/

相關連結:






2016年10月13日 星期四

在GitHub 建立Organizations


GitHub 上有種類型帳號


Personal User Account 與 Organization Account

Your user account is your identity on GitHub. Your user account can be a member of any number of organizations, regardless of whether the account is on a free or paid plan.

什麼是組織?

組織的目的就是方便對GitHub上進行階層性的程式碼管理。

可以在組織下長Repository,而不是個人帳號下長Repository。 建立組織後,可以邀請其他人加這個組織中。不同組織可以有自己的名稱,再由不同組織去長出一堆Repository。

組織的角色除了Owner以外, 就是成員(Member), Owner也可以有很多人。 Owner 可以可以邀請其他人加入這個組織, 並對不同成員給予不同的權限, 也可以指定某些成員變成組織的Owner。

成員的權限, 包含是否可以建立Repository或是可讀可寫(clone+push+pull)或僅能唯讀(clone+pull)。

組織中的人可以自由選擇離開這個組織,但一個組織至少得有一個人存在, 這個人就是Owner,
因為一個組織必須至少隸屬於某一個Owner帳號。倘若最後一個Owner也要離開此組織是不允許的, 你只能直接刪除組織。

建立組織的方式:

(1)  從申請的個人User帳號, 去建立一個組織(Organization),則此時這個Personal 帳號就是目前組織中唯一的owner,

(2)
從既有的User帳號(可能早已包含一堆Repository), 轉為組織 (前提是這User帳號不可以存在於任何組織中), GitHub會自動將原個人帳號所包含的全部Repository 掛在這個組織下。(小心!則此時Personal 帳號就無法再用了, 因為已經變成組織了, 所以你必須再轉換前, 事先申請好另一個GitHub帳號, 然後建立組織時, 把這個事先已申請來的帳號, 成為這個組織的Owner, 等於反過用這個帳號來管理這個從user變成組織的組織。

建構組織的流程

Step 1:Set up a personal account
Step 2:Set up the organization
Step 3:Invite members to organization

Personal user accounts

Every person who uses GitHub has their own user account. These accounts include:

Organizations

Organizations are great for businesses and large open-source projects that need multiple owners and admins. They include:
Organizations paid plan:

  1. Unlimited members and public repositories for free.
  2. Unlimited private repositories at $25/month for your first 5 users. $9/month for each additional user.

2016年10月12日 星期三

TortoiseGit與GitHub



Git 是一種分散式 Source code 管理系統, 相對於SVN , SVN 則是屬於Client/Server 架構.

在SVN 裡, 每一次的commit 都是送到Server的 Repository上, 而在Git 每一次commit 都是送到Local Repository , 若要分享每次變更的狀態, 則用git push  一次送到Remote Repository。如此相較於SVN, 版本更迭版頻率就不會太快,且每次commit 也不用連在網路上, 除非要push。





Remote Repository 可以選擇免費的Git Server平台, 如SourceforgeBitbucketGitHub, 可以自己先去申請一個帳號. 不過免費帳號是Public Repository, 任何人都可以找到並clone 你的專案, 若付費可以做成private Repository. (一個月大約是7美金, 以GitHub來說的話) 


Github


Git Client 端工具

Git Client 端工具也有很多, 因為過去已習慣使用TortoiseSVN 的界面, 所以使用Git, 也就使用
TortoiseGit。安裝方式,就是從頭到尾到只按"下一步" 就可以安裝完成。

使用TortoiseGit 必須要有 command line 的 git.exe , 故安裝TortoiseGit 須先行安裝 Git for Windows 2.0+

Tortoise 裝完後, 對資料匣按右鍵可以看到TortoiseGit 相關的工具選單



Git 和Remote Repository 有兩種溝通方式,可以使用 https 方式和 ssh 方式。
若使用SSH 會有RSA public/private key 要去產生及設定, 相對而言複雜許多.用 https 設定上其實簡單許多。 

常用的動作:


  • Git clone: 貼上GitHub上的"Clone With HTTPS"的網址, 即可獲得整個專案程式碼



與Local Repository 相關指令


  • git add : 於local repository 中,新增檔案/目錄 (staged)
  • git del :  於local repository 中,刪除檔案/目錄 (staged)
  • git commit : commit只發生在local repository, 並且會記錄在修改歷程記錄檔案中, 若要將此歷程記錄分享到Remote repository, 就執行git push
  • revert: 這個動作就如同 svn update (以Local Repository所記錄的狀態為更新還原的狀態)



與Remote Repository 有關指令


"Git Sync" : 使Local Repository和Remote Repository 達到一致
  • git push : 將Local repository 送到 remote repository, 別人才看得見。git push之前, 要先git pull 取得最新的遠端變更,才能進行git push (此如同svn update 才進行svn commit 以防止版本衝突)。
  • git fetch: 只取得最新的 HEAD
  • git pull : git fetch + merge to local (會從Remote Repository下載最新的歷程記錄,並且自動Merge到Local Repository)

your local repository consists of three "trees" maintained by git. the first one is your Working Directory which holds the actual files. the second one is the Index which acts as a staging area and finally the HEAD which points to the last commit you've made.































TortoiseGit與GitHub 基本操作


  1. 複製git code : git clone https://github.com/xxxxx/project.git
  2. git add  <files>
  3. git commit   <files or *>  
    單純執行 git commit 僅會顯示那些檔案有改過 (即Un-staged 狀態) 
  4. Push 到GitHub: 對clone下來的資料匣, 按右鍵push, 輸入GitHub的username/password。若不是受邀的username , 則必須在Github 上邀請此username成為collaborators
  

輸入GitHub 帳密

push 成功


----------------

其他Git指令: 

查看變更記錄 git log





git Revert : 還原



參考