FreeRTOS Basic Introduction

Source: Internet
Author: User
Tags volatile

Why Choose FreeRTOS
Ucos more information, especially Chinese information. FreeRTOS information is small, and most are in English. The reasons are as follows:

1.FreeRTOS free. Ucos charges. That's the main reason.
2. Many semiconductor manufacturers, using FreeRTOS as their operating system
Low number of 3.FreeRTOS files

Download Address
http://www.freertos.org/

directory Structure

# ls-l Total
drwx------5 pi pi 4096 Sep 04:17 freertos
drwx------4 pi pi 4096 Sep 04:18 freertos-p LUs
-rwx------1 pi Pi  141 Jan  new-direct to Task notifications.url
-rwx------1 pi Pi  155 Dec  new-freertos+tcp.url
-rwx------1 pi pi  144 Sep  Quick_start_guide.url
- RWX------1 Pi pi 1468 Sep  readme.txt
-rwx------1 pi pi  129 Feb  Upgrading-to-freertos -9.url

Freertos-plus: Contains freertos+ components and demo routines
FreeRTOS: Contains FreeRTOS real-time kernel source files and demo routines

# ls-l FreeRTOS Total
drwx------166 pi Pi 12288 Sep 04:17 Demo
drwx------   2 pi pi  4096 Sep 16 04:17 License
-rwx------   1 pi pi   124 Oct  Links_to_doc_pages_for_the_demo_projects.url
- rwx------   1 pi pi   912 Sep  readme.txt
drwx------   4 pi pi  4096 Sep 04:17 Source

Demo: Demo Routines
License: Licensing Information
Source: Real-time kernel file

# ls-l freertos/source/Total
352
-rwx------  1 pi pi  15771 may  croutine.c
- rwx------  1 pi pi  26251  event_groups.c
drwx------  2 pi pi   4096 Sep 04:17 Inc Lude
-rwx------  1 pi pi  10993 may  list.c
drwx------pi pi   4096 Sep 04:17 Porta ble
-rwx------  1 pi pi  83729  queue.c
-rwx------  1 pi pi    822 Sep  Readme.txt
-rwx------  1 pi pi 157816 may  tasks.c
-rwx------  1 pi pi  41115  TIMERS.C

Tasks.c, queue.c, list.c: Core files
timers.c, EVENT_GROUPS.C, croutine.c: Optional files
include: Kernel generation Dock File
Portable: Processor-specific code

# ls freertos/source/portable/-l total drwx------3 pi pi 4096 Sep 04:17 BCC drwx------5 pi pi 4096 Sep 16 04:17 CCS drwx------5 pi pi 4096 Sep 04:17 CodeWarrior drwx------2 pi pi 4096 Sep 04:17 Common drwx------notoginseng Pi Pi 40 2 Sep-04:17 GCC drwx------pi pi 4096 Sep 04:17 IAR drwx------pi pi 4096 Sep 04:17 Keil drwx------2 pi Pi 4096 Sep 04:17 memmang drwx------3 pi pi 4096 Sep 04:17 mikroc drwx------7 pi pi 4096 Sep 04:17 MPLAB drwx  ------2 pi pi 4096 Sep 04:17 msvc-mingw drwx------3 pi pi 4096 Sep 04:17 owatcom drwx------3 pi pi 4096 Sep 16  04:17 paradigm-rwx------1 Pi pi 866 Feb readme.txt drwx------7 pi pi 4096 Sep 04:17 Renesas drwx------ 4 pi pi 4096 Sep 04:17 Rowley drwx------9 pi pi 4096 Sep 04:17 RVDS drwx------3 pi pi 4096 Sep 04:17 SDCC Dr WX------4 pi pi 4096 Sep 04:17 softune drwx------3 pi pi 4096 Sep 04:17 Tasking drwx------3 pi pi 4096 Sep 16 04:17 WIZC

Keil, RVDS: Compiling the required files using the MDK environment
Memmang: Memory management, stack implementation

# ls-l freertos/demo/common/Total
drwx------5 pi pi 4096 Sep 04:04 drivers drwx
------9 pi pi 4096 Se P 04:05 Ethernet
drwx------2 pi pi 4096 Sep 04:06 full
drwx------2 pi pi 4096 Sep 04:06 include
DRW x------2 pi pi 4096 Sep 04:06 Minimal
-rwx------1 pi Pi  737 Mar  ReadMe.txt

Common: Demo Routines

Test Demo
Replace the original main function to test the LED flicker

int main (void)
{
    volatile unsigned long ul;/* Volatile so it's not optimized away. *

    /Prvsetuphardware (); Clock settings
    vpartestinitialise ();//gpio initialization/

    * Toggle the LEDs repeatedly. *
    /for (;;)
    {
        /* We don ' t want to use the RTOS features yet, so just use a
        very crude delay mechanism instead. *
        /FOR (UL = 0; UL < 0xfffff; ul++)
        {
        }

        /* Toggle the first four LEDs (on the assumption there is at least
        4 fitted. */
        Vpart esttoggleled (0);
        vpartesttoggleled (1);
        Vpartesttoggleled (2);
        Vpartesttoggleled (3);
    }

    return 0;
}

RTOs Scheduler
LED flashing at different frequencies

int main (void)
{/
   * Setup The microcontroller hardware for the demo. *
   /Prvsetuphardware ();

   Vstartledflashtasks (mainflash_task_priority);

   /* All and functions that create tasks is commented out.

      Vcreatepollqtasks ();
      Vcreatecomtesttasks ();
      ETC.

      Xtaskcreate (Vchecktask, "Check", stack_size, NULL, task_priority, NULL);
   *

   /* Start the RTOS scheduler. *
   /Vtaskstartscheduler ();

   /* should never get here! */
   return 0;
}

Reference: http://www.freertos.org/porting-a-freertos-demo-to-different-hardware.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.