Skip to content

Commit

Permalink
Add PM support for the STM32F4Discovery -- still a work in progress
Browse files Browse the repository at this point in the history
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4976 42af7a65-404d-4744-a932-0658087f49c3
  • Loading branch information
patacongo committed Jul 25, 2012
1 parent 1c7794b commit c1a3d46
Show file tree
Hide file tree
Showing 21 changed files with 2,666 additions and 258 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -3065,4 +3065,7 @@
* include/termios.h and lib/termios/*: Replace cfsetispeed and cfsetospeed with
cfsetspeed (with definitions for the input/outputs in termios.h). Same for
cfgetispeed and cfgetospeed.
* configs/stm32f4discovery/src and configs/stm32f4discovery/pm: Add a power
management configuration for the STM32F4Discovery and supporting logic. This
check-in also includes some fixes for the F4 RTC alarm logic.

6 changes: 3 additions & 3 deletions arch/arm/src/stm32/stm32f40xxx_rtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -626,8 +626,8 @@ int up_rtcinitialize(void)

/* Then attach the ALARM interrupt handler */

irq_attach(STM32_IRQ_RTC, rtc_interrupt);
up_enable_irq(STM32_IRQ_RTC);
irq_attach(STM32_IRQ_RTC_WKUP, rtc_interrupt);
up_enable_irq(STM32_IRQ_RTC_WKUP);
#endif

g_rtc_enabled = true;
Expand Down Expand Up @@ -813,7 +813,7 @@ int up_rtc_settime(FAR const struct timespec *tp)
************************************************************************************/

#ifdef CONFIG_RTC_ALARM
int up_rtc_setalarm(FAR const struct timespec *tp, alarmcb_t callback);
int up_rtc_setalarm(FAR const struct timespec *tp, alarmcb_t callback)
{
irqstate_t flags;
int ret = -EBUSY;
Expand Down
47 changes: 47 additions & 0 deletions configs/stm32f4discovery/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1070,3 +1070,50 @@ Where <subdir> is one of the following:
CONFIG_STM32_CODESOURCERYW=y : CodeSourcery under Windows

NOTE: As of this writing, I have not seen the LCD work!

pm:
--
This is a configuration that is used to test STM32 power management, i.e.,
to test that the board can go into lower and lower states of power usage
as a result of inactivity. This configuration is based on the nsh2
configuration with modifications for testing power management. This
configuration should provide some guideline for power management in your
STM32 application.

CONFIG_STM32_CODESOURCERYW=y : CodeSourcery under Windows

CONFIG_PM_CUSTOMINIT and CONFIG_IDLE_CUSTOM are necessary parts of the
PM configuration:

CONFIG_PM_CUSTOMINIT=y

CONFIG_PM_CUSTOMINIT moves the PM initialization from arch/arm/src/stm32/stm32_pminitialiaze.c
to configs/stm3210-eval/src/up_pm.c. This allows us to support board-
specific PM initialization.

CONFIG_IDLE_CUSTOM=y

The bulk of the PM activities occur in the IDLE loop. The IDLE loop is
special because it is what runs when there is no other task running. Therefore
when the IDLE executes, we can be assure that nothing else is going on; this
is the ideal condition for doing reduced power management.

The configuration CONFIG_IDLE_CUSTOM allows us to "steal" the normal STM32
IDLE loop (of arch/arm/src/stm32/stm32_idle.c) and replace this with our own
custom IDLE loop (at configs/stm3210-eval/src/up_idle.c).

Here are some additional things to note in the configuration:

CONFIG_PM_BUTTONS=y

CONFIG_PM_BUTTONS enables button support for PM testing. Buttons can drive
EXTI interrupts and EXTI interrrupts can be used to wakeup for certain reduced
power modes (STOP mode). The use of the buttons here is for PM testing purposes
only; buttons would normally be part the application code and CONFIG_PM_BUTTONS
would not be defined.

CONFIG_RTC_ALARM=y

The RTC alarm is used to wake up from STOP mode and to transition to
STANDBY mode. This used of the RTC alarm could conflict with other uses of
the RTC alarm in your application.
4 changes: 2 additions & 2 deletions configs/stm32f4discovery/nsh/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,14 @@ ifeq ($(WINTOOL),y)
MKDEP = $(TOPDIR)/tools/mknulldeps.sh
ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/$(LDSCRIPT)}"
ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
MAXOPTIMIZATION = -O2
else
# Linux/Cygwin-native toolchain
MKDEP = $(TOPDIR)/tools/mkdeps.sh
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/$(LDSCRIPT)
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
endif

CC = $(CROSSDEV)gcc
Expand Down
4 changes: 2 additions & 2 deletions configs/stm32f4discovery/nxlines/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,14 @@ ifeq ($(WINTOOL),y)
MKDEP = $(TOPDIR)/tools/mknulldeps.sh
ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nxlines/$(LDSCRIPT)}"
ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
MAXOPTIMIZATION = -O2
else
# Linux/Cygwin-native toolchain
MKDEP = $(TOPDIR)/tools/mkdeps.sh
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nxlines/$(LDSCRIPT)
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
endif

CC = $(CROSSDEV)gcc
Expand Down
122 changes: 0 additions & 122 deletions configs/stm32f4discovery/nxlines/ld.script

This file was deleted.

4 changes: 2 additions & 2 deletions configs/stm32f4discovery/ostest/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,14 @@ ifeq ($(WINTOOL),y)
MKDEP = $(TOPDIR)/tools/mknulldeps.sh
ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/$(LDSCRIPT)}"
ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
MAXOPTIMIZATION = -O2
else
# Linux/Cygwin-native toolchain
MKDEP = $(TOPDIR)/tools/mkdeps.sh
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/$(LDSCRIPT)
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
endif

CC = $(CROSSDEV)gcc
Expand Down
122 changes: 0 additions & 122 deletions configs/stm32f4discovery/ostest/ld.script

This file was deleted.

Loading

0 comments on commit c1a3d46

Please sign in to comment.