您的位置:首页 > 其它

Using NuttX OS as a library on Atmel Studio 7

2017-10-19 20:50 288 查看
This document explains how to add NuttX OS to your application on Atmel Studio 7, using NuttX OS as a library. With Atmel Studio 7 easy-to-use feature, you can easily set up the project by following below steps. This project will base on Atmel SAMD21 Xplained Pro, a 32bit ARM Cortex-M0+ MCU with up to 48MHz operating frequency.

Before we start it, must make sure you have executed the ./configure.sh to select samd21-xplained\nsh as NuttX OS configuration file. Then now you should execute:

make export

It will take several minutes to cross compile NuttX OS source file and then you will get a zip file like this nuttx-export-7.22.zip. Now let’s start creating the project on Atmel Studio 7. Launch Atmel Studio 7 and select File->New ->Project to create a new project for SAMD21 Xplained Pro.



Please select GCC C Executable Project, input project Name and choose the proper folder you want to save your project.



The last step is to choose the device for the project, of source, we should choose ATSAMD21J18A. Click OK and wait for Atmel Studio 7 generating project file automatically.



Copy exported file to your project folder and modify the fold name to ‘nuttx-7.22’.



Remove unnecessary files from project.



Add nuttx-7.22 header files and libraries to project.



Right click ‘nuttx_samd21’ project and select ‘Properties’, let us configure the project, such as ‘Directories’, Linker library and so on.















The last step is to copy nsh_main.c from nuttx-7.22\apps\examples\nsh folder to your project and rename the file to main.c. OK, we can compile the project now and wait for the compiling result. Error message will show like below picture. The way to correct these errors is to remove spi_bitband.c.





We are luck, only 2 Errors left. In main.c, please comment there are 2 header files.

//#include “platform/cxxinitialize.h”

//#include “nshlib/nshlib.h”

Otherwise the error message will tell you that no such file or directory.



The compiling process was succeeded, flash memory usage was 42 KB and data memory usage was 3.4 KB.



If you do not need to use nsh library, it will take less flash memory usage. Only 24 KB flash memory used for running NuttX on SAMD21 Xplained with rich OS features. That is a big surprise for me.



Before start running NuttX OS on SAMD21 Xplained, we should set up debug tools in Atmel Studio 7.



Now we can debug the NuttX OS based project on Atmel Studio 7, have fun with NuttX and Atmel Studio 7 & SAMD21 Xplained.



At the end of this blog, I want to thank Alan for his help and suggestion. The readers can visit his blog and there are many articles about NuttX will helpful for you. Alan C. Assis
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Nuttx Atmel SAMD21 Studio7 os
相关文章推荐