Build an environment for migrating TinyOS in Ubuntu to the CC2530 Environment

Source: Internet
Author: User
In, TI released the standard. Till now no one has transplanted TinyOS to this SOC (some may have been successfully transplanted, but it is relatively low-key ). Previously, TinyOS was transplanted to the MSP430F2618 + CC2520 + CC2591 platform. In order to make the platform designed by our project team compatible with each other, TinyOS was transplanted to the CC2530 platform by the way. The first task is to build the compiling environment. If you have already used CC2430, you can skip this step. TinyOS

In, TI released the standard. Till now no one has transplanted TinyOS to this SOC (some may have been successfully transplanted, but it is relatively low-key ). Previously, TinyOS was transplanted to the MSP430F2618 + CC2520 + CC2591 platform. In order to make the platform designed by our project team compatible with each other, TinyOS was transplanted to the CC2530 platform by the way.

The first task is to build the compiling environment. If you have already used CC2430, you can skip this step. The TinyOS 8051 workgroup provides a plug-in for 51-core On-Chip Systems Using TinyOS. Instead of a plug-in, TinyOS is a complete TinyOS system. For environment setup, refer to some articles on the Internet. Here we recommend a workshop.

1. The installation of TinyOS-2.1.1 can be based on the automation installation for debian system in Getting started on TinyOS official website. First, update your source

Sudo gedit/etc/apt/sources. list

Add the deb http://hinrg.cs.jhu.edu/tinyos karmic main at the end, and then update

Sudo apt-get update

Then you can install

Sudo apt-get install tinyos-2.1.1

After the installation is complete, set the path. You can modify it ~ /. Bashrc or ~ /. Profile file, add the following statement source/opt/tinyos-2.1.1/tinyos. sh, here the default is Tinyos installed under/opt.

Install python:

Apt-get install python-dev

This step is required. Otherwise, an error will be reported when make micaz sim is running.

View your python version, and then modify/opt/tinyos-2.1.1/support/make/sim. extra

Modify PYTHON_VERSION to your own python version. Edit the/opt/tinyos-2.1.1/tinyos. sh file and modify the CLASSPATH environment variable as follows:

CLASSPATH = $ CLASSPATH: $ TOSROOT/support/sdk/java/tinyos. jar :.

To automatically set TinyOS environment variables when shell is started

Sudo gedit ~ /. Bashrc

Add the following statement to the. bashrc file under $ HOME:

Source/opt/tinyos-2.1.1/tinyos. sh export CLASSPATH = $ TOSROOT/support/sdk/java/tinyos. jar :. finally, run tos-check-env to check whether you have correctly installed it.

2. Install Keil (Keil uVersion4)

If you need an installation package, you can leave a message to me. Because only files smaller than 20 mb can be uploaded, they cannot be uploaded. You can search for the Keil C51 V900 registrar in the resource.

The reason is that in the Linux system, the. exe file is run by installing winewith the kernel. Terminal Operation

After sudo apt-get install wine is installed, you can install Keil. After the keilkey is decompressed, copy c51v900.exe cmdkeil_lic.exe to another directory (it is best not to include a Chinese name), and run it in the terminal.

WINEPREFIX =/root/. wine. keil wine C51V900.exe

The familiar software installation interface in windows is displayed. All software installation interfaces are installed by default. Finally, select the last provided sample program. The installation is complete and the terminal runs Keil.

WINEPREFIX =/root/. wine. keil wine "C:/Keil/UV4/Uv4.exe"

Run Keil, add License, file-> License Management, and run the registration machine on another terminal (without the root permission ).

Wine KEIL_Lic.exe

Copy the content in the CID to the CID on the registration machine and click Generate the registration code.

Run the example program that comes with Keil compilation again. If the License information is not warned, the registration is successful.

3. Install tinyos-2.x-contrib

There should be a TinyOS-2.1.1 directory under the/opt directory after the tinyos-2.1.1 is installed in the first step. Copy the TinyOS8051wg-0.1pre4.tgz generated after extracting the downloaded tinyos-2.x-contrib to the/opt directory. Modify environment variables, there is an env file under the tinyos-2.x-contrib/diku directory that contains the environment variables to be set, modified as needed, because the tinyos-2.1.1 version is used now, so/opt directory under the original tinyos-2.x directory has been replaced by the tinyos-2.1.1, so first modify TOSROOT =/opt/tinyos-2.1.1 otherwise the prompt cannot find the Makerules file, which is why the tinyos-2.1.1 is installed. Currently, we use the keil compiler, so the compiler option should be keil export MCS51_COMPILER = keil. After the modification, env the source file to make the environment variable valid.

Note: To compile after each restart, you need to run this command (source/opt/tinyos-2.x-contrib/diku/env)

The following tests whether the Keil tool chain is available.

Compile the project file (taking BlinkNoTimerTask as an example)

Cd/diku/common/apps/BlinkNoTimerTask

Make cc2430em

If the following error occurs: Z:/opt/tinyos-2.x-contrib/diku/common/apps/BlinkNoTimerTask/build/cc2430em> C:/Keil/C51/BIN/A51.EXE "startup. a51 "SET (SMALL) DEBUG EP

File not found

Make: *** [build/cc2430em/startup. OBJ] Error 49

Indicates that the installation path of keil is incorrect. follow Step 2 to reinstall keil. The default installation path for TinyOS keil is $ (HOME)/. wine. keil. Make sure the path is correct.

If *** ERROR L257: extended linker requires upgrade to PK51 appears, it is likely that the attack fails. Reinstall Keil and use keygen to crack it.

4. install other cross-compilation links

It is very convenient to install SDCC in ubuntu and run it on the terminal.

Apt-get install sdcc-libraries

Modify the env file to set the compilation tool to sdcc and export MCS51_COMPILER = sdcc.

Source/opt/tinyos-2.x-contrib/diku/env

Re-compile BlinkNoTimerTask. There should be no problem.

IAR installation (currently no cracking is successful, only 30-day trial version can be used ). Download IAR For 8051 from the IAR official website and the cracking tool (it is only used For installation and cannot be cracked because keygen cannot identify the ID in ubuntu ). The installation method is similar to Keil.

WINEPREFIX =/root/. wine. iar wine autorun.exe

Follow the prompts to select the default installation.

Modify/opt/tinyos-2.x-contrib/diku/env after installation, select MCS51_COMPILER = iar, modify MCS51_IAR_PATH = Program \ Files/IAR \ Systems/Embedded \ Workbench \ 5.3/common/bin/. This setting depends on the currently installed IAR version.

The Error Fatal Error [Cp001]: Copy protection check will be prompted during running because the IAR fails to be cracked, no valid license found for this product [20] Error while running C/C ++ Compiler. However, at this stage, the app. c file we need has been generated. Copy this file to Windows and use IAR Embedded Workbench for compilation. It is worth noting that you need to set the project before compilation. The settings are as follows:

After the project is set up, modify the app. c file and add the header file ioCC2530.h. Deregister register definition statements starting with sfr and sbit. These are defined in ioCC2530.h. Finally, modify the undefined register name in the error prompt, some Register names in TinyOS are defined differently from those defined in ioCC2530.h.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.