Using NuttX OS as a library on Atmel Studio 7

来源:互联网 发布:java的数据结构有哪些 编辑:程序博客网 时间:2024/05/22 01:42

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.
启动Atmel Studio 7

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

原创粉丝点击