Go to file
Olli-Pekka Puolitaival e27a26eb9d Icetea support 2018-08-31 11:51:57 +03:00
.github PR template: Feature -> functionality change 2018-08-08 12:50:12 +01:00
TESTS Merge pull request #7781 from deepikabhavnani/crc_safety 2018-08-29 15:42:23 -05:00
TEST_APPS Icetea support 2018-08-31 11:51:57 +03:00
UNITTESTS Unittests: update documentation for Windows 2018-08-28 09:23:25 +03:00
cmsis Remove uVisor from mbed-os 2018-08-22 16:36:59 +03:00
drivers Merge pull request #7781 from deepikabhavnani/crc_safety 2018-08-29 15:42:23 -05:00
events Merge pull request #7810 from kegilbert/eventqueue-templatewall-rework 2018-08-24 11:30:54 +02:00
features Icetea support 2018-08-31 11:51:57 +03:00
hal Merge pull request #7592 from orenc17/remove_uvisor 2018-08-25 19:52:24 -05:00
mbed-client-cli Icetea support 2018-08-31 11:51:57 +03:00
platform Merge pull request #7794 from c1728p9/boot_overhaul 2018-08-30 10:22:15 -05:00
rtos Refactor boot process 2018-08-28 19:26:55 -05:00
source Icetea support 2018-08-31 11:51:57 +03:00
targets Merge pull request #7778 from SeppoTakalo/provide_default_mesh 2018-08-30 16:11:00 -05:00
test Icetea support 2018-08-31 11:51:57 +03:00
tools Icetea support 2018-08-31 11:51:57 +03:00
.astyleignore AStyle: ignore hal storage abstraction 2018-06-29 10:36:36 +01:00
.astylerc AStyle: fix indentation for longer lines 2018-05-24 14:15:52 +01:00
.coveragerc Exclude libraries and tests from coverage numbers 2017-09-25 11:51:31 -05:00
.gitattributes Added .gitattributes for automatic LF line ending conversion 2013-08-08 13:19:34 +03:00
.gitignore Icetea support 2018-08-31 11:51:57 +03:00
.mbedignore Icetea support 2018-08-31 11:51:57 +03:00
.pylintrc Add pylint configuration file 2016-08-16 11:48:45 -05:00
.travis.yml Adopted travis changes from littlefs v1.6 2018-08-06 14:30:29 -05:00
.yotta_ignore Icetea support 2018-08-31 11:51:57 +03:00
CONTRIBUTING.md Update link in CONTRIBUTING.md 2017-06-09 16:38:38 -05:00
DOXYGEN_FRONTPAGE.md Very minimal text 2016-08-04 14:09:59 +01:00
Jenkinsfile Updated file comment 2018-08-20 12:31:40 +03:00
LICENSE Add Apache v2 LICENSE file 2013-08-06 12:05:04 +01:00
Makefile Icetea support 2018-08-31 11:51:57 +03:00
README.md Icetea support 2018-08-31 11:51:57 +03:00
doxyfile_options Merge pull request #7819 from lorjala/unittests 2018-08-29 09:37:12 -05:00
doxygen_options.json Merge pull request #7592 from orenc17/remove_uvisor 2018-08-25 19:52:24 -05:00
logo.png Readme updates for style and branding 2017-12-04 14:59:16 -06:00
mbed.h Separate version header file to get version updates in Mbed OS 2018-07-11 09:41:30 -05:00
module.json Icetea support 2018-08-31 11:51:57 +03:00
requirements.txt Remove extra package used for CI debugging 2018-08-29 17:57:28 -05:00
target.json Icetea support 2018-08-31 11:51:57 +03:00
test_suite.json Icetea support 2018-08-31 11:51:57 +03:00

README.md

Mbed OS

Build status release Build status master Tools coverage status PR progress

Arm Mbed OS is an open source embedded operating system designed specifically for the "things" in the Internet of Things. It includes all the features you need to develop a connected product based on an Arm Cortex-M microcontroller, including security, connectivity, an RTOS and drivers for sensors and I/O devices.

Mbed OS provides a platform that includes:

  • Security foundations.
  • Cloud management services.
  • Drivers for sensors, I/O devices and connectivity.

Release notes

The release notes detail the current release. You can also find information about previous versions.

Getting started for developers

We have a developer website for asking questions, engaging with others, finding information on boards and components, using an online IDE and compiler, reading the documentation and learning about what's new and what's coming next in Mbed OS.

Getting started for contributors

We also have a contributing and publishing guide that covers licensing, contributor agreements and style guidelines.

mbed-client-cli

This is the Command Line Library for a CLI application. This library provides methods for:

  • Adding commands to the interpreter.
  • Deleting commands from the interpreter.
  • Executing commands.
  • Adding command aliases to the interpreter.
  • Searching command arguments.

API

Command Line Library API is described in the snipplet below:

// if thread safety for CLI terminal output is needed
// configure output mutex wait cb before initialization so it's available immediately
cmd_set_mutex_wait_func( (func)(void) );
// configure output mutex release cb before initialization so it's available immediately
cmd_set_mutex_wait_func( (func)(void) );
// initialize cmdline with print function
cmd_init( (func)(const char* fmt, va_list ap) );
// configure ready cb
cmd_set_ready_cb( (func)(int retcode)  );
// register command for library
cmd_add( <command>, (int func)(int argc, char *argv[]), <help>, <man>); 
//execute some existing commands
cmd_exe( <command> );

Tracing

Command Line Library has trace messages, which are disabled by default. "MBED_CLIENT_CLI_TRACE_ENABLE" flag if defined, enables all the trace prints for debugging.

Usage example

Adding new commands to the Command Line Library and executing the commands:

//example print function
void myprint(const char* fmt, va_list ap){ vprintf(fmt, ap); }

// ready cb, calls next command to be executed
void cmd_ready_cb(int retcode) { cmd_next( retcode ); }

// dummy command with some option
int cmd_dummy(int argc, char *argv[]){
  if( cmd_has_option(argc, argv, "o") ) {
    cmd_printf("This is o option");
  } else {
        return CMDLINE_RETCODE_INVALID_PARAMETERS;
  }
  return CMDLINE_RETCODE_SUCCESS;
}

// timer cb (pseudo-timer-code)
void timer_ready_cb(void) {
   cmd_ready(CMDLINE_RETCODE_SUCCESS);
}

// long command, that needs for example some events to complete the command execution
int cmd_long(int argc, char *argv[] ) {
   timer_start( 5000, timer_ready_cb ); //pseudo timer code
   return CMDLINE_RETCODE_EXCUTING_CONTINUE;
}
void main(void) {
   cmd_init( &myprint );              // initialize cmdline with print function
   cmd_set_ready_cb( cmd_ready_cb );  // configure ready cb
   cmd_add("dummy", cmd_dummy, 0, 0); // add one dummy command
   cmd_add("long", cmd_long, 0, 0);   // add one dummy command
   //execute dummy and long commands
   cmd_exe( "dummy;long" );
}

Thread safety

The CLI library is not thread safe, but the CLI terminal output can be locked against other output streams, for example if both traces and CLI output are using serial out.

static Mutex MyMutex;

// mutex wait cb, acquires the mutex, waiting if necessary
static void mutex_wait(void)
{
    MyMutex.lock();
}

// mutex release cb, releases the mutex
static void my_mutex_release(void)
{
    MyMutex.unlock();
}

void main(void) {
   cmd_mutex_wait_func( my_mutex_wait ); // configure mutex wait function before initializing
   cmd_mutex_release_func( my_mutex_release ); // configure mutex release function before initializing
   cmd_init( &myprint );              // initialize cmdline with print function
   cmd_set_ready_cb( cmd_ready_cb );  // configure ready cb.
   //CLI terminal output now locks against MyMutex
}