element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Smart Spaces Design Challenge
  • Challenges & Projects
  • Design Challenges
  • Smart Spaces Design Challenge
  • More
  • Cancel
Smart Spaces Design Challenge
Forum Smart Spaces - Using RT-Thread with FRDM- MCXA153
  • Forum
  • Projects
  • DC
  • Leaderboard
  • Files
  • Members
  • More
  • Cancel
  • New
Join Smart Spaces Design Challenge to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 1 reply
  • Subscribers 41 subscribers
  • Views 83 views
  • Users 0 members are here
Related

Smart Spaces - Using RT-Thread with FRDM- MCXA153

fyaocn
fyaocn 19 days ago

1 Brief on RT-Thread

RT-Thread​ (Real-Time Thread) is an open-source, embedded real-time operating system (RTOS).

Its key differentiator is that it's not just a minimal kernel but a complete platform, offering a wide range of middleware components and a package management system, making it highly scalable for a broad spectrum of IoT applications, which allows for rapid prototyping and development of feature-rich IoT devices without the need to integrate and maintain numerous third-party libraries. It effectively bridges the gap between a simple RTOS like FreeRTOS and a full-featured OS like Linux.

2 Develop with SCons and Virtual ENV

Developing with the RT-Thread env​ environment and SCons​ is the standard and recommended way to build RT-Thread projects.

  • env(RT-Thread env tool):​ This is a powerful auxiliary tool provided by RT-Thread. It's not just a command-line interface; it's an environment that contains the package manager​ (pkgs) and a collection of Python-based build and configuration scripts. It's the primary tool you interact with for project configuration.
  • SCons:​ This is an open-source build system, written in Python. It is the underlying engine that RT-Thread uses to compile source code, manage dependencies, and generate the final binary (like rtthread.elf, rtthread.bin). You describe the build process in a Python script called SConstruct.

Download the rt-thread package from github and start the env

image

upgrade packages automatically,

Here is the code main.c

#include <rtdevice.h>
#include "drv_pin.h"

#define LED_PIN        ((3*32)+12)

int main(void)
{
#if defined(__CC_ARM)
    rt_kprintf("using armcc, version: %d\n", __ARMCC_VERSION);
#elif defined(__clang__)
    rt_kprintf("using armclang, version: %d\n", __ARMCC_VERSION);
#elif defined(__ICCARM__)
    rt_kprintf("using iccarm, version: %d\n", __VER__);
#elif defined(__GNUC__)
    rt_kprintf("using gcc, version: %d.%d\n", __GNUC__, __GNUC_MINOR__);
#endif

    rt_pin_mode(LED_PIN, PIN_MODE_OUTPUT);  /* Set GPIO as Output */
    rt_kprintf("MCXA153 HelloWorld\n");

    while (1)
    {
        rt_pin_write(LED_PIN, PIN_HIGH);    /* Set GPIO output 1 */
        rt_thread_mdelay(1000);               /* Delay 500mS */
        rt_pin_write(LED_PIN, PIN_LOW);     /* Set GPIO output 0 */
        rt_thread_mdelay(500);               /* Delay 500mS */
        rt_kprintf("MCXA153.\n");
    }
}

Other Key files in the project

SConstruct: The main SCons build script. It sets up the global environment and includes other scripts.
SConscript: Found in subdirectories (like libraries, packages). They define how to build the files in that specific directory.
rtconfig.h: The C header file generated by menuconfigcontaining all your #defines.
.config: The saved configuration for menuconfig.
rtconfig.py: Contains Python variables for the compiler toolchain (e.g., EXEC_PATHfor the GCC toolchain location).
packages/: The folder where pkgs --updatedownloads all the online software packages.

image

3 Build the project with scons

Build the project with scons

image

output the rtthread.efg

4 Flash the board

Flash the board, use pyocd since the MCU-Link is CMSIS-Dap compatible,

image

Now it is ready to restart the board for result.

.

5 Run with the blinky

Here is the result.

image

.

  • Sign in to reply
  • Cancel
Parents
  • embeddedguy
    embeddedguy 11 days ago

    Congratulations on your first steps with RT-Thread RTOS. 

    I know this RTOS but have not yet given it a try.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • embeddedguy
    embeddedguy 11 days ago

    Congratulations on your first steps with RT-Thread RTOS. 

    I know this RTOS but have not yet given it a try.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube