mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 08:22:32 +08:00
Add support for the ISOTEL NetClamps VSN board
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3321 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
+5
-1
@@ -1004,7 +1004,7 @@ configs/skp16c26
|
|||||||
uses the GNU m32c toolchain.
|
uses the GNU m32c toolchain.
|
||||||
|
|
||||||
configs/stm3210e-evel
|
configs/stm3210e-evel
|
||||||
STMicrco STM3210E-EVAL development board based on the STMicro STM32F103ZET6
|
STMicro STM3210E-EVAL development board based on the STMicro STM32F103ZET6
|
||||||
microcontroller (ARM Cortex-M3). This port uses the GNU Cortex-M3
|
microcontroller (ARM Cortex-M3). This port uses the GNU Cortex-M3
|
||||||
toolchain.
|
toolchain.
|
||||||
|
|
||||||
@@ -1012,6 +1012,10 @@ configs/us7032evb1
|
|||||||
This is a port of the Hitachi SH-1 on the Hitachi SH-1/US7032EVB1 board.
|
This is a port of the Hitachi SH-1 on the Hitachi SH-1/US7032EVB1 board.
|
||||||
STATUS: Work has just began on this port.
|
STATUS: Work has just began on this port.
|
||||||
|
|
||||||
|
configs/vsn
|
||||||
|
ISOTEL NetClamps VSN V1.2 ready2go sensor network platform based on the
|
||||||
|
STMicro STM32F103RET6. Contributed by Uros Platise.
|
||||||
|
|
||||||
configs/xtrs
|
configs/xtrs
|
||||||
TRS80 Model 3. This port uses a vintage computer based on the Z80.
|
TRS80 Model 3. This port uses a vintage computer based on the Z80.
|
||||||
An emulator for this computer is available to run TRS80 programs on a
|
An emulator for this computer is available to run TRS80 programs on a
|
||||||
|
|||||||
@@ -179,11 +179,18 @@ CONFIG_SPI_POLLWAIT=y
|
|||||||
# CONFIG_HAVE_LIBM - toolchain supports libm.a
|
# CONFIG_HAVE_LIBM - toolchain supports libm.a
|
||||||
#
|
#
|
||||||
CONFIG_RRLOAD_BINARY=n
|
CONFIG_RRLOAD_BINARY=n
|
||||||
CONFIG_INTELHEX_BINARY=y
|
CONFIG_INTELHEX_BINARY=n
|
||||||
CONFIG_MOTOROLA_SREC=n
|
CONFIG_MOTOROLA_SREC=y
|
||||||
CONFIG_RAW_BINARY=n
|
CONFIG_RAW_BINARY=n
|
||||||
CONFIG_HAVE_LIBM=n
|
CONFIG_HAVE_LIBM=n
|
||||||
|
|
||||||
|
#
|
||||||
|
# Setup for a two-pass build
|
||||||
|
#
|
||||||
|
CONFIG_BUILD_2PASS=n
|
||||||
|
CONFIG_PASS1_BUILDIR=configs/demo9s12ne64/initrel
|
||||||
|
CONFIG_PASS1_OBJECT=init.r
|
||||||
|
|
||||||
#
|
#
|
||||||
# General OS setup
|
# General OS setup
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -190,11 +190,18 @@ CONFIG_SPI_POLLWAIT=y
|
|||||||
# CONFIG_HAVE_LIBM - toolchain supports libm.a
|
# CONFIG_HAVE_LIBM - toolchain supports libm.a
|
||||||
#
|
#
|
||||||
CONFIG_RRLOAD_BINARY=n
|
CONFIG_RRLOAD_BINARY=n
|
||||||
CONFIG_INTELHEX_BINARY=y
|
CONFIG_INTELHEX_BINARY=n
|
||||||
CONFIG_MOTOROLA_SREC=n
|
CONFIG_MOTOROLA_SREC=y
|
||||||
CONFIG_RAW_BINARY=n
|
CONFIG_RAW_BINARY=n
|
||||||
CONFIG_HAVE_LIBM=n
|
CONFIG_HAVE_LIBM=n
|
||||||
|
|
||||||
|
#
|
||||||
|
# Setup for a two-pass build
|
||||||
|
#
|
||||||
|
CONFIG_BUILD_2PASS=n
|
||||||
|
CONFIG_PASS1_BUILDIR=configs/ne64badge/initrel
|
||||||
|
CONFIG_PASS1_OBJECT=init.r
|
||||||
|
|
||||||
#
|
#
|
||||||
# General OS setup
|
# General OS setup
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ SECTIONS
|
|||||||
_etext = ABSOLUTE(.);
|
_etext = ABSOLUTE(.);
|
||||||
} > hitext
|
} > hitext
|
||||||
|
|
||||||
_eronly = ABSOLUTE(.); /* See below */
|
_eronly = ABSOLUTE(.);
|
||||||
|
|
||||||
.data : {
|
.data : {
|
||||||
_sdata = ABSOLUTE(.);
|
_sdata = ABSOLUTE(.);
|
||||||
@@ -121,7 +121,7 @@ SECTIONS
|
|||||||
*(vectors)
|
*(vectors)
|
||||||
} > vectors
|
} > vectors
|
||||||
|
|
||||||
.bss : { /* BSS */
|
.bss : {
|
||||||
_sbss = ABSOLUTE(.);
|
_sbss = ABSOLUTE(.);
|
||||||
*(.bss .bss.*)
|
*(.bss .bss.*)
|
||||||
*(.gnu.linkonce.b.*)
|
*(.gnu.linkonce.b.*)
|
||||||
|
|||||||
@@ -49,7 +49,9 @@ MEMORY
|
|||||||
|
|
||||||
/* Three fixed text flash pages (corresponding to page 3e, 3d, and 3f) at
|
/* Three fixed text flash pages (corresponding to page 3e, 3d, and 3f) at
|
||||||
* 16Kb each (minus 256 bytes at the end of page 3f that is reserved for
|
* 16Kb each (minus 256 bytes at the end of page 3f that is reserved for
|
||||||
* interrupt vectors).
|
* interrupt vectors). Notice that this is linked as a single contiguous;
|
||||||
|
* Post-processing is planned to make the binary to the appropriate flash
|
||||||
|
* pages.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
text (rx) : ORIGIN = 0x4000, LENGTH = 48K-256 /* Page 3e, 3d, and 3f */
|
text (rx) : ORIGIN = 0x4000, LENGTH = 48K-256 /* Page 3e, 3d, and 3f */
|
||||||
@@ -78,7 +80,7 @@ SECTIONS
|
|||||||
_etext = ABSOLUTE(.);
|
_etext = ABSOLUTE(.);
|
||||||
} > text
|
} > text
|
||||||
|
|
||||||
_eronly = ABSOLUTE(.); /* See below */
|
_eronly = ABSOLUTE(.);
|
||||||
|
|
||||||
.data : {
|
.data : {
|
||||||
_sdata = ABSOLUTE(.);
|
_sdata = ABSOLUTE(.);
|
||||||
@@ -92,7 +94,7 @@ SECTIONS
|
|||||||
*(vectors)
|
*(vectors)
|
||||||
} > vectors
|
} > vectors
|
||||||
|
|
||||||
.bss : { /* BSS */
|
.bss : {
|
||||||
_sbss = ABSOLUTE(.);
|
_sbss = ABSOLUTE(.);
|
||||||
*(.bss .bss.*)
|
*(.bss .bss.*)
|
||||||
*(.gnu.linkonce.b.*)
|
*(.gnu.linkonce.b.*)
|
||||||
|
|||||||
@@ -0,0 +1,418 @@
|
|||||||
|
README
|
||||||
|
^^^^^^
|
||||||
|
|
||||||
|
This README discusses issues unique to NuttX configurations for the
|
||||||
|
ISOTEL NetClamps VSN V1.2 ready2go sensor network platform.
|
||||||
|
|
||||||
|
Contents
|
||||||
|
^^^^^^^^
|
||||||
|
|
||||||
|
- Development Environment
|
||||||
|
- GNU Toolchain Options
|
||||||
|
- IDEs
|
||||||
|
- NuttX buildroot Toolchain
|
||||||
|
- DFU
|
||||||
|
- LEDs
|
||||||
|
- VSN-specific Configuration Options
|
||||||
|
- Configurations
|
||||||
|
|
||||||
|
Development Environment
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
Either Linux or Cygwin on Windows can be used for the development environment.
|
||||||
|
The source has been built only using the GNU toolchain (see below). Other
|
||||||
|
toolchains will likely cause problems. Testing was performed using the Cygwin
|
||||||
|
environment because the Raisonance R-Link emulatator and some RIDE7 development tools
|
||||||
|
were used and those tools works only under Windows.
|
||||||
|
|
||||||
|
GNU Toolchain Options
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
The NuttX make system has been modified to support the following different
|
||||||
|
toolchain options.
|
||||||
|
|
||||||
|
1. The CodeSourcery GNU toolchain,
|
||||||
|
2. The devkitARM GNU toolchain,
|
||||||
|
3. Raisonance GNU toolchain, or
|
||||||
|
4. The NuttX buildroot Toolchain (see below).
|
||||||
|
|
||||||
|
All testing has been conducted using the NuttX buildroot toolchain. However,
|
||||||
|
the make system is setup to default to use the devkitARM toolchain. To use
|
||||||
|
the CodeSourcery, devkitARM or Raisonance GNU toolchain, you simply need to
|
||||||
|
add one of the following configuration options to your .config (or defconfig)
|
||||||
|
file:
|
||||||
|
|
||||||
|
CONFIG_STM32_CODESOURCERYW=y : CodeSourcery under Windows
|
||||||
|
CONFIG_STM32_CODESOURCERYL=y : CodeSourcery under Linux
|
||||||
|
CONFIG_STM32_DEVKITARM=y : devkitARM under Windows
|
||||||
|
CONFIG_STM32_RAISONANCE=y : Raisonance RIDE7 under Windows
|
||||||
|
CONFIG_STM32_BUILDROOT=y : NuttX buildroot under Linux or Cygwin (default)
|
||||||
|
|
||||||
|
If you are not using CONFIG_STM32_BUILDROOT, then you may also have to modify
|
||||||
|
the PATH in the setenv.h file if your make cannot find the tools.
|
||||||
|
|
||||||
|
NOTE: the CodeSourcery (for Windows), devkitARM, and Raisonance toolchains are
|
||||||
|
Windows native toolchains. The CodeSourcey (for Linux) and NuttX buildroot
|
||||||
|
toolchains are Cygwin and/or Linux native toolchains. There are several limitations
|
||||||
|
to using a Windows based toolchain in a Cygwin environment. The three biggest are:
|
||||||
|
|
||||||
|
1. The Windows toolchain cannot follow Cygwin paths. Path conversions are
|
||||||
|
performed automatically in the Cygwin makefiles using the 'cygpath' utility
|
||||||
|
but you might easily find some new path problems. If so, check out 'cygpath -w'
|
||||||
|
|
||||||
|
2. Windows toolchains cannot follow Cygwin symbolic links. Many symbolic links
|
||||||
|
are used in Nuttx (e.g., include/arch). The make system works around these
|
||||||
|
problems for the Windows tools by copying directories instead of linking them.
|
||||||
|
But this can also cause some confusion for you: For example, you may edit
|
||||||
|
a file in a "linked" directory and find that your changes had not effect.
|
||||||
|
That is because you are building the copy of the file in the "fake" symbolic
|
||||||
|
directory. If you use a Windows toolchain, you should get in the habit of
|
||||||
|
making like this:
|
||||||
|
|
||||||
|
make clean_context all
|
||||||
|
|
||||||
|
An alias in your .bashrc file might make that less painful.
|
||||||
|
|
||||||
|
3. Dependencies are not made when using Windows versions of the GCC. This is
|
||||||
|
because the dependencies are generated using Windows pathes which do not
|
||||||
|
work with the Cygwin make.
|
||||||
|
|
||||||
|
Support has been added for making dependencies with the windows-native toolchains.
|
||||||
|
That support can be enabled by modifying your Make.defs file as follows:
|
||||||
|
|
||||||
|
- MKDEP = $(TOPDIR)/tools/mknulldeps.sh
|
||||||
|
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh --winpaths "$(TOPDIR)"
|
||||||
|
|
||||||
|
If you have problems with the dependency build (for example, if you are not
|
||||||
|
building on C:), then you may need to modify tools/mkdeps.sh
|
||||||
|
|
||||||
|
NOTE 1: The CodeSourcery toolchain (2009q1) does not work with default optimization
|
||||||
|
level of -Os (See Make.defs). It will work with -O0, -O1, or -O2, but not with
|
||||||
|
-Os.
|
||||||
|
|
||||||
|
NOTE 2: The devkitARM toolchain includes a version of MSYS make. Make sure that
|
||||||
|
the paths to Cygwin's /bin and /usr/bin directories appear BEFORE the devkitARM
|
||||||
|
path or will get the wrong version of make.
|
||||||
|
|
||||||
|
IDEs
|
||||||
|
^^^^
|
||||||
|
|
||||||
|
NuttX is built using command-line make. It can be used with an IDE, but some
|
||||||
|
effort will be required to create the project (There is a simple RIDE project
|
||||||
|
in the RIDE subdirectory).
|
||||||
|
|
||||||
|
Makefile Build
|
||||||
|
--------------
|
||||||
|
Under Eclipse, it is pretty easy to set up an "empty makefile project" and
|
||||||
|
simply use the NuttX makefile to build the system. That is almost for free
|
||||||
|
under Linux. Under Windows, you will need to set up the "Cygwin GCC" empty
|
||||||
|
makefile project in order to work with Windows (Google for "Eclipse Cygwin" -
|
||||||
|
there is a lot of help on the internet).
|
||||||
|
|
||||||
|
Native Build
|
||||||
|
------------
|
||||||
|
Here are a few tips before you start that effort:
|
||||||
|
|
||||||
|
1) Select the toolchain that you will be using in your .config file
|
||||||
|
2) Start the NuttX build at least one time from the Cygwin command line
|
||||||
|
before trying to create your project. This is necessary to create
|
||||||
|
certain auto-generated files and directories that will be needed.
|
||||||
|
3) Set up include pathes: You will need include/, arch/arm/src/stm32,
|
||||||
|
arch/arm/src/common, arch/arm/src/cortexm3, and sched/.
|
||||||
|
4) All assembly files need to have the definition option -D __ASSEMBLY__
|
||||||
|
on the command line.
|
||||||
|
|
||||||
|
Startup files will probably cause you some headaches. The NuttX startup file
|
||||||
|
is arch/arm/src/stm32/stm32_vectors.S. With RIDE, I have to build NuttX
|
||||||
|
one time from the Cygwin command line in order to obtain the pre-built
|
||||||
|
startup object needed by RIDE.
|
||||||
|
|
||||||
|
NuttX buildroot Toolchain
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
A GNU GCC-based toolchain is assumed. The files */setenv.sh should
|
||||||
|
be modified to point to the correct path to the Cortex-M3 GCC toolchain (if
|
||||||
|
different from the default in your PATH variable).
|
||||||
|
|
||||||
|
If you have no Cortex-M3 toolchain, one can be downloaded from the NuttX
|
||||||
|
SourceForge download site (https://sourceforge.net/project/showfiles.php?group_id=189573).
|
||||||
|
This GNU toolchain builds and executes in the Linux or Cygwin environment.
|
||||||
|
|
||||||
|
1. You must have already configured Nuttx in <some-dir>/nuttx.
|
||||||
|
|
||||||
|
cd tools
|
||||||
|
./configure.sh vsn/<sub-dir>
|
||||||
|
|
||||||
|
2. Download the latest buildroot package into <some-dir>
|
||||||
|
|
||||||
|
3. unpack the buildroot tarball. The resulting directory may
|
||||||
|
have versioning information on it like buildroot-x.y.z. If so,
|
||||||
|
rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
|
||||||
|
|
||||||
|
4. cd <some-dir>/buildroot
|
||||||
|
|
||||||
|
5. cp configs/cortexm3-defconfig-4.3.3 .config
|
||||||
|
|
||||||
|
6. make oldconfig
|
||||||
|
|
||||||
|
7. make
|
||||||
|
|
||||||
|
8. Edit setenv.h, if necessary, so that the PATH variable includes
|
||||||
|
the path to the newly built binaries.
|
||||||
|
|
||||||
|
See the file configs/README.txt in the buildroot source tree. That has more
|
||||||
|
detailed PLUS some special instructions that you will need to follow if you are
|
||||||
|
building a Cortex-M3 toolchain for Cygwin under Windows.
|
||||||
|
|
||||||
|
DFU
|
||||||
|
^^^
|
||||||
|
|
||||||
|
The linker files in these projects can be configured to indicate that you
|
||||||
|
will be loading code using STMicro built-in USB Device Firmware Upgrade (DFU)
|
||||||
|
loader or via some JTAG emulator. You can specify the DFU bootloader by
|
||||||
|
adding the following line:
|
||||||
|
|
||||||
|
CONFIG_STM32_DFU=y
|
||||||
|
|
||||||
|
to your .config file. Most of the configurations in this directory are set
|
||||||
|
up to use the DFU loader.
|
||||||
|
|
||||||
|
If CONFIG_STM32_DFU is defined, the code will not be positioned at the beginning
|
||||||
|
of FLASH (0x08000000) but will be offset to 0x08003000. This offset is needed
|
||||||
|
to make space for the DFU loader and 0x08003000 is where the DFU loader expects
|
||||||
|
to find new applications at boot time. If you need to change that origin for some
|
||||||
|
other bootloader, you will need to edit the file(s) ld.script.dfu for each
|
||||||
|
configuration.
|
||||||
|
|
||||||
|
The DFU SE PC-based software is available from the STMicro website,
|
||||||
|
http://www.st.com. General usage instructions:
|
||||||
|
|
||||||
|
1. Convert the NuttX Intel Hex file (nuttx.ihx) into a special DFU
|
||||||
|
file (nuttx.dfu)... see below for details.
|
||||||
|
2. Connect the VSN board to your computer using a USB
|
||||||
|
cable.
|
||||||
|
3. Start the DFU loader on the VSN board. You do this by
|
||||||
|
resetting the board while holding the "Key" button. Windows should
|
||||||
|
recognize that the DFU loader has been installed.
|
||||||
|
3. Run the DFU SE program to load nutt.dfu into FLASH.
|
||||||
|
|
||||||
|
What if the DFU loader is not in FLASH? The loader code is available
|
||||||
|
inside of the Demo dirctory of the USBLib ZIP file that can be downloaded
|
||||||
|
from the STMicro Website. You can build it using RIDE (or other toolchains);
|
||||||
|
you will need a JTAG emulator to burn it into FLASH the first time.
|
||||||
|
|
||||||
|
In order to use STMicro's built-in DFU loader, you will have to get
|
||||||
|
the NuttX binary into a special format with a .dfu extension. The
|
||||||
|
DFU SE PC_based software installation includes a file "DFU File Manager"
|
||||||
|
conversion program that a file in Intel Hex format to the special DFU
|
||||||
|
format. When you successfully build NuttX, you will find a file called
|
||||||
|
nutt.ihx in the top-level directory. That is the file that you should
|
||||||
|
provide to the DFU File Manager. You will need to rename it to nuttx.hex
|
||||||
|
in order to find it with the DFU File Manager. You will end up with
|
||||||
|
a file called nuttx.dfu that you can use with the STMicro DFU SE program.
|
||||||
|
|
||||||
|
LEDs
|
||||||
|
^^^^
|
||||||
|
|
||||||
|
The VSN board has four LEDs labeled LD1, LD2, LD3 and LD4 on the
|
||||||
|
the board. Usage of these LEDs is defined in include/board.h and src/up_leds.c.
|
||||||
|
They are encoded as follows:
|
||||||
|
|
||||||
|
SYMBOL Meaning LED1* LED2 LED3 LED4
|
||||||
|
------------------- ----------------------- ------- ------- ------- ------
|
||||||
|
LED_STARTED NuttX has been started ON OFF OFF OFF
|
||||||
|
LED_HEAPALLOCATE Heap has been allocated OFF ON OFF OFF
|
||||||
|
LED_IRQSENABLED Interrupts enabled ON ON OFF OFF
|
||||||
|
LED_STACKCREATED Idle stack created OFF OFF ON OFF
|
||||||
|
LED_INIRQ In an interrupt** ON N/C N/C OFF
|
||||||
|
LED_SIGNAL In a signal handler*** N/C ON N/C OFF
|
||||||
|
LED_ASSERTION An assertion failed ON ON N/C OFF
|
||||||
|
LED_PANIC The system has crashed N/C N/C N/C ON
|
||||||
|
|
||||||
|
* If LED1, LED2, LED3 are statically on, then NuttX probably failed to boot
|
||||||
|
and these LEDs will give you some indication of where the failure was
|
||||||
|
** The normal state is LED3 ON and LED1 faintly glowing. This faint glow
|
||||||
|
is because of timer interupts that result in the LED being illuminated
|
||||||
|
on a small proportion of the time.
|
||||||
|
*** LED2 may also flicker normally if signals are processed.
|
||||||
|
|
||||||
|
VSN-specific Configuration Options
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
CONFIG_ARCH - Identifies the arch/ subdirectory. This should
|
||||||
|
be set to:
|
||||||
|
|
||||||
|
CONFIG_ARCH=arm
|
||||||
|
|
||||||
|
CONFIG_ARCH_family - For use in C code:
|
||||||
|
|
||||||
|
CONFIG_ARCH_ARM=y
|
||||||
|
|
||||||
|
CONFIG_ARCH_architecture - For use in C code:
|
||||||
|
|
||||||
|
CONFIG_ARCH_CORTEXM3=y
|
||||||
|
|
||||||
|
CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
|
||||||
|
|
||||||
|
CONFIG_ARCH_CHIP=stm32
|
||||||
|
|
||||||
|
CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
|
||||||
|
chip:
|
||||||
|
|
||||||
|
CONFIG_ARCH_CHIP_STM32F103ZET6
|
||||||
|
|
||||||
|
CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
|
||||||
|
hence, the board that supports the particular chip or SoC.
|
||||||
|
|
||||||
|
CONFIG_ARCH_BOARD=vsn (for the VSN development board)
|
||||||
|
|
||||||
|
CONFIG_ARCH_BOARD_name - For use in C code
|
||||||
|
|
||||||
|
CONFIG_ARCH_BOARD_VSN=y
|
||||||
|
|
||||||
|
CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
|
||||||
|
of delay loops
|
||||||
|
|
||||||
|
CONFIG_ENDIAN_BIG - define if big endian (default is little
|
||||||
|
endian)
|
||||||
|
|
||||||
|
CONFIG_DRAM_SIZE - Describes the installed DRAM (SRAM in this case):
|
||||||
|
|
||||||
|
CONFIG_DRAM_SIZE=0x00010000 (64Kb)
|
||||||
|
|
||||||
|
CONFIG_DRAM_START - The start address of installed DRAM
|
||||||
|
|
||||||
|
CONFIG_DRAM_START=0x20000000
|
||||||
|
|
||||||
|
CONFIG_DRAM_END - Last address+1 of installed RAM
|
||||||
|
|
||||||
|
CONFIG_DRAM_END=(CONFIG_DRAM_START+CONFIG_DRAM_SIZE)
|
||||||
|
|
||||||
|
CONFIG_ARCH_IRQPRIO - The STM32F103Z supports interrupt prioritization
|
||||||
|
|
||||||
|
CONFIG_ARCH_IRQPRIO=y
|
||||||
|
|
||||||
|
CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
|
||||||
|
have LEDs
|
||||||
|
|
||||||
|
CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
|
||||||
|
stack. If defined, this symbol is the size of the interrupt
|
||||||
|
stack in bytes. If not defined, the user task stacks will be
|
||||||
|
used during interrupt handling.
|
||||||
|
|
||||||
|
CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
|
||||||
|
|
||||||
|
CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
|
||||||
|
|
||||||
|
CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
|
||||||
|
cause a 100 second delay during boot-up. This 100 second delay
|
||||||
|
serves no purpose other than it allows you to calibratre
|
||||||
|
CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
|
||||||
|
the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
|
||||||
|
the delay actually is 100 seconds.
|
||||||
|
|
||||||
|
Individual subsystems can be enabled:
|
||||||
|
AHB
|
||||||
|
---
|
||||||
|
CONFIG_STM32_DMA1
|
||||||
|
CONFIG_STM32_DMA2
|
||||||
|
CONFIG_STM32_CRC
|
||||||
|
CONFIG_STM32_FSMC
|
||||||
|
CONFIG_STM32_SDIO
|
||||||
|
|
||||||
|
APB1
|
||||||
|
----
|
||||||
|
CONFIG_STM32_TIM2
|
||||||
|
CONFIG_STM32_TIM3
|
||||||
|
CONFIG_STM32_TIM4
|
||||||
|
CONFIG_STM32_TIM5
|
||||||
|
CONFIG_STM32_TIM6
|
||||||
|
CONFIG_STM32_TIM7
|
||||||
|
CONFIG_STM32_WWDG
|
||||||
|
CONFIG_STM32_SPI2
|
||||||
|
CONFIG_STM32_SPI4
|
||||||
|
CONFIG_STM32_USART2
|
||||||
|
CONFIG_STM32_USART3
|
||||||
|
CONFIG_STM32_UART4
|
||||||
|
CONFIG_STM32_UART5
|
||||||
|
CONFIG_STM32_I2C1
|
||||||
|
CONFIG_STM32_I2C2
|
||||||
|
CONFIG_STM32_USB
|
||||||
|
CONFIG_STM32_CAN
|
||||||
|
CONFIG_STM32_BKP
|
||||||
|
CONFIG_STM32_PWR
|
||||||
|
CONFIG_STM32_DAC
|
||||||
|
CONFIG_STM32_USB
|
||||||
|
|
||||||
|
APB2
|
||||||
|
----
|
||||||
|
CONFIG_STM32_ADC1
|
||||||
|
CONFIG_STM32_ADC2
|
||||||
|
CONFIG_STM32_TIM1
|
||||||
|
CONFIG_STM32_SPI1
|
||||||
|
CONFIG_STM32_TIM8
|
||||||
|
CONFIG_STM32_USART1
|
||||||
|
CONFIG_STM32_ADC3
|
||||||
|
|
||||||
|
Alternate pin mappings (should not be used with the VSN board):
|
||||||
|
|
||||||
|
CONFIG_STM32_TIM1_FULL_REMAP
|
||||||
|
CONFIG_STM32_TIM1_PARTIAL_REMAP
|
||||||
|
CONFIG_STM32_TIM2_FULL_REMAP
|
||||||
|
CONFIG_STM32_TIM2_PARTIAL_REMAP_1
|
||||||
|
CONFIG_STM32_TIM2_PARTIAL_REMAP_2
|
||||||
|
CONFIG_STM32_TIM3_FULL_REMAP
|
||||||
|
CONFIG_STM32_TIM3_PARTIAL_REMAP
|
||||||
|
CONFIG_STM32_TIM4_REMAP
|
||||||
|
CONFIG_STM32_USART1_REMAP
|
||||||
|
CONFIG_STM32_USART2_REMAP
|
||||||
|
CONFIG_STM32_USART3_FULL_REMAP
|
||||||
|
CONFIG_STM32_USART3_PARTIAL_REMAP
|
||||||
|
CONFIG_STM32_SPI1_REMAP
|
||||||
|
CONFIG_STM32_SPI3_REMAP
|
||||||
|
CONFIG_STM32_I2C1_REMAP
|
||||||
|
CONFIG_STM32_CAN1_FULL_REMAP
|
||||||
|
CONFIG_STM32_CAN1_PARTIAL_REMAP
|
||||||
|
CONFIG_STM32_CAN2_REMAP
|
||||||
|
|
||||||
|
STM32F103Z specific device driver settings
|
||||||
|
|
||||||
|
CONFIG_U[S]ARTn_SERIAL_CONSOLE - selects the USARTn (n=1,2,3) or UART
|
||||||
|
m (m=4,5) for the console and ttys0 (default is the USART1).
|
||||||
|
CONFIG_U[S]ARTn_RXBUFSIZE - Characters are buffered as received.
|
||||||
|
This specific the size of the receive buffer
|
||||||
|
CONFIG_U[S]ARTn_TXBUFSIZE - Characters are buffered before
|
||||||
|
being sent. This specific the size of the transmit buffer
|
||||||
|
CONFIG_U[S]ARTn_BAUD - The configure BAUD of the UART. Must be
|
||||||
|
CONFIG_U[S]ARTn_BITS - The number of bits. Must be either 7 or 8.
|
||||||
|
CONFIG_U[S]ARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
|
||||||
|
CONFIG_U[S]ARTn_2STOP - Two stop bits
|
||||||
|
|
||||||
|
CONFIG_STM32_SPI_INTERRUPTS - Select to enable interrupt driven SPI
|
||||||
|
support. Non-interrupt-driven, poll-waiting is recommended if the
|
||||||
|
interrupt rate would be to high in the interrupt driven case.
|
||||||
|
CONFIG_STM32_SPI_DMA - Use DMA to improve SPI transfer performance.
|
||||||
|
Cannot be used with CONFIG_STM32_SPI_INTERRUPT.
|
||||||
|
|
||||||
|
CONFIG_SDIO_DMA - Support DMA data transfers. Requires CONFIG_STM32_SDIO
|
||||||
|
and CONFIG_STM32_DMA2.
|
||||||
|
CONFIG_SDIO_PRI - Select SDIO interrupt prority. Default: 128
|
||||||
|
CONFIG_SDIO_DMAPRIO - Select SDIO DMA interrupt priority.
|
||||||
|
Default: Medium
|
||||||
|
|
||||||
|
Configurations
|
||||||
|
^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
Each VSN configuration is maintained in a sudirectory and
|
||||||
|
can be selected as follow:
|
||||||
|
|
||||||
|
cd tools
|
||||||
|
./configure.sh vsn/<subdir>
|
||||||
|
cd -
|
||||||
|
. ./setenv.sh
|
||||||
|
|
||||||
|
Where <subdir> is one of the following:
|
||||||
|
|
||||||
|
nsh:
|
||||||
|
Configures the NuttShell (nsh) located at examples/nsh. The
|
||||||
|
Configuration enables both the serial and telnetd NSH interfaces.
|
||||||
@@ -0,0 +1,206 @@
|
|||||||
|
/************************************************************************************
|
||||||
|
* configs/vsn-1.2/include/board.h
|
||||||
|
* include/arch/board/board.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Gregory Nutt. All rights reserved.
|
||||||
|
* Copyright (C) 2011 Uros Platise. All rights reserved
|
||||||
|
*
|
||||||
|
* Authors: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
|
* Uros Platise <uros.platise@isotel.eu>
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. 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.
|
||||||
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
|
* used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* 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 OWNER 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.
|
||||||
|
*
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __ARCH_BOARD_BOARD_H
|
||||||
|
#define __ARCH_BOARD_BOARD_H
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Included Files
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
#ifndef __ASSEMBLY__
|
||||||
|
# include <stdint.h>
|
||||||
|
#endif
|
||||||
|
#include "stm32_rcc.h"
|
||||||
|
#include "stm32_sdio.h"
|
||||||
|
#include "stm32_internal.h"
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Definitions
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/* Clocking *************************************************************************/
|
||||||
|
|
||||||
|
/* On-board external frequency source is 9MHz (HSE) provided by the CC1101, so it is
|
||||||
|
* not available on power-up. Instead we are about to run on HSI*9 = 36 MHz, see
|
||||||
|
* up_sysclock.c for details. */
|
||||||
|
|
||||||
|
#define STM32_BOARD_XTAL 9000000UL
|
||||||
|
#define STM32_BOARD_HCLK 36000000UL
|
||||||
|
|
||||||
|
/* PLL source is either HSI or HSE
|
||||||
|
* When HSI: PLL multiplier is 9, out frequency 36 MHz
|
||||||
|
* When HSE: PLL multiplier is 8: out frequency is 9 MHz x 8 = 72MHz
|
||||||
|
*/
|
||||||
|
#define STM32_CFGR_PLLSRC_HSI 0
|
||||||
|
#define STM32_CFGR_PLLMUL_HSI RCC_CFGR_PLLMUL_CLKx9
|
||||||
|
|
||||||
|
#define STM32_CFGR_PLLXTPRE_HSE 0
|
||||||
|
#define STM32_CFGR_PLLSRC_HSE RCC_CFGR_PLLSRC
|
||||||
|
#define STM32_CFGR_PLLMUL_HSE RCC_CFGR_PLLMUL_CLKx8
|
||||||
|
|
||||||
|
/* Use the PLL and set the SYSCLK source to be the PLL */
|
||||||
|
|
||||||
|
#define STM32_SYSCLK_SW RCC_CFGR_SW_PLL
|
||||||
|
#define STM32_SYSCLK_SWS RCC_CFGR_SWS_PLL
|
||||||
|
|
||||||
|
/* AHB clock (HCLK, 36 MHz) is SYSCLK on HSI or SYSCLK/2 on HSE */
|
||||||
|
|
||||||
|
#define STM32_RCC_CFGR_HPRE_HSI RCC_CFGR_HPRE_SYSCLK
|
||||||
|
#define STM32_RCC_CFGR_HPRE_HSE RCC_CFGR_HPRE_SYSCLKd2
|
||||||
|
#define STM32_HCLK_FREQUENCY STM32_BOARD_HCLK
|
||||||
|
|
||||||
|
/* APB2 clock (PCLK2) is HCLK (36MHz) */
|
||||||
|
|
||||||
|
#define STM32_RCC_CFGR_PPRE2 RCC_CFGR_PPRE2_HCLK
|
||||||
|
#define STM32_PCLK2_FREQUENCY STM32_BOARD_HCLK
|
||||||
|
|
||||||
|
/* APB1 clock (PCLK1) is HCLK (36MHz) */
|
||||||
|
|
||||||
|
#define STM32_RCC_CFGR_PPRE1 RCC_CFGR_PPRE1_HCLK
|
||||||
|
#define STM32_PCLK1_FREQUENCY STM32_BOARD_HCLK
|
||||||
|
|
||||||
|
/* USB divider -- Divide PLL clock by 1.5 */
|
||||||
|
|
||||||
|
#define STM32_CFGR_USBPRE 0
|
||||||
|
|
||||||
|
/* SDIO dividers. Note that slower clocking is required when DMA is disabled
|
||||||
|
* in order to avoid RX overrun/TX underrun errors due to delayed responses
|
||||||
|
* to service FIFOs in interrupt driven mode. These values have not been
|
||||||
|
* tuned!!!
|
||||||
|
*
|
||||||
|
* \todo Not checked yet! Uros.
|
||||||
|
* HCLK=36MHz, SDIOCLK=? MHz, SDIO_CK=HCLK/(178+2)=400 KHz
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define SDIO_INIT_CLKDIV (178 << SDIO_CLKCR_CLKDIV_SHIFT)
|
||||||
|
|
||||||
|
/* DMA ON: HCLK=72 MHz, SDIOCLK=72MHz, SDIO_CK=HCLK/(2+2)=18 MHz
|
||||||
|
* DMA OFF: HCLK=72 MHz, SDIOCLK=72MHz, SDIO_CK=HCLK/(3+2)=14.4 MHz
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef CONFIG_SDIO_DMA
|
||||||
|
# define SDIO_MMCXFR_CLKDIV (2 << SDIO_CLKCR_CLKDIV_SHIFT)
|
||||||
|
#else
|
||||||
|
# define SDIO_MMCXFR_CLKDIV (3 << SDIO_CLKCR_CLKDIV_SHIFT)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* DMA ON: HCLK=72 MHz, SDIOCLK=72MHz, SDIO_CK=HCLK/(1+2)=24 MHz
|
||||||
|
* DMA OFF: HCLK=72 MHz, SDIOCLK=72MHz, SDIO_CK=HCLK/(3+2)=14.4 MHz
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef CONFIG_SDIO_DMA
|
||||||
|
# define SDIO_SDXFR_CLKDIV (1 << SDIO_CLKCR_CLKDIV_SHIFT)
|
||||||
|
#else
|
||||||
|
# define SDIO_SDXFR_CLKDIV (3 << SDIO_CLKCR_CLKDIV_SHIFT)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* LED definitions ******************************************************************/
|
||||||
|
|
||||||
|
/* The VSN has one LED that we will encode as: */
|
||||||
|
|
||||||
|
#define LED_STARTED 0 /* ... */
|
||||||
|
#define LED_HEAPALLOCATE 1 /* ... */
|
||||||
|
#define LED_IRQSENABLED 2 /* ... */
|
||||||
|
#define LED_STACKCREATED 3 /* ... */
|
||||||
|
#define LED_INIRQ 4 /* ... */
|
||||||
|
#define LED_SIGNAL 5 /* ... */
|
||||||
|
#define LED_ASSERTION 6 /* ... */
|
||||||
|
#define LED_PANIC 7 /* ... */
|
||||||
|
#define LED_IDLE 8 /* shows idle state */
|
||||||
|
|
||||||
|
/* eXternal connector pins */
|
||||||
|
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Public Data
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __ASSEMBLY__
|
||||||
|
|
||||||
|
#undef EXTERN
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
#define EXTERN extern "C"
|
||||||
|
extern "C" {
|
||||||
|
#else
|
||||||
|
#define EXTERN extern
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Public Function Prototypes
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
EXTERN void stm32_board_clockconfig(void);
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Name: stm32_boardinitialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* All STM32 architectures must provide the following entry point. This entry point
|
||||||
|
* is called early in the intitialization -- after all memory has been configured
|
||||||
|
* and mapped but before any devices have been initialized.
|
||||||
|
*
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
EXTERN void stm32_boardinitialize(void);
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Button support.
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* up_buttoninit() must be called to initialize button resources. After that,
|
||||||
|
* up_buttons() may be called to collect the state of all buttons. up_buttons()
|
||||||
|
* returns an 8-bit bit set with each bit associated with a button. See the
|
||||||
|
* BUTTON_* and JOYSTICK_* definitions above for the meaning of each bit.
|
||||||
|
*
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARCH_BUTTONS
|
||||||
|
EXTERN void up_buttoninit(void);
|
||||||
|
EXTERN uint8_t up_buttons(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#undef EXTERN
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __ASSEMBLY__ */
|
||||||
|
#endif /* __ARCH_BOARD_BOARD_H */
|
||||||
@@ -0,0 +1,174 @@
|
|||||||
|
############################################################################
|
||||||
|
# configs/stm3210e-eval/nsh/Make.defs
|
||||||
|
#
|
||||||
|
# Copyright (C) 2009 Gregory Nutt. All rights reserved.
|
||||||
|
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions
|
||||||
|
# are met:
|
||||||
|
#
|
||||||
|
# 1. Redistributions of source code must retain the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer.
|
||||||
|
# 2. 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.
|
||||||
|
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
|
# used to endorse or promote products derived from this software
|
||||||
|
# without specific prior written permission.
|
||||||
|
#
|
||||||
|
# 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 OWNER 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.
|
||||||
|
#
|
||||||
|
############################################################################
|
||||||
|
|
||||||
|
include ${TOPDIR}/.config
|
||||||
|
|
||||||
|
# Setup for the selected toolchain
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_STM32_DFU),y)
|
||||||
|
LDSCRIPT = ld.script.dfu
|
||||||
|
else
|
||||||
|
LDSCRIPT = ld.script
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
|
||||||
|
# CodeSourcery under Windows
|
||||||
|
CROSSDEV = arm-none-eabi-
|
||||||
|
WINTOOL = y
|
||||||
|
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
|
||||||
|
endif
|
||||||
|
ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
|
||||||
|
# CodeSourcery under Linux
|
||||||
|
CROSSDEV = arm-none-eabi-
|
||||||
|
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
|
||||||
|
MAXOPTIMIZATION = -O2
|
||||||
|
endif
|
||||||
|
ifeq ($(CONFIG_STM32_DEVKITARM),y)
|
||||||
|
# devkitARM under Windows
|
||||||
|
CROSSDEV = arm-eabi-
|
||||||
|
WINTOOL = y
|
||||||
|
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
|
||||||
|
endif
|
||||||
|
ifeq ($(CONFIG_STM32_RAISONANCE),y)
|
||||||
|
# Raisonance RIDE7 under Windows
|
||||||
|
CROSSDEV = arm-none-eabi-
|
||||||
|
WINTOOL = y
|
||||||
|
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
|
||||||
|
endif
|
||||||
|
ifeq ($(CONFIG_STM32_BUILDROOT),y)
|
||||||
|
# NuttX buildroot under Linux or Cygwin
|
||||||
|
CROSSDEV = arm-elf-
|
||||||
|
ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
|
||||||
|
MAXOPTIMIZATION = -Os
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(WINTOOL),y)
|
||||||
|
# Windows-native toolchains
|
||||||
|
DIRLINK = $(TOPDIR)/tools/winlink.sh
|
||||||
|
DIRUNLINK = $(TOPDIR)/tools/unlink.sh
|
||||||
|
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)}"
|
||||||
|
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)
|
||||||
|
endif
|
||||||
|
|
||||||
|
CC = $(CROSSDEV)gcc
|
||||||
|
CXX = $(CROSSDEV)g++
|
||||||
|
CPP = $(CROSSDEV)gcc -E
|
||||||
|
LD = $(CROSSDEV)ld
|
||||||
|
AR = $(CROSSDEV)ar rcs
|
||||||
|
NM = $(CROSSDEV)nm
|
||||||
|
OBJCOPY = $(CROSSDEV)objcopy
|
||||||
|
OBJDUMP = $(CROSSDEV)objdump
|
||||||
|
|
||||||
|
ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
|
||||||
|
ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
|
||||||
|
|
||||||
|
ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
|
||||||
|
ARCHOPTIMIZATION = -g
|
||||||
|
else
|
||||||
|
ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
|
||||||
|
endif
|
||||||
|
|
||||||
|
ARCHCFLAGS = -fno-builtin
|
||||||
|
ARCHCXXFLAGS = -fno-builtin -fno-exceptions
|
||||||
|
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
|
||||||
|
ARCHWARNINGSXX = -Wall -Wshadow
|
||||||
|
ARCHDEFINES =
|
||||||
|
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
|
||||||
|
|
||||||
|
CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) -pipe
|
||||||
|
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
|
||||||
|
CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) -pipe
|
||||||
|
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
|
||||||
|
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES)
|
||||||
|
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
|
||||||
|
|
||||||
|
NXFLATLDFLAGS1 = -r -d -warn-common
|
||||||
|
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
|
||||||
|
LDNXFLATFLAGS = -e main -s 2048
|
||||||
|
|
||||||
|
OBJEXT = .o
|
||||||
|
LIBEXT = .a
|
||||||
|
EXEEXT =
|
||||||
|
|
||||||
|
ifneq ($(CROSSDEV),arm-elf-)
|
||||||
|
LDFLAGS += -nostartfiles -nodefaultlibs
|
||||||
|
endif
|
||||||
|
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||||
|
LDFLAGS += -g
|
||||||
|
endif
|
||||||
|
|
||||||
|
define PREPROCESS
|
||||||
|
@echo "CPP: $1->$2"
|
||||||
|
@$(CPP) $(CPPFLAGS) $1 -o $2
|
||||||
|
endef
|
||||||
|
|
||||||
|
define COMPILE
|
||||||
|
@echo "CC: $1"
|
||||||
|
@$(CC) -c $(CFLAGS) $1 -o $2
|
||||||
|
endef
|
||||||
|
|
||||||
|
define COMPILEXX
|
||||||
|
@echo "CXX: $1"
|
||||||
|
@$(CXX) -c $(CXXFLAGS) $1 -o $2
|
||||||
|
endef
|
||||||
|
|
||||||
|
define ASSEMBLE
|
||||||
|
@echo "AS: $1"
|
||||||
|
@$(CC) -c $(AFLAGS) $1 -o $2
|
||||||
|
endef
|
||||||
|
|
||||||
|
define ARCHIVE
|
||||||
|
echo "AR: $2"; \
|
||||||
|
$(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
|
||||||
|
endef
|
||||||
|
|
||||||
|
define CLEAN
|
||||||
|
@rm -f *.o *.a
|
||||||
|
endef
|
||||||
|
|
||||||
|
HOSTCC = gcc
|
||||||
|
HOSTINCLUDES = -I.
|
||||||
|
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
|
||||||
|
HOSTLDFLAGS =
|
||||||
|
|
||||||
Executable
+814
File diff suppressed because it is too large
Load Diff
Executable
+111
@@ -0,0 +1,111 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* configs/stm3210e-eval/nsh/ld.script
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Gregory Nutt. All rights reserved.
|
||||||
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. 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.
|
||||||
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
|
* used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* 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 OWNER 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.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* The STM32F103ZET6 has 512Kb of FLASH beginning at address 0x0800:0000 and
|
||||||
|
* 64Kb of SRAM beginning at address 0x2000:0000. When booting from FLASH,
|
||||||
|
* FLASH memory is aliased to address 0x0000:0000 where the code expects to
|
||||||
|
* begin execution by jumping to the entry point in the 0x0800:0000 address
|
||||||
|
* range.
|
||||||
|
*/
|
||||||
|
|
||||||
|
MEMORY
|
||||||
|
{
|
||||||
|
flash (rx) : ORIGIN = 0x08000000, LENGTH = 512K
|
||||||
|
sram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
|
||||||
|
}
|
||||||
|
|
||||||
|
OUTPUT_ARCH(arm)
|
||||||
|
ENTRY(_stext)
|
||||||
|
SECTIONS
|
||||||
|
{
|
||||||
|
.text : {
|
||||||
|
_stext = ABSOLUTE(.);
|
||||||
|
*(.vectors)
|
||||||
|
*(.text .text.*)
|
||||||
|
*(.fixup)
|
||||||
|
*(.gnu.warning)
|
||||||
|
*(.rodata .rodata.*)
|
||||||
|
*(.gnu.linkonce.t.*)
|
||||||
|
*(.glue_7)
|
||||||
|
*(.glue_7t)
|
||||||
|
*(.got)
|
||||||
|
*(.gcc_except_table)
|
||||||
|
*(.gnu.linkonce.r.*)
|
||||||
|
_etext = ABSOLUTE(.);
|
||||||
|
} > flash
|
||||||
|
|
||||||
|
_eronly = ABSOLUTE(.); /* See below */
|
||||||
|
|
||||||
|
/* The STM32F103Z has 64Kb of SRAM beginning at the following address */
|
||||||
|
|
||||||
|
.data : {
|
||||||
|
_sdata = ABSOLUTE(.);
|
||||||
|
*(.data .data.*)
|
||||||
|
*(.gnu.linkonce.d.*)
|
||||||
|
CONSTRUCTORS
|
||||||
|
_edata = ABSOLUTE(.);
|
||||||
|
} > sram AT > flash
|
||||||
|
|
||||||
|
.ARM.extab : {
|
||||||
|
*(.ARM.extab*)
|
||||||
|
} >sram
|
||||||
|
|
||||||
|
.ARM.exidx : {
|
||||||
|
__exidx_start = ABSOLUTE(.);
|
||||||
|
*(.ARM.exidx*)
|
||||||
|
__exidx_end = ABSOLUTE(.);
|
||||||
|
} >sram
|
||||||
|
|
||||||
|
.bss : { /* BSS */
|
||||||
|
_sbss = ABSOLUTE(.);
|
||||||
|
*(.bss .bss.*)
|
||||||
|
*(.gnu.linkonce.b.*)
|
||||||
|
*(COMMON)
|
||||||
|
_ebss = ABSOLUTE(.);
|
||||||
|
} > sram
|
||||||
|
/* Stabs debugging sections. */
|
||||||
|
.stab 0 : { *(.stab) }
|
||||||
|
.stabstr 0 : { *(.stabstr) }
|
||||||
|
.stab.excl 0 : { *(.stab.excl) }
|
||||||
|
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||||
|
.stab.index 0 : { *(.stab.index) }
|
||||||
|
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||||
|
.comment 0 : { *(.comment) }
|
||||||
|
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||||
|
.debug_info 0 : { *(.debug_info) }
|
||||||
|
.debug_line 0 : { *(.debug_line) }
|
||||||
|
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||||
|
.debug_aranges 0 : { *(.debug_aranges) }
|
||||||
|
}
|
||||||
Executable
+110
@@ -0,0 +1,110 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* configs/stm3210e-eval/nsh/ld.script.dfu
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Gregory Nutt. All rights reserved.
|
||||||
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. 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.
|
||||||
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
|
* used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* 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 OWNER 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.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* The STM32F103ZET6 has 512Kb of FLASH beginning at address 0x0800:0000 and
|
||||||
|
* 64Kb of SRAM beginning at address 0x2000:0000. Here we assume that the
|
||||||
|
* STM3210E-EVAL's DFU bootloader is being used. In that case, the corrct
|
||||||
|
* load .text load address is 0x08003000 (leaving 464Kb).
|
||||||
|
*/
|
||||||
|
|
||||||
|
MEMORY
|
||||||
|
{
|
||||||
|
flash (rx) : ORIGIN = 0x08003000, LENGTH = 464K
|
||||||
|
sram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
|
||||||
|
}
|
||||||
|
|
||||||
|
OUTPUT_ARCH(arm)
|
||||||
|
ENTRY(_stext)
|
||||||
|
SECTIONS
|
||||||
|
{
|
||||||
|
.text : {
|
||||||
|
_stext = ABSOLUTE(.);
|
||||||
|
*(.vectors)
|
||||||
|
*(.text .text.*)
|
||||||
|
*(.fixup)
|
||||||
|
*(.gnu.warning)
|
||||||
|
*(.rodata .rodata.*)
|
||||||
|
*(.gnu.linkonce.t.*)
|
||||||
|
*(.glue_7)
|
||||||
|
*(.glue_7t)
|
||||||
|
*(.got)
|
||||||
|
*(.gcc_except_table)
|
||||||
|
*(.gnu.linkonce.r.*)
|
||||||
|
_etext = ABSOLUTE(.);
|
||||||
|
} > flash
|
||||||
|
|
||||||
|
_eronly = ABSOLUTE(.); /* See below */
|
||||||
|
|
||||||
|
/* The STM32F103Z has 64Kb of SRAM beginning at the following address */
|
||||||
|
|
||||||
|
.data : {
|
||||||
|
_sdata = ABSOLUTE(.);
|
||||||
|
*(.data .data.*)
|
||||||
|
*(.gnu.linkonce.d.*)
|
||||||
|
CONSTRUCTORS
|
||||||
|
_edata = ABSOLUTE(.);
|
||||||
|
} > sram AT > flash
|
||||||
|
|
||||||
|
.ARM.extab : {
|
||||||
|
*(.ARM.extab*)
|
||||||
|
} >sram
|
||||||
|
|
||||||
|
.ARM.exidx : {
|
||||||
|
__exidx_start = ABSOLUTE(.);
|
||||||
|
*(.ARM.exidx*)
|
||||||
|
__exidx_end = ABSOLUTE(.);
|
||||||
|
} >sram
|
||||||
|
|
||||||
|
.bss : { /* BSS */
|
||||||
|
_sbss = ABSOLUTE(.);
|
||||||
|
*(.bss .bss.*)
|
||||||
|
*(.gnu.linkonce.b.*)
|
||||||
|
*(COMMON)
|
||||||
|
_ebss = ABSOLUTE(.);
|
||||||
|
} > sram
|
||||||
|
/* Stabs debugging sections. */
|
||||||
|
.stab 0 : { *(.stab) }
|
||||||
|
.stabstr 0 : { *(.stabstr) }
|
||||||
|
.stab.excl 0 : { *(.stab.excl) }
|
||||||
|
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||||
|
.stab.index 0 : { *(.stab.index) }
|
||||||
|
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||||
|
.comment 0 : { *(.comment) }
|
||||||
|
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||||
|
.debug_info 0 : { *(.debug_info) }
|
||||||
|
.debug_line 0 : { *(.debug_line) }
|
||||||
|
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||||
|
.debug_aranges 0 : { *(.debug_aranges) }
|
||||||
|
}
|
||||||
Executable
+47
@@ -0,0 +1,47 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# configs/stm3210e-eval/dfu/setenv.sh
|
||||||
|
#
|
||||||
|
# Copyright (C) 2009 Gregory Nutt. All rights reserved.
|
||||||
|
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions
|
||||||
|
# are met:
|
||||||
|
#
|
||||||
|
# 1. Redistributions of source code must retain the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer.
|
||||||
|
# 2. 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.
|
||||||
|
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
|
# used to endorse or promote products derived from this software
|
||||||
|
# without specific prior written permission.
|
||||||
|
#
|
||||||
|
# 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 OWNER 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.
|
||||||
|
#
|
||||||
|
|
||||||
|
if [ "$(basename $0)" = "setenv.sh" ] ; then
|
||||||
|
echo "You must source this script, not run it!" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
|
||||||
|
|
||||||
|
WD=`pwd`
|
||||||
|
export RIDE_BIN="/cygdrive/c/Program Files/Raisonance/Ride/arm-gcc/bin"
|
||||||
|
export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
|
||||||
|
export PATH="${BUILDROOT_BIN}:${RIDE_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
|
||||||
|
|
||||||
|
echo "PATH : ${PATH}"
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
############################################################################
|
||||||
|
# configs/vsn/src/Makefile
|
||||||
|
#
|
||||||
|
# Copyright (C) 2009-2010 Gregory Nutt. All rights reserved.
|
||||||
|
# Copyright (c) 2011 Uros Platise. All rights reserved.
|
||||||
|
#
|
||||||
|
# Authors: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
|
# Uros Platise <uros.platise@isotel.eu>
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions
|
||||||
|
# are met:
|
||||||
|
#
|
||||||
|
# 1. Redistributions of source code must retain the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer.
|
||||||
|
# 2. 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.
|
||||||
|
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
|
# used to endorse or promote products derived from this software
|
||||||
|
# without specific prior written permission.
|
||||||
|
#
|
||||||
|
# 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 OWNER 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.
|
||||||
|
#
|
||||||
|
############################################################################
|
||||||
|
|
||||||
|
-include $(TOPDIR)/Make.defs
|
||||||
|
|
||||||
|
CFLAGS += -I$(TOPDIR)/sched
|
||||||
|
|
||||||
|
ASRCS =
|
||||||
|
AOBJS = $(ASRCS:.S=$(OBJEXT))
|
||||||
|
|
||||||
|
CSRCS = up_sysclock.c up_boot.c up_leds.c up_buttons.c up_spi.c up_usbdev.c
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_EXAMPLES_NSH_ARCHINIT),y)
|
||||||
|
CSRCS += up_nsh.c
|
||||||
|
endif
|
||||||
|
ifeq ($(CONFIG_APP_DIR),examples/usbstorage)
|
||||||
|
CSRCS += up_usbstrg.c
|
||||||
|
endif
|
||||||
|
COBJS = $(CSRCS:.c=$(OBJEXT))
|
||||||
|
|
||||||
|
SRCS = $(ASRCS) $(CSRCS)
|
||||||
|
OBJS = $(AOBJS) $(COBJS)
|
||||||
|
|
||||||
|
ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
|
||||||
|
ifeq ($(WINTOOL),y)
|
||||||
|
CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
|
||||||
|
-I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
|
||||||
|
-I "${shell cygpath -w $(ARCH_SRCDIR)/cortexm3}"
|
||||||
|
else
|
||||||
|
CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/cortexm3
|
||||||
|
endif
|
||||||
|
|
||||||
|
all: libboard$(LIBEXT)
|
||||||
|
|
||||||
|
$(AOBJS): %$(OBJEXT): %.S
|
||||||
|
$(call ASSEMBLE, $<, $@)
|
||||||
|
|
||||||
|
$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
|
||||||
|
$(call COMPILE, $<, $@)
|
||||||
|
|
||||||
|
libboard$(LIBEXT): $(OBJS)
|
||||||
|
@( for obj in $(OBJS) ; do \
|
||||||
|
$(call ARCHIVE, $@, $${obj}); \
|
||||||
|
done ; )
|
||||||
|
|
||||||
|
.depend: Makefile $(SRCS)
|
||||||
|
@$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||||
|
@touch $@
|
||||||
|
|
||||||
|
depend: .depend
|
||||||
|
|
||||||
|
clean:
|
||||||
|
@rm -f libboard$(LIBEXT) *~ .*.swp
|
||||||
|
$(call CLEAN)
|
||||||
|
|
||||||
|
distclean: clean
|
||||||
|
@rm -f Make.dep .depend
|
||||||
|
|
||||||
|
-include Make.dep
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
/************************************************************************************
|
||||||
|
* configs/vsn/src/up_boot.c
|
||||||
|
* arch/arm/src/board/up_boot.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Gregory Nutt. All rights reserved.
|
||||||
|
* Copyright (c) 2011 Uros Platise. All rights reserved.
|
||||||
|
*
|
||||||
|
* Authors: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
|
* Uros Platise <uros.platise@isotel.eu>
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. 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.
|
||||||
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
|
* used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* 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 OWNER 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.
|
||||||
|
*
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Included Files
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
#include <arch/board/board.h>
|
||||||
|
|
||||||
|
#include "up_arch.h"
|
||||||
|
#include "vsn-internal.h"
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Definitions
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Private Functions
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Name: stm32_boardinitialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* All STM32 architectures must provide the following entry point. This entry point
|
||||||
|
* is called early in the intitialization -- after all memory has been configured
|
||||||
|
* and mapped but before any devices have been initialized.
|
||||||
|
*
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
void stm32_boardinitialize(void)
|
||||||
|
{
|
||||||
|
/* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak function
|
||||||
|
* stm32_spiinitialize() has been brought into the link.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(CONFIG_STM32_SPI1) || defined(CONFIG_STM32_SPI2)
|
||||||
|
if (stm32_spiinitialize)
|
||||||
|
{
|
||||||
|
stm32_spiinitialize();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Initialize USB is 1) USBDEV is selected, 2) the USB controller is not
|
||||||
|
* disabled, and 3) the weak function stm32_usbinitialize() has been brought
|
||||||
|
* into the build.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(CONFIG_USBDEV) && defined(CONFIG_STM32_USB)
|
||||||
|
if (stm32_usbinitialize)
|
||||||
|
{
|
||||||
|
stm32_usbinitialize();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Configure on-board LEDs if LED support has been selected. */
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARCH_LEDS
|
||||||
|
up_ledinit();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* configs/vsn-1.2/src/up_buttons.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Gregory Nutt. All rights reserved.
|
||||||
|
* Copyright (C) 2011 Uros Platise. All rights reserved.
|
||||||
|
*
|
||||||
|
* Authors: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
|
* Uros Platise <uros.platise@isotel.eu>
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. 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.
|
||||||
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
|
* used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* 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 OWNER 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.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <arch/board/board.h>
|
||||||
|
#include "vsn-internal.h"
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARCH_BUTTONS
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: up_buttoninit
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void up_buttoninit(void)
|
||||||
|
{
|
||||||
|
stm32_configgpio(GPIO_PUSHBUTTON);
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: up_buttons
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
uint8_t up_buttons(void)
|
||||||
|
{
|
||||||
|
return stm32_gpioread(GPIO_PUSHBUTTON);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* CONFIG_ARCH_BUTTONS */
|
||||||
@@ -0,0 +1,116 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* configs/vsn-1.2/src/up_leds.c
|
||||||
|
* arch/arm/src/board/up_leds.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Gregory Nutt. All rights reserved.
|
||||||
|
* Copyright (C) 2011 Uros Platise. All rights reserved.
|
||||||
|
*
|
||||||
|
* Authors: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
|
* Uros Platise <uros.platise@isotel.eu>
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. 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.
|
||||||
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
|
* used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* 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 OWNER 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.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
#include <arch/board/board.h>
|
||||||
|
#include "vsn-internal.h"
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* Enables debug output from this file (needs CONFIG_DEBUG with
|
||||||
|
* CONFIG_DEBUG_VERBOSE too)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#undef LED_DEBUG /* Define to enable debug */
|
||||||
|
|
||||||
|
#ifdef LED_DEBUG
|
||||||
|
# define leddbg lldbg
|
||||||
|
# define ledvdbg llvdbg
|
||||||
|
#else
|
||||||
|
# define leddbg(x...)
|
||||||
|
# define ledvdbg(x...)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static void led_setonoff(unsigned int bits)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: up_ledinit
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARCH_LEDS
|
||||||
|
void up_ledinit(void)
|
||||||
|
{
|
||||||
|
stm32_configgpio(GPIO_LED);
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: up_ledon
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void up_ledon(int led)
|
||||||
|
{
|
||||||
|
if (led==LED_IDLE) stm32_gpiowrite(GPIO_LED, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: up_ledoff
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void up_ledoff(int led)
|
||||||
|
{
|
||||||
|
if (led==LED_IDLE) stm32_gpiowrite(GPIO_LED, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* CONFIG_ARCH_LEDS */
|
||||||
@@ -0,0 +1,215 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* config/vsn/src/up_nsh.c
|
||||||
|
* arch/arm/src/board/up_nsh.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Gregory Nutt. All rights reserved.
|
||||||
|
* Copyright (C) 2011 Uros Platise. All rights reserved.
|
||||||
|
*
|
||||||
|
* Authors: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
|
* Uros Platise <uros.platise@isotel.eu>
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. 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.
|
||||||
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
|
* used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* 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 OWNER 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.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <debug.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
#ifdef CONFIG_STM32_SPI1
|
||||||
|
# include <nuttx/spi.h>
|
||||||
|
# include <nuttx/mtd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_STM32_SDIO
|
||||||
|
# include <nuttx/sdio.h>
|
||||||
|
# include <nuttx/mmcsd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "vsn-internal.h"
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-Processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* Configuration ************************************************************/
|
||||||
|
|
||||||
|
/* For now, don't build in any SPI1 support -- NSH is not using it */
|
||||||
|
|
||||||
|
#undef CONFIG_STM32_SPI1
|
||||||
|
|
||||||
|
/* PORT and SLOT number probably depend on the board configuration */
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARCH_BOARD_VSN
|
||||||
|
# define CONFIG_EXAMPLES_NSH_HAVEUSBDEV 1
|
||||||
|
# define CONFIG_EXAMPLES_NSH_HAVEMMCSD 1
|
||||||
|
# if defined(CONFIG_EXAMPLES_NSH_MMCSDSLOTNO) && CONFIG_EXAMPLES_NSH_MMCSDSLOTNO != 0
|
||||||
|
# error "Only one MMC/SD slot"
|
||||||
|
# undef CONFIG_EXAMPLES_NSH_MMCSDSLOTNO
|
||||||
|
# endif
|
||||||
|
# ifndef CONFIG_EXAMPLES_NSH_MMCSDSLOTNO
|
||||||
|
# define CONFIG_EXAMPLES_NSH_MMCSDSLOTNO 0
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
/* Add configuration for new STM32 boards here */
|
||||||
|
# undef CONFIG_EXAMPLES_NSH_HAVEUSBDEV
|
||||||
|
# undef CONFIG_EXAMPLES_NSH_HAVEMMCSD
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Can't support USB features if USB is not enabled */
|
||||||
|
|
||||||
|
#ifndef CONFIG_USBDEV
|
||||||
|
# undef CONFIG_EXAMPLES_NSH_HAVEUSBDEV
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Can't support MMC/SD features if mountpoints are disabled or if SDIO support
|
||||||
|
* is not enabled.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_STM32_SDIO)
|
||||||
|
# undef CONFIG_EXAMPLES_NSH_HAVEMMCSD
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef CONFIG_EXAMPLES_NSH_MMCSDMINOR
|
||||||
|
# define CONFIG_EXAMPLES_NSH_MMCSDMINOR 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Debug ********************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||||
|
# ifdef CONFIG_DEBUG
|
||||||
|
# define message(...) lib_lowprintf(__VA_ARGS__)
|
||||||
|
# else
|
||||||
|
# define message(...) printf(__VA_ARGS__)
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
# ifdef CONFIG_DEBUG
|
||||||
|
# define message lib_lowprintf
|
||||||
|
# else
|
||||||
|
# define message printf
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: nsh_archinitialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Perform architecture specific initialization
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int nsh_archinitialize(void)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_STM32_SPI1
|
||||||
|
FAR struct spi_dev_s *spi;
|
||||||
|
FAR struct mtd_dev_s *mtd;
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_EXAMPLES_NSH_HAVEMMCSD
|
||||||
|
FAR struct sdio_dev_s *sdio;
|
||||||
|
int ret;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Configure SPI-based devices */
|
||||||
|
|
||||||
|
#ifdef CONFIG_STM32_SPI1
|
||||||
|
/* Get the SPI port */
|
||||||
|
|
||||||
|
message("nsh_archinitialize: Initializing SPI port 0\n");
|
||||||
|
spi = up_spiinitialize(0);
|
||||||
|
if (!spi)
|
||||||
|
{
|
||||||
|
message("nsh_archinitialize: Failed to initialize SPI port 0\n");
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
message("nsh_archinitialize: Successfully initialized SPI port 0\n");
|
||||||
|
|
||||||
|
/* Now bind the SPI interface to the M25P64/128 SPI FLASH driver */
|
||||||
|
|
||||||
|
message("nsh_archinitialize: Bind SPI to the SPI flash driver\n");
|
||||||
|
mtd = m25p_initialize(spi);
|
||||||
|
if (!mtd)
|
||||||
|
{
|
||||||
|
message("nsh_archinitialize: Failed to bind SPI port 0 to the SPI FLASH driver\n");
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
message("nsh_archinitialize: Successfully bound SPI port 0 to the SPI FLASH driver\n");
|
||||||
|
#warning "Now what are we going to do with this SPI FLASH driver?"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Create the SPI FLASH MTD instance */
|
||||||
|
/* The M25Pxx is not a give media to implement a file system..
|
||||||
|
* its block sizes are too large
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Mount the SDIO-based MMC/SD block driver */
|
||||||
|
|
||||||
|
#ifdef CONFIG_EXAMPLES_NSH_HAVEMMCSD
|
||||||
|
/* First, get an instance of the SDIO interface */
|
||||||
|
|
||||||
|
message("nsh_archinitialize: Initializing SDIO slot %d\n",
|
||||||
|
CONFIG_EXAMPLES_NSH_MMCSDSLOTNO);
|
||||||
|
sdio = sdio_initialize(CONFIG_EXAMPLES_NSH_MMCSDSLOTNO);
|
||||||
|
if (!sdio)
|
||||||
|
{
|
||||||
|
message("nsh_archinitialize: Failed to initialize SDIO slot %d\n",
|
||||||
|
CONFIG_EXAMPLES_NSH_MMCSDSLOTNO);
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Now bind the SPI interface to the MMC/SD driver */
|
||||||
|
|
||||||
|
message("nsh_archinitialize: Bind SDIO to the MMC/SD driver, minor=%d\n",
|
||||||
|
CONFIG_EXAMPLES_NSH_MMCSDMINOR);
|
||||||
|
ret = mmcsd_slotinitialize(CONFIG_EXAMPLES_NSH_MMCSDMINOR, sdio);
|
||||||
|
if (ret != OK)
|
||||||
|
{
|
||||||
|
message("nsh_archinitialize: Failed to bind SDIO to the MMC/SD driver: %d\n", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
message("nsh_archinitialize: Successfully bound SDIO to the MMC/SD driver\n");
|
||||||
|
|
||||||
|
/* Then let's guess and say that there is a card in the slot. I need to check to
|
||||||
|
* see if the VSN board supports a GPIO to detect if there is a card in
|
||||||
|
* the slot.
|
||||||
|
*/
|
||||||
|
|
||||||
|
sdio_mediachange(sdio, true);
|
||||||
|
#endif
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
@@ -0,0 +1,181 @@
|
|||||||
|
/************************************************************************************
|
||||||
|
* configs/vsn/src/up_spi.c
|
||||||
|
* arch/arm/src/board/up_spi.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Gregory Nutt. All rights reserved.
|
||||||
|
* Copyright (C) 2011 Uros Platise. All rights reserved.
|
||||||
|
*
|
||||||
|
* Authors: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
|
* Uros Platise <uros.platise@isotel.eu>
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. 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.
|
||||||
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
|
* used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* 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 OWNER 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.
|
||||||
|
*
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Included Files
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
#include <nuttx/spi.h>
|
||||||
|
#include <arch/board/board.h>
|
||||||
|
|
||||||
|
#include "up_arch.h"
|
||||||
|
#include "chip.h"
|
||||||
|
#include "stm32_internal.h"
|
||||||
|
#include "vsn-internal.h"
|
||||||
|
|
||||||
|
#if defined(CONFIG_STM32_SPI1) || defined(CONFIG_STM32_SPI2)
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Definitions
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/* Enables debug output from this file (needs CONFIG_DEBUG too) */
|
||||||
|
|
||||||
|
#undef SPI_DEBUG /* Define to enable debug */
|
||||||
|
#undef SPI_VERBOSE /* Define to enable verbose debug */
|
||||||
|
|
||||||
|
#ifdef SPI_DEBUG
|
||||||
|
# define spidbg lldbg
|
||||||
|
# ifdef SPI_VERBOSE
|
||||||
|
# define spivdbg lldbg
|
||||||
|
# else
|
||||||
|
# define spivdbg(x...)
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
# undef SPI_VERBOSE
|
||||||
|
# define spidbg(x...)
|
||||||
|
# define spivdbg(x...)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Private Functions
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Name: stm32_spiinitialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Called to configure SPI chip select GPIO pins for the VSN board.
|
||||||
|
*
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
void weak_function stm32_spiinitialize(void)
|
||||||
|
{
|
||||||
|
/* NOTE: Clocking for SPI1 and/or SPI2 was already provided in stm32_rcc.c.
|
||||||
|
* Configurations of SPI pins is performed in stm32_spi.c.
|
||||||
|
* Here, we only initialize chip select pins unique to the board
|
||||||
|
* architecture.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef CONFIG_STM32_SPI1
|
||||||
|
/* Configure the SPI-based FLASH CS GPIO */
|
||||||
|
|
||||||
|
stm32_configgpio(GPIO_FLASH_CS);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: stm32_spi1/2/3select and stm32_spi1/2/3status
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* The external functions, stm32_spi1/2/3select and stm32_spi1/2/3status must be
|
||||||
|
* provided by board-specific logic. They are implementations of the select
|
||||||
|
* and status methods of the SPI interface defined by struct spi_ops_s (see
|
||||||
|
* include/nuttx/spi.h). All other methods (including up_spiinitialize())
|
||||||
|
* are provided by common STM32 logic. To use this common SPI logic on your
|
||||||
|
* board:
|
||||||
|
*
|
||||||
|
* 1. Provide logic in stm32_boardinitialize() to configure SPI chip select
|
||||||
|
* pins.
|
||||||
|
* 2. Provide stm32_spi1/2/3select() and stm32_spi1/2/3status() functions in your
|
||||||
|
* board-specific logic. These functions will perform chip selection and
|
||||||
|
* status operations using GPIOs in the way your board is configured.
|
||||||
|
* 3. Add a calls to up_spiinitialize() in your low level application
|
||||||
|
* initialization logic
|
||||||
|
* 4. The handle returned by up_spiinitialize() may then be used to bind the
|
||||||
|
* SPI driver to higher level logic (e.g., calling
|
||||||
|
* mmcsd_spislotinitialize(), for example, will bind the SPI driver to
|
||||||
|
* the SPI MMC/SD driver).
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_STM32_SPI1
|
||||||
|
void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
|
||||||
|
{
|
||||||
|
spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||||
|
|
||||||
|
if (devid == SPIDEV_FLASH)
|
||||||
|
{
|
||||||
|
/* Set the GPIO low to select and high to de-select */
|
||||||
|
|
||||||
|
stm32_gpiowrite(GPIO_FLASH_CS, !selected);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
|
||||||
|
{
|
||||||
|
return SPI_STATUS_PRESENT;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_STM32_SPI2
|
||||||
|
void stm32_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
|
||||||
|
{
|
||||||
|
spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
|
||||||
|
{
|
||||||
|
return SPI_STATUS_PRESENT;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_STM32_SPI3
|
||||||
|
void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
|
||||||
|
{
|
||||||
|
spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
|
||||||
|
{
|
||||||
|
return SPI_STATUS_PRESENT;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* CONFIG_STM32_SPI1 || CONFIG_STM32_SPI2 */
|
||||||
@@ -0,0 +1,172 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* configs/vsn-1.2/src/up_sysclock.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2011 Uros Platise. All rights reserved.
|
||||||
|
*
|
||||||
|
* Author: Uros Platise <uros.platise@isotel.eu>
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. 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.
|
||||||
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
|
* used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* 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 OWNER 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.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/** \file
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <arch/board/board.h>
|
||||||
|
#include "stm32_rcc.h"
|
||||||
|
#include "stm32_flash.h"
|
||||||
|
#include "up_internal.h"
|
||||||
|
#include "up_arch.h"
|
||||||
|
#include "chip.h"
|
||||||
|
|
||||||
|
|
||||||
|
/*--- Private ---*/
|
||||||
|
|
||||||
|
/** Selects internal HSI Clock, SYSCLK = 36 MHz, HCLK = 36 MHz
|
||||||
|
* - HSI at 8 MHz, :2 enters DPLL * 9, to get 36 MHz
|
||||||
|
* - AHB prescaler is set to 1 for maximum performance of all peripherals and FRAM (18 Mbps)
|
||||||
|
* - Suitable for start-up and lower power operation
|
||||||
|
* - Flash Wait State = 1, since it is 64-bit prefetch, it satisfies two 32-bit instructions
|
||||||
|
* (and branch losses a single cycle only, I found this as the best performance vs. frequency)
|
||||||
|
* - Sleep with peripherals disabled is about 2.5 mA @ 36 MHz, HSI
|
||||||
|
*
|
||||||
|
* \todo:
|
||||||
|
* - dynamic clock scalling according to cross-peripheral requirements, AHB prescaler could
|
||||||
|
* change if all other prescalers increase, to maintain the ratio and to have min. HCLK
|
||||||
|
* possible; This is of interest when peripherals consume 50% of all power, as for instance
|
||||||
|
* in sleep mode @ 36 MHz, HSI with all peripherals enabled, i = 7 mA, on 24 Mhz 4.8 mA and
|
||||||
|
* on 16 MHz 3.2 mA only.
|
||||||
|
*
|
||||||
|
* \return Nothing, operation is always successful.
|
||||||
|
*/
|
||||||
|
void stm32_board_select_hsi(void)
|
||||||
|
{
|
||||||
|
uint32_t regval;
|
||||||
|
|
||||||
|
// Are we running on HSE?
|
||||||
|
regval = getreg32(STM32_RCC_CR);
|
||||||
|
if (regval & RCC_CR_HSEON) {
|
||||||
|
|
||||||
|
// \todo: check is if we are running on HSE, we need the step down sequenuce from HSE -> HSI
|
||||||
|
|
||||||
|
return; // do nothing at this time
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set FLASH prefetch buffer and 1 wait state
|
||||||
|
regval = getreg32(STM32_FLASH_ACR);
|
||||||
|
regval &= ~ACR_LATENCY_MASK;
|
||||||
|
regval |= (ACR_LATENCY_1|ACR_PRTFBE);
|
||||||
|
putreg32(regval, STM32_FLASH_ACR);
|
||||||
|
|
||||||
|
// Set the HCLK source/divider
|
||||||
|
regval = getreg32(STM32_RCC_CFGR);
|
||||||
|
regval &= ~RCC_CFGR_HPRE_MASK;
|
||||||
|
regval |= STM32_RCC_CFGR_HPRE_HSI;
|
||||||
|
putreg32(regval, STM32_RCC_CFGR);
|
||||||
|
|
||||||
|
// Set the PCLK2 divider
|
||||||
|
regval = getreg32(STM32_RCC_CFGR);
|
||||||
|
regval &= ~RCC_CFGR_PPRE2_MASK;
|
||||||
|
regval |= STM32_RCC_CFGR_PPRE2;
|
||||||
|
putreg32(regval, STM32_RCC_CFGR);
|
||||||
|
|
||||||
|
// Set the PCLK1 divider
|
||||||
|
regval = getreg32(STM32_RCC_CFGR);
|
||||||
|
regval &= ~RCC_CFGR_PPRE1_MASK;
|
||||||
|
regval |= STM32_RCC_CFGR_PPRE1;
|
||||||
|
putreg32(regval, STM32_RCC_CFGR);
|
||||||
|
|
||||||
|
// Set the PLL source = HSI, divider (/2) and multipler (*9)
|
||||||
|
regval = getreg32(STM32_RCC_CFGR);
|
||||||
|
regval &= ~(RCC_CFGR_PLLSRC|RCC_CFGR_PLLXTPRE|RCC_CFGR_PLLMUL_MASK);
|
||||||
|
regval |= (STM32_CFGR_PLLSRC_HSI|STM32_CFGR_PLLMUL_HSI);
|
||||||
|
putreg32(regval, STM32_RCC_CFGR);
|
||||||
|
|
||||||
|
// Enable the PLL
|
||||||
|
regval = getreg32(STM32_RCC_CR);
|
||||||
|
regval |= RCC_CR_PLLON;
|
||||||
|
putreg32(regval, STM32_RCC_CR);
|
||||||
|
|
||||||
|
// Wait until the PLL is ready
|
||||||
|
while ((getreg32(STM32_RCC_CR) & RCC_CR_PLLRDY) == 0);
|
||||||
|
|
||||||
|
// Select the system clock source (probably the PLL)
|
||||||
|
regval = getreg32(STM32_RCC_CFGR);
|
||||||
|
regval &= ~RCC_CFGR_SW_MASK;
|
||||||
|
regval |= STM32_SYSCLK_SW;
|
||||||
|
putreg32(regval, STM32_RCC_CFGR);
|
||||||
|
|
||||||
|
// Wait until the selected source is used as the system clock source
|
||||||
|
while ((getreg32(STM32_RCC_CFGR) & RCC_CFGR_SWS_MASK) != STM32_SYSCLK_SWS);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** Selects external HSE Clock, SYSCLK = 72 MHz, HCLK = 36/72 MHz
|
||||||
|
* - HSE at 9 MHz, DPLL * 8, to get 72 MHz
|
||||||
|
* - Suitable for maximum performance and USB
|
||||||
|
* - Sleep power consumption at HSE and at 72 MHz is 5.5 mA (3.1 @ 36 MHz)
|
||||||
|
* - Option AHB prescaler is set to :2 to be compatible with HSI to remain on HCLK = 36 MHz
|
||||||
|
* - Flash memory running on 72 MHz needs two wait states
|
||||||
|
*
|
||||||
|
* \return Clock selection status
|
||||||
|
* \retval 0 Successful
|
||||||
|
* \retval -1 External clock is not provided
|
||||||
|
* \retval -2 Could not lock to external clock
|
||||||
|
*/
|
||||||
|
int stm32_board_select_hse(void)
|
||||||
|
{
|
||||||
|
// if (is cc1101 9 MHz clock output enabled), otherwise return with -1
|
||||||
|
// I think that clock register provides HSE valid signal to detect that as well.
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*--- Interrupts ---*/
|
||||||
|
|
||||||
|
|
||||||
|
/** TODO: Interrupt on lost HSE clock, change it to HSI, ... restarting is
|
||||||
|
* more complex as the step requires restart of CC1101 device driver;
|
||||||
|
* so spawn a task for that... once cc1101 is restarted signal an event
|
||||||
|
* to restart clock.
|
||||||
|
*/
|
||||||
|
void stm32_board_hse_lost(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*--- Public API ---*/
|
||||||
|
|
||||||
|
/** Setup system clock, enabled when:
|
||||||
|
* - CONFIG_ARCH_BOARD_STM32_CUSTOM_CLOCKCONFIG
|
||||||
|
* option is set in .config
|
||||||
|
*/
|
||||||
|
void stm32_board_clockconfig(void)
|
||||||
|
{
|
||||||
|
stm32_board_select_hsi();
|
||||||
|
}
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
/************************************************************************************
|
||||||
|
* configs/svsn/src/up_usbdev.c
|
||||||
|
* arch/arm/src/board/up_boot.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009-2010 Gregory Nutt. All rights reserved.
|
||||||
|
* Copyright (c) 2011 Uros Platise. All rights reserved.
|
||||||
|
*
|
||||||
|
* Authors: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
|
* Uros Platise <uros.platise@isotel.eu>
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. 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.
|
||||||
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
|
* used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* 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 OWNER 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.
|
||||||
|
*
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Included Files
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
#include <nuttx/usb/usbdev.h>
|
||||||
|
#include <nuttx/usb/usbdev_trace.h>
|
||||||
|
|
||||||
|
#include "up_arch.h"
|
||||||
|
#include "stm32_internal.h"
|
||||||
|
#include "vsn-internal.h"
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Definitions
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Private Functions
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Name: stm32_usbinitialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Called to setup USB-related GPIO pins for the VSN board.
|
||||||
|
*
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
void stm32_usbinitialize(void)
|
||||||
|
{
|
||||||
|
/* USB Soft Connect Pullup: PB.14 */
|
||||||
|
|
||||||
|
#if defined(GPIO_USB_PULLUP)
|
||||||
|
stm32_configgpio(GPIO_USB_PULLUP);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Name: stm32_usbpullup
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* If USB is supported and the board supports a pullup via GPIO (for USB software
|
||||||
|
* connect and disconnect), then the board software must provide stm32_pullup.
|
||||||
|
* See include/nuttx/usb/usbdev.h for additional description of this method.
|
||||||
|
* Alternatively, if no pull-up GPIO the following EXTERN can be redefined to be
|
||||||
|
* NULL.
|
||||||
|
*
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
int stm32_usbpullup(FAR struct usbdev_s *dev, bool enable)
|
||||||
|
{
|
||||||
|
usbtrace(TRACE_DEVPULLUP, (uint16_t)enable);
|
||||||
|
#if defined(GPIO_USB_PULLUP)
|
||||||
|
stm32_gpiowrite(GPIO_USB_PULLUP, !enable);
|
||||||
|
#endif
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Name: stm32_usbsuspend
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Board logic must provide the stm32_usbsuspend logic if the USBDEV driver is
|
||||||
|
* used. This function is called whenever the USB enters or leaves suspend mode.
|
||||||
|
* This is an opportunity for the board logic to shutdown clocks, power, etc.
|
||||||
|
* while the USB is suspended.
|
||||||
|
*
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
void stm32_usbsuspend(FAR struct usbdev_s *dev, bool resume)
|
||||||
|
{
|
||||||
|
ulldbg("resume: %d\n", resume);
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,156 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* configs/vsn/src/up_usbstrg.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Gregory Nutt. All rights reserved.
|
||||||
|
* Copyright (c) 2011 Uros Platise. All rights reserved.
|
||||||
|
*
|
||||||
|
* Authors: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
|
* Uros Platise <uros.platise@isotel.eu>
|
||||||
|
*
|
||||||
|
* Configure and register the STM32 MMC/SD SDIO block driver.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. 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.
|
||||||
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
|
* used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* 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 OWNER 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.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <debug.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include <nuttx/sdio.h>
|
||||||
|
#include <nuttx/mmcsd.h>
|
||||||
|
|
||||||
|
#include "vsn-internal.h"
|
||||||
|
|
||||||
|
#ifdef CONFIG_STM32_SDIO
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-Processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* Configuration ************************************************************/
|
||||||
|
|
||||||
|
#ifndef CONFIG_EXAMPLES_USBSTRG_DEVMINOR1
|
||||||
|
# define CONFIG_EXAMPLES_USBSTRG_DEVMINOR1 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* SLOT number(s) could depend on the board configuration */
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARCH_BOARD_VSN
|
||||||
|
# undef STM32_MMCSDSLOTNO
|
||||||
|
# define STM32_MMCSDSLOTNO 0
|
||||||
|
#else
|
||||||
|
/* Add configuration for new STM32 boards here */
|
||||||
|
# error "Unrecognized STM32 board"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Debug ********************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||||
|
# ifdef CONFIG_DEBUG
|
||||||
|
# define message(...) lib_lowprintf(__VA_ARGS__)
|
||||||
|
# define msgflush()
|
||||||
|
# else
|
||||||
|
# define message(...) printf(__VA_ARGS__)
|
||||||
|
# define msgflush() fflush(stdout)
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
# ifdef CONFIG_DEBUG
|
||||||
|
# define message lib_lowprintf
|
||||||
|
# define msgflush()
|
||||||
|
# else
|
||||||
|
# define message printf
|
||||||
|
# define msgflush() fflush(stdout)
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: usbstrg_archinitialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Perform architecture specific initialization
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int usbstrg_archinitialize(void)
|
||||||
|
{
|
||||||
|
FAR struct sdio_dev_s *sdio;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
/* First, get an instance of the SDIO interface */
|
||||||
|
|
||||||
|
message("usbstrg_archinitialize: "
|
||||||
|
"Initializing SDIO slot %d\n",
|
||||||
|
STM32_MMCSDSLOTNO);
|
||||||
|
|
||||||
|
sdio = sdio_initialize(STM32_MMCSDSLOTNO);
|
||||||
|
if (!sdio)
|
||||||
|
{
|
||||||
|
message("usbstrg_archinitialize: Failed to initialize SDIO slot %d\n",
|
||||||
|
STM32_MMCSDSLOTNO);
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Now bind the SPI interface to the MMC/SD driver */
|
||||||
|
|
||||||
|
message("usbstrg_archinitialize: "
|
||||||
|
"Bind SDIO to the MMC/SD driver, minor=%d\n",
|
||||||
|
CONFIG_EXAMPLES_USBSTRG_DEVMINOR1);
|
||||||
|
|
||||||
|
ret = mmcsd_slotinitialize(CONFIG_EXAMPLES_USBSTRG_DEVMINOR1, sdio);
|
||||||
|
if (ret != OK)
|
||||||
|
{
|
||||||
|
message("usbstrg_archinitialize: "
|
||||||
|
"Failed to bind SDIO to the MMC/SD driver: %d\n",
|
||||||
|
ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
message("usbstrg_archinitialize: "
|
||||||
|
"Successfully bound SDIO to the MMC/SD driver\n");
|
||||||
|
|
||||||
|
/* Then let's guess and say that there is a card in the slot. I need to check to
|
||||||
|
* see if the VSN board supports a GPIO to detect if there is a card in
|
||||||
|
* the slot.
|
||||||
|
*/
|
||||||
|
|
||||||
|
sdio_mediachange(sdio, true);
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* CONFIG_STM32_SDIO */
|
||||||
@@ -0,0 +1,121 @@
|
|||||||
|
/************************************************************************************
|
||||||
|
* configs/vsn/src/vsn-internal.h
|
||||||
|
* arch/arm/src/board/vsn-internal.n
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Gregory Nutt. All rights reserved.
|
||||||
|
* Copyright (c) 2011 Uros Platise. All rights reserved.
|
||||||
|
*
|
||||||
|
* Authors: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
|
* Uros Platise <uros.platise@isotel.eu>
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. 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.
|
||||||
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
|
* used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* 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 OWNER 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.
|
||||||
|
*
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __CONFIGS_VSN_1_2_SRC_VSN_INTERNAL_H
|
||||||
|
#define __CONFIGS_VSN_1_2_SRC_VSN_INTERNAL_H
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Included Files
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
#include <nuttx/compiler.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Definitions
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/* How many SPI modules does this chip support? The LM3S6918 supports 2 SPI
|
||||||
|
* modules (others may support more -- in such case, the following must be
|
||||||
|
* expanded).
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if STM32_NSPI < 1
|
||||||
|
# undef CONFIG_STM32_SPI1
|
||||||
|
# undef CONFIG_STM32_SPI2
|
||||||
|
#elif STM32_NSPI < 2
|
||||||
|
# undef CONFIG_STM32_SPI2
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* VSN 1.2 GPIOs **************************************************************/
|
||||||
|
|
||||||
|
/* LED */
|
||||||
|
|
||||||
|
#define GPIO_LED (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTB|GPIO_PIN2)
|
||||||
|
|
||||||
|
/* BUTTON - Note that after a good second button causes hardware reset */
|
||||||
|
|
||||||
|
#define GPIO_PUSHBUTTON (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|GPIO_PORTC|GPIO_PIN5)
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Public Types
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Public data
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __ASSEMBLY__
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Name: stm32_spiinitialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Called to configure SPI chip select GPIO pins for the VSN board.
|
||||||
|
*
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
extern void weak_function stm32_spiinitialize(void);
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Name: stm32_usbinitialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Called to setup USB-related GPIO pins for the VSN board.
|
||||||
|
*
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
extern void weak_function stm32_usbinitialize(void);
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Name: stm32_extcontextsave
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Save current GPIOs that will used by external memory configurations
|
||||||
|
*
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
#endif /* __ASSEMBLY__ */
|
||||||
|
#endif /* __CONFIGS_VSN_1_2_SRC_VSN_INTERNAL_H */
|
||||||
|
|
||||||
Reference in New Issue
Block a user