UOS-LPC800

Introduction Introduction

UOS-LPC800 is a real-time operating system for NXP LPC800 series.
It provides multi-tasking, sleep, yield in your design easily.

You can select the scheduling algorithm such as Round-Robin or Priority-Based.
Please see uosdef.h for the details.

The implementation of the kernel is very simple.
You can learn how the RTOS works, and how RTOS implemented by examining the source codes.

The simple kernel API The simple kernel API

1. void uos_kernel_init(void);
    - This is the kernel initialization of UOS-LPC800.
    - First, you must call this API.
2. void uos_task_setup(TASKID tid, void (*task)(void), unsigned int priority);
    - This is the task setup API.
    - You must call this API after uos_kernel_init.
3. void uos_kernel_start(void);
    - This is the kernel starting API.
    - You must call this API after uos_task_setup.
4. void uos_task_sleep(unsigned int ms);
    - This kernel allows you to sleep the current task.
5. void uos_task_yield(void);
    - This kernel allows you to change the current task.

Demo movie Demo movie

The sample program The sample program

#include "uos.h"
#include "board.h"

#if defined(__CODE_RED)
#   include <cr_section_macros.h>
#   include <NXP/crp.h>
    __CRP const unsigned int CRP_WORD = CRP_NO_CRP;
#endif

static void task_led(void)
{
    while (1) {
        board_led(1);
        uos_task_sleep(500);
        board_led(0);
        uos_task_sleep(500);
    }
}

static void sxo(char *p)
{
    while (*p) {
        while (board_uart_putc(*p) != *p) {
            uos_task_yield();
        }
        p++;
    }
}

static void task_con(void)
{
    unsigned int timer = 0;
    while (1) {
        int c = board_uart_getc();
        if (0 <= c) {
            if (timer == 0) {
                sxo("\r\n");
                sxo("Yeah. It's your turn.\r\n");
            }
            if (c == '\r') {
                sxo("\r\n");
            } else {
                char tmp[2] = { c, 0x00 };
                sxo(tmp);
            }
            timer = 500;
        }
        if (0 < timer) {
            timer--;
        }
        if (0 == timer) {
            sxo("The quick brown fox jumps over the lazy dog.\r\n");
        }
        uos_task_yield();
    }
}

int main(void)
{
    board_init();

    uos_kernel_init();
    uos_task_setup(1, task_led, 10);
    uos_task_setup(2, task_con, 20);
    uos_kernel_start();

    return 0;
}

The kernel footprint (with the sample program) The kernel footprint (with the sample program)

With the Debug configuration

text    data     bss     dec     hex filename
3504       4     576    4084     ff4 UOS-LPC800.axf

With the Release configuration

text    data     bss     dec     hex filename
2272       4     576    2852     b24 UOS-LPC800.axf

Project settings for LPCXpresso IDE Project settings for LPCXpresso IDE

The definition for your target board

Currently, UOS-LPC800 supported only two platforms.
Please define your platform in the preprocessor option.
See the following image.

Properties

LPC800 Mini Board

- BOARD_LPC800_MINIBOARD

LPC800 Mini Board

LPCXpresso LPC812

- BOARD_LPCXPRESSO_LPC812

LPCXpresso LPC812

The configuration for Flash Magic

The default configuration of LPCXpresso IDE doesn't make any .HEX file.
So you should change the project configuration for Flash Magic if you don't have a debugging tool.

- Properties for UOS-LPC800.
- C/C++ Build - Settings
- Build Steps
- Post-build steps
- Command:

Post-build steps

Original Configuration

arm-none-eabi-size ${BuildArtifactFileName};
arm-none-eabi-objcopy -O binary ${BuildArtifactFileName} ${BuildArtifactFileBaseName}.bin;
checksum -p ${TargetChip} -d ${BuildArtifactFileBaseName}.bin;

Modified Configuration

arm-none-eabi-size ${BuildArtifactFileName};
arm-none-eabi-objcopy -O binary ${BuildArtifactFileName} ${BuildArtifactFileBaseName}.bin;
checksum -p ${TargetChip} -d ${BuildArtifactFileBaseName}.bin;
arm-none-eabi-objcopy -O ihex ${BuildArtifactFileName} ${BuildArtifactFileBaseName}.hex;

The recommendation of NXP LPC800 The recommendation of NXP LPC800

The recommendation of NXP LPC800 is LPC812 for UOS-LPC800.

LPC812 LPC812 (ROM : 16KB, RAM : 4KB)

- Best choice for UOS-LPC800.

LPC811 LPC811 (ROM : 8KB, RAM : 2KB)

- Better choice for UOS-LPC800.

LPC810 LPC810 (ROM : 4KB, RAM : 1KB)

- You can create only two or three tasks with LPC810.
- You should change the stack size.

Author Author

Copyright(C) Shinichiro Nakamura (CuBeatSystems) - @shintamainjp

License License

The license of UOS-LPC800 is "The BSD 2-Clause License".

Copyright (c) 2013, Shinichiro Nakamura - CuBeatSystems
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Resources Resources

Source codes

You can get the source code from here.
This is the preliminary version of UOS-LPC800.

UOS-LPC800 Version 0.1.0

Binary files

LPC800 Mini Board

UOS-LPC800 Version 0.1.0 for LPC800 Mini Board

LPCXpresso LPC812

UOS-LPC800 Version 0.1.0 for LPCXpresso LPC812

History History

- 2013/06/23 Initial version. UOS-LPC800 Version 0.1.0 released.