Fix example-fsm-55 and documentation.

This commit is contained in:
NIIBE Yutaka
2017-11-15 10:46:49 +09:00
parent f161928b0b
commit bbe09de209
5 changed files with 27 additions and 5 deletions

View File

@@ -1,5 +1,8 @@
2017-11-15 NIIBE Yutaka <gniibe@fsij.org>
* example-fsm-55/hh.c (main): Add call to chopstx_conf_idle.
* example-fsm-55/Makefile (DEFS): Remove USE_WFI_FOR_IDLE.
* chopstx.c (chx_init): Initialize sleep lock.
(chopstx_conf_idle): New.
* chopstx-cortex-m.c (idle): Support sleep.

6
NEWS
View File

@@ -10,6 +10,12 @@ In Chopstx 1.4 and 1.5, cancellation doesn't work for real MCU. This
is due to the change of chx_sched interface, introduced for GNU/Linux
emulation. This bug is fixed.
** New feature: sleep mode
New function chopstx_conf_idle is added to support core sleep. Use of
sleep by this feature requires careful preparation. Enabling sleep, a
board with no RESET pin cannot be debugged by JTAG/SWD. Setting of
DBGMCU_CR (0xE0042004) is required beforehand (default is zero).
** USB API changes
INTR_REQ_USB is now defined by usb_lld.h. Enumeration type of
DEVICE_STATE now has USB_DEVICE_STATE_ prefix.

View File

@@ -11,7 +11,7 @@
This manual is for Chopstx (version @value{VERSION}).
@noindent
Copyright @copyright{} 2013, 2015, 2016 Flying Stone Technology @*
Copyright @copyright{} 2013, 2015, 2016, 2017 Flying Stone Technology @*
@quotation
Permission is granted to copy, distribute and/or modify this document
@@ -59,6 +59,7 @@ section entitled ``Copying''.
@menu
* Introduction:: What is Chopstx.
* Use of sleep mode:: Use it carefully.
* API:: API.
Appendix
@@ -83,9 +84,9 @@ Indexes
@node Introduction
@chapter Introduction
Chopstx is an RT thread library for ARM Cortex-M0, Cortex-M0plus and
Cortex-M3. Specifically, it is used for STM32F030, MKL27Z and
STM32F103.
Chopstx is an RT thread library for ARM Cortex-M0, Cortex-M0plus,
Cortex-M3 and GNU/Linux emulation. Specifically, it is used for
STM32F030, MKL27Z and STM32F103.
While most RTOSes come with many features, drivers, and stacks,
Chopstx just offers a RT thread library.
@@ -93,6 +94,16 @@ Chopstx just offers a RT thread library.
With Chopstx, interrupt handling is also done by a thread. This
enables coherent code for ease of maintenance.
@node Use of sleep mode
Calling the chopstx_conf_idle function with 1 to allow the idle thread
going to sleep. MCU will be in sleep mode when no threads are
running. By setting relevant system registers, MCU will be able to be
into deep sleep or stand-by mode.
If you use this sleep feature, please consider and implement
carefully. Enabling sleep, it may result bricked board; A board with
no RESET pin cannot be debugged by JTAG/SWD.
@node API
@chapter API

View File

@@ -25,7 +25,7 @@ OBJCOPY = $(CROSS)objcopy
MCU = cortex-m0 # -save-temps
CWARN = -Wall -Wextra -Wstrict-prototypes
DEFS = -DMAKE_ENTRY_PUBLIC \
-DFREE_STANDING -DMHZ=48 -DUSE_WFI_FOR_IDLE
-DFREE_STANDING -DMHZ=48
OPT = -O3 -Os -g
LIBS =

View File

@@ -366,6 +366,8 @@ main (int argc, const char *argv[])
(void)argc;
(void)argv;
chopstx_conf_idle (1);
chopstx_mutex_init (&mtx);
chopstx_cond_init (&cnd0);
chopstx_cond_init (&cnd1);