EventOS Nano is a SCM, event-driven embedded development platform

EventOS Nano is a SCM, event-driven embedded development platform

2022-09-30 0 748
Resource Number 43935 Last Updated 2025-02-24
¥ 0USD Upgrade VIP
Download Now Matters needing attention
Can't download? Please contact customer service to submit a link error!
Value-added Service: Installation Guide Environment Configuration Secondary Development Template Modification Source Code Installation

EventOS Nano, which is recommended in this issue, is an event-driven embedded development platform for microcontroller.

EventOS Nano is a SCM, event-driven embedded development platform插图

class=”pgc-h-arrow-right” data-track=”2″>

It has two main technical features: one is event-driven, the other is ultra-lightweight. EventOS Nano and its parent project EventOS, the goal is to develop an enterprise level embedded development platform, with event bus as the core, to create a unified embedded technology ecosystem, For the majority of enterprise users and embedded developers, to provide a reliable, high-performance, modern and high development efficiency of the embedded development environment.

The main features of EventOS Nano are listed below:

    The

  • event bus is the core component, which is flexible and easy to use. It is the main means of synchronization or communication between threads (state machines), and the only means to support the distributed characteristics and cross-platform development of EventOS. Events support either a broadcast send or a publisher-subscribe mechanism (one of two options).
  • global event queue , which eliminates the way that each thread (state machine) has its own event queue. There is only one global event queue, which minimizes RAM consumption.
  • Collaborative kernel , which has the advantage of not generating resource competition and is extremely reliable.
  • extremely lightweight, easy to embed into other systems , all features except event bus (hierarchical state machine, planar state machine, publishing-subscribe mechanism, event carrying data, event bridge, etc.) can be trimmed to reduce resource usage to the limit. Available as low as 1.2KB ROM and 172Byte RAM. Can be used as a subsystem, “quietly” embedded in other software systems.
  • Powerful soft timer , in the form of time events, soft timer function, elegant and powerful implementation.
  • API design, more concise, more in line with the habits of local embedded engineers.
  • Easy to migrate, only need to implement a few interface functions.
  • will use the Event Bridge mechanism to get through the event bus with EventOS in the future, To support the distributed nature of EventOS.
  • Focus on three application scenarios: single chip microcomputer, embedded as a module to other software systems and high reliability requirements of embedded scenarios.

Programming ideas advocated by EventOS Nano

Event driver and event bus

Event driver and event bus, is the core of EventOS Nano, is also the core of EventOS. The event mechanism, which is completely different from the event concept in RTOS, is more like the message in windows programming. Events can be regarded as topic + variable length data . Through events, the coupling between modules can be greatly decoupling, the testability of software can be enhanced, and cross-platform development and distributed expansion can be carried out.

Defensive programming

EventOS Nano uses a lot of assertions, a lot of checks on the running process of the system and the user’s use of EventOS Nano. We strongly recommend that users carefully design and implement assertion interface functions so that assertions are still turned on in actual production code. In this way, the software will converge to the steady state at a very fast rate.

Cross-platform development

EventOS Nano advocates cross-platform development. The so-called cross-platform development is to complete most of the development work in the convenient and friendly development environment such as Windows and Linux, including programming, debugging, running and unit testing, and then carry out the final transplantation, debugging and adaptation work on the target platform. There are many advantages of cross-platform, such as very high development efficiency, engineers into more programming areas, and program stability and reliability. EventOS Nano is mainly developed on the 32-bit MinGW platform and Linux platform. For setting up the development environment, see the document Setting up the Development Environment. Of course, you can also use MDK directly on the microcontroller development, the efficiency is slightly lower.

Decoupling

Whether it is broadcast event sending mechanism or publist-subscribe event sending mechanism, in fact, it is to eliminate the coupling between software modules.

class=”pgc-h-arrow-right” data-track=”23″>

EventOS Nano is easy to get started with. In addition to the source code, you only need to implement three codes to write programs using EventOS Nano.

  • main.c main function, initialize and start EventOS Nano.
  • eos_port.c For example, the interface implementation of EventOS on a specific platform, that is, the related code of EventOS Nano migration.
  • eos_led.c LED flashing state machine. LED lights flashing, is the MCU World Hello World. I believe it is the entry code for many people.

main.c The process of booting from EventOS is very simple and can be started in just a few steps.

/* include  ------------------------------------------------------------------ */
#include "eventos.h"                                // EventOS  Nano header file 
#include "event_def.h"                              //  Enumeration of event topics 
#include "eos_led.h"                                //  LED flashing state machine 

/* define ------------------------------------------------------------------- */
static eos_u32_t eos_sub_table[Event_Max];           // Subscribe table data space 
static eos_u8_t eos_heap_memory[1024];               // Event pool space 

/* main function ------------------------------------------------------------ */
int main(void)
{
    // EventOS Nano
    eos_init();                                     // Initialize EventOS 
    eos_sub_init(eos_sub_table);                    //Initialize subscription table 
    eos_event_pool_init(eos_heap_memory, 1024);     // Event pool initialization 

    //Initialization of state machine module 
    eos_led_init();                                 // LED state machine initialization 

    // Start EventOS Nano. 
    eos_run();                                      //EventOS is up and running 

    return 0;
}

Event theme event_def.h is defined as follows.

#include "eventos.h"

enum {
    Event_Test = Event_User,                // The event topic definition starts with Event_User, and the less than Event_User is the system event. 
    Event_Time_500ms,

    Event_Max
};

eos_port.c migration file, which has been detailed in UM-02-002 EventOS Nano Migration Document, will not be described again.

eos_led.c and eos_led.h headers. Instead, let’s focus on the.c file, which is how the state machine is used.

/* include ------------------------------------------------------------------ */
#include "eos_led.h"                    // Module header file
#include "eventos.h"                    // EventOS header file
#include "event_def.h"                  // Event definition header file
#include <stdio.h>                      // Standard input and output libraries

/* data structure ----------------------------------------------------------- */
typedef struct eos_led_tag { // LED  Span
    eos_sm_t super;

    eos_bool_t status;
} eos_led_t;

static eos_led_t led;                   //led object, singleton mode

/* static state function ---------------------------------------------------- */
//  Span
static eos_ret_t state_init(eos_led_t * const me,  eos_event_t const * const e);
// ON status of Led 
static eos_ret_t state_on(eos_led_t * const me,  eos_event_t const * const e);
// Led Off status 
static eos_ret_t state_off(eos_led_t * const me,  eos_event_t const * const e);

/* api ---------------------------------------------------- */
void eos_led_init(void)
{
    static eos_u32_t queue[32];                 // Queue of events
    eos_sm_init(&led.super, 1, queue, 32);      // State machine initialization
                                                // The state machine starts with state_init as the initial state.
    eos_sm_start(&led.super, EOS_STATE_CAST(state_init));

    led.status = 0;
}

/* static state function ---------------------------------------------------- */
static eos_ret_t state_init(eos_led_t * const me, eos_event_t const * const e)
{
    // Subscribe to eventsEvent_Time_500ms
    EOS_EVENT_SUB(Event_Time_500ms);
    // Make event Event_Time_500ms,It's sent every 500ms.
    eos_event_pub_period(Event_Time_500ms, 500);

    return EOS_TRAN(state_off);
}

static eos_ret_t state_on(eos_led_t * const me, eos_event_t const * const e)
{
    switch (e->topic) {
        case Event_Enter:                           //Entry event for state state_on
            printf("State On!\n");
            me->status = 1;
            return EOS_Ret_Handled;

        case Event_Time_500ms:                      // Event_Time_500ms received, jump to state_off
            return EOS_TRAN(state_off);

        default:
            return EOS_SUPER(eos_state_top);
    }
}

static eos_ret_t state_off(eos_led_t * const me, eos_event_t const * const e)
{
    switch (e->topic) {
        case Event_Enter:                           // Entry event for state state_on
            printf("State Off!\n");
            me->status = 0;
            return EOS_Ret_Handled;

        case Event_Time_500ms:                      //Event_Time_500ms received, jump to state_on
            return EOS_TRAN(state_on);

        default:
            return EOS_SUPER(eos_state_top);
    }
}

Structure of code

Core code

  • EventOS/evenTOs. c Implementation of EventOS Nano state machine framework
  • eventos/eventos.h header
  • eventos/eventos_config.h Configure and crop the EventOS Nano

third-party code base

  • RTT Segger JLink provides logging libraries that depend on JLink hardware.
  • unity unit testing framework
资源下载此资源为免费资源立即下载
Telegram:@John_Software

Disclaimer: This article is published by a third party and represents the views of the author only and has nothing to do with this website. This site does not make any guarantee or commitment to the authenticity, completeness and timeliness of this article and all or part of its content, please readers for reference only, and please verify the relevant content. The publication or republication of articles by this website for the purpose of conveying more information does not mean that it endorses its views or confirms its description, nor does it mean that this website is responsible for its authenticity.

Ictcoder Free source code EventOS Nano is a SCM, event-driven embedded development platform https://ictcoder.com/kyym/eventos-nano-is-a-scm-event-driven-embedded-development-platform.html

Share free open-source source code

Q&A
  • 1, automatic: after taking the photo, click the (download) link to download; 2. Manual: After taking the photo, contact the seller to issue it or contact the official to find the developer to ship.
View details
  • 1, the default transaction cycle of the source code: manual delivery of goods for 1-3 days, and the user payment amount will enter the platform guarantee until the completion of the transaction or 3-7 days can be issued, in case of disputes indefinitely extend the collection amount until the dispute is resolved or refunded!
View details
  • 1. Heptalon will permanently archive the process of trading between the two parties and the snapshots of the traded goods to ensure that the transaction is true, effective and safe! 2, Seven PAWS can not guarantee such as "permanent package update", "permanent technical support" and other similar transactions after the merchant commitment, please identify the buyer; 3, in the source code at the same time there is a website demonstration and picture demonstration, and the site is inconsistent with the diagram, the default according to the diagram as the dispute evaluation basis (except for special statements or agreement); 4, in the absence of "no legitimate basis for refund", the commodity written "once sold, no support for refund" and other similar statements, shall be deemed invalid; 5, before the shooting, the transaction content agreed by the two parties on QQ can also be the basis for dispute judgment (agreement and description of the conflict, the agreement shall prevail); 6, because the chat record can be used as the basis for dispute judgment, so when the two sides contact, only communicate with the other party on the QQ and mobile phone number left on the systemhere, in case the other party does not recognize self-commitment. 7, although the probability of disputes is very small, but be sure to retain such important information as chat records, mobile phone messages, etc., in case of disputes, it is convenient for seven PAWS to intervene in rapid processing.
View details
  • 1. As a third-party intermediary platform, Qichou protects the security of the transaction and the rights and interests of both buyers and sellers according to the transaction contract (commodity description, content agreed before the transaction); 2, non-platform online trading projects, any consequences have nothing to do with mutual site; No matter the seller for any reason to require offline transactions, please contact the management report.
View details

Related Article

make a comment
No comments available at the moment
Official customer service team

To solve your worries - 24 hours online professional service