热搜关键词: 电路基础ADC数字信号处理封装库PLC

pdf

stm32cube_RTOS

  • 1星
  • 2015-11-02
  • 710.07KB
  • 需要2积分
  • 5次下载
标签: stm32cube

stm32cube

RTOS

RTOS

STM32

STM32

stm32cube_RTOS

文档内容节选

UM1722 User manual Developing Applications on STM32Cube with RTOS Introduction The STMCubeTM initiative was originated by STMicroelectronics to ease developers life by reducing development efforts time and cost STM32Cube covers the STM32 portfolio STM32Cube Version 1x includes The STM32CubeMX a graphical software configuration tool that allows to generate C initialization code using graphical wizards A comprehensive embedded software platform delivered per series namely STM32CubeF4 for STM32......

UM1722
User manual
Developing Applications on STM32Cube with RTOS
Introduction
The STMCube
TM
initiative was originated by STMicroelectronics to ease developers life by
reducing development efforts, time and cost. STM32Cube covers the STM32 portfolio.
STM32Cube Version 1.x includes:
The STM32CubeMX, a graphical software configuration tool that allows to generate C
initialization code using graphical wizards.
A comprehensive embedded software platform, delivered per series (namely,
STM32CubeF4 for STM32F4 series)
The STM32Cube HAL, an STM32 abstraction layer embedded software, ensuring
maximized portability across STM32 portfolio
A consistent set of middleware components such as RTOS, USB, TCP/IP,
Graphics
All embedded software utilities coming with a full set of examples.
A Real Time Operating System is an operating system optimized for use in embedded/real
time applications. Their primary objective is to ensure a timely and deterministic response to
events. Using a real time operating system allows applications to be written as a set of
independent threads that inter-communicate using message queues and semaphores.
This user manual is intended for developers who use STM32Cube firmware on STM32
microcontrollers. It provides a full description of how to use the STM32Cube firmware
components with a real time operating system (RTOS); this user manual comes also with
description of a set of examples based on FreeRTOS using the common APIs provided by
the CMSIS-OS wrapping layer.
In the STM32Cube firmware FreeRTOS is used as real time operating system through the
generic CMSIS-OS wrapping layer provided by ARM. Examples and applications using the
FreeRTOS can be direcltly ported on any other RTOS without modifying the high level APIs,
only the CMSIS-OS wrapper has to be changed in this case.
Please refer to the release notes of the package to know the version of FreeRTOS and
CMSIS-RTOS firmware components used with the STM32Cube
TM
.
This document is applicable to all STM32 devices; however for simplicity reason, the
STM32F4xx devices and STM32CubeF4 are used as reference platform. To know more
about the examples implementation on your STM32 device, please refer to the readme file
provided within the associated STM32Cube FW package.
June 2014
DocID025801 Rev 2
1/26
www.st.com
Contents
UM1722
Contents
1
Free RTOS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.1
1.2
1.3
1.4
1.5
1.6
1.7
1.8
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
License . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Free RTOS source organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Porting FreeRTOS on STM32 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
FreeRTOS API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
FreeRTOS memory management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
FreeRTOS low power . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
FreeRTOS configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11
2
CMSIS-RTOS module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.1
2.2
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
CMSIS-RTOS API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3
FreeRTOS applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.1
3.2
Thread Creation example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Semaphores examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3.2.1
3.2.2
Semaphore between threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Semaphore from ISR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3.3
3.4
3.5
3.6
Mutexes example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Queues example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Timer example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Low power example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
4
5
6
Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
FAQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
2/26
DocID025801 Rev 2
UM1722
List of tables
List of tables
Table 1.
Table 2.
Table 3.
Table 4.
Table 5.
Free RTOS API. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
CMSIS-RTOS API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Free RTOS application categories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Comparison of power consumption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
DocID025801 Rev 2
3/26
3
List of figures
UM1722
List of figures
Figure 1.
Figure 2.
Figure 3.
Figure 4.
Figure 5.
Figure 6.
Figure 7.
Figure 8.
Figure 9.
Figure 10.
FreeRTOS license . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Free RTOS architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Free RTOS port . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
FreeRTOS configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
CMSIS-RTOS architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Thread example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Semaphore example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Obtaining semaphore from ISR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Queue process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Periodic timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
4/26
DocID025801 Rev 2
UM1722
Free RTOS
1
1.1
Free RTOS
Overview
FreeRTOS is a class of RTOS that is designed to be small enough to run on a
microcontroller, although its use is not limited to microcontroller applications.
A microcontroller is a small and resource constrained processor that incorporates, on a
single chip, the processor itself, read only memory (ROM or Flash) to hold the program to be
executed, and the random access memory (RAM) needed by the programs it executes.
Typically the program is executed directly from the read only memory.
Microcontrollers are used in deeply embedded applications (those applications where you
never actually see the processors themselves or the software they are running) that
normally have a very specific and dedicated job to do. The size constraints, and dedicated
end application nature, rarely warrant the use of a full RTOS implementation - or indeed
make the use of a full RTOS implementation possible. FreeRTOS therefore provides the
core real time scheduling functionality, inter-task communication, timing and synchronization
primitives only. This means it is more accurately described as a real time kernel, or real time
executive. Additional functionality, such as a command console interface, or networking
stacks, can be then be included with add-on components.
FreeRTOS is a scalable real time demonstration builder core designed specifically for small
embedded systems. Highlights include
Free RTOS demonstration builder core-preemptive, cooperative and hybrid
configuration options.
Official support for 27 architectures (counting ARM7 and ARM Cortex M3 as one
architecture each).
FreeRTOS-MPU supports the Cortex M3 Memory Protection Unit (MPU).
Designed to be small, simple and easy to use. Typically a demonstration builder core
binary image will be in the region of 4K to 9K bytes.
Very portable code structure predominantly written in C.
Supports both tasks and co-routines.
Queues, binary semaphores, counting semaphores, recursive semaphores and
mutexes for communication and synchronization between tasks, or between tasks and
interrupts.
Mutexes with priority inheritance.
Supports efficient software timers.
Powerful execution traces functionality.
Stack overflows detection options.
Pre-configured demo applications for selected single board computers allowing out of
the box operation and fast learning curve.
Free forum support, or optional commercial support and licensing.
No software restriction on the number of tasks that can be created.
No software restriction on the number of priorities that can be used.
No restrictions imposed on priority assignment - more than one task can be assigned
the same priority.
Free development tools for many supported architectures.
DocID025801 Rev 2
5/26
25
展开预览

猜您喜欢

评论

登录/注册

意见反馈

求资源

回顶部

推荐内容

热门活动

热门器件

随便看看

  • 有没有兼职做硬件开发的大侠,我有一些小项目想外包??
    先发一个小项目我们公司主要业务是做电脑游戏开发,但不属于互联网游戏,在局域网下使用的,类似于小孩玩的街机游戏,使用 PC 机做主机。但 PC 机有一个问题,就是有磁盘缓冲功能。这个功能对我们来说是一个缺陷。在游戏中如果突然断电的话数据就会丢失。我们目前需要开发一块存储卡,来实时存放游戏过程中的数据。一旦突然断电,开机后,存放的数据便可以从卡中读出开发存储卡的要求:制作存储卡的目的是保护游戏过程中的
  • 无线网络怎么找不到DNS和端口?
    我的笔记本在周围能搜到别人的无线路由器,没加密的。之前还能上网,后来就上不了了。QQ和MSN检测报告大概是:dns不正确,不能解析ip;还有端口也不对。大家说这有办法解决吗?(这行为是有些不道德,但小第我目前穷困,能省点就省点,也就偶尔上网查查资料)还有我用ethereal怎么抓不到包?是不是ethereal对我的无线网卡不支持?Thanks a lot!
  • 经验交流
    使用过cadence的conformal LEC,经常可能运行到某个步骤99%的时候停在那里不动了。也见到synopsys的formality使用者遇到过这样的问题我认为这通常由于比较规模太大或者内存不够造成的,不排除少数情况工具有bug造成内存泄露。解决办法:1.检查是否用的64bit操作2.化整为零,用hierarchy 的方法比较。3.增加内存,或者增加swap的大小4.如果是版本支持,采取
  • 各前辈,谁有s7-200操作手册和s7-200密码破解软件
    各前辈,谁有s7-200操作手册和s7-200密码破解软件。新手上路请多多指教。
  • 【PSoC4心得】CapSense应用
    在《PSoC4心得_点亮LED》的基础上,添加CapSense功能。首先判断是否有手指按下,然后判断手指的位置是否发生改变,若有手指按下而且手指的位置发生改变,则改变LED的颜色。一、添加CapSense模块,设置如下:二、添加程序三、其他
  • TMS320F28335学习之ADC注意事项
  • 好笑的鬼故事
  • IR2101做H桥时高端输出波形不正常
  • RGB 六角形键盘
  • 利用微控制器如何根据PI调节器的输出来改变PWM的占空比?

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved
×