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

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

2022-09-30 0 1,110
Resource Number 43935 Last Updated 2025-02-24
¥ 0HKD 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/eventos-nano-is-a-scm-event-driven-embedded-development-platform/

Share free open-source source code

Q&A
  • 1. Automatic: After making an online payment, click the (Download) link to download the source code; 2. Manual: Contact the seller or the official to check if the template is consistent. Then, place an order and make payment online. The seller ships the goods, and both parties inspect and confirm that there are no issues. ICTcoder will then settle the payment for the seller. Note: Please ensure to place your order and make payment through ICTcoder. If you do not place your order and make payment through ICTcoder, and the seller sends fake source code or encounters any issues, ICTcoder will not assist in resolving them, nor can we guarantee your funds!
View details
  • 1. Default transaction cycle for source code: The seller manually ships the goods within 1-3 days. The amount paid by the user will be held in escrow by ICTcoder until 7 days after the transaction is completed and both parties confirm that there are no issues. ICTcoder will then settle with the seller. In case of any disputes, ICTcoder will have staff to assist in handling until the dispute is resolved or a refund is made! If the buyer places an order and makes payment not through ICTcoder, any issues and disputes have nothing to do with ICTcoder, and ICTcoder will not be responsible for any liabilities!
View details
  • 1. ICTcoder will permanently archive the transaction process between both parties and snapshots of the traded goods to ensure the authenticity, validity, and security of the transaction! 2. ICTcoder cannot guarantee services such as "permanent package updates" and "permanent technical support" after the merchant's commitment. Buyers are advised to identify these services on their own. If necessary, they can contact ICTcoder for assistance; 3. When both website demonstration and image demonstration exist in the source code, and the text descriptions of the website and images are inconsistent, the text description of the image shall prevail as the basis for dispute resolution (excluding special statements or agreements); 4. If there is no statement such as "no legal basis for refund" or similar content, any indication on the product that "once sold, no refunds will be supported" or other similar declarations shall be deemed invalid; 5. Before the buyer places an order and makes payment, the transaction details agreed upon by both parties via WhatsApp or email can also serve as the basis for dispute resolution (in case of any inconsistency between the agreement and the description of the conflict, the agreement shall prevail); 6. Since chat records and email records can serve as the basis for dispute resolution, both parties should only communicate with each other through the contact information left on the system when contacting each other, in order to prevent the other party from denying their own commitments. 7. Although the probability of disputes is low, it is essential to retain important information such as chat records, text messages, and email records, in case a dispute arises, so that ICTcoder can intervene quickly.
View details
  • 1. As a third-party intermediary platform, ICTcoder solely protects transaction security and the rights and interests of both buyers and sellers based on the transaction contract (product description, agreed content before the transaction); 2. For online trading projects not on the ICTcoder platform, any consequences are unrelated to this platform; regardless of the reason why the seller requests an offline transaction, please contact the administrator to report.
View details

Related Source code

ICTcoder Customer Service

24-hour online professional services