modify nuttx bug of lack of files

This commit is contained in:
TangYiwen123
2021-06-11 11:25:07 +08:00
parent 4a7f51a5e9
commit 6d0f2ca39a
6752 changed files with 1528133 additions and 0 deletions
@@ -0,0 +1,113 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
if ARCH_BOARD_STM32F103_MINIMUM
choice
prompt "Board type"
default STM32F103MINIMUM_BLUEPILL
config STM32F103MINIMUM_BLUEPILL
bool "Blue Pill/Red Pill/RoboDyn Black Pill"
config STM32F103MINIMUM_BLACKPILL
bool "Black Pill"
endchoice
config STM32F103MINIMUM_AT24_BLOCKMOUNT
bool "AT24 Serial EEPROM auto-mount"
default n
depends on NSH_ARCHINIT && STM32_I2C1 && MTD_AT24XX
---help---
Automatically initialize the AT24 I2C EEPROM driver when NSH starts.
choice
prompt "AT24 serial EPPROM configuration"
default STM32F103MINIMUM_AT24_FTL
depends on STM32F103MINIMUM_AT24_BLOCKMOUNT
config STM32F103MINIMUM_AT24_FTL
bool "Create AT24 block driver"
---help---
Create the MTD driver for the AT24 and "wrap" the AT24 as a standard
block driver that could then, for example, be mounted using FAT or
any other file system. Any file system may be used, but there will
be no wear-leveling.
config STM32F103MINIMUM_AT24_NXFFS
bool "Create AT24 NXFFS file system"
depends on FS_NXFFS
---help---
Create the MTD driver for the AT24 and mount the AT24 device as
a wear-leveling, NuttX FLASH file system (NXFFS). The downside of
NXFFS is that it can be very slow.
endchoice # AT24 serial EPPROM configuration
config STM32F103MINIMUM_FLASH
bool "MTD driver for external 4Mbyte W25Q32FV FLASH on SPI1"
default n
select MTD
select MTD_W25
select MTD_SMART
select FS_SMARTFS
select STM32_SPI1
select MTD_BYTE_WRITE
---help---
Configures an MTD device for use with the onboard flash
config STM32F103MINIMUM_FLASH_MINOR
int "Minor number for the FLASH /dev/smart entry"
default 0
depends on STM32F103MINIMUM_FLASH
---help---
Sets the minor number for the FLASH MTD /dev entry
config STM32F103MINIMUM_FLASH_PART
bool "Enable partition support on FLASH"
default y
depends on STM32F103MINIMUM_FLASH
select MTD_PARTITION
---help---
Enables creation of partitions on the FLASH
config STM32F103MINIMUM_FLASH_CONFIG_PART
bool "Create application config data partition on FLASH"
default n
depends on STM32F103MINIMUM_FLASH_PART
depends on PLATFORM_CONFIGDATA
---help---
Enables creation of a /dev/config partition on the FLASH
config STM32F103MINIMUM_FLASH_CONFIG_PART_NUMBER
int "Index number of config partition (in list below)"
default 0
depends on STM32F103MINIMUM_FLASH_CONFIG_PART
---help---
Specifies the index number of the config data partition
from the partition list.
config STM32F103MINIMUM_FLASH_PART_LIST
string "Flash partition size list"
default "1024,1024,1024,1024"
depends on STM32F103MINIMUM_FLASH_PART
---help---
Comma separated list of partition sizes in KB.
config STM32F103MINIMUM_FLASH_PART_NAMES
string "Flash partition name list"
default "first,second,third,forth"
depends on STM32F103MINIMUM_FLASH_PART
depends on MTD_PARTITION_NAMES
---help---
Comma separated list of partition names.
config STM32F103MINIMUM_QETIMER
int "Timer to use with QE encoder"
default 4
depends on SENSORS_QENCODER
endif
@@ -0,0 +1,837 @@
README
======
This README discusses issues unique to NuttX configurations for the
STM32F103C8T6 Minimum System Development Board for ARM Microcontroller.
Contents
========
- STM32F103C8T6 Minimum System Development Boards:
- LEDs
- UARTs
- Timer Inputs/Outputs
- Using 128KiB of Flash instead of 64KiB
- Nintendo Wii Nunchuck
- Quadrature Encoder
- SDCard support
- SPI NOR Flash
- Nokia 5110 LCD Display support
- USB Console support
- STM32F103 Minimum - specific Configuration Options
- Configurations
STM32F103C8T6 Minimum System Development Boards:
================================================
This STM32F103C8T6 minimum system development board is available from
several vendors on the net, and may be sold under different names or
no name at all. It is based on a STM32F103C8T6 and has a DIP-40 form-
factor.
There are four versions of very similar boards: Red, Blue, RoboDyn Black and
Black.
See: https://wiki.stm32duino.com/index.php?title=Blue_Pill
https://wiki.stm32duino.com/index.php?title=Red_Pill
https://wiki.stm32duino.com/index.php?title=RobotDyn_Black_Pill
https://wiki.stm32duino.com/index.php?title=Black_Pill
The Red Board:
Good things about the red board:
- 1.5k pull up resistor on the PA12 pin (USB D+) which you can
programmatically drag down for automated USB reset.
- large power capacitors and LDO power.
- User LED on PC13
Problems with the red board:
- Silk screen is barely readable, the text is chopped off on some of
the pins
- USB connector only has two anchor points and it is directly soldered
on the surface
- Small reset button with hardly any resistance
The Blue Board:
Good things about the blue board:
- Four soldered anchor point on the USB connector. What you can't tell
from this picture is that there is a notch in the PCB board and the USB
connector sits down inside it some. This provides some lateral stability
that takes some of the stress off the solder points.
- It has nice clear readable silkscreen printing.
- It also a larger reset button.
- User LED on PC13
Problems with the blue board:
- Probably won't work as a USB device if it has a 10k pull-up on PA12. You
have to check the pull up on PA12 (USB D+). If it has a 10k pull-up
resistor, you will need to replace it with a 1.5k one to use the native
USB.
- Puny voltage regulator probably 100mA.
A schematic for the blue board is available here:
http://www.stm32duino.com/download/file.php?id=276
The Black Board:
- User LED is on PB12.
- Mounting holes.
Both Boards:
Nice features common to both:
- SWD pins broken out and easily connected (VCC, GND, SWDIO, SWCLK)
- USB 5V is broken out with easy access.
- Power LED
- You can probably use more flash (128k) than officially documented for
the chip (stm32f103c8t6 64k), I was able to load 115k of flash on mine
and it seemed to work.
Problems with both boards:
- No preloaded bootloader (this isn't really a problem as the
entire 64k of flash is available for use)
- No user button
This is the board pinout based on its form-factor for the Blue board:
USB
___
-----/ _ \-----
|B12 GND|
|B13 GND|
|B14 3.3V|
|B15 RST|
|A8 B11|
|A9 B10|
|A10 B1|
|A11 B0|
|A12 A7|
|A15 A6|
|B3 A5|
|B4 A4|
|B5 A3|
|B6 A2|
|B7 A1|
|B8 A0|
|B9 C15|
|5V C14|
|GND C13|
|3.3V VB|
|_____________|
LEDs
====
The STM32F103 Minimum board has only one software controllable LED.
This LED can be used by the board port when CONFIG_ARCH_LEDS option is
enabled.
If enabled the LED is simply turned on when the board boots
successfully, and is blinking on panic / assertion failed.
UARTs
=====
UART/USART PINS
---------------
USART1
RX PA10
TX PA9
USART2
CK PA4
CTS PA0
RTS PA1
RX PA3
TX PA2
USART3
CK PB12
CTS PB13
RTS PB14
RX PB11
TX PB10
Default USART/UART Configuration
--------------------------------
USART1 (RX & TX only) is available through pins PA9 (TX) and PA10 (RX).
Timer Inputs/Outputs
====================
TIM1
CH1 PA8
CH2 PA9*
CH3 PA10*
CH4 PA11*
TIM2
CH1 PA0*, PA15, PA5
CH2 PA1, PB3
CH3 PA2, PB10*
CH4 PA3, PB11
TIM3
CH1 PA6, PB4
CH2 PA7, PB5*
CH3 PB0
CH4 PB1*
TIM4
CH1 PB6*
CH2 PB7
CH3 PB8
CH4 PB9*
* Indicates pins that have other on-board functions and should be used only
with care (See board datasheet).
Using 128KiB of Flash instead of 64KiB
======================================
Some people figured out that the STM32F103C8T6 has 128KiB of internal memory
instead of 64KiB as documented in the datasheet and reported by its internal
register.
In order to enable 128KiB you need modify the linker script to reflect this
new size. Open the boards/arm/stm32/stm32f103-minimum/scripts/ld.script and replace:
flash (rx) : ORIGIN = 0x08000000, LENGTH = 64K
with
flash (rx) : ORIGIN = 0x08000000, LENGTH = 128K
Enable many NuttX features (ie. many filesystems and applications) to get a
large binary image with more than 64K.
We will use OpenOCD to write the firmware in the STM32F103C8T6 Flash. Use a
up to dated OpenOCD version (ie. openocd-0.9).
You will need to create a copy of original openocd/scripts/target/stm32f1x.cfg
to openocd/scripts/target/stm32f103c8t6.cfg and edit the later file replacing:
flash bank $_FLASHNAME stm32f1x 0x08000000 0 0 0 $_TARGETNAME
with
flash bank $_FLASHNAME stm32f1x 0x08000000 0x20000 0 0 $_TARGETNAME
We will use OpenOCD with STLink-V2 programmer, but it will work with other
programmers (JLink, Versaloon, or some based on FTDI FT232, etc).
Open a terminal and execute:
$ sudo openocd -f interface/stlink-v2.cfg -f target/stm32f103c8t6.cfg
Now in other terminal execute:
$ telnet localhost 4444
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Open On-Chip Debugger
> reset halt
stm32f1x.cpu: target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x080003ac msp: 0x20000d78
> flash write_image erase nuttx.bin 0x08000000
auto erase enabled
device id = 0x20036410
ignoring flash probed value, using configured bank size
flash size = 128kbytes
stm32f1x.cpu: target state: halted
target halted due to breakpoint, current mode: Thread
xPSR: 0x61000000 pc: 0x2000003a msp: 0x20000d78
wrote 92160 bytes from file nuttx.bin in 4.942194s (18.211 KiB/s)
> reset run
> exit
Now NuttX should start normally.
Nintendo Wii Nunchuck:
======================
There is a driver on NuttX to support Nintendo Wii Nunchuck Joystick. If you
want to use it please select these options:
- Enable the I2C1 at System Type -> STM32 Peripheral Support, it will enable:
CONFIG_STM32_I2C1=y
- Enable to Custom board/driver initialization at RTOS Features -> RTOS hooks
CONFIG_BOARD_LATE_INITIALIZE=y
- Enable the I2C Driver Support at Device Drivers, it will enable this symbol:
CONFIG_I2C=y
- Nintendo Wii Nunchuck Joystick at Device Drivers -> [*] Input Device Support
CONFIG_INPUT=y
CONFIG_INPUT_NUNCHUCK=y
- Enable the Nunchuck joystick example at Application Configuration -> Examples
CONFIG_EXAMPLES_NUNCHUCK=y
CONFIG_EXAMPLES_NUNCHUCK_DEVNAME="/dev/nunchuck0"
You need to connect GND and +3.3V pins from Nunchuck connector to GND and 3.3V
of stm32f103-minimum respectively (Nunchuck also can work connected to 5V, but
I don't recommend it). Connect I2C Clock from Nunchuck to SCK (PB6) and the
I2C Data to SDA (PB7).
Quadrature Encoder:
===================
The nsh configuration has been used to test the Quadrature Encoder
(QEncoder, QE) with the following modifications to the configuration
file:
- These setting enable support for the common QEncode upper half driver:
CONFIG_SENSORS=y
CONFIG_SENSORS_QENCODER=y
- This is a board setting that selected timer 4 for use with the
quadrature encode:
CONFIG_STM32F103MINIMUM_QETIMER=4
- These settings enable the STM32 Quadrature encoder on timer 4:
CONFIG_STM32_TIM4_CAP=y
CONFIG_STM32_TIM4_QE=y
CONFIG_STM32_TIM4_QECLKOUT=2800000
CONFIG_STM32_QENCODER_FILTER=y
CONFIG_STM32_QENCODER_SAMPLE_EVENT_6=y
CONFIG_STM32_QENCODER_SAMPLE_FDTS_4=y
- These settings enable the test case at apps/examples/qencoder:
CONFIG_EXAMPLES_QENCODER=y
CONFIG_EXAMPLES_QENCODER_DELAY=100
CONFIG_EXAMPLES_QENCODER_DEVPATH="/dev/qe0"
In this configuration, the QEncoder inputs will be on the TIM4 inputs of
PB6 and PB7.
SPI NOR Flash support:
======================
We can use an extern SPI NOR Flash with STM32F103-Minimum board. In this case
we tested the Winboard W25Q32FV (32Mbit = 4MiB).
You can connect the W25Q32FV module in the STM32F103 Minimum board this way:
connect PA5 (SPI1 CLK) to CLK; PA7 (SPI1 MOSI) to DI; PA6 (SPI MISO) to DO;
PA4 to /CS; Also connect 3.3V to VCC and GND to GND.
You can start with default "stm32f103-minimum/nsh" configuration option and
enable/disable these options using "make menuconfig" :
System Type --->
STM32 Peripheral Support --->
[*] SPI1
Board Selection --->
[*] MTD driver for external 4Mbyte W25Q32FV FLASH on SPI1
(0) Minor number for the FLASH /dev/smart entry
[*] Enable partition support on FLASH
(1024,1024,1024,1024) Flash partition size list
RTOS Features --->
Stack and heap information --->
(512) Idle thread stack size
(1024) Main thread stack size
(256) Minimum pthread stack size
(1024) Default pthread stack size
Device Drivers --->
-*- Memory Technology Device (MTD) Support --->
[*] Support MTD partitions
-*- SPI-based W25 FLASH
(0) W25 SPI Mode
(20000000) W25 SPI Frequency
File Systems --->
[ ] Disable pseudo-filesystem operations
-*- SMART file system
(0xff) FLASH erased state
(16) Maximum file name length
Memory Management --->
[*] Small memory model
Also change the boards/arm/stm32/stm32f103-minimum/scripts/ld.script file to use 128KB
of Flash instead 64KB (since this board has a hidden 64KB flash) :
MEMORY
{
flash (rx) : ORIGIN = 0x08000000, LENGTH = 128K
sram (rwx) : ORIGIN = 0x20000000, LENGTH = 20K
}
Then after compiling and flashing the file nuttx.bin you can format and mount
the flash this way:
nsh> mksmartfs /dev/smart0p0
nsh> mksmartfs /dev/smart0p1
nsh> mksmartfs /dev/smart0p2
nsh> mksmartfs /dev/smart0p3
nsh> mount -t smartfs /dev/smart0p0 /mnt
nsh> ls /mnt
/mnt:
nsh> echo "Testing" > /mnt/file.txt
nsh> ls /mnt
/mnt:
file.txt
nsh> cat /mnt/file.txt
Testing
nsh>
SDCard support:
===============
Only STM32F103xx High-density devices has SDIO controller. STM32F103C8T6 is a
Medium-density device, but we can use SDCard over SPI.
You can do that enabling these options:
CONFIG_FS_FAT=y
CONFIG_MMCSD=y
CONFIG_MMCSD_NSLOTS=1
CONFIG_MMCSD_SPI=y
CONFIG_MMCSD_SPICLOCK=20000000
CONFIG_MMCSD_SPIMODE=0
CONFIG_STM32_SPI=y
CONFIG_STM32_SPI1=y
CONFIG_SPI=y
CONFIG_SPI_CALLBACK=y
CONFIG_SPI_EXCHANGE=y
And connect a SDCard/SPI board on SPI1. Connect the CS pin to PA4, SCK to
PA5, MOSI to PA7 and MISO to PA6. Note: some chinese boards use MOSO instead
of MISO.
Nokia 5110 LCD Display support:
===============================
You can connect a low cost Nokia 5110 LCD display in the STM32F103 Minimum
board this way: connect PA5 (SPI1 CLK) to CLK; PA7 (SPI1 MOSI) to DIN; PA4
to CE; PA3 to RST; PA2 to DC. Also connect 3.3V to VCC and GND to GND.
You can start with default "stm32f103-minimum/nsh" configuration option and
enable these options using "make menuconfig" :
System Type --->
STM32 Peripheral Support --->
[*] SPI1
Device Drivers --->
-*- SPI Driver Support --->
[*] SPI exchange
[*] SPI CMD/DATA
Device Drivers --->
LCD Driver Support --->
[*] Graphic LCD Driver Support --->
[*] Nokia 5110 LCD Display (Phillips PCD8544)
(1) Number of PCD8544 Devices
(84) PCD8544 X Resolution
(48) PCD8544 Y Resolution
Graphics Support --->
[*] NX Graphics
(1) Number of Color Planes
(0x0) Initial background color
Supported Pixel Depths --->
[ ] Disable 1 BPP
[*] Packed MS First
Font Selections --->
(7) Bits in Character Set
[*] Mono 5x8
Application Configuration --->
Examples --->
[*] NX graphics "Hello, World!" example
(1) Bits-Per-Pixel
After compiling and flashing the nuttx.bin inside the board, reset it.
You should see it:
NuttShell (NSH)
nsh> ?
help usage: help [-v] [<cmd>]
[ dd free mb source usleep
? echo help mh sleep xd
cat exec hexdump mw test
cd exit kill pwd true
cp false ls set unset
Builtin Apps:
nxhello
Now just run nxhello and you should see "Hello World" in the display:
nsh> nxhello
USB Console support:
====================
The STM32F103C8 has a USB Device controller, then we can use NuttX support
to USB Device. We can the console over USB enabling these options:
System Type --->
STM32 Peripheral Support --->
[*] USB Device
It will enable: CONFIG_STM32_USB=y
Board Selection --->
-*- Enable boardctl() interface
[*] Enable USB device controls
It will enable: CONFIG_BOARDCTL_USBDEVCTRL=y
Device Drivers --->
-*- USB Device Driver Support --->
[*] USB Modem (CDC/ACM) support --->
It will enable: CONFIG_CDCACM=y and many default options.
Device Drivers --->
-*- USB Device Driver Support --->
[*] USB Modem (CDC/ACM) support --->
[*] CDC/ACM console device
It will enable: CONFIG_CDCACM_CONSOLE=y
Device Drivers --->
[*] Serial Driver Support --->
Serial console (No serial console) --->
(X) No serial console
It will enable: CONFIG_NO_SERIAL_CONSOLE=y
After flashing the firmware in the board, unplug and plug it in the computer
and it will create a /dev/ttyACM0 device in the Linux. Use minicom with this
device to get access to NuttX NSH console (press Enter three times to start)
MCP2515 External Module
=======================
You can use an external MCP2515 (tested with NiRen MCP2515_CAN module) to
get CAN Bus working on STM32F103C8 chip (remember the internal CAN cannot
work with USB at same time because they share the SRAM buffer).
You can connect the MCP2515 module in the STM32F103 Minimum board this way:
connect PA5 (SPI1 CLK) to SCK; PA7 (SPI1 MOSI) to SI; PA6 (SPI MISO) to SO;
PA4 to CS; B0 to INT. Also connect 5V to VCC and GND to GND.
Note: Although MCP2515 can work with 2.7V-5.5V it is more stable when using
it on BluePill board on 5V.
Testing: you will need at least 2 boards each one with a MCP2515 module
connected to it. Connect CAN High from the first module to the CAN High of
the second module, and the CAN Low from the first module to the CAN Low of
the second module.
You need to modify the "CAN example" application on menuconfig and create
two firmware versions: the first firmware will be Read-only and the second
one Write-only. Flash the first firmware in the first board and the second
firmware in the second board. Now you can start the both boards, run the
"can" command in the Write-only board and then run the "can" command in the
Read-only board. You should see the data coming.
STM32F103 Minimum - 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_STM32F103C8=y
CONFIG_ARCH_BOARD_STM32_CUSTOM_CLOCKCONFIG - Enables special STM32 clock
configuration features.
CONFIG_ARCH_BOARD_STM32_CUSTOM_CLOCKCONFIG=n
CONFIG_ARCH_BOARD - Identifies the boards/ subdirectory and
hence, the board that supports the particular chip or SoC.
CONFIG_ARCH_BOARD=stm32f103-minimum
CONFIG_ARCH_BOARD_name - For use in C code
CONFIG_ARCH_BOARD_STM32_MINIMUM=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_RAM_SIZE - Describes the installed DRAM (SRAM in this case):
CONFIG_RAM_SIZE=20480 (20Kb)
CONFIG_RAM_START - The start address of installed DRAM
CONFIG_RAM_START=0x20000000
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
Individual subsystems can be enabled:
AHB
---
CONFIG_STM32_CRC
CONFIG_STM32_BKPSRAM
APB1
----
CONFIG_STM32_TIM2
CONFIG_STM32_TIM3
CONFIG_STM32_TIM4
CONFIG_STM32_WWDG
CONFIG_STM32_IWDG
CONFIG_STM32_SPI2
CONFIG_STM32_USART2
CONFIG_STM32_USART3
CONFIG_STM32_I2C1
CONFIG_STM32_I2C2
CONFIG_STM32_CAN1
CONFIG_STM32_PWR -- Required for RTC
APB2
----
CONFIG_STM32_TIM1
CONFIG_STM32_USART1
CONFIG_STM32_ADC1
CONFIG_STM32_ADC2
CONFIG_STM32_SPI1
Timer devices may be used for different purposes. One special purpose is
to generate modulated outputs for such things as motor control. If CONFIG_STM32_TIMn
is defined (as above) then the following may also be defined to indicate that
the timer is intended to be used for pulsed output modulation or ADC conversion.
Note that ADC require two definitions: Not only do you have
to assign the timer (n) for used by the ADC, but then you also have to
configure which ADC (m) it is assigned to.
CONFIG_STM32_TIMn_PWM Reserve timer n for use by PWM, n=1,..,14
CONFIG_STM32_TIMn_ADC Reserve timer n for use by ADC, n=1,..,14
CONFIG_STM32_TIMn_ADCm Reserve timer n to trigger ADCm, n=1,..,14, m=1,..,3
For each timer that is enabled for PWM usage, we need the following additional
configuration settings:
CONFIG_STM32_TIMx_CHANNEL - Specifies the timer output channel {1,..,4}
NOTE: The STM32 timers are each capable of generating different signals on
each of the four channels with different duty cycles. That capability is
not supported by this driver: Only one output channel per timer.
JTAG Enable settings (by default only SW-DP is enabled):
CONFIG_STM32_JTAG_FULL_ENABLE - Enables full SWJ (JTAG-DP + SW-DP)
CONFIG_STM32_JTAG_NOJNTRST_ENABLE - Enables full SWJ (JTAG-DP + SW-DP)
but without JNTRST.
CONFIG_STM32_JTAG_SW_ENABLE - Set JTAG-DP disabled and SW-DP enabled
STM32F103 Minimum specific device driver settings
CONFIG_U[S]ARTn_SERIAL_CONSOLE - selects the USARTn (n=1,2,3)
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
STM32F103 Minimum CAN Configuration
CONFIG_CAN - Enables CAN support (one or both of CONFIG_STM32_CAN1 or
CONFIG_STM32_CAN2 must also be defined)
CONFIG_CAN_EXTID - Enables support for the 29-bit extended ID. Default
Standard 11-bit IDs.
CONFIG_CAN_FIFOSIZE - The size of the circular buffer of CAN messages.
Default: 8
CONFIG_CAN_NPENDINGRTR - The size of the list of pending RTR requests.
Default: 4
CONFIG_CAN_LOOPBACK - A CAN driver may or may not support a loopback
mode for testing. The STM32 CAN driver does support loopback mode.
CONFIG_STM32_CAN1_BAUD - CAN1 BAUD rate. Required if CONFIG_STM32_CAN1
is defined.
CONFIG_STM32_CAN2_BAUD - CAN1 BAUD rate. Required if CONFIG_STM32_CAN2
is defined.
CONFIG_STM32_CAN_TSEG1 - The number of CAN time quanta in segment 1.
Default: 6
CONFIG_STM32_CAN_TSEG2 - the number of CAN time quanta in segment 2.
Default: 7
CONFIG_STM32_CAN_REGDEBUG - If CONFIG_DEBUG_FEATURES is set, this will generate an
dump of all CAN registers.
STM32F103 Minimum SPI Configuration
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.
Configurations
==============
Instantiating Configurations
----------------------------
Each STM32F103 Minimum configuration is maintained in a sub-directory and
can be selected as follow:
tools/configure.sh STM32F103 Minimum:<subdir>
Where <subdir> is one of the following:
Configuration Directories
-------------------------
nsh:
---
Configures the NuttShell (nsh) located at apps/examples/nsh. This
configuration enables a console on UART1. Support for
builtin applications is enabled, but in the base configuration no
builtin applications are selected.
jlx12864g:
---------
This is a config example to use the JLX12864G-086 LCD module. To use this
LCD you need to connect PA5 (SPI1 CLK) to SCK; PA7 (SPI1 MOSI) to SDA; PA4
to CS; PA3 to RST; PA2 to RS.
nrf24:
---------
This is a config example to test the nrf24 terminal example. You will need
two stm32f103-minimum board each one with a nRF24L01 module connected this
way: connect PB1 to nRF24 CE pin; PA4 to CSN; PA5 (SPI1 CLK) to SCK; PA7
(SPI1 MOSI) to MOSI; PA6 (SPI1 MISO) to MISO; PA0 to IRQ.
usbnsh:
-------
This is another NSH example. If differs from other 'nsh' configurations
in that this configurations uses a USB serial device for console I/O.
NOTES:
1. This configuration uses the mconf-based configuration tool. To
change this configuration using that tool, you should:
a. Build and install the kconfig-mconf tool. See nuttx/README.txt
see additional README.txt files in the NuttX tools repository.
b. Execute 'make menuconfig' in nuttx/ in order to start the
reconfiguration process.
2. By default, this configuration uses the ARM EABI toolchain
for Windows and builds under Cygwin (or probably MSYS). That
can easily be reconfigured, of course.
CONFIG_HOST_WINDOWS=y : Builds under Windows
CONFIG_WINDOWS_CYGWIN=y : Using Cygwin
CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIW=y : GNU EABI toolchain for Windows
3. This configuration does have UART2 output enabled and set up as
the system logging device:
CONFIG_SYSLOG_CHAR=y : Use a character device for system logging
CONFIG_SYSLOG_DEVPATH="/dev/ttyS0" : UART2 will be /dev/ttyS0
However, there is nothing to generate SYSLOG output in the default
configuration so nothing should appear on UART2 unless you enable
some debug output or enable the USB monitor.
4. Enabling USB monitor SYSLOG output. If tracing is enabled, the USB
device will save encoded trace output in in-memory buffer; if the
USB monitor is enabled, that trace buffer will be periodically
emptied and dumped to the system logging device (UART2 in this
configuration):
CONFIG_USBDEV_TRACE=y : Enable USB trace feature
CONFIG_USBDEV_TRACE_NRECORDS=128 : Buffer 128 records in memory
CONFIG_NSH_USBDEV_TRACE=n : No builtin tracing from NSH
CONFIG_NSH_ARCHINIT=y : Automatically start the USB monitor
CONFIG_USBMONITOR=y : Enable the USB monitor daemon
CONFIG_USBMONITOR_STACKSIZE=2048 : USB monitor daemon stack size
CONFIG_USBMONITOR_PRIORITY=50 : USB monitor daemon priority
CONFIG_USBMONITOR_INTERVAL=2 : Dump trace data every 2 seconds
CONFIG_USBMONITOR_TRACEINIT=y : Enable TRACE output
CONFIG_USBMONITOR_TRACECLASS=y
CONFIG_USBMONITOR_TRACETRANSFERS=y
CONFIG_USBMONITOR_TRACECONTROLLER=y
CONFIG_USBMONITOR_TRACEINTERRUPTS=y
5. By default, this project assumes that you are *NOT* using the DFU
bootloader.
Using the Prolifics PL2303 Emulation
------------------------------------
You could also use the non-standard PL2303 serial device instead of
the standard CDC/ACM serial device by changing:
CONFIG_CDCACM=y : Disable the CDC/ACM serial device class
CONFIG_CDCACM_CONSOLE=y : The CDC/ACM serial device is NOT the console
CONFIG_PL2303=y : The Prolifics PL2303 emulation is enabled
CONFIG_PL2303_CONSOLE=y : The PL2303 serial device is the console
veml6070:
--------
This is a config example to use the Vishay VEML6070 UV-A sensor. To use this
sensor you need to connect PB6 (I2C1 CLK) to SCL; PB7 (I2C1 SDA) to SDA of
sensor module. I used a GY-VEML6070 module to test this driver.
@@ -0,0 +1,77 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_DISABLE_OS_API is not set
# CONFIG_NSH_DISABLESCRIPT is not set
# CONFIG_NSH_DISABLE_DD is not set
# CONFIG_NSH_DISABLE_EXEC is not set
# CONFIG_NSH_DISABLE_EXIT is not set
# CONFIG_NSH_DISABLE_GET is not set
# CONFIG_NSH_DISABLE_HEXDUMP is not set
# CONFIG_NSH_DISABLE_PUT is not set
# CONFIG_NSH_DISABLE_WGET is not set
# CONFIG_NSH_DISABLE_XD is not set
CONFIG_ADBD_BOARD_INIT=y
CONFIG_ADBD_DEVICE_ID="test"
CONFIG_ADBD_FILE_SERVICE=y
CONFIG_ADBD_SHELL_SERVICE=y
CONFIG_ADBD_USB_SERVER=y
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="stm32f103-minimum"
CONFIG_ARCH_BOARD_STM32F103_MINIMUM=y
CONFIG_ARCH_CHIP="stm32"
CONFIG_ARCH_CHIP_STM32=y
CONFIG_ARCH_CHIP_STM32F103C8=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARDCTL_RESET=y
CONFIG_BOARD_LOOPSPERMSEC=5483
CONFIG_BUILTIN=y
CONFIG_CLOCK_MONOTONIC=y
CONFIG_DEFAULT_SMALL=y
CONFIG_DEV_FIFO_SIZE=64
CONFIG_DEV_PIPE_MAXSIZE=64
CONFIG_DEV_PIPE_SIZE=64
CONFIG_EXAMPLES_HELLO=y
CONFIG_FS_PROCFS=y
CONFIG_FS_PROCFS_EXCLUDE_MOUNTS=y
CONFIG_LIBUV=y
CONFIG_LIBUV_PIPE=y
CONFIG_LIBUV_STREAM=y
CONFIG_MAX_TASKS=16
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_DISABLE_IFCONFIG=y
CONFIG_NSH_DISABLE_IFUPDOWN=y
CONFIG_NSH_FILEIOSIZE=1024
CONFIG_NSH_LINELEN=80
CONFIG_PIPES=y
CONFIG_PREALLOC_TIMERS=4
CONFIG_RAM_SIZE=20480
CONFIG_RAM_START=0x20000000
CONFIG_RAW_BINARY=y
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_WAITPID=y
CONFIG_SDCLONE_DISABLE=y
CONFIG_SERIAL_TERMIOS=y
CONFIG_STACK_COLORATION=y
CONFIG_START_DAY=5
CONFIG_START_MONTH=7
CONFIG_START_YEAR=2011
CONFIG_STM32_DFU=y
CONFIG_STM32_DISABLE_IDLE_SLEEP_DURING_DEBUG=y
CONFIG_STM32_JTAG_FULL_ENABLE=y
CONFIG_STM32_USART1=y
CONFIG_STM32_USB=y
CONFIG_SYMTAB_ORDEREDBYNAME=y
CONFIG_SYSTEM_ADBD=y
CONFIG_SYSTEM_NSH=y
CONFIG_TASK_NAME_SIZE=8
CONFIG_USART1_SERIAL_CONSOLE=y
CONFIG_USBADB=y
CONFIG_USBDEV_BUSPOWERED=y
CONFIG_USERMAIN_STACKSIZE=1024
CONFIG_USER_ENTRYPOINT="adbd_main"
@@ -0,0 +1,63 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_DISABLE_OS_API is not set
# CONFIG_NSH_DISABLESCRIPT is not set
# CONFIG_NSH_DISABLE_DD is not set
# CONFIG_NSH_DISABLE_EXEC is not set
# CONFIG_NSH_DISABLE_EXIT is not set
# CONFIG_NSH_DISABLE_GET is not set
# CONFIG_NSH_DISABLE_HEXDUMP is not set
# CONFIG_NSH_DISABLE_MKRD is not set
# CONFIG_NSH_DISABLE_PS is not set
# CONFIG_NSH_DISABLE_PUT is not set
# CONFIG_NSH_DISABLE_WGET is not set
# CONFIG_NSH_DISABLE_XD is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="stm32f103-minimum"
CONFIG_ARCH_BOARD_STM32F103_MINIMUM=y
CONFIG_ARCH_CHIP="stm32"
CONFIG_ARCH_CHIP_STM32=y
CONFIG_ARCH_CHIP_STM32F103C8=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARD_LOOPSPERMSEC=5483
CONFIG_BUILTIN=y
CONFIG_DEFAULT_SMALL=y
CONFIG_EXAMPLES_APDS9960=y
CONFIG_I2C_DRIVER=y
CONFIG_IDLETHREAD_STACKSIZE=512
CONFIG_MAX_TASKS=16
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=1024
CONFIG_NSH_LINELEN=80
CONFIG_PREALLOC_TIMERS=4
CONFIG_PTHREAD_STACK_MIN=512
CONFIG_RAM_SIZE=20480
CONFIG_RAM_START=0x20000000
CONFIG_RAW_BINARY=y
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_HPWORK=y
CONFIG_SCHED_HPWORKPRIORITY=192
CONFIG_SCHED_HPWORKSTACKSIZE=3072
CONFIG_SCHED_WAITPID=y
CONFIG_SDCLONE_DISABLE=y
CONFIG_SENSORS=y
CONFIG_SENSORS_APDS9960=y
CONFIG_SERIAL_TERMIOS=y
CONFIG_START_DAY=5
CONFIG_START_MONTH=7
CONFIG_START_YEAR=2011
CONFIG_STM32_DISABLE_IDLE_SLEEP_DURING_DEBUG=y
CONFIG_STM32_I2C1=y
CONFIG_STM32_JTAG_FULL_ENABLE=y
CONFIG_STM32_USART1=y
CONFIG_SYMTAB_ORDEREDBYNAME=y
CONFIG_SYSTEM_NSH=y
CONFIG_TASK_NAME_SIZE=0
CONFIG_USART1_SERIAL_CONSOLE=y
CONFIG_USER_ENTRYPOINT="nsh_main"
@@ -0,0 +1,65 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_DISABLE_OS_API is not set
# CONFIG_NSH_DISABLESCRIPT is not set
# CONFIG_NSH_DISABLE_DD is not set
# CONFIG_NSH_DISABLE_EXEC is not set
# CONFIG_NSH_DISABLE_EXIT is not set
# CONFIG_NSH_DISABLE_GET is not set
# CONFIG_NSH_DISABLE_HEXDUMP is not set
# CONFIG_NSH_DISABLE_MKRD is not set
# CONFIG_NSH_DISABLE_PS is not set
# CONFIG_NSH_DISABLE_PUT is not set
# CONFIG_NSH_DISABLE_WGET is not set
# CONFIG_NSH_DISABLE_XD is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="stm32f103-minimum"
CONFIG_ARCH_BOARD_STM32F103_MINIMUM=y
CONFIG_ARCH_CHIP="stm32"
CONFIG_ARCH_CHIP_STM32=y
CONFIG_ARCH_CHIP_STM32F103C8=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_AUDIO=y
CONFIG_AUDIO_TONE=y
CONFIG_BOARD_LOOPSPERMSEC=5483
CONFIG_BUILTIN=y
CONFIG_DEFAULT_SMALL=y
CONFIG_DRIVERS_AUDIO=y
CONFIG_MAX_TASKS=16
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=1024
CONFIG_NSH_LINELEN=80
CONFIG_PREALLOC_TIMERS=4
CONFIG_PWM=y
CONFIG_RAM_SIZE=20480
CONFIG_RAM_START=0x20000000
CONFIG_RAW_BINARY=y
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_HPWORK=y
CONFIG_SCHED_HPWORKPRIORITY=192
CONFIG_SCHED_WAITPID=y
CONFIG_SDCLONE_DISABLE=y
CONFIG_SERIAL_TERMIOS=y
CONFIG_START_DAY=5
CONFIG_START_MONTH=7
CONFIG_START_YEAR=2011
CONFIG_STM32_DISABLE_IDLE_SLEEP_DURING_DEBUG=y
CONFIG_STM32_JTAG_FULL_ENABLE=y
CONFIG_STM32_ONESHOT=y
CONFIG_STM32_TIM2=y
CONFIG_STM32_TIM2_CH2OUT=y
CONFIG_STM32_TIM2_CHANNEL=2
CONFIG_STM32_TIM2_PWM=y
CONFIG_STM32_TIM3=y
CONFIG_STM32_USART1=y
CONFIG_SYMTAB_ORDEREDBYNAME=y
CONFIG_SYSTEM_NSH=y
CONFIG_TASK_NAME_SIZE=0
CONFIG_USART1_SERIAL_CONSOLE=y
CONFIG_USER_ENTRYPOINT="nsh_main"
@@ -0,0 +1,63 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_ARCH_LEDS is not set
# CONFIG_DISABLE_OS_API is not set
# CONFIG_NSH_DISABLESCRIPT is not set
# CONFIG_NSH_DISABLE_DD is not set
# CONFIG_NSH_DISABLE_EXEC is not set
# CONFIG_NSH_DISABLE_EXIT is not set
# CONFIG_NSH_DISABLE_GET is not set
# CONFIG_NSH_DISABLE_HEXDUMP is not set
# CONFIG_NSH_DISABLE_MKRD is not set
# CONFIG_NSH_DISABLE_PS is not set
# CONFIG_NSH_DISABLE_PUT is not set
# CONFIG_NSH_DISABLE_WGET is not set
# CONFIG_NSH_DISABLE_XD is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="stm32f103-minimum"
CONFIG_ARCH_BOARD_STM32F103_MINIMUM=y
CONFIG_ARCH_BUTTONS=y
CONFIG_ARCH_CHIP="stm32"
CONFIG_ARCH_CHIP_STM32=y
CONFIG_ARCH_CHIP_STM32F103C8=y
CONFIG_ARCH_IRQBUTTONS=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARD_LATE_INITIALIZE=y
CONFIG_BOARD_LOOPSPERMSEC=5483
CONFIG_BUILTIN=y
CONFIG_DEFAULT_SMALL=y
CONFIG_EXAMPLES_BUTTONS=y
CONFIG_INPUT=y
CONFIG_INPUT_BUTTONS=y
CONFIG_INPUT_BUTTONS_LOWER=y
CONFIG_MAX_TASKS=16
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=1024
CONFIG_NSH_LINELEN=80
CONFIG_PREALLOC_TIMERS=4
CONFIG_RAM_SIZE=20480
CONFIG_RAM_START=0x20000000
CONFIG_RAW_BINARY=y
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_HPWORK=y
CONFIG_SCHED_HPWORKPRIORITY=192
CONFIG_SCHED_WAITPID=y
CONFIG_SDCLONE_DISABLE=y
CONFIG_SERIAL_TERMIOS=y
CONFIG_START_DAY=5
CONFIG_START_MONTH=7
CONFIG_START_YEAR=2011
CONFIG_STM32_DISABLE_IDLE_SLEEP_DURING_DEBUG=y
CONFIG_STM32_JTAG_SW_ENABLE=y
CONFIG_STM32_USART1=y
CONFIG_SYMTAB_ORDEREDBYNAME=y
CONFIG_SYSTEM_NSH=y
CONFIG_TASK_NAME_SIZE=0
CONFIG_USART1_SERIAL_CONSOLE=y
CONFIG_USER_ENTRYPOINT="nsh_main"
@@ -0,0 +1,65 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_ARCH_LEDS is not set
# CONFIG_DEV_NULL is not set
# CONFIG_NSH_DISABLEBG is not set
# CONFIG_NSH_DISABLE_DF is not set
# CONFIG_NSH_DISABLE_EXEC is not set
# CONFIG_NSH_DISABLE_EXIT is not set
# CONFIG_NSH_DISABLE_GET is not set
# CONFIG_NSH_DISABLE_HEXDUMP is not set
# CONFIG_NSH_DISABLE_PS is not set
# CONFIG_NSH_DISABLE_XD is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="stm32f103-minimum"
CONFIG_ARCH_BOARD_STM32F103_MINIMUM=y
CONFIG_ARCH_CHIP="stm32"
CONFIG_ARCH_CHIP_STM32=y
CONFIG_ARCH_CHIP_STM32F103C8=y
CONFIG_BINFMT_DISABLE=y
CONFIG_BOARD_LOOPSPERMSEC=5483
CONFIG_DEFAULT_SMALL=y
CONFIG_DISABLE_MOUNTPOINT=y
CONFIG_DISABLE_MQUEUE=y
CONFIG_DISABLE_PTHREAD=y
CONFIG_EXAMPLES_HELLO=y
CONFIG_FDCLONE_STDIO=y
CONFIG_MAX_TASKS=4
CONFIG_MM_SMALL=y
CONFIG_NSH_DISABLE_CP=y
CONFIG_NSH_DISABLE_MKDIR=y
CONFIG_NSH_DISABLE_MOUNT=y
CONFIG_NSH_DISABLE_MV=y
CONFIG_NSH_DISABLE_RM=y
CONFIG_NSH_DISABLE_RMDIR=y
CONFIG_NSH_DISABLE_UMOUNT=y
CONFIG_NSH_FILEIOSIZE=64
CONFIG_NSH_LINELEN=80
CONFIG_NUNGET_CHARS=0
CONFIG_PREALLOC_TIMERS=0
CONFIG_PTHREAD_STACK_DEFAULT=1536
CONFIG_RAM_SIZE=20480
CONFIG_RAM_START=0x20000000
CONFIG_RAW_BINARY=y
CONFIG_RR_INTERVAL=200
CONFIG_SDCLONE_DISABLE=y
CONFIG_SERIAL_TERMIOS=y
CONFIG_START_DAY=5
CONFIG_START_MONTH=7
CONFIG_START_YEAR=2011
CONFIG_STDIO_DISABLE_BUFFERING=y
CONFIG_STM32_DISABLE_IDLE_SLEEP_DURING_DEBUG=y
CONFIG_STM32_JTAG_FULL_ENABLE=y
CONFIG_STM32_NOEXT_VECTORS=y
CONFIG_STM32_USART1=y
CONFIG_SYSTEM_NSH=y
CONFIG_TASK_NAME_SIZE=0
CONFIG_TASK_SPAWN_DEFAULT_STACKSIZE=1536
CONFIG_USART1_SERIAL_CONSOLE=y
CONFIG_USERMAIN_STACKSIZE=1536
CONFIG_USER_ENTRYPOINT="hello_main"
@@ -0,0 +1,70 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_DISABLE_OS_API is not set
# CONFIG_NSH_DISABLESCRIPT is not set
# CONFIG_NSH_DISABLE_DD is not set
# CONFIG_NSH_DISABLE_EXEC is not set
# CONFIG_NSH_DISABLE_EXIT is not set
# CONFIG_NSH_DISABLE_GET is not set
# CONFIG_NSH_DISABLE_HEXDUMP is not set
# CONFIG_NSH_DISABLE_MKRD is not set
# CONFIG_NSH_DISABLE_PS is not set
# CONFIG_NSH_DISABLE_PUT is not set
# CONFIG_NSH_DISABLE_WGET is not set
# CONFIG_NSH_DISABLE_XD is not set
# CONFIG_NX_DISABLE_1BPP is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="stm32f103-minimum"
CONFIG_ARCH_BOARD_STM32F103_MINIMUM=y
CONFIG_ARCH_CHIP="stm32"
CONFIG_ARCH_CHIP_STM32=y
CONFIG_ARCH_CHIP_STM32F103C8=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARD_LOOPSPERMSEC=5483
CONFIG_BUILTIN=y
CONFIG_DEFAULT_SMALL=y
CONFIG_EXAMPLES_NXHELLO=y
CONFIG_EXAMPLES_NXHELLO_BPP=1
CONFIG_EXAMPLES_NXHELLO_LISTENER_STACKSIZE=1536
CONFIG_EXAMPLES_NXHELLO_STACKSIZE=1536
CONFIG_LCD=y
CONFIG_LCD_ST7567=y
CONFIG_MAX_TASKS=16
CONFIG_MQ_MAXMSGSIZE=64
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=1024
CONFIG_NSH_LINELEN=80
CONFIG_NX=y
CONFIG_NXFONT_MONO5X8=y
CONFIG_NXTK_BORDERWIDTH=1
CONFIG_NX_BLOCKING=y
CONFIG_NX_WRITEONLY=y
CONFIG_PREALLOC_TIMERS=4
CONFIG_RAM_SIZE=20480
CONFIG_RAM_START=0x20000000
CONFIG_RAW_BINARY=y
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_HPWORK=y
CONFIG_SCHED_HPWORKPRIORITY=192
CONFIG_SCHED_WAITPID=y
CONFIG_SDCLONE_DISABLE=y
CONFIG_SERIAL_TERMIOS=y
CONFIG_SPI_CMDDATA=y
CONFIG_START_DAY=5
CONFIG_START_MONTH=7
CONFIG_START_YEAR=2011
CONFIG_STM32_DISABLE_IDLE_SLEEP_DURING_DEBUG=y
CONFIG_STM32_JTAG_FULL_ENABLE=y
CONFIG_STM32_SPI1=y
CONFIG_STM32_USART1=y
CONFIG_SYMTAB_ORDEREDBYNAME=y
CONFIG_SYSTEM_NSH=y
CONFIG_TASK_NAME_SIZE=0
CONFIG_USART1_SERIAL_CONSOLE=y
CONFIG_USER_ENTRYPOINT="nsh_main"
@@ -0,0 +1,65 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_DISABLE_OS_API is not set
# CONFIG_NSH_DISABLESCRIPT is not set
# CONFIG_NSH_DISABLE_DD is not set
# CONFIG_NSH_DISABLE_EXEC is not set
# CONFIG_NSH_DISABLE_EXIT is not set
# CONFIG_NSH_DISABLE_GET is not set
# CONFIG_NSH_DISABLE_HEXDUMP is not set
# CONFIG_NSH_DISABLE_MKRD is not set
# CONFIG_NSH_DISABLE_PS is not set
# CONFIG_NSH_DISABLE_PUT is not set
# CONFIG_NSH_DISABLE_WGET is not set
# CONFIG_NSH_DISABLE_XD is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="stm32f103-minimum"
CONFIG_ARCH_BOARD_STM32F103_MINIMUM=y
CONFIG_ARCH_CHIP="stm32"
CONFIG_ARCH_CHIP_STM32=y
CONFIG_ARCH_CHIP_STM32F103C8=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARD_LOOPSPERMSEC=5483
CONFIG_BUILTIN=y
CONFIG_DEFAULT_SMALL=y
CONFIG_EXAMPLES_SLCD=y
CONFIG_I2C=y
CONFIG_I2CTOOL_DEFFREQ=100000
CONFIG_I2CTOOL_MAXBUS=1
CONFIG_I2CTOOL_MINBUS=1
CONFIG_LCD_BACKPACK=y
CONFIG_LCD_LCD1602=y
CONFIG_MAX_TASKS=16
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=1024
CONFIG_NSH_LINELEN=80
CONFIG_PREALLOC_TIMERS=4
CONFIG_RAM_SIZE=20480
CONFIG_RAM_START=0x20000000
CONFIG_RAW_BINARY=y
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_HPWORK=y
CONFIG_SCHED_HPWORKPRIORITY=192
CONFIG_SCHED_WAITPID=y
CONFIG_SDCLONE_DISABLE=y
CONFIG_SERIAL_TERMIOS=y
CONFIG_SLCD=y
CONFIG_START_DAY=5
CONFIG_START_MONTH=7
CONFIG_START_YEAR=2011
CONFIG_STM32_DISABLE_IDLE_SLEEP_DURING_DEBUG=y
CONFIG_STM32_I2C1=y
CONFIG_STM32_JTAG_FULL_ENABLE=y
CONFIG_STM32_USART1=y
CONFIG_SYMTAB_ORDEREDBYNAME=y
CONFIG_SYSTEM_I2CTOOL=y
CONFIG_SYSTEM_NSH=y
CONFIG_TASK_NAME_SIZE=0
CONFIG_USART1_SERIAL_CONSOLE=y
CONFIG_USER_ENTRYPOINT="nsh_main"
@@ -0,0 +1,63 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_DISABLE_OS_API is not set
# CONFIG_NSH_DISABLESCRIPT is not set
# CONFIG_NSH_DISABLE_DD is not set
# CONFIG_NSH_DISABLE_EXEC is not set
# CONFIG_NSH_DISABLE_EXIT is not set
# CONFIG_NSH_DISABLE_GET is not set
# CONFIG_NSH_DISABLE_HEXDUMP is not set
# CONFIG_NSH_DISABLE_MKRD is not set
# CONFIG_NSH_DISABLE_PS is not set
# CONFIG_NSH_DISABLE_PUT is not set
# CONFIG_NSH_DISABLE_WGET is not set
# CONFIG_NSH_DISABLE_XD is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="stm32f103-minimum"
CONFIG_ARCH_BOARD_STM32F103_MINIMUM=y
CONFIG_ARCH_CHIP="stm32"
CONFIG_ARCH_CHIP_STM32=y
CONFIG_ARCH_CHIP_STM32F103C8=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARD_LOOPSPERMSEC=5483
CONFIG_BUILTIN=y
CONFIG_CAN=y
CONFIG_CANUTILS_CANLIB=y
CONFIG_CAN_MCP2515=y
CONFIG_CAN_TXREADY=y
CONFIG_DEFAULT_SMALL=y
CONFIG_EXAMPLES_CAN=y
CONFIG_EXAMPLES_CAN_READ=y
CONFIG_MAX_TASKS=16
CONFIG_MCP2515_PHASESEG1=3
CONFIG_MCP2515_PROPSEG=1
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=1024
CONFIG_NSH_LINELEN=80
CONFIG_PREALLOC_TIMERS=4
CONFIG_RAM_SIZE=20480
CONFIG_RAM_START=0x20000000
CONFIG_RAW_BINARY=y
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_HPWORKPRIORITY=192
CONFIG_SCHED_WAITPID=y
CONFIG_SDCLONE_DISABLE=y
CONFIG_SERIAL_TERMIOS=y
CONFIG_START_DAY=5
CONFIG_START_MONTH=7
CONFIG_START_YEAR=2011
CONFIG_STM32_DISABLE_IDLE_SLEEP_DURING_DEBUG=y
CONFIG_STM32_JTAG_FULL_ENABLE=y
CONFIG_STM32_SPI1=y
CONFIG_STM32_USART1=y
CONFIG_SYMTAB_ORDEREDBYNAME=y
CONFIG_SYSTEM_NSH=y
CONFIG_TASK_NAME_SIZE=0
CONFIG_USART1_SERIAL_CONSOLE=y
CONFIG_USER_ENTRYPOINT="nsh_main"
@@ -0,0 +1,59 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_DISABLE_OS_API is not set
# CONFIG_NSH_DISABLESCRIPT is not set
# CONFIG_NSH_DISABLE_DD is not set
# CONFIG_NSH_DISABLE_EXEC is not set
# CONFIG_NSH_DISABLE_EXIT is not set
# CONFIG_NSH_DISABLE_GET is not set
# CONFIG_NSH_DISABLE_HEXDUMP is not set
# CONFIG_NSH_DISABLE_MKRD is not set
# CONFIG_NSH_DISABLE_PS is not set
# CONFIG_NSH_DISABLE_PUT is not set
# CONFIG_NSH_DISABLE_WGET is not set
# CONFIG_NSH_DISABLE_XD is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="stm32f103-minimum"
CONFIG_ARCH_BOARD_STM32F103_MINIMUM=y
CONFIG_ARCH_CHIP="stm32"
CONFIG_ARCH_CHIP_STM32=y
CONFIG_ARCH_CHIP_STM32F103C8=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARD_LOOPSPERMSEC=5483
CONFIG_BUILTIN=y
CONFIG_DEFAULT_SMALL=y
CONFIG_DRIVERS_WIRELESS=y
CONFIG_EXAMPLES_NRF24L01TERM=y
CONFIG_MAX_TASKS=16
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=1024
CONFIG_NSH_LINELEN=80
CONFIG_PREALLOC_TIMERS=4
CONFIG_RAM_SIZE=20480
CONFIG_RAM_START=0x20000000
CONFIG_RAW_BINARY=y
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_HPWORK=y
CONFIG_SCHED_HPWORKPRIORITY=192
CONFIG_SCHED_WAITPID=y
CONFIG_SDCLONE_DISABLE=y
CONFIG_SERIAL_TERMIOS=y
CONFIG_START_DAY=5
CONFIG_START_MONTH=7
CONFIG_START_YEAR=2011
CONFIG_STM32_DISABLE_IDLE_SLEEP_DURING_DEBUG=y
CONFIG_STM32_JTAG_FULL_ENABLE=y
CONFIG_STM32_SPI1=y
CONFIG_STM32_USART1=y
CONFIG_SYMTAB_ORDEREDBYNAME=y
CONFIG_SYSTEM_NSH=y
CONFIG_TASK_NAME_SIZE=0
CONFIG_USART1_SERIAL_CONSOLE=y
CONFIG_USER_ENTRYPOINT="nsh_main"
CONFIG_WL_NRF24L01=y
@@ -0,0 +1,54 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_DISABLE_OS_API is not set
# CONFIG_NSH_DISABLESCRIPT is not set
# CONFIG_NSH_DISABLE_DD is not set
# CONFIG_NSH_DISABLE_EXEC is not set
# CONFIG_NSH_DISABLE_EXIT is not set
# CONFIG_NSH_DISABLE_GET is not set
# CONFIG_NSH_DISABLE_HEXDUMP is not set
# CONFIG_NSH_DISABLE_PS is not set
# CONFIG_NSH_DISABLE_PUT is not set
# CONFIG_NSH_DISABLE_WGET is not set
# CONFIG_NSH_DISABLE_XD is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="stm32f103-minimum"
CONFIG_ARCH_BOARD_STM32F103_MINIMUM=y
CONFIG_ARCH_CHIP="stm32"
CONFIG_ARCH_CHIP_STM32=y
CONFIG_ARCH_CHIP_STM32F103C8=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARD_LOOPSPERMSEC=5483
CONFIG_BUILTIN=y
CONFIG_DEFAULT_SMALL=y
CONFIG_MAX_TASKS=16
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=1024
CONFIG_NSH_LINELEN=80
CONFIG_PREALLOC_TIMERS=4
CONFIG_RAM_SIZE=20480
CONFIG_RAM_START=0x20000000
CONFIG_RAW_BINARY=y
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_HPWORK=y
CONFIG_SCHED_HPWORKPRIORITY=192
CONFIG_SCHED_WAITPID=y
CONFIG_SDCLONE_DISABLE=y
CONFIG_SERIAL_TERMIOS=y
CONFIG_START_DAY=5
CONFIG_START_MONTH=7
CONFIG_START_YEAR=2011
CONFIG_STM32_DISABLE_IDLE_SLEEP_DURING_DEBUG=y
CONFIG_STM32_JTAG_FULL_ENABLE=y
CONFIG_STM32_USART1=y
CONFIG_SYMTAB_ORDEREDBYNAME=y
CONFIG_SYSTEM_NSH=y
CONFIG_TASK_NAME_SIZE=0
CONFIG_USART1_SERIAL_CONSOLE=y
CONFIG_USER_ENTRYPOINT="nsh_main"
@@ -0,0 +1,61 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_DISABLE_OS_API is not set
# CONFIG_NSH_DISABLESCRIPT is not set
# CONFIG_NSH_DISABLE_DD is not set
# CONFIG_NSH_DISABLE_EXEC is not set
# CONFIG_NSH_DISABLE_EXIT is not set
# CONFIG_NSH_DISABLE_GET is not set
# CONFIG_NSH_DISABLE_HEXDUMP is not set
# CONFIG_NSH_DISABLE_MKRD is not set
# CONFIG_NSH_DISABLE_PS is not set
# CONFIG_NSH_DISABLE_PUT is not set
# CONFIG_NSH_DISABLE_WGET is not set
# CONFIG_NSH_DISABLE_XD is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="stm32f103-minimum"
CONFIG_ARCH_BOARD_STM32F103_MINIMUM=y
CONFIG_ARCH_CHIP="stm32"
CONFIG_ARCH_CHIP_STM32=y
CONFIG_ARCH_CHIP_STM32F103C8=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARD_LOOPSPERMSEC=5483
CONFIG_BUILTIN=y
CONFIG_DEFAULT_SMALL=y
CONFIG_EXAMPLES_PWM=y
CONFIG_MAX_TASKS=16
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=1024
CONFIG_NSH_LINELEN=80
CONFIG_PREALLOC_TIMERS=4
CONFIG_PWM=y
CONFIG_RAM_SIZE=20480
CONFIG_RAM_START=0x20000000
CONFIG_RAW_BINARY=y
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_HPWORK=y
CONFIG_SCHED_HPWORKPRIORITY=192
CONFIG_SCHED_WAITPID=y
CONFIG_SDCLONE_DISABLE=y
CONFIG_SERIAL_TERMIOS=y
CONFIG_START_DAY=5
CONFIG_START_MONTH=7
CONFIG_START_YEAR=2011
CONFIG_STM32_DISABLE_IDLE_SLEEP_DURING_DEBUG=y
CONFIG_STM32_JTAG_FULL_ENABLE=y
CONFIG_STM32_TIM3=y
CONFIG_STM32_TIM3_CH3OUT=y
CONFIG_STM32_TIM3_CHANNEL=3
CONFIG_STM32_TIM3_PWM=y
CONFIG_STM32_USART1=y
CONFIG_SYMTAB_ORDEREDBYNAME=y
CONFIG_SYSTEM_NSH=y
CONFIG_TASK_NAME_SIZE=0
CONFIG_USART1_SERIAL_CONSOLE=y
CONFIG_USER_ENTRYPOINT="nsh_main"
@@ -0,0 +1,59 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_DISABLE_OS_API is not set
# CONFIG_NSH_DISABLESCRIPT is not set
# CONFIG_NSH_DISABLE_DD is not set
# CONFIG_NSH_DISABLE_EXEC is not set
# CONFIG_NSH_DISABLE_EXIT is not set
# CONFIG_NSH_DISABLE_GET is not set
# CONFIG_NSH_DISABLE_HEXDUMP is not set
# CONFIG_NSH_DISABLE_MKRD is not set
# CONFIG_NSH_DISABLE_PS is not set
# CONFIG_NSH_DISABLE_PUT is not set
# CONFIG_NSH_DISABLE_WGET is not set
# CONFIG_NSH_DISABLE_XD is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="stm32f103-minimum"
CONFIG_ARCH_BOARD_STM32F103_MINIMUM=y
CONFIG_ARCH_CHIP="stm32"
CONFIG_ARCH_CHIP_STM32=y
CONFIG_ARCH_CHIP_STM32F103C8=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARD_LOOPSPERMSEC=5483
CONFIG_BUILTIN=y
CONFIG_CL_MFRC522=y
CONFIG_DEFAULT_SMALL=y
CONFIG_DRIVERS_CONTACTLESS=y
CONFIG_EXAMPLES_RFID_READUID=y
CONFIG_MAX_TASKS=16
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=1024
CONFIG_NSH_LINELEN=80
CONFIG_PREALLOC_TIMERS=4
CONFIG_RAM_SIZE=20480
CONFIG_RAM_START=0x20000000
CONFIG_RAW_BINARY=y
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_HPWORK=y
CONFIG_SCHED_HPWORKPRIORITY=192
CONFIG_SCHED_WAITPID=y
CONFIG_SDCLONE_DISABLE=y
CONFIG_SERIAL_TERMIOS=y
CONFIG_START_DAY=5
CONFIG_START_MONTH=7
CONFIG_START_YEAR=2011
CONFIG_STM32_DISABLE_IDLE_SLEEP_DURING_DEBUG=y
CONFIG_STM32_JTAG_FULL_ENABLE=y
CONFIG_STM32_SPI1=y
CONFIG_STM32_USART1=y
CONFIG_SYMTAB_ORDEREDBYNAME=y
CONFIG_SYSTEM_NSH=y
CONFIG_TASK_NAME_SIZE=0
CONFIG_USART1_SERIAL_CONSOLE=y
CONFIG_USER_ENTRYPOINT="nsh_main"
@@ -0,0 +1,73 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_DISABLE_OS_API is not set
# CONFIG_NSH_DISABLESCRIPT is not set
# CONFIG_NSH_DISABLE_DD is not set
# CONFIG_NSH_DISABLE_EXEC is not set
# CONFIG_NSH_DISABLE_EXIT is not set
# CONFIG_NSH_DISABLE_GET is not set
# CONFIG_NSH_DISABLE_HEXDUMP is not set
# CONFIG_NSH_DISABLE_MKRD is not set
# CONFIG_NSH_DISABLE_PS is not set
# CONFIG_NSH_DISABLE_PUT is not set
# CONFIG_NSH_DISABLE_WGET is not set
# CONFIG_NSH_DISABLE_XD is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="stm32f103-minimum"
CONFIG_ARCH_BOARD_STM32F103_MINIMUM=y
CONFIG_ARCH_CHIP="stm32"
CONFIG_ARCH_CHIP_STM32=y
CONFIG_ARCH_CHIP_STM32F103C8=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARD_LOOPSPERMSEC=5483
CONFIG_BUILTIN=y
CONFIG_DEFAULT_SMALL=y
CONFIG_EXAMPLES_RGBLED=y
CONFIG_MAX_TASKS=16
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=1024
CONFIG_NSH_LINELEN=80
CONFIG_PREALLOC_TIMERS=4
CONFIG_PWM=y
CONFIG_RAM_SIZE=20480
CONFIG_RAM_START=0x20000000
CONFIG_RAW_BINARY=y
CONFIG_RGBLED=y
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_HPWORK=y
CONFIG_SCHED_HPWORKPRIORITY=192
CONFIG_SCHED_WAITPID=y
CONFIG_SDCLONE_DISABLE=y
CONFIG_SERIAL_TERMIOS=y
CONFIG_START_DAY=5
CONFIG_START_MONTH=7
CONFIG_START_YEAR=2011
CONFIG_STM32_DISABLE_IDLE_SLEEP_DURING_DEBUG=y
CONFIG_STM32_JTAG_FULL_ENABLE=y
CONFIG_STM32_TIM1=y
CONFIG_STM32_TIM1_CH1OUT=y
CONFIG_STM32_TIM1_PWM=y
CONFIG_STM32_TIM2=y
CONFIG_STM32_TIM2_CH2OUT=y
CONFIG_STM32_TIM2_CHANNEL=2
CONFIG_STM32_TIM2_PWM=y
CONFIG_STM32_TIM3=y
CONFIG_STM32_TIM3_CH3OUT=y
CONFIG_STM32_TIM3_CHANNEL=3
CONFIG_STM32_TIM3_PWM=y
CONFIG_STM32_TIM4=y
CONFIG_STM32_TIM4_CH4OUT=y
CONFIG_STM32_TIM4_CHANNEL=4
CONFIG_STM32_TIM4_PWM=y
CONFIG_STM32_USART1=y
CONFIG_SYMTAB_ORDEREDBYNAME=y
CONFIG_SYSTEM_NSH=y
CONFIG_TASK_NAME_SIZE=0
CONFIG_USART1_SERIAL_CONSOLE=y
CONFIG_USER_ENTRYPOINT="nsh_main"
@@ -0,0 +1,59 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_DEV_CONSOLE is not set
# CONFIG_DISABLE_OS_API is not set
# CONFIG_NSH_DISABLEBG is not set
# CONFIG_NSH_DISABLESCRIPT is not set
# CONFIG_NSH_DISABLE_DD is not set
# CONFIG_NSH_DISABLE_EXEC is not set
# CONFIG_NSH_DISABLE_EXIT is not set
# CONFIG_NSH_DISABLE_GET is not set
# CONFIG_NSH_DISABLE_HEXDUMP is not set
# CONFIG_NSH_DISABLE_MKRD is not set
# CONFIG_NSH_DISABLE_PS is not set
# CONFIG_NSH_DISABLE_PUT is not set
# CONFIG_NSH_DISABLE_WGET is not set
# CONFIG_NSH_DISABLE_XD is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="stm32f103-minimum"
CONFIG_ARCH_BOARD_STM32F103_MINIMUM=y
CONFIG_ARCH_CHIP="stm32"
CONFIG_ARCH_CHIP_STM32=y
CONFIG_ARCH_CHIP_STM32F103C8=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARDCTL_USBDEVCTRL=y
CONFIG_BOARD_LOOPSPERMSEC=5483
CONFIG_BUILTIN=y
CONFIG_CDCACM=y
CONFIG_CDCACM_CONSOLE=y
CONFIG_CDCACM_RXBUFSIZE=256
CONFIG_CDCACM_TXBUFSIZE=256
CONFIG_DEFAULT_SMALL=y
CONFIG_MAX_TASKS=16
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=1024
CONFIG_NSH_LINELEN=80
CONFIG_PREALLOC_TIMERS=4
CONFIG_RAM_SIZE=20480
CONFIG_RAM_START=0x20000000
CONFIG_RAW_BINARY=y
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_WAITPID=y
CONFIG_SDCLONE_DISABLE=y
CONFIG_START_DAY=5
CONFIG_START_MONTH=7
CONFIG_START_YEAR=2011
CONFIG_STM32_JTAG_FULL_ENABLE=y
CONFIG_STM32_USART1=y
CONFIG_STM32_USB=y
CONFIG_SYMTAB_ORDEREDBYNAME=y
CONFIG_SYSTEM_NSH=y
CONFIG_TASK_NAME_SIZE=0
CONFIG_USBDEV_TRACE=y
CONFIG_USBDEV_TRACE_NRECORDS=32
CONFIG_USER_ENTRYPOINT="nsh_main"
@@ -0,0 +1,60 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_ARCH_LEDS is not set
# CONFIG_DISABLE_OS_API is not set
# CONFIG_NSH_DISABLESCRIPT is not set
# CONFIG_NSH_DISABLE_DD is not set
# CONFIG_NSH_DISABLE_EXEC is not set
# CONFIG_NSH_DISABLE_EXIT is not set
# CONFIG_NSH_DISABLE_GET is not set
# CONFIG_NSH_DISABLE_HEXDUMP is not set
# CONFIG_NSH_DISABLE_MKRD is not set
# CONFIG_NSH_DISABLE_PS is not set
# CONFIG_NSH_DISABLE_PUT is not set
# CONFIG_NSH_DISABLE_WGET is not set
# CONFIG_NSH_DISABLE_XD is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="stm32f103-minimum"
CONFIG_ARCH_BOARD_STM32F103_MINIMUM=y
CONFIG_ARCH_CHIP="stm32"
CONFIG_ARCH_CHIP_STM32=y
CONFIG_ARCH_CHIP_STM32F103C8=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARD_LATE_INITIALIZE=y
CONFIG_BOARD_LOOPSPERMSEC=5483
CONFIG_BUILTIN=y
CONFIG_DEFAULT_SMALL=y
CONFIG_EXAMPLES_LEDS=y
CONFIG_MAX_TASKS=16
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=1024
CONFIG_NSH_LINELEN=80
CONFIG_PREALLOC_TIMERS=4
CONFIG_RAM_SIZE=20480
CONFIG_RAM_START=0x20000000
CONFIG_RAW_BINARY=y
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_HPWORK=y
CONFIG_SCHED_HPWORKPRIORITY=192
CONFIG_SCHED_WAITPID=y
CONFIG_SDCLONE_DISABLE=y
CONFIG_SERIAL_TERMIOS=y
CONFIG_START_DAY=5
CONFIG_START_MONTH=7
CONFIG_START_YEAR=2011
CONFIG_STM32_DISABLE_IDLE_SLEEP_DURING_DEBUG=y
CONFIG_STM32_JTAG_SW_ENABLE=y
CONFIG_STM32_USART1=y
CONFIG_SYMTAB_ORDEREDBYNAME=y
CONFIG_SYSTEM_NSH=y
CONFIG_TASK_NAME_SIZE=0
CONFIG_USART1_SERIAL_CONSOLE=y
CONFIG_USERLED=y
CONFIG_USERLED_LOWER=y
CONFIG_USER_ENTRYPOINT="nsh_main"
@@ -0,0 +1,59 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_DISABLE_OS_API is not set
# CONFIG_NSH_DISABLESCRIPT is not set
# CONFIG_NSH_DISABLE_DD is not set
# CONFIG_NSH_DISABLE_EXEC is not set
# CONFIG_NSH_DISABLE_EXIT is not set
# CONFIG_NSH_DISABLE_GET is not set
# CONFIG_NSH_DISABLE_HEXDUMP is not set
# CONFIG_NSH_DISABLE_MKRD is not set
# CONFIG_NSH_DISABLE_PS is not set
# CONFIG_NSH_DISABLE_PUT is not set
# CONFIG_NSH_DISABLE_WGET is not set
# CONFIG_NSH_DISABLE_XD is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="stm32f103-minimum"
CONFIG_ARCH_BOARD_STM32F103_MINIMUM=y
CONFIG_ARCH_CHIP="stm32"
CONFIG_ARCH_CHIP_STM32=y
CONFIG_ARCH_CHIP_STM32F103C8=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARD_LATE_INITIALIZE=y
CONFIG_BOARD_LOOPSPERMSEC=5483
CONFIG_BUILTIN=y
CONFIG_DEFAULT_SMALL=y
CONFIG_MAX_TASKS=16
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=1024
CONFIG_NSH_LINELEN=80
CONFIG_PREALLOC_TIMERS=4
CONFIG_RAM_SIZE=20480
CONFIG_RAM_START=0x20000000
CONFIG_RAW_BINARY=y
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_HPWORK=y
CONFIG_SCHED_HPWORKPRIORITY=192
CONFIG_SCHED_WAITPID=y
CONFIG_SDCLONE_DISABLE=y
CONFIG_SENSORS=y
CONFIG_SENSORS_VEML6070=y
CONFIG_SERIAL_TERMIOS=y
CONFIG_START_DAY=5
CONFIG_START_MONTH=7
CONFIG_START_YEAR=2011
CONFIG_STM32_DISABLE_IDLE_SLEEP_DURING_DEBUG=y
CONFIG_STM32_I2C1=y
CONFIG_STM32_JTAG_SW_ENABLE=y
CONFIG_STM32_USART1=y
CONFIG_SYMTAB_ORDEREDBYNAME=y
CONFIG_SYSTEM_NSH=y
CONFIG_TASK_NAME_SIZE=0
CONFIG_USART1_SERIAL_CONSOLE=y
CONFIG_USER_ENTRYPOINT="nsh_main"
@@ -0,0 +1,227 @@
/****************************************************************************
* boards/arm/stm32/stm32f103-minimum/include/board.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __BOARDS_ARM_STM32_STM32F103_MINIMUM_INCLUDE_BOARD_H
#define __BOARDS_ARM_STM32_STM32F103_MINIMUM_INCLUDE_BOARD_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#ifndef __ASSEMBLY__
# include <stdint.h>
#endif
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Clocking *****************************************************************/
/* On-board crystal frequency is 8MHz (HSE) */
#define STM32_BOARD_XTAL 8000000ul
/* PLL source is HSE/1, PLL multiplier is 9: PLL frequency is
* 8MHz (XTAL) x 9 = 72MHz
*/
#define STM32_CFGR_PLLSRC RCC_CFGR_PLLSRC
#define STM32_CFGR_PLLXTPRE 0
#define STM32_CFGR_PLLMUL RCC_CFGR_PLLMUL_CLKx9
#define STM32_PLL_FREQUENCY (9*STM32_BOARD_XTAL)
/* 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
#define STM32_SYSCLK_FREQUENCY STM32_PLL_FREQUENCY
/* AHB clock (HCLK) is SYSCLK (72MHz) */
#define STM32_RCC_CFGR_HPRE RCC_CFGR_HPRE_SYSCLK
#define STM32_HCLK_FREQUENCY STM32_PLL_FREQUENCY
/* APB2 clock (PCLK2) is HCLK (72MHz) */
#define STM32_RCC_CFGR_PPRE2 RCC_CFGR_PPRE2_HCLK
#define STM32_PCLK2_FREQUENCY STM32_HCLK_FREQUENCY
/* APB2 timers 1 and 8 will receive PCLK2. */
#define STM32_APB2_TIM1_CLKIN (STM32_PCLK2_FREQUENCY)
#define STM32_APB2_TIM8_CLKIN (STM32_PCLK2_FREQUENCY)
/* APB1 clock (PCLK1) is HCLK/2 (36MHz) */
#define STM32_RCC_CFGR_PPRE1 RCC_CFGR_PPRE1_HCLKd2
#define STM32_PCLK1_FREQUENCY (STM32_HCLK_FREQUENCY/2)
/* APB1 timers 2-7 will be twice PCLK1 */
#define STM32_APB1_TIM2_CLKIN (2*STM32_PCLK1_FREQUENCY)
#define STM32_APB1_TIM3_CLKIN (2*STM32_PCLK1_FREQUENCY)
#define STM32_APB1_TIM4_CLKIN (2*STM32_PCLK1_FREQUENCY)
#define STM32_APB1_TIM5_CLKIN (2*STM32_PCLK1_FREQUENCY)
#define STM32_APB1_TIM6_CLKIN (2*STM32_PCLK1_FREQUENCY)
#define STM32_APB1_TIM7_CLKIN (2*STM32_PCLK1_FREQUENCY)
/* USB divider -- Divide PLL clock by 1.5 */
#define STM32_CFGR_USBPRE 0
/* Timer Frequencies, if APBx is set to 1, frequency is same to APBx
* otherwise frequency is 2xAPBx.
* Note: TIM1,8 are on APB2, others on APB1
*/
#define BOARD_TIM1_FREQUENCY STM32_HCLK_FREQUENCY
#define BOARD_TIM2_FREQUENCY STM32_PCLK1_FREQUENCY
#define BOARD_TIM3_FREQUENCY STM32_PCLK1_FREQUENCY
#define BOARD_TIM4_FREQUENCY STM32_PCLK1_FREQUENCY
#define BOARD_TIM5_FREQUENCY STM32_PCLK1_FREQUENCY
#define BOARD_TIM6_FREQUENCY STM32_PCLK1_FREQUENCY
#define BOARD_TIM7_FREQUENCY STM32_PCLK1_FREQUENCY
#define BOARD_TIM8_FREQUENCY STM32_HCLK_FREQUENCY
/* 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!!!
*
* HCLK=72MHz, SDIOCLK=72MHz, 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
/* BUTTON definitions *******************************************************/
#define NUM_BUTTONS 2
#define BUTTON_USER1 0
#define BUTTON_USER2 1
#define BUTTON_USER1_BIT (1 << BUTTON_USER1)
#define BUTTON_USER2_BIT (1 << BUTTON_USER2)
/* LED definitions **********************************************************/
/* Define how many LEDs this board has (needed by userleds) */
#define BOARD_NLEDS 1
/* The board has only one controllable LED */
#define LED_STARTED 0 /* No LEDs */
#define LED_HEAPALLOCATE 1 /* LED1 on */
#define LED_IRQSENABLED 2 /* LED2 on */
#define LED_STACKCREATED 3 /* LED1 on */
#define LED_INIRQ 4 /* LED1 off */
#define LED_SIGNAL 5 /* LED2 on */
#define LED_ASSERTION 6 /* LED1 + LED2 */
#define LED_PANIC 7 /* LED1 / LED2 blinking */
/* PWM
*
* The STM32F103-Minimum has no real on-board PWM devices, but the board can
* be configured to output a pulse train using TIM3 CH3 on PB0.
*
* Note: we don't need redefine GPIO_TIM3_CH3OUT because PB0 is not
* remap pin.
*/
/* RGB LED
*
* R = TIM1 CH1 on PA8 | G = TIM2 CH2 on PA1 | B = TIM4 CH4 on PB9
*
* Note: Pin boards: GPIO_TIM1_CH1OUT ; GPIO_TIM2_CH2OUT ; GPIO_TIM4_CH4OUT
*/
#define RGBLED_RPWMTIMER 1
#define RGBLED_RPWMCHANNEL 1
#define RGBLED_GPWMTIMER 2
#define RGBLED_GPWMCHANNEL 2
#define RGBLED_BPWMTIMER 4
#define RGBLED_BPWMCHANNEL 4
/* Tone Driver **************************************************************/
#define BOARD_TONE_PWM_TIM 2 /* PWM timer for tone generation */
#define BOARD_TONE_ONESHOT_TIM 3 /* Oneshot timer for note timings */
#define BOARD_TONE_ONESHOT_TIM_RES 10 /* Oneshot timer resolution (us) */
/* NRF24L01 Driver **********************************************************/
/* Chip enable: PB.1 */
#define GPIO_NRF24L01_CE (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
GPIO_OUTPUT_CLEAR|GPIO_PORTB|GPIO_PIN1)
/* IRQ line: PA.0 */
#define GPIO_NRF24L01_IRQ (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_PORTA|GPIO_PIN0)
#define BOARD_NRF24L01_GPIO_CE GPIO_NRF24L01_CE
#define BOARD_NRF24L01_GPIO_IRQ GPIO_NRF24L01_IRQ
/* HCSR04 driver */
/* Pins config to use with HC-SR04 sensor */
#define GPIO_HCSR04_INT (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_PORTA|GPIO_PIN0)
#define GPIO_HCSR04_TRIG (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
GPIO_OUTPUT_CLEAR|GPIO_PORTA|GPIO_PIN1)
#define BOARD_HCSR04_GPIO_INT GPIO_HCSR04_INT
#define BOARD_HCSR04_GPIO_TRIG GPIO_HCSR04_TRIG
#define BOARD_HCSR04_FRTIMER 1 /* TIM1 as free running timer */
/* Pin for APDS-9960 sensor */
#define GPIO_APDS9960_INT (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_PORTA|GPIO_PIN0)
#define BOARD_APDS9960_GPIO_INT GPIO_APDS9960_INT
/* ZERO CROSS pin definition */
#define BOARD_ZEROCROSS_GPIO \
(GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_PORTA|GPIO_PIN0)
#endif /* __BOARDS_ARM_STM32_STM32F103_MINIMUM_INCLUDE_BOARD_H */
@@ -0,0 +1,69 @@
############################################################################
# boards/arm/stm32/stm32f103-minimum/scripts/Make.defs
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
############################################################################
include $(TOPDIR)/.config
include $(TOPDIR)/tools/Config.mk
include $(TOPDIR)/arch/arm/src/armv7-m/Toolchain.defs
ifeq ($(CONFIG_STM32_DFU),y)
LDSCRIPT = ld.script.dfu
else
LDSCRIPT = ld.script
endif
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
ARCHSCRIPT = -T "${shell cygpath -w $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)}"
else
ARCHSCRIPT = -T$(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)
endif
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
ARCHOPTIMIZATION = -g
endif
ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
endif
ARCHCFLAGS = -fno-builtin
ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fcheck-new
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
CFLAGS := $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -ffunction-sections -fdata-sections -pipe
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
AFLAGS := $(CFLAGS) -D__ASSEMBLY__
NXFLATLDFLAGS1 = -r -d -warn-common
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
LDNXFLATFLAGS = -e main -s 2048
LDFLAGS += --gc-sections
ifneq ($(CROSSDEV),arm-nuttx-elf-)
LDFLAGS += -nostartfiles -nodefaultlibs
endif
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
LDFLAGS += -g
endif
@@ -0,0 +1,112 @@
/****************************************************************************
* boards/arm/stm32/stm32f103-minimum/scripts/ld.script
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/* The STM32F103C8T6 has 64Kb of FLASH beginning at address 0x0800:0000 and
* 20Kb 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.
*
* NOTE: While the STM32F103C8T6 states that the part has 64Kb of FLASH,
* all parts that I have seen do, in fact, have 128Kb of FLASH. That
* additional 64Kb of FLASH can be utilized by simply change the LENGTH
* of the flash region from 64K to 128K.
*/
MEMORY
{
flash (rx) : ORIGIN = 0x08000000, LENGTH = 64K
sram (rwx) : ORIGIN = 0x20000000, LENGTH = 20K
}
OUTPUT_ARCH(arm)
EXTERN(_vectors)
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
.init_section : ALIGN(4) {
_sinit = ABSOLUTE(.);
*(.init_array .init_array.*)
_einit = ABSOLUTE(.);
} > flash
.ARM.extab : ALIGN(4) {
*(.ARM.extab*)
} > flash
.ARM.exidx : ALIGN(4) {
__exidx_start = ABSOLUTE(.);
*(.ARM.exidx*)
__exidx_end = ABSOLUTE(.);
} > flash
_eronly = ABSOLUTE(.);
/* The STM32F103C8T6 has 20Kb of SRAM beginning at the following address */
.data : ALIGN(4) {
_sdata = ABSOLUTE(.);
*(.data .data.*)
*(.gnu.linkonce.d.*)
CONSTRUCTORS
. = ALIGN(4);
_edata = ABSOLUTE(.);
} > sram AT > flash
.bss : ALIGN(4) {
_sbss = ABSOLUTE(.);
*(.bss .bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
. = ALIGN(4);
_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) }
}
@@ -0,0 +1,103 @@
/****************************************************************************
* boards/arm/stm32/stm32f103-minimum/scripts/ld.script.dfu
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/* The STM32F103C8T6 has 64Kb of FLASH beginning at address 0x0800:0000 and
* 20Kb of SRAM beginning at address 0x2000:0000. Here we assume that the
* STM32duino bootloader is being used. In that case, the correct load .text
* address is 0x0800:2000 (leaving 56Kb).
*/
MEMORY
{
flash (rx) : ORIGIN = 0x08002000, LENGTH = 120K
sram (rwx) : ORIGIN = 0x20000000, LENGTH = 20K
}
OUTPUT_ARCH(arm)
EXTERN(_vectors)
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
.init_section : ALIGN(4) {
_sinit = ABSOLUTE(.);
*(.init_array .init_array.*)
_einit = ABSOLUTE(.);
} > flash
.ARM.extab : ALIGN(4) {
*(.ARM.extab*)
} > flash
.ARM.exidx : ALIGN(4) {
__exidx_start = ABSOLUTE(.);
*(.ARM.exidx*)
__exidx_end = ABSOLUTE(.);
} > flash
_eronly = ABSOLUTE(.);
/* The STM32F103C8T6 has 20Kb of SRAM beginning at the following address */
.data : ALIGN(4) {
_sdata = ABSOLUTE(.);
*(.data .data.*)
*(.gnu.linkonce.d.*)
CONSTRUCTORS
_edata = ABSOLUTE(.);
} > sram AT > flash
.bss : ALIGN(4) {
_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) }
}
@@ -0,0 +1,110 @@
############################################################################
# boards/arm/stm32/stm32f103-minimum/src/Make.defs
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
############################################################################
include $(TOPDIR)/Make.defs
CSRCS = stm32_boot.c stm32_bringup.c stm32_spi.c
ifeq ($(CONFIG_LIB_BOARDCTL),y)
CSRCS += stm32_appinit.c
ifeq ($(CONFIG_BOARDCTL_RESET),y)
CSRCS += stm32_reset.c
endif
endif
ifeq ($(CONFIG_ARCH_BUTTONS),y)
CSRCS += stm32_buttons.c
endif
ifeq ($(CONFIG_ARCH_LEDS),y)
CSRCS += stm32_autoleds.c
else
CSRCS += stm32_userleds.c
endif
ifeq ($(CONFIG_ADC),y)
CSRCS += stm32_adc.c
endif
ifeq ($(CONFIG_DEV_GPIO),y)
CSRCS += stm32_gpio.c
endif
ifeq ($(CONFIG_PWM),y)
CSRCS += stm32_pwm.c
endif
ifeq ($(CONFIG_RGBLED),y)
CSRCS += stm32_rgbled.c
endif
ifeq ($(CONFIG_MMCSD),y)
CSRCS += stm32_mmcsd.c
endif
ifeq ($(CONFIG_MTD_W25),y)
CSRCS += stm32_w25.c
endif
ifeq ($(CONFIG_MTD_AT24XX),y)
ifeq ($(CONFIG_STM32_I2C1),y)
CSRCS += stm32_at24.c
endif
endif
ifeq ($(CONFIG_CAN_MCP2515),y)
CSRCS += stm32_mcp2515.c
endif
ifeq ($(CONFIG_CL_MFRC522),y)
CSRCS += stm32_mfrc522.c
endif
ifeq ($(CONFIG_LCD_MAX7219),y)
CSRCS += stm32_max7219.c
endif
ifeq ($(CONFIG_INPUT_NUNCHUCK),y)
CSRCS += stm32_nunchuck.c
endif
ifeq ($(CONFIG_LCD_SSD1306_I2C),y)
CSRCS += stm32_lcd_ssd1306.c
endif
ifeq ($(CONFIG_LCD_ST7567),y)
CSRCS += stm32_lcd_st7567.c
endif
ifeq ($(CONFIG_LCD_PCD8544),y)
CSRCS += stm32_pcd8544.c
endif
ifeq ($(CONFIG_USBDEV),y)
CSRCS += stm32_usbdev.c
endif
ifeq ($(CONFIG_USBMSC),y)
CSRCS += stm32_usbmsc.c
endif
DEPPATH += --dep-path board
VPATH += :board
CFLAGS += $(shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board)
@@ -0,0 +1,148 @@
/****************************************************************************
* boards/arm/stm32/stm32f103-minimum/src/stm32_adc.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <errno.h>
#include <debug.h>
#include <nuttx/board.h>
#include <nuttx/analog/adc.h>
#include <arch/board/board.h>
#include "chip.h"
#include "stm32_adc.h"
#include "stm32f103_minimum.h"
#ifdef CONFIG_ADC
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Configuration ************************************************************/
/* Up to 2 ADC interfaces are supported */
#if STM32_NADC < 2
# undef CONFIG_STM32_ADC2
#endif
#if STM32_NADC < 1
# undef CONFIG_STM32_ADC1
#endif
#if defined(CONFIG_STM32_ADC1) || defined(CONFIG_STM32_ADC2)
#ifndef CONFIG_STM32_ADC1
# warning "Channel information only available for ADC1"
#endif
/* The number of ADC channels in the conversion list */
#define ADC1_NCHANNELS 1
/****************************************************************************
* Private Data
****************************************************************************/
/* Identifying number of each ADC channel to be used with Variable Resistor
* (Pontentiometer)
*/
#ifdef CONFIG_STM32_ADC1
static const uint8_t g_chanlist[ADC1_NCHANNELS] =
{
0
}; /* ADC12_IN0 */
/* Configurations of pins used byte each ADC channels */
static const uint32_t g_pinlist[ADC1_NCHANNELS] =
{
GPIO_ADC12_IN0
};
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: stm32_adc_setup
*
* Description:
* Initialize ADC and register the ADC driver.
*
****************************************************************************/
int stm32_adc_setup(void)
{
#ifdef CONFIG_STM32_ADC1
static bool initialized = false;
struct adc_dev_s *adc;
int ret;
int i;
/* Check if we have already initialized */
if (!initialized)
{
/* Configure the pins as analog inputs for the selected channels */
for (i = 0; i < ADC1_NCHANNELS; i++)
{
stm32_configgpio(g_pinlist[i]);
}
/* Call stm32_adcinitialize() to get an instance of the ADC interface */
adc = stm32_adcinitialize(1, g_chanlist, ADC1_NCHANNELS);
if (adc == NULL)
{
aerr("ERROR: Failed to get ADC interface\n");
return -ENODEV;
}
/* Register the ADC driver at "/dev/adc0" */
ret = adc_register("/dev/adc0", adc);
if (ret < 0)
{
aerr("ERROR: adc_register failed: %d\n", ret);
return ret;
}
/* Now we are initialized */
initialized = true;
}
return OK;
#else
return -ENOSYS;
#endif
}
#endif /* CONFIG_STM32_ADC1 || CONFIG_STM32_ADC2 || CONFIG_STM32_ADC3 */
#endif /* CONFIG_ADC */
@@ -0,0 +1,72 @@
/****************************************************************************
* boards/arm/stm32/stm32f103-minimum/src/stm32_appinit.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdbool.h>
#include <stdio.h>
#include <syslog.h>
#include <errno.h>
#include <nuttx/board.h>
#include <nuttx/timers/oneshot.h>
#include "stm32.h"
#include "stm32f103_minimum.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: board_app_initialize
*
* Description:
* Perform application specific initialization. This function is never
* called directly from application code, but only indirectly via the
* (non-standard) boardctl() interface using the command BOARDIOC_INIT.
*
* Input Parameters:
* arg - The boardctl() argument is passed to the board_app_initialize()
* implementation without modification. The argument has no
* meaning to NuttX; the meaning of the argument is a contract
* between the board-specific initialization logic and the
* matching application logic. The value could be such things as a
* mode enumeration value, a set of DIP switch switch settings, a
* pointer to configuration data read from a file or serial FLASH,
* or whatever you would like to do with it. Every implementation
* should accept zero/NULL as a default configuration.
*
* Returned Value:
* Zero (OK) is returned on success; a negated errno value is returned on
* any failure to indicate the nature of the failure.
*
****************************************************************************/
int board_app_initialize(uintptr_t arg)
{
/* Perform board initialization here */
return stm32_bringup();
}
@@ -0,0 +1,132 @@
/****************************************************************************
* boards/arm/stm32/stm32f103-minimum/src/stm32_at24.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdbool.h>
#include <stdio.h>
#include <errno.h>
#include <debug.h>
#include <nuttx/i2c/i2c_master.h>
#include <nuttx/mtd/mtd.h>
#include <nuttx/fs/fs.h>
#include <nuttx/fs/nxffs.h>
#include "stm32_i2c.h"
#include "stm32f103_minimum.h"
#ifdef HAVE_AT24
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: stm32_at24_automount
*
* Description:
* Initialize and configure the AT24 serial EEPROM
*
****************************************************************************/
int stm32_at24_automount(int minor)
{
FAR struct i2c_master_s *i2c;
FAR struct mtd_dev_s *mtd;
static bool initialized = false;
int ret;
/* Have we already initialized? */
if (!initialized)
{
/* No.. Get the I2C bus driver */
finfo("Initialize I2C%d\n", AT24_I2C_BUS);
i2c = stm32_i2cbus_initialize(AT24_I2C_BUS);
if (!i2c)
{
ferr("ERROR: Failed to initialize I2C%d\n", AT24_I2C_BUS);
return -ENODEV;
}
/* Now bind the I2C interface to the AT24 I2C EEPROM driver */
finfo("Bind the AT24 EEPROM driver to I2C%d\n", AT24_I2C_BUS);
mtd = at24c_initialize(i2c);
if (!mtd)
{
ferr("ERROR: Failed to bind TWI%d to the AT24 EEPROM driver\n",
AT24_I2C_BUS);
return -ENODEV;
}
#if defined(CONFIG_STM32F103MINIMUM_AT24_FTL)
/* And use the FTL layer to wrap the MTD driver as a block driver */
finfo("Initialize the FTL layer to create /dev/mtdblock%d\n",
AT24_MINOR);
ret = ftl_initialize(AT24_MINOR, mtd);
if (ret < 0)
{
ferr("ERROR: Failed to initialize the FTL layer: %d\n", ret);
return ret;
}
#elif defined(CONFIG_STM32F103MINIMUM_AT24_NXFFS)
/* Initialize to provide NXFFS on the MTD interface */
finfo("Initialize the NXFFS file system\n");
ret = nxffs_initialize(mtd);
if (ret < 0)
{
ferr("ERROR: NXFFS initialization failed: %d\n", ret);
return ret;
}
/* Mount the file system at /mnt/at24 */
finfo("Mount the NXFFS file system at /dev/at24\n");
ret = nx_mount(NULL, "/mnt/at24", "nxffs", 0, NULL);
if (ret < 0)
{
ferr("ERROR: Failed to mount the NXFFS volume: %d\n", ret);
return ret;
}
#endif
/* Now we are initialized */
initialized = true;
}
return OK;
}
#endif /* HAVE_AT24 */
@@ -0,0 +1,112 @@
/****************************************************************************
* boards/arm/stm32/stm32f103-minimum/src/stm32_autoleds.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
#include <stdbool.h>
#include <debug.h>
#include <nuttx/board.h>
#include <arch/board/board.h>
#include "chip.h"
#include "arm_arch.h"
#include "arm_internal.h"
#include "stm32.h"
#include "stm32f103_minimum.h"
/****************************************************************************
* Private Functions
****************************************************************************/
static inline void set_led(bool v)
{
ledinfo("Turn LED %s\n", v? "on":"off");
stm32_gpiowrite(GPIO_LED1, !v);
}
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: board_autoled_initialize
****************************************************************************/
#ifdef CONFIG_ARCH_LEDS
void board_autoled_initialize(void)
{
/* Configure LED GPIO for output */
stm32_configgpio(GPIO_LED1);
}
/****************************************************************************
* Name: board_autoled_on
****************************************************************************/
void board_autoled_on(int led)
{
ledinfo("board_autoled_on(%d)\n", led);
switch (led)
{
case LED_STARTED:
case LED_HEAPALLOCATE:
/* As the board provides only one soft controllable LED, we simply
* turn it on when the board boots.
*/
set_led(true);
break;
case LED_PANIC:
/* For panic state, the LED is blinking */
set_led(true);
break;
}
}
/****************************************************************************
* Name: board_autoled_off
****************************************************************************/
void board_autoled_off(int led)
{
switch (led)
{
case LED_PANIC:
/* For panic state, the LED is blinking */
set_led(false);
break;
}
}
#endif /* CONFIG_ARCH_LEDS */
@@ -0,0 +1,105 @@
/****************************************************************************
* boards/arm/stm32/stm32f103-minimum/src/stm32_boot.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/spi/spi.h>
#include <debug.h>
#include <nuttx/board.h>
#include <arch/board/board.h>
#include "arm_arch.h"
#include "stm32f103_minimum.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: stm32_boardinitialize
*
* Description:
* All STM32 architectures must provide the following entry point. This
* entry point is called early in the initialization -- after all memory
* has been configured and mapped but before any devices have been
* initialized.
*
****************************************************************************/
void stm32_boardinitialize(void)
{
/* Configure on-board LEDs if LED support has been selected. */
#ifdef CONFIG_ARCH_LEDS
board_autoled_initialize();
#endif
/* Configure SPI chip selects if
* 1) SPI is not disabled, and
* 2) the weak function stm32_spidev_initialize() has been brought into
* the link.
*/
#if defined(CONFIG_STM32_SPI1) || defined(CONFIG_STM32_SPI2)
stm32_spidev_initialize();
#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)
stm32_usbinitialize();
#endif
}
/****************************************************************************
* Name: board_late_initialize
*
* Description:
* If CONFIG_BOARD_LATE_INITIALIZE is selected, then an additional
* initialization call will be performed in the boot-up sequence to a
* function called board_late_initialize(). board_late_initialize()
* will be called immediately after up_initialize() is called and just
* before the initial application is started. This additional
* initialization phase may be used, for example, to initialize
* board-specific device drivers.
*
****************************************************************************/
#ifdef CONFIG_BOARD_LATE_INITIALIZE
void board_late_initialize(void)
{
#ifndef CONFIG_LIB_BOARDCTL
/* Perform board initialization here instead of from the
* board_app_initialize().
*/
stm32_bringup();
#endif
}
#endif
@@ -0,0 +1,487 @@
/****************************************************************************
* boards/arm/stm32/stm32f103-minimum/src/stm32_bringup.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdbool.h>
#include <stdio.h>
#include <syslog.h>
#include <debug.h>
#include <errno.h>
#include <nuttx/board.h>
#include <nuttx/fs/fs.h>
#include <nuttx/timers/oneshot.h>
#ifdef CONFIG_USBMONITOR
# include <nuttx/usb/usbmonitor.h>
#endif
#include "stm32.h"
#ifdef CONFIG_STM32_OTGFS
# include "stm32_usbhost.h"
#endif
#ifdef CONFIG_INPUT_BUTTONS
# include <nuttx/input/buttons.h>
#endif
#ifdef CONFIG_USERLED
# include <nuttx/leds/userled.h>
#endif
#ifdef CONFIG_VIDEO_FB
# include <nuttx/video/fb.h>
#endif
#include "stm32f103_minimum.h"
/* Conditional logic in stm32f103_minimum.h will determine if certain
* features are supported. Tests for these features need to be made after
* including stm32f103_minimum.h.
*/
#ifdef HAVE_RTC_DRIVER
# include <nuttx/timers/rtc.h>
# include "stm32_rtc.h"
#endif
/* The following are includes from board-common logic */
#ifdef CONFIG_SENSORS_BMP180
#include "stm32_bmp180.h"
#endif
#ifdef CONFIG_LEDS_APA102
#include "stm32_apa102.h"
#endif
#ifdef CONFIG_WS2812
#include "stm32_ws2812.h"
#endif
#ifdef CONFIG_SENSORS_MAX6675
#include "stm32_max6675.h"
#endif
#ifdef CONFIG_SENSORS_VEML6070
#include "stm32_veml6070.h"
#endif
#ifdef CONFIG_INPUT_NUNCHUCK
#include "stm32_nunchuck.h"
#endif
#ifdef CONFIG_AUDIO_TONE
#include "stm32_tone.h"
#endif
#ifdef CONFIG_SENSORS_LM75
#include "stm32_lm75.h"
#endif
#ifdef CONFIG_WL_NRF24L01
#include "stm32_nrf24l01.h"
#endif
#ifdef CONFIG_SENSORS_HCSR04
#include "stm32_hcsr04.h"
#endif
#ifdef CONFIG_SENSORS_APDS9960
#include "stm32_apds9960.h"
#endif
#ifdef CONFIG_SENSORS_ZEROCROSS
#include "stm32_zerocross.h"
#endif
#ifdef CONFIG_SENSORS_QENCODER
#include "board_qencoder.h"
#endif
#ifdef CONFIG_LCD_BACKPACK
#include "stm32_lcd_backpack.h"
#endif
#ifdef CONFIG_USBADB
#include <nuttx/usb/adb.h>
#endif
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Checking needed by W25 Flash */
#define HAVE_W25 1
/* Can't support the W25 device if it SPI1 or W25 support is not enabled */
#if !defined(CONFIG_STM32_SPI1) || !defined(CONFIG_MTD_W25)
# undef HAVE_W25
#endif
/* Can't support W25 features if mountpoints are disabled */
#ifdef CONFIG_DISABLE_MOUNTPOINT
# undef HAVE_W25
#endif
/* Default W25 minor number */
#if defined(HAVE_W25) && !defined(CONFIG_NSH_W25MINOR)
# define CONFIG_NSH_W25MINOR 0
#endif
/* Checking needed by MMC/SDCard */
#ifdef CONFIG_NSH_MMCSDMINOR
# define MMCSD_MINOR CONFIG_NSH_MMCSDMINOR
#else
# define MMCSD_MINOR 0
#endif
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: stm32_bringup
*
* Description:
* Perform architecture-specific initialization
*
* CONFIG_BOARD_LATE_INITIALIZE=y :
* Called from board_late_initialize().
*
* CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_LIB_BOARDCTL=y :
* Called from the NSH library
*
****************************************************************************/
int stm32_bringup(void)
{
#ifdef CONFIG_ONESHOT
struct oneshot_lowerhalf_s *os = NULL;
#endif
int ret = OK;
#ifdef CONFIG_DEV_GPIO
ret = stm32_gpio_initialize();
if (ret < 0)
{
syslog(LOG_ERR, "Failed to initialize GPIO Driver: %d\n", ret);
return ret;
}
#endif
#ifdef CONFIG_VIDEO_FB
/* Initialize and register the framebuffer driver */
ret = fb_register(0, 0);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: fb_register() failed: %d\n", ret);
}
#endif
#ifdef CONFIG_LCD_BACKPACK
/* slcd:0, i2c:1, rows=2, cols=16 */
ret = board_lcd_backpack_init(0, 1, 2, 16);
if (ret < 0)
{
syslog(LOG_ERR, "Failed to initialize PCF8574 LCD, error %d\n", ret);
return ret;
}
#endif
#ifdef CONFIG_SENSORS_ZEROCROSS
/* Configure the zero-crossing driver */
ret = board_zerocross_initialize(0);
if (ret < 0)
{
syslog(LOG_ERR, "Failed to initialize Zero-Cross, error %d\n", ret);
return ret;
}
#endif
#ifdef CONFIG_MMCSD
ret = stm32_mmcsd_initialize(MMCSD_MINOR);
if (ret < 0)
{
syslog(LOG_ERR, "Failed to initialize SD slot %d: %d\n", ret);
return ret;
}
#endif
#ifdef CONFIG_SENSORS_BMP180
/* Initialize the BMP180 pressure sensor. */
ret = board_bmp180_initialize(0, 1);
if (ret < 0)
{
syslog(LOG_ERR, "Failed to initialize BMP180, error %d\n", ret);
return ret;
}
#endif
#ifdef HAVE_W25
/* Initialize and register the W25 FLASH file system. */
ret = stm32_w25initialize(CONFIG_NSH_W25MINOR);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to initialize W25 minor %d: %d\n",
CONFIG_NSH_W25MINOR, ret);
return ret;
}
#endif
#ifdef CONFIG_FS_PROCFS
/* Mount the procfs file system */
ret = nx_mount(NULL, STM32_PROCFS_MOUNTPOINT, "procfs", 0, NULL);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to mount procfs at %s: %d\n",
STM32_PROCFS_MOUNTPOINT, ret);
}
#endif
#ifdef HAVE_AT24
/* Initialize the AT24 driver */
ret = stm32_at24_automount(AT24_MINOR);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: stm32_at24_automount() failed: %d\n", ret);
return ret;
}
#endif /* HAVE_AT24 */
#ifdef CONFIG_PWM
/* Initialize PWM and register the PWM device. */
ret = stm32_pwm_setup();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: stm32_pwm_setup() failed: %d\n", ret);
}
#endif
#ifdef CONFIG_AUDIO_TONE
/* Configure and initialize the tone generator. */
ret = board_tone_initialize(0);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: board_tone_initialize() failed: %d\n", ret);
}
#endif
#ifdef CONFIG_LEDS_APA102
/* Configure and initialize the APA102 LED Strip. */
ret = board_apa102_initialize(0, 1);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: board_apa102_initialize() failed: %d\n", ret);
}
#endif
#ifdef CONFIG_WS2812
/* Configure and initialize the WS2812 LEDs. */
ret = board_ws2812_initialize(0, WS2812_SPI, WS2812_NLEDS);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: board_ws2812_initialize() failed: %d\n", ret);
}
#endif
#ifdef CONFIG_LM75_I2C
/* Configure and initialize the LM75 sensor */
ret = board_lm75_initialize(0, 1);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: board_lm75_initialize() failed: %d\n", ret);
}
#endif
#ifdef CONFIG_RGBLED
/* Configure and initialize the RGB LED. */
ret = stm32_rgbled_setup();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: stm32_rgbled_setup() failed: %d\n", ret);
}
#endif
#ifdef CONFIG_SENSORS_HCSR04
/* Configure and initialize the HC-SR04 distance sensor */
ret = board_hcsr04_initialize(0);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: board_hcsr04_initialize() failed: %d\n", ret);
}
#endif
#ifdef CONFIG_SENSORS_MAX6675
ret = board_max6675_initialize(0, 1);
if (ret < 0)
{
serr("ERROR: board_max6675_initialize() failed: %d\n", ret);
}
#endif
#ifdef CONFIG_CAN_MCP2515
/* Configure and initialize the MCP2515 CAN device */
ret = stm32_mcp2515initialize("/dev/can0");
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: stm32_mcp2515initialize() failed: %d\n", ret);
}
#endif
#ifdef CONFIG_CL_MFRC522
ret = stm32_mfrc522initialize("/dev/rfid0");
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: stm32_mfrc522initialize() failed: %d\n", ret);
}
#endif
#ifdef CONFIG_ONESHOT
os = oneshot_initialize(1, 10);
if (os)
{
ret = oneshot_register("/dev/oneshot", os);
}
#endif
#ifdef CONFIG_INPUT_BUTTONS
/* Register the BUTTON driver */
ret = btn_lower_initialize("/dev/buttons");
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: btn_lower_initialize() failed: %d\n", ret);
}
#endif
#ifdef CONFIG_INPUT_NUNCHUCK
/* Register the Nunchuck driver */
ret = board_nunchuck_initialize(0, 1);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: board_nunchuck_initialize() failed: %d\n",
ret);
}
#endif
#ifdef CONFIG_SENSORS_QENCODER
/* Initialize and register the qencoder driver */
ret = board_qencoder_initialize(0,
CONFIG_STM32F103MINIMUM_QETIMER);
if (ret != OK)
{
syslog(LOG_ERR,
"ERROR: Failed to register the qencoder: %d\n",
ret);
}
#endif
#ifdef CONFIG_USERLED
/* Register the LED driver */
ret = userled_lower_initialize("/dev/userleds");
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", ret);
}
#endif
#ifdef CONFIG_SENSORS_APDS9960
/* Register the APDS-9960 gesture sensor */
ret = board_apds9960_initialize(0, 1);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: board_apds9960_initialize() failed: %d\n",
ret);
}
#endif
#ifdef CONFIG_SENSORS_VEML6070
/* Register the UV-A light sensor */
ret = board_veml6070_initialize(0, 1);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: board_veml6070_initialize() failed: %d\n",
ret);
}
#endif
#ifdef CONFIG_ADC
/* Initialize ADC and register the ADC driver. */
ret = stm32_adc_setup();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: stm32_adc_setup() failed: %d\n", ret);
}
#endif
#if defined(CONFIG_WL_NRF24L01)
/* Initialize the NRF24L01 wireless module */
ret = board_nrf24l01_initialize(1);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: board_nrf24l01_initialize() failed: %d\n",
ret);
}
#endif
#ifdef CONFIG_USBADB
usbdev_adb_initialize();
#endif
return ret;
}
@@ -0,0 +1,158 @@
/****************************************************************************
* boards/arm/stm32/stm32f103-minimum/src/stm32_buttons.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
#include <errno.h>
#include <nuttx/arch.h>
#include <nuttx/board.h>
#include <arch/board/board.h>
#include "stm32_gpio.h"
#include "stm32f103_minimum.h"
#if defined(CONFIG_ARCH_BUTTONS)
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#if defined(CONFIG_INPUT_BUTTONS) && !defined(CONFIG_ARCH_IRQBUTTONS)
# error "The NuttX Buttons Driver depends on IRQ support to work!\n"
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
/* Pin configuration for each STM32F3Discovery button. This array is indexed
* by the BUTTON_* definitions in board.h
*/
static const uint32_t g_buttons[NUM_BUTTONS] =
{
GPIO_BTN_USER1, GPIO_BTN_USER2
};
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: board_button_initialize
*
* Description:
* board_button_initialize() must be called to initialize button resources.
* After that, board_buttons() may be called to collect the current state
* of all buttons or board_button_irq() may be called to register button
* interrupt handlers.
*
****************************************************************************/
uint32_t board_button_initialize(void)
{
int i;
/* Configure the GPIO pins as inputs. NOTE that EXTI interrupts are
* configured for all pins.
*/
for (i = 0; i < NUM_BUTTONS; i++)
{
stm32_configgpio(g_buttons[i]);
}
return NUM_BUTTONS;
}
/****************************************************************************
* Name: board_buttons
****************************************************************************/
uint32_t board_buttons(void)
{
uint32_t ret = 0;
int i;
/* Check that state of each key */
for (i = 0; i < NUM_BUTTONS; i++)
{
/* A LOW value means that the key is pressed. */
bool released = stm32_gpioread(g_buttons[i]);
/* Accumulate the set of depressed (not released) keys */
if (!released)
{
ret |= (1 << i);
}
}
return ret;
}
/****************************************************************************
* Button support.
*
* Description:
* board_button_initialize() must be called to initialize button resources.
* After that, board_buttons() may be called to collect the current state
* of all buttons or board_button_irq() may be called to register button
* interrupt handlers.
*
* After board_button_initialize() has been called, board_buttons() may be
* called to collect the state of all buttons. board_buttons() returns
* an 32-bit bit set with each bit associated with a button. See the
* BUTTON_*_BIT definitions in board.h for the meaning of each bit.
*
* board_button_irq() may be called to register an interrupt handler that
* will be called when a button is depressed or released. The ID value is
* a button enumeration value that uniquely identifies a button resource.
* See the BUTTON_* definitions in board.h for the meaning of enumeration
* value.
*
****************************************************************************/
#ifdef CONFIG_ARCH_IRQBUTTONS
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
{
int ret = -EINVAL;
/* The following should be atomic */
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
{
ret = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler,
arg);
}
return ret;
}
#endif
#endif /* CONFIG_ARCH_BUTTONS */
@@ -0,0 +1,321 @@
/****************************************************************************
* boards/arm/stm32/stm32f103-minimum/src/stm32_gpio.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdbool.h>
#include <assert.h>
#include <debug.h>
#include <nuttx/clock.h>
#include <nuttx/wdog.h>
#include <nuttx/ioexpander/gpio.h>
#include <arch/board/board.h>
#include "chip.h"
#include "stm32.h"
#include "stm32f103_minimum.h"
#if defined(CONFIG_DEV_GPIO) && !defined(CONFIG_GPIO_LOWER_HALF)
/****************************************************************************
* Private Types
****************************************************************************/
struct stm32gpio_dev_s
{
struct gpio_dev_s gpio;
uint8_t id;
};
struct stm32gpint_dev_s
{
struct stm32gpio_dev_s stm32gpio;
pin_interrupt_t callback;
};
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
static int gpin_read(FAR struct gpio_dev_s *dev, FAR bool *value);
static int gpout_read(FAR struct gpio_dev_s *dev, FAR bool *value);
static int gpout_write(FAR struct gpio_dev_s *dev, bool value);
static int gpint_read(FAR struct gpio_dev_s *dev, FAR bool *value);
static int gpint_attach(FAR struct gpio_dev_s *dev,
pin_interrupt_t callback);
static int gpint_enable(FAR struct gpio_dev_s *dev, bool enable);
/****************************************************************************
* Private Data
****************************************************************************/
static const struct gpio_operations_s gpin_ops =
{
.go_read = gpin_read,
.go_write = NULL,
.go_attach = NULL,
.go_enable = NULL,
};
static const struct gpio_operations_s gpout_ops =
{
.go_read = gpout_read,
.go_write = gpout_write,
.go_attach = NULL,
.go_enable = NULL,
};
static const struct gpio_operations_s gpint_ops =
{
.go_read = gpint_read,
.go_write = NULL,
.go_attach = gpint_attach,
.go_enable = gpint_enable,
};
#if BOARD_NGPIOIN > 0
/* This array maps the GPIO pins used as INPUT */
static const uint32_t g_gpioinputs[BOARD_NGPIOIN] =
{
GPIO_IN1,
};
static struct stm32gpio_dev_s g_gpin[BOARD_NGPIOIN];
#endif
#if BOARD_NGPIOOUT
/* This array maps the GPIO pins used as OUTPUT */
static const uint32_t g_gpiooutputs[BOARD_NGPIOOUT] =
{
GPIO_OUT1,
};
static struct stm32gpio_dev_s g_gpout[BOARD_NGPIOOUT];
#endif
#if BOARD_NGPIOINT > 0
/* This array maps the GPIO pins used as INTERRUPT INPUTS */
static const uint32_t g_gpiointinputs[BOARD_NGPIOINT] =
{
GPIO_INT1,
};
static struct stm32gpint_dev_s g_gpint[BOARD_NGPIOINT];
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
static int stm32gpio_interrupt(int irq, void *context, void *arg)
{
FAR struct stm32gpint_dev_s *stm32gpint =
(FAR struct stm32gpint_dev_s *)arg;
DEBUGASSERT(stm32gpint != NULL && stm32gpint->callback != NULL);
gpioinfo("Interrupt! callback=%p\n", stm32gpint->callback);
stm32gpint->callback(&stm32gpint->stm32gpio.gpio,
stm32gpint->stm32gpio.id);
return OK;
}
static int gpin_read(FAR struct gpio_dev_s *dev, FAR bool *value)
{
FAR struct stm32gpio_dev_s *stm32gpio =
(FAR struct stm32gpio_dev_s *)dev;
DEBUGASSERT(stm32gpio != NULL && value != NULL);
DEBUGASSERT(stm32gpio->id < BOARD_NGPIOIN);
gpioinfo("Reading...\n");
*value = stm32_gpioread(g_gpioinputs[stm32gpio->id]);
return OK;
}
static int gpout_read(FAR struct gpio_dev_s *dev, FAR bool *value)
{
FAR struct stm32gpio_dev_s *stm32gpio =
(FAR struct stm32gpio_dev_s *)dev;
DEBUGASSERT(stm32gpio != NULL && value != NULL);
DEBUGASSERT(stm32gpio->id < BOARD_NGPIOOUT);
gpioinfo("Reading...\n");
*value = stm32_gpioread(g_gpiooutputs[stm32gpio->id]);
return OK;
}
static int gpout_write(FAR struct gpio_dev_s *dev, bool value)
{
FAR struct stm32gpio_dev_s *stm32gpio =
(FAR struct stm32gpio_dev_s *)dev;
DEBUGASSERT(stm32gpio != NULL);
DEBUGASSERT(stm32gpio->id < BOARD_NGPIOOUT);
gpioinfo("Writing %d\n", (int)value);
stm32_gpiowrite(g_gpiooutputs[stm32gpio->id], value);
return OK;
}
static int gpint_read(FAR struct gpio_dev_s *dev, FAR bool *value)
{
FAR struct stm32gpint_dev_s *stm32gpint =
(FAR struct stm32gpint_dev_s *)dev;
DEBUGASSERT(stm32gpint != NULL && value != NULL);
DEBUGASSERT(stm32gpint->stm32gpio.id < BOARD_NGPIOINT);
gpioinfo("Reading int pin...\n");
*value = stm32_gpioread(g_gpiointinputs[stm32gpint->stm32gpio.id]);
return OK;
}
static int gpint_attach(FAR struct gpio_dev_s *dev,
pin_interrupt_t callback)
{
FAR struct stm32gpint_dev_s *stm32gpint =
(FAR struct stm32gpint_dev_s *)dev;
gpioinfo("Attaching the callback\n");
/* Make sure the interrupt is disabled */
stm32_gpiosetevent(g_gpiointinputs[stm32gpint->stm32gpio.id], false,
false, false, NULL, NULL);
gpioinfo("Attach %p\n", callback);
stm32gpint->callback = callback;
return OK;
}
static int gpint_enable(FAR struct gpio_dev_s *dev, bool enable)
{
FAR struct stm32gpint_dev_s *stm32gpint =
(FAR struct stm32gpint_dev_s *)dev;
if (enable)
{
if (stm32gpint->callback != NULL)
{
gpioinfo("Enabling the interrupt\n");
/* Configure the interrupt for rising edge */
stm32_gpiosetevent(g_gpiointinputs[stm32gpint->stm32gpio.id],
true, false, false, stm32gpio_interrupt,
&g_gpint[stm32gpint->stm32gpio.id]);
}
}
else
{
gpioinfo("Disable the interrupt\n");
stm32_gpiosetevent(g_gpiointinputs[stm32gpint->stm32gpio.id],
false, false, false, NULL, NULL);
}
return OK;
}
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: stm32_gpio_initialize
*
* Description:
* Initialize GPIO drivers for use with /apps/examples/gpio
*
****************************************************************************/
int stm32_gpio_initialize(void)
{
int i;
int pincount = 0;
#if BOARD_NGPIOIN > 0
for (i = 0; i < BOARD_NGPIOIN; i++)
{
/* Setup and register the GPIO pin */
g_gpin[i].gpio.gp_pintype = GPIO_INPUT_PIN;
g_gpin[i].gpio.gp_ops = &gpin_ops;
g_gpin[i].id = i;
gpio_pin_register(&g_gpin[i].gpio, pincount);
/* Configure the pin that will be used as input */
stm32_configgpio(g_gpioinputs[i]);
pincount++;
}
#endif
#if BOARD_NGPIOOUT > 0
for (i = 0; i < BOARD_NGPIOOUT; i++)
{
/* Setup and register the GPIO pin */
g_gpout[i].gpio.gp_pintype = GPIO_OUTPUT_PIN;
g_gpout[i].gpio.gp_ops = &gpout_ops;
g_gpout[i].id = i;
gpio_pin_register(&g_gpout[i].gpio, pincount);
/* Configure the pin that will be used as output */
stm32_gpiowrite(g_gpiooutputs[i], 0);
stm32_configgpio(g_gpiooutputs[i]);
pincount++;
}
#endif
#if BOARD_NGPIOINT > 0
for (i = 0; i < BOARD_NGPIOINT; i++)
{
/* Setup and register the GPIO pin */
g_gpint[i].stm32gpio.gpio.gp_pintype = GPIO_INTERRUPT_PIN;
g_gpint[i].stm32gpio.gpio.gp_ops = &gpint_ops;
g_gpint[i].stm32gpio.id = i;
gpio_pin_register(&g_gpint[i].stm32gpio.gpio, pincount);
/* Configure the pin that will be used as interrupt input */
stm32_configgpio(g_gpiointinputs[i]);
pincount++;
}
#endif
return 0;
}
#endif /* CONFIG_DEV_GPIO && !CONFIG_GPIO_LOWER_HALF */
@@ -0,0 +1,86 @@
/****************************************************************************
* boards/arm/stm32/stm32f103-minimum/src/stm32_lcd_ssd1306.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <debug.h>
#include <nuttx/board.h>
#include <nuttx/lcd/lcd.h>
#include <nuttx/lcd/ssd1306.h>
#include "stm32.h"
#include "stm32f103_minimum.h"
#include "stm32_ssd1306.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#define OLED_I2C_PORT 1 /* OLED display connected to I2C1 */
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: board_lcd_initialize
****************************************************************************/
int board_lcd_initialize(void)
{
int ret;
ret = board_ssd1306_initialize(OLED_I2C_PORT);
if (ret < 0)
{
lcderr("ERROR: Failed to initialize SSD1306\n");
return ret;
}
return OK;
}
/****************************************************************************
* Name: board_lcd_getdev
****************************************************************************/
FAR struct lcd_dev_s *board_lcd_getdev(int devno)
{
return board_ssd1306_getdev();
}
/****************************************************************************
* Name: board_lcd_uninitialize
****************************************************************************/
void board_lcd_uninitialize(void)
{
/* TO-FIX */
}
@@ -0,0 +1,153 @@
/****************************************************************************
* boards/arm/stm32/stm32f103-minimum/src/stm32_lcd_st7567.c
*
* Copyright (C) 2016 Uniquix Tecnologia. All rights reserved.
* Author: Alan Carvalho de Assis <acassis@gmail.com>
*
* I used the JLX12864G-086 LCD module based on ST7567 controller.
*
* Based on boards/zkit-arm-1769/src/lpc17_40_lcd.c
*
* Copyright (C) 2013 Zilogic Systems. All rights reserved.
* Author: Manikandan <code@zilogic.com>
*
* 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 <stdbool.h>
#include <debug.h>
#include <errno.h>
#include <nuttx/arch.h>
#include <nuttx/board.h>
#include <nuttx/spi/spi.h>
#include <nuttx/lcd/lcd.h>
#include <nuttx/lcd/st7567.h>
#include "arm_arch.h"
#include "arm_internal.h"
#include "stm32_gpio.h"
#include "stm32_spi.h"
#include "stm32f103_minimum.h"
#ifdef CONFIG_NX_LCDDRIVER
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#define LCD_SPI_PORTNO 1 /* On SPI1 */
#ifndef CONFIG_LCD_CONTRAST
# define CONFIG_LCD_CONTRAST 0x1f
#endif
/****************************************************************************
* Private Data
****************************************************************************/
FAR struct spi_dev_s *g_spidev;
FAR struct lcd_dev_s *g_lcddev;
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: board_lcd_initialize
****************************************************************************/
int board_lcd_initialize(void)
{
stm32_configgpio(STM32_LCD_RST);
stm32_configgpio(STM32_LCD_RS);
stm32_gpiowrite(STM32_LCD_RST, 1);
stm32_gpiowrite(STM32_LCD_RS, 1);
g_spidev = stm32_spibus_initialize(LCD_SPI_PORTNO);
if (!g_spidev)
{
lcderr("ERROR: Failed to initialize SPI port %d\n", LCD_SPI_PORTNO);
return -ENODEV;
}
stm32_gpiowrite(STM32_LCD_RST, 0);
up_mdelay(1);
stm32_gpiowrite(STM32_LCD_RST, 1);
return OK;
}
/****************************************************************************
* Name: board_lcd_getdev
****************************************************************************/
FAR struct lcd_dev_s *board_lcd_getdev(int lcddev)
{
g_lcddev = st7567_initialize(g_spidev, lcddev);
if (!g_lcddev)
{
lcderr("ERROR: Failed to bind SPI port 1 to LCD %d\n", lcddev);
}
else
{
lcdinfo("SPI port 1 bound to LCD %d\n", lcddev);
/* And turn the LCD on (CONFIG_LCD_MAXPOWER should be 1) */
g_lcddev->setpower(g_lcddev, CONFIG_LCD_MAXPOWER);
/* Set contrast to right value, otherwise background too dark */
g_lcddev->setcontrast(g_lcddev, CONFIG_LCD_CONTRAST);
return g_lcddev;
}
return NULL;
}
/****************************************************************************
* Name: board_lcd_uninitialize
****************************************************************************/
void board_lcd_uninitialize(void)
{
/* TO-FIX */
}
#endif /* CONFIG_NX_LCDDRIVER */
@@ -0,0 +1,112 @@
/****************************************************************************
* boards/arm/stm32/stm32f103-minimum/src/stm32_max7219.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdio.h>
#include <stdbool.h>
#include <debug.h>
#include <errno.h>
#include <nuttx/arch.h>
#include <nuttx/board.h>
#include <nuttx/spi/spi.h>
#include <nuttx/lcd/lcd.h>
#include <nuttx/lcd/max7219.h>
#include "stm32_gpio.h"
#include "stm32_spi.h"
#include "stm32f103_minimum.h"
#ifdef CONFIG_NX_LCDDRIVER
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#define LCD_SPI_PORTNO 1 /* On SPI1 */
#ifndef CONFIG_LCD_CONTRAST
# define CONFIG_LCD_CONTRAST 60
#endif
/****************************************************************************
* Private Data
****************************************************************************/
FAR struct spi_dev_s *g_spidev;
FAR struct lcd_dev_s *g_lcddev;
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: board_lcd_initialize
****************************************************************************/
int board_lcd_initialize(void)
{
g_spidev = stm32_spibus_initialize(LCD_SPI_PORTNO);
if (!g_spidev)
{
lcderr("ERROR: Failed to initialize SPI port %d\n", LCD_SPI_PORTNO);
return -ENODEV;
}
return OK;
}
/****************************************************************************
* Name: board_lcd_getdev
****************************************************************************/
FAR struct lcd_dev_s *board_lcd_getdev(int lcddev)
{
g_lcddev = max7219_initialize(g_spidev, lcddev);
if (!g_lcddev)
{
lcderr("ERROR: Failed to bind SPI port 1 to LCD %d\n", lcddev);
}
else
{
lcdinfo("SPI port 1 bound to LCD %d\n", lcddev);
return g_lcddev;
}
return NULL;
}
/****************************************************************************
* Name: board_lcd_uninitialize
****************************************************************************/
void board_lcd_uninitialize(void)
{
/* TO-FIX */
}
#endif /* CONFIG_NX_LCDDRIVER */
@@ -0,0 +1,238 @@
/****************************************************************************
* boards/arm/stm32/stm32f103-minimum/src/stm32_mcp2515.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <errno.h>
#include <debug.h>
#include <nuttx/spi/spi.h>
#include <nuttx/can/mcp2515.h>
#include "stm32.h"
#include "stm32_spi.h"
#include "stm32f103_minimum.h"
#if defined(CONFIG_SPI) && defined(CONFIG_STM32_SPI1) && \
defined(CONFIG_CAN_MCP2515)
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#define MCP2515_SPI_PORTNO 1 /* On SPI1 */
/****************************************************************************
* Private Types
****************************************************************************/
struct stm32_mcp2515config_s
{
/* Configuration structure as seen by the MCP2515 driver */
struct mcp2515_config_s config;
/* Additional private definitions only known to this driver */
FAR struct mcp2515_can_s *handle; /* The MCP2515 driver handle */
mcp2515_handler_t handler; /* The MCP2515 interrupt handler */
FAR void *arg; /* Argument to pass to the interrupt handler */
};
/****************************************************************************
* Static Function Prototypes
****************************************************************************/
/* IRQ/GPIO access callbacks. These operations all hidden behind callbacks
* to isolate the MCP2515 driver from differences in GPIO interrupt handling
* by varying boards and MCUs.
*
* attach - Attach the MCP2515 interrupt handler to the GPIO interrupt
*/
static int mcp2515_attach(FAR struct mcp2515_config_s *state,
mcp2515_handler_t handler, FAR void *arg);
/****************************************************************************
* Private Data
****************************************************************************/
/* A reference to a structure of this type must be passed to the MCP2515
* driver. This structure provides information about the configuration
* of the MCP2515 and provides some board-specific hooks.
*
* Memory for this structure is provided by the caller. It is not copied
* by the driver and is presumed to persist while the driver is active. The
* memory must be writable because, under certain circumstances, the driver
* may modify frequency or X plate resistance values.
*/
static struct stm32_mcp2515config_s g_mcp2515config =
{
.config =
{
.spi = NULL,
.baud = 0, /* REVISIT. Probably broken by commit eb7373cedfa */
.btp = 0, /* REVISIT. Probably broken by commit eb7373cedfa */
.devid = 0,
.mode = 0, /* REVISIT. Probably broken by commit eb7373cedfa */
.nfilters = 6,
#ifdef MCP2515_LOOPBACK
.loopback = false;
#endif
.attach = mcp2515_attach,
},
};
/****************************************************************************
* Private Functions
****************************************************************************/
/* This is the MCP2515 Interrupt handler */
int mcp2515_interrupt(int irq, FAR void *context, FAR void *arg)
{
FAR struct stm32_mcp2515config_s *priv =
(FAR struct stm32_mcp2515config_s *)arg;
DEBUGASSERT(priv != NULL);
/* Verify that we have a handler attached */
if (priv->handler)
{
/* Yes.. forward with interrupt along with its argument */
priv->handler(&priv->config, priv->arg);
}
return OK;
}
static int mcp2515_attach(FAR struct mcp2515_config_s *state,
mcp2515_handler_t handler, FAR void *arg)
{
FAR struct stm32_mcp2515config_s *priv =
(FAR struct stm32_mcp2515config_s *)state;
irqstate_t flags;
caninfo("Saving handler %p\n", handler);
flags = enter_critical_section();
priv->handler = handler;
priv->arg = arg;
/* Configure the interrupt for falling edge */
stm32_gpiosetevent(GPIO_MCP2515_IRQ, false, true, false,
mcp2515_interrupt, priv);
leave_critical_section(flags);
return OK;
}
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: stm32_mcp2515initialize
*
* Description:
* Initialize and register the MCP2515 RFID driver.
*
* Input Parameters:
* devpath - The full path to the driver to register. E.g., "/dev/rfid0"
*
* Returned Value:
* Zero (OK) on success; a negated errno value on failure.
*
****************************************************************************/
int stm32_mcp2515initialize(FAR const char *devpath)
{
FAR struct spi_dev_s *spi;
FAR struct can_dev_s *can;
FAR struct mcp2515_can_s *mcp2515;
int ret;
/* Check if we are already initialized */
if (!g_mcp2515config.handle)
{
sninfo("Initializing\n");
/* Configure the MCP2515 interrupt pin as an input */
stm32_configgpio(GPIO_MCP2515_IRQ);
spi = stm32_spibus_initialize(MCP2515_SPI_PORTNO);
if (!spi)
{
return -ENODEV;
}
/* Save the SPI instance in the mcp2515_config_s structure */
g_mcp2515config.config.spi = spi;
/* Instantiate the MCP2515 CAN Driver */
mcp2515 = mcp2515_instantiate(&g_mcp2515config.config);
if (mcp2515 == NULL)
{
canerr("ERROR: Failed to get MCP2515 Driver Loaded\n");
return -ENODEV;
}
/* Save the opaque structure */
g_mcp2515config.handle = mcp2515;
/* Initialize the CAN Device with the MCP2515 operations */
can = mcp2515_initialize(mcp2515);
if (can == NULL)
{
canerr("ERROR: Failed to get CAN interface\n");
return -ENODEV;
}
/* Register the CAN driver at "/dev/can0" */
ret = can_register(devpath, can);
if (ret < 0)
{
canerr("ERROR: can_register failed: %d\n", ret);
return ret;
}
}
return OK;
}
#endif /* CONFIG_SPI && CONFIG_CAN_MCP2515 */
@@ -0,0 +1,86 @@
/****************************************************************************
* boards/arm/stm32/stm32f103-minimum/src/stm32_mfrc522.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <errno.h>
#include <debug.h>
#include <nuttx/spi/spi.h>
#include <nuttx/contactless/mfrc522.h>
#include "stm32.h"
#include "stm32_spi.h"
#include "stm32f103_minimum.h"
#if defined(CONFIG_SPI) && defined(CONFIG_STM32_SPI1) && defined(CONFIG_CL_MFRC522)
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#define MFRC522_SPI_PORTNO 1 /* On SPI1 */
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: stm32_mfrc522initialize
*
* Description:
* Initialize and register the MFRC522 RFID driver.
*
* Input Parameters:
* devpath - The full path to the driver to register. E.g., "/dev/rfid0"
*
* Returned Value:
* Zero (OK) on success; a negated errno value on failure.
*
****************************************************************************/
int stm32_mfrc522initialize(FAR const char *devpath)
{
FAR struct spi_dev_s *spi;
int ret;
spi = stm32_spibus_initialize(MFRC522_SPI_PORTNO);
if (!spi)
{
return -ENODEV;
}
/* Then register the MFRC522 */
ret = mfrc522_register(devpath, spi);
if (ret < 0)
{
snerr("ERROR: Error registering MFRC522\n");
}
return ret;
}
#endif /* CONFIG_SPI && CONFIG_MFRC522 */
@@ -0,0 +1,114 @@
/****************************************************************************
* boards/arm/stm32/stm32f103-minimum/src/stm32_mmcsd.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <debug.h>
#include <nuttx/config.h>
#include <nuttx/mmcsd.h>
#include <nuttx/spi/spi.h>
#include <pthread.h>
#include <sched.h>
#include <time.h>
#include <unistd.h>
#include "stm32.h"
#include "stm32f103_minimum.h"
#include "stm32_spi.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#ifndef CONFIG_STM32_SPI1
# error "SD driver requires CONFIG_STM32_SPI1 to be enabled"
#endif
#ifdef CONFIG_DISABLE_MOUNTPOINT
# error "SD driver requires CONFIG_DISABLE_MOUNTPOINT to be disabled"
#endif
/****************************************************************************
* Private Definitions
****************************************************************************/
static const int SD_SPI_PORT = 1; /* SD is connected to SPI1 port */
static const int SD_SLOT_NO = 0; /* There is only one SD slot */
/****************************************************************************
* Private Functions
****************************************************************************/
/* NOTE: We are using a SDCard adapter/module without Card Detect pin!
* Then we don't need to Card Detect callback here.
*/
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: stm32_spi1register
*
* Description:
* Registers media change callback
****************************************************************************/
int stm32_spi1register(struct spi_dev_s *dev, spi_mediachange_t callback,
void *arg)
{
spiinfo("INFO: Registering spi1 device\n");
return OK;
}
/****************************************************************************
* Name: stm32_mmcsd_initialize
*
* Description:
* Initialize SPI-based SD card and card detect thread.
****************************************************************************/
int stm32_mmcsd_initialize(int minor)
{
struct spi_dev_s *spi;
int rv;
mcinfo("INFO: Initializing mmcsd card\n");
spi = stm32_spibus_initialize(SD_SPI_PORT);
if (spi == NULL)
{
mcerr("ERROR: Failed to initialize SPI port %d\n", SD_SPI_PORT);
return -ENODEV;
}
rv = mmcsd_spislotinitialize(minor, SD_SLOT_NO, spi);
if (rv < 0)
{
mcerr("ERROR: Failed to bind SPI port %d to SD slot %d\n",
SD_SPI_PORT, SD_SLOT_NO);
return rv;
}
spiinfo("INFO: mmcsd card has been initialized successfully\n");
return OK;
}
@@ -0,0 +1,130 @@
/****************************************************************************
* boards/arm/stm32/stm32f103-minimum/src/stm32_pcd8544.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdio.h>
#include <stdbool.h>
#include <debug.h>
#include <errno.h>
#include <nuttx/arch.h>
#include <nuttx/board.h>
#include <nuttx/spi/spi.h>
#include <nuttx/lcd/lcd.h>
#include <nuttx/lcd/pcd8544.h>
#include "stm32_gpio.h"
#include "stm32_spi.h"
#include "stm32f103_minimum.h"
#ifdef CONFIG_NX_LCDDRIVER
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#define LCD_SPI_PORTNO 1 /* On SPI1 */
#ifndef CONFIG_LCD_CONTRAST
# define CONFIG_LCD_CONTRAST 60
#endif
/****************************************************************************
* Private Data
****************************************************************************/
FAR struct spi_dev_s *g_spidev;
FAR struct lcd_dev_s *g_lcddev;
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: board_lcd_initialize
****************************************************************************/
int board_lcd_initialize(void)
{
/* Configure the GPIO pins */
stm32_configgpio(STM32_LCD_RST);
stm32_configgpio(STM32_LCD_CD);
stm32_gpiowrite(STM32_LCD_RST, 1);
stm32_gpiowrite(STM32_LCD_CD, 1);
g_spidev = stm32_spibus_initialize(LCD_SPI_PORTNO);
if (!g_spidev)
{
lcderr("ERROR: Failed to initialize SPI port %d\n", LCD_SPI_PORTNO);
return -ENODEV;
}
stm32_gpiowrite(STM32_LCD_RST, 0);
up_mdelay(10);
stm32_gpiowrite(STM32_LCD_RST, 1);
return OK;
}
/****************************************************************************
* Name: board_lcd_getdev
****************************************************************************/
FAR struct lcd_dev_s *board_lcd_getdev(int lcddev)
{
g_lcddev = pcd8544_initialize(g_spidev, lcddev);
if (!g_lcddev)
{
lcderr("ERROR: Failed to bind SPI port 1 to LCD %d\n", lcddev);
}
else
{
lcdinfo("SPI port 1 bound to LCD %d\n", lcddev);
/* And turn the LCD on (CONFIG_LCD_MAXPOWER should be 1) */
g_lcddev->setpower(g_lcddev, CONFIG_LCD_MAXPOWER);
/* Set contrast to right value, otherwise background too dark */
g_lcddev->setcontrast(g_lcddev, CONFIG_LCD_CONTRAST);
return g_lcddev;
}
return NULL;
}
/****************************************************************************
* Name: board_lcd_uninitialize
****************************************************************************/
void board_lcd_uninitialize(void)
{
/* TO-FIX */
}
#endif /* CONFIG_NX_LCDDRIVER */
@@ -0,0 +1,125 @@
/****************************************************************************
* boards/arm/stm32/stm32f103-minimum/src/stm32_pwm.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <errno.h>
#include <debug.h>
#include <nuttx/board.h>
#include <nuttx/timers/pwm.h>
#include <arch/board/board.h>
#include "chip.h"
#include "arm_arch.h"
#include "stm32_pwm.h"
#include "stm32f103_minimum.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Configuration ************************************************************/
/* PWM
*
* The stm32f103-minimum has no real on-board PWM devices, but the board can
* be configured to output a pulse train using TIM4 CH2.
* This pin is used by FSMC is connect to CN5 just for this purpose:
*
* PB0 ADC12_IN8/TIM3_CH3
*
*/
#define HAVE_PWM 1
#ifndef CONFIG_PWM
# undef HAVE_PWM
#endif
#ifndef CONFIG_STM32_TIM3
# undef HAVE_PWM
#endif
#ifndef CONFIG_STM32_TIM3_PWM
# undef HAVE_PWM
#endif
#if !defined(CONFIG_STM32_TIM3_CHANNEL) || CONFIG_STM32_TIM3_CHANNEL != STM32F103MINIMUM_PWMCHANNEL
# undef HAVE_PWM
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: stm32_pwm_setup
*
* Description:
* Initialize PWM and register the PWM device.
*
****************************************************************************/
int stm32_pwm_setup(void)
{
#ifdef HAVE_PWM
static bool initialized = false;
struct pwm_lowerhalf_s *pwm;
int ret;
/* Have we already initialized? */
if (!initialized)
{
/* Call stm32_pwminitialize() to get an instance of the PWM interface */
pwm = stm32_pwminitialize(STM32F103MINIMUM_PWMTIMER);
if (!pwm)
{
aerr("ERROR: Failed to get the STM32 PWM lower half\n");
return -ENODEV;
}
/* Register the PWM driver at "/dev/pwm0" */
ret = pwm_register("/dev/pwm0", pwm);
if (ret < 0)
{
aerr("ERROR: pwm_register failed: %d\n", ret);
return ret;
}
/* Now we are initialized */
initialized = true;
}
return OK;
#else
return -ENODEV;
#endif
}
@@ -0,0 +1,64 @@
/****************************************************************************
* boards/arm/stm32/stm32f103-minimum/src/stm32_reset.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/arch.h>
#include <nuttx/board.h>
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: board_reset
*
* Description:
* Reset board. Support for this function is required by board-level
* logic if CONFIG_BOARDCTL_RESET is selected.
*
* Input Parameters:
* status - Status information provided with the reset event. This
* meaning of this status information is board-specific. If not
* used by a board, the value zero may be provided in calls to
* board_reset().
*
* Returned Value:
* If this function returns, then it was not possible to power-off the
* board due to some constraints. The return value int this case is a
* board-specific reason for the failure to shutdown.
*
****************************************************************************/
int board_reset(int status)
{
#ifdef CONFIG_STM32_DFU
/* TODO handle reboot to bootloader */
#endif
up_systemreset();
return 0;
}
@@ -0,0 +1,181 @@
/****************************************************************************
* boards/arm/stm32/stm32f103-minimum/src/stm32_rgbled.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <errno.h>
#include <debug.h>
#include <nuttx/timers/pwm.h>
#include <nuttx/leds/rgbled.h>
#include <arch/board/board.h>
#include "chip.h"
#include "arm_arch.h"
#include "stm32_pwm.h"
#include "stm32f103_minimum.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Configuration ************************************************************/
#define HAVE_RGBLED 1
#ifndef CONFIG_PWM
# undef HAVE_RGBLED
#endif
#ifndef CONFIG_STM32_TIM1
# undef HAVE_RGBLED
#endif
#ifndef CONFIG_STM32_TIM2
# undef HAVE_RGBLED
#endif
#ifndef CONFIG_STM32_TIM4
# undef HAVE_RGBLED
#endif
#ifndef CONFIG_STM32_TIM1_PWM
# undef HAVE_RGBLED
#endif
#ifndef CONFIG_STM32_TIM2_PWM
# undef HAVE_RGBLED
#endif
#ifndef CONFIG_STM32_TIM4_PWM
# undef HAVE_RGBLED
#endif
#if CONFIG_STM32_TIM1_CHANNEL != RGBLED_RPWMCHANNEL
# undef HAVE_PWM
#endif
#if CONFIG_STM32_TIM2_CHANNEL != RGBLED_GPWMCHANNEL
# undef HAVE_PWM
#endif
#if CONFIG_STM32_TIM4_CHANNEL != RGBLED_BPWMCHANNEL
# undef HAVE_PWM
#endif
#ifdef HAVE_RGBLED
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: stm32_rgbled_setup
*
* Description:
* Initial for support of a connected RGB LED using PWM.
*
****************************************************************************/
int stm32_rgbled_setup(void)
{
static bool initialized = false;
struct pwm_lowerhalf_s *ledr;
struct pwm_lowerhalf_s *ledg;
struct pwm_lowerhalf_s *ledb;
struct pwm_info_s info;
int ret;
/* Have we already initialized? */
if (!initialized)
{
/* Call stm32_pwminitialize() to get an instance of the PWM interface */
ledr = stm32_pwminitialize(RGBLED_RPWMTIMER);
if (!ledr)
{
lederr("ERROR: Failed to get the STM32 PWM lower half to LEDR\n");
return -ENODEV;
}
/* Define frequency and duty cycle */
info.frequency = 100;
info.duty = 0;
/* Initialize LED R */
ledr->ops->setup(ledr);
ledr->ops->start(ledr, &info);
/* Call stm32_pwminitialize() to get an instance of the PWM interface */
ledg = stm32_pwminitialize(RGBLED_GPWMTIMER);
if (!ledg)
{
lederr("ERROR: Failed to get the STM32 PWM lower half to LEDG\n");
return -ENODEV;
}
/* Initialize LED G */
ledg->ops->setup(ledg);
ledg->ops->start(ledg, &info);
/* Call stm32_pwminitialize() to get an instance of the PWM interface */
ledb = stm32_pwminitialize(RGBLED_BPWMTIMER);
if (!ledb)
{
lederr("ERROR: Failed to get the STM32 PWM lower half to LEDB\n");
return -ENODEV;
}
/* Initialize LED B */
ledb->ops->setup(ledb);
ledb->ops->start(ledb, &info);
/* Register the RGB LED diver at "/dev/rgbled0" */
ret = rgbled_register("/dev/rgbled0", ledr, ledg, ledb);
if (ret < 0)
{
lederr("ERROR: rgbled_register failed: %d\n", ret);
return ret;
}
/* Now we are initialized */
initialized = true;
}
return OK;
}
#else
# error "HAVE_RGBLED is undefined"
#endif /* HAVE_RGBLED */
@@ -0,0 +1,283 @@
/****************************************************************************
* boards/arm/stm32/stm32f103-minimum/src/stm32_spi.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
#include <stdbool.h>
#include <debug.h>
#include <nuttx/spi/spi.h>
#include <arch/board/board.h>
#include "arm_arch.h"
#include "chip.h"
#include "stm32.h"
#include "stm32f103_minimum.h"
#if defined(CONFIG_STM32_SPI1) || defined(CONFIG_STM32_SPI2)
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: stm32_spidev_initialize
*
* Description:
* Called to configure SPI chip select GPIO pins for the HY-MiniSTM32
* board.
*
****************************************************************************/
void stm32_spidev_initialize(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_MTD_W25
stm32_configgpio(FLASH_SPI1_CS); /* FLASH chip select */
#endif
#ifdef CONFIG_CAN_MCP2515
stm32_configgpio(GPIO_MCP2515_CS); /* MCP2515 chip select */
#endif
#ifdef CONFIG_CL_MFRC522
stm32_configgpio(GPIO_CS_MFRC522); /* MFRC522 chip select */
#endif
#if defined(CONFIG_SENSORS_MAX6675)
stm32_configgpio(GPIO_MAX6675_CS); /* MAX6675 chip select */
#endif
#ifdef CONFIG_LCD_MAX7219
stm32_configgpio(STM32_LCD_CS); /* MAX7219 chip select */
#endif
#ifdef CONFIG_LCD_ST7567
stm32_configgpio(STM32_LCD_CS); /* ST7567 chip select */
#endif
#ifdef CONFIG_LCD_PCD8544
stm32_configgpio(STM32_LCD_CS); /* ST7567 chip select */
#endif
#ifdef CONFIG_WL_NRF24L01
stm32_configgpio(GPIO_NRF24L01_CS); /* nRF24L01 chip select */
#endif
#ifdef CONFIG_MMCSD_SPI
stm32_configgpio(GPIO_SDCARD_CS); /* SD/MMC Card chip select */
#endif
}
/****************************************************************************
* Name: stm32_spi1/2select and stm32_spi1/2status
*
* 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/spi.h). All other methods (including
* stm32_spibus_initialize()) 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 stm32_spibus_initialize() in your low level
* application initialization logic
* 4. The handle returned by stm32_spibus_initialize() 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, uint32_t devid,
bool selected)
{
#if defined(CONFIG_CAN_MCP2515)
if (devid == SPIDEV_CANBUS(0))
{
stm32_gpiowrite(GPIO_MCP2515_CS, !selected);
}
#endif
#if defined(CONFIG_CL_MFRC522)
if (devid == SPIDEV_CONTACTLESS(0))
{
stm32_gpiowrite(GPIO_CS_MFRC522, !selected);
}
#endif
#if defined(CONFIG_SENSORS_MAX6675)
if (devid == SPIDEV_TEMPERATURE(0))
{
stm32_gpiowrite(GPIO_MAX6675_CS, !selected);
}
#endif
#ifdef CONFIG_LCD_MAX7219
if (devid == SPIDEV_DISPLAY(0))
{
stm32_gpiowrite(STM32_LCD_CS, !selected);
}
#endif
#ifdef CONFIG_LCD_PCD8544
if (devid == SPIDEV_DISPLAY(0))
{
stm32_gpiowrite(STM32_LCD_CS, !selected);
}
#endif
#ifdef CONFIG_LCD_ST7567
if (devid == SPIDEV_DISPLAY(0))
{
stm32_gpiowrite(STM32_LCD_CS, !selected);
}
#endif
#ifdef CONFIG_WL_NRF24L01
if (devid == SPIDEV_WIRELESS(0))
{
stm32_gpiowrite(GPIO_NRF24L01_CS, !selected);
}
#endif
#ifdef CONFIG_MMCSD_SPI
if (devid == SPIDEV_MMCSD(0))
{
stm32_gpiowrite(GPIO_SDCARD_CS, !selected);
}
#endif
#ifdef CONFIG_MTD_W25
stm32_gpiowrite(FLASH_SPI1_CS, !selected);
#endif
}
uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
uint8_t status = 0;
#ifdef CONFIG_WL_NRF24L01
if (devid == SPIDEV_WIRELESS(0))
{
status |= SPI_STATUS_PRESENT;
}
#endif
#ifdef CONFIG_MMCSD_SPI
if (devid == SPIDEV_MMCSD(0))
{
status |= SPI_STATUS_PRESENT;
}
#endif
return status;
}
#endif
#ifdef CONFIG_STM32_SPI2
void stm32_spi2select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected)
{
}
uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
/****************************************************************************
* Name: stm32_spi1cmddata
*
* Description:
* Set or clear the SH1101A A0 or SD1306 D/C n bit to select data (true)
* or command (false). This function must be provided by platform-specific
* logic. This is an implementation of the cmddata method of the SPI
* interface defined by struct spi_ops_s (see include/nuttx/spi/spi.h).
*
* Input Parameters:
*
* spi - SPI device that controls the bus the device that requires the CMD/
* DATA selection.
* devid - If there are multiple devices on the bus, this selects which one
* to select cmd or data. NOTE: This design restricts, for example,
* one one SPI display per SPI bus.
* cmd - true: select command; false: select data
*
* Returned Value:
* None
*
****************************************************************************/
#ifdef CONFIG_SPI_CMDDATA
#ifdef CONFIG_STM32_SPI1
int stm32_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid,
bool cmd)
{
#ifdef CONFIG_LCD_ST7567
if (devid == SPIDEV_DISPLAY(0))
{
/* This is the Data/Command control pad which determines whether the
* data bits are data or a command.
*/
stm32_gpiowrite(STM32_LCD_RS, !cmd);
return OK;
}
#endif
#ifdef CONFIG_LCD_PCD8544
if (devid == SPIDEV_DISPLAY(0))
{
/* This is the Data/Command control pad which determines whether the
* data bits are data or a command.
*/
stm32_gpiowrite(STM32_LCD_CD, !cmd);
return OK;
}
#endif
return -ENODEV;
}
#endif
#endif
#endif /* CONFIG_STM32_SPI1 || CONFIG_STM32_SPI2 */
@@ -0,0 +1,91 @@
/****************************************************************************
* boards/arm/stm32/stm32f103-minimum/src/stm32_usbdev.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* 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 "arm_arch.h"
#include "stm32.h"
#include "stm32f103_minimum.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: stm32_usbinitialize
*
* Description:
* Called to setup USB-related GPIO pins for the STM32F103 Minimum board.
*
****************************************************************************/
void stm32_usbinitialize(void)
{
/* USB Soft Connect Pullup */
stm32_configgpio(GPIO_USB_PULLUP);
}
/****************************************************************************
* 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);
stm32_gpiowrite(GPIO_USB_PULLUP, enable);
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)
{
uinfo("resume: %d\n", resume);
}
@@ -0,0 +1,70 @@
/****************************************************************************
* boards/arm/stm32/stm32f103-minimum/src/stm32_usbmsc.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdio.h>
#include <syslog.h>
#include <errno.h>
#include <nuttx/board.h>
#include "stm32.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Configuration ************************************************************/
#ifndef CONFIG_SYSTEM_USBMSC_DEVMINOR1
# define CONFIG_SYSTEM_USBMSC_DEVMINOR1 0
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: board_usbmsc_initialize
*
* Description:
* Perform architecture specific initialization of the USB MSC device.
*
****************************************************************************/
int board_usbmsc_initialize(int port)
{
/* If system/usbmsc is built as an NSH command, then SD slot should
* already have been initialized in board_app_initialize()
* (see stm32_appinit.c).
* In this case, there is nothing further to be done here.
*/
#ifndef CONFIG_NSH_BUILTIN_APPS
return stm32_sdinitialize(CONFIG_SYSTEM_USBMSC_DEVMINOR1);
#else
return OK;
#endif
}
@@ -0,0 +1,100 @@
/****************************************************************************
* boards/arm/stm32/stm32f103-minimum/src/stm32_userleds.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
#include <stdbool.h>
#include <debug.h>
#include <arch/board/board.h>
#include "chip.h"
#include "stm32.h"
#include "stm32f103_minimum.h"
#ifndef CONFIG_ARCH_LEDS
/****************************************************************************
* Private Data
****************************************************************************/
/* This array maps an LED number to GPIO pin configuration */
static const uint32_t g_ledcfg[BOARD_NLEDS] =
{
GPIO_LED1,
};
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: board_userled_initialize
****************************************************************************/
uint32_t board_userled_initialize(void)
{
int i;
/* Configure LED1-8 GPIOs for output */
for (i = 0; i < BOARD_NLEDS; i++)
{
stm32_configgpio(g_ledcfg[i]);
}
return BOARD_NLEDS;
}
/****************************************************************************
* Name: board_userled
****************************************************************************/
void board_userled(int led, bool ledon)
{
if ((unsigned)led < BOARD_NLEDS)
{
stm32_gpiowrite(g_ledcfg[led], ledon);
}
}
/****************************************************************************
* Name: board_userled_all
****************************************************************************/
void board_userled_all(uint32_t ledset)
{
int i;
/* Configure LED1-8 GPIOs for output */
for (i = 0; i < BOARD_NLEDS; i++)
{
stm32_gpiowrite(g_ledcfg[i], (ledset & (1 << i)) != 0);
}
}
#endif /* !CONFIG_ARCH_LEDS */
@@ -0,0 +1,273 @@
/****************************************************************************
* boards/arm/stm32/stm32f103-minimum/src/stm32_w25.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <debug.h>
#ifdef CONFIG_STM32_SPI1
# include <nuttx/spi/spi.h>
# include <nuttx/mtd/mtd.h>
# include <nuttx/fs/smart.h>
# include <nuttx/mtd/configdata.h>
#endif
#include "stm32_spi.h"
#include "stm32f103_minimum.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Debug ********************************************************************/
/* Non-standard debug that may be enabled just for testing the watchdog
* timer
*/
#define W25_SPI_PORT 1
/* Configuration ************************************************************/
/* Can't support the W25 device if it SPI1 or W25 support is not enabled */
#define HAVE_W25 1
#if !defined(CONFIG_STM32_SPI1) || !defined(CONFIG_MTD_W25)
# undef HAVE_W25
#endif
/* Can't support W25 features if mountpoints are disabled */
#if defined(CONFIG_DISABLE_MOUNTPOINT)
# undef HAVE_W25
#endif
/* Can't support both FAT and SMARTFS */
#if defined(CONFIG_FS_FAT) && defined(CONFIG_FS_SMARTFS)
# warning "Can't support both FAT and SMARTFS -- using FAT"
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: stm32_w25initialize
*
* Description:
* Initialize and register the W25 FLASH file system.
*
****************************************************************************/
int stm32_w25initialize(int minor)
{
int ret;
#ifdef HAVE_W25
FAR struct spi_dev_s *spi;
FAR struct mtd_dev_s *mtd;
FAR struct mtd_geometry_s geo;
#if defined(CONFIG_MTD_PARTITION_NAMES)
FAR const char *partname = CONFIG_STM32F103MINIMUM_FLASH_PART_NAMES;
#endif
/* Get the SPI port */
spi = stm32_spibus_initialize(W25_SPI_PORT);
if (!spi)
{
syslog(LOG_ERR, "ERROR: Failed to initialize SPI port %d\n",
W25_SPI_PORT);
return -ENODEV;
}
/* Now bind the SPI interface to the W25 SPI FLASH driver */
mtd = w25_initialize(spi);
if (!mtd)
{
syslog(LOG_ERR, "ERROR: Failed to bind SPI port %d to the Winbond"
"W25 FLASH driver\n", W25_SPI_PORT);
return -ENODEV;
}
#ifndef CONFIG_FS_SMARTFS
/* And use the FTL layer to wrap the MTD driver as a block driver */
ret = ftl_initialize(minor, mtd);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Initialize the FTL layer\n");
return ret;
}
#else
/* Initialize to provide SMARTFS on the MTD interface */
/* Get the geometry of the FLASH device */
ret = mtd->ioctl(mtd, MTDIOC_GEOMETRY, (unsigned long)((uintptr_t)&geo));
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: mtd->ioctl failed: %d\n", ret);
return ret;
}
#ifdef CONFIG_STM32F103MINIMUM_FLASH_PART
{
int partno;
int partsize;
int partoffset;
int partszbytes;
int erasesize;
const char *partstring = CONFIG_STM32F103MINIMUM_FLASH_PART_LIST;
const char *ptr;
FAR struct mtd_dev_s *mtd_part;
char partref[4];
/* Now create a partition on the FLASH device */
partno = 0;
ptr = partstring;
partoffset = 0;
/* Get the Flash erase size */
erasesize = geo.erasesize;
while (*ptr != '\0')
{
/* Get the partition size */
partsize = atoi(ptr);
partszbytes = (partsize << 10); /* partsize is defined in KB */
/* Check if partition size is bigger then erase block */
if (partszbytes < erasesize)
{
syslog(LOG_ERR,
"ERROR: Partition size is lesser than erasesize!\n");
return -1;
}
/* Check if partition size is multiple of erase block */
if ((partszbytes % erasesize) != 0)
{
syslog(LOG_ERR,
"ERROR: Partition size isn't multiple of erasesize!\n");
return -1;
}
mtd_part = mtd_partition(mtd, partoffset, partszbytes / erasesize);
partoffset += partszbytes / erasesize;
#ifdef CONFIG_STM32F103MINIMUM_FLASH_CONFIG_PART
/* Test if this is the config partition */
if (CONFIG_STM32F103MINIMUM_FLASH_CONFIG_PART_NUMBER == partno)
{
/* Register the partition as the config device */
mtdconfig_register(mtd_part);
}
else
#endif
{
/* Now initialize a SMART Flash block device and bind it
* to the MTD device.
*/
#if defined(CONFIG_MTD_SMART) && defined(CONFIG_FS_SMARTFS)
sprintf(partref, "p%d", partno);
smart_initialize(CONFIG_STM32F103MINIMUM_FLASH_MINOR,
mtd_part, partref);
#endif
}
/* Set the partition name */
#if defined(CONFIG_MTD_PARTITION_NAMES)
if (!mtd_part)
{
syslog(LOG_ERR, "Error: failed to create partition %s\n",
partname);
return -1;
}
mtd_setpartitionname(mtd_part, partname);
/* Now skip to next name. We don't need to split the string here
* because the MTD partition logic will only display names up to
* the comma, thus allowing us to use a single static name
* in the code.
*/
while (*partname != ',' && *partname != '\0')
{
/* Skip to next ',' */
partname++;
}
if (*partname == ',')
{
partname++;
}
#endif
/* Update the pointer to point to the next size in the list */
while ((*ptr >= '0') && (*ptr <= '9'))
{
ptr++;
}
if (*ptr == ',')
{
ptr++;
}
/* Increment the part number */
partno++;
}
}
#else /* CONFIG_STM32F103MINIMUM_FLASH_PART */
/* Configure the device with no partition support */
smart_initialize(CONFIG_STM32F103MINIMUM_FLASH_MINOR, mtd, NULL);
#endif /* CONFIG_STM32F103MINIMUM_FLASH_PART */
#endif /* CONFIG_FS_SMARTFS */
#endif /* HAVE_W25 */
return OK;
}
@@ -0,0 +1,340 @@
/****************************************************************************
* boards/arm/stm32/stm32f103-minimum/src/stm32f103_minimum.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __BOARDS_ARM_STM32_STM32F103_MINIMUM_SRC_STM32F103_MINIMUM_H
#define __BOARDS_ARM_STM32_STM32F103_MINIMUM_SRC_STM32F103_MINIMUM_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/compiler.h>
#include <stdint.h>
#include <arch/chip/chip.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#define HAVE_AT24 1
/* AT24 Serial EEPROM */
#define AT24_I2C_BUS 1 /* AT24C256 connected to I2C1 */
#define AT24_MINOR 0
#if !defined(CONFIG_MTD_AT24XX) || !defined(CONFIG_STM32_I2C1)
# undef HAVE_AT24
#endif
/* Can't support AT24 features if mountpoints are disabled or if we were not
* asked to mount the AT25 part
*/
#if defined(CONFIG_DISABLE_MOUNTPOINT) || \
!defined(CONFIG_STM32F103MINIMUM_AT24_BLOCKMOUNT)
# undef HAVE_AT24
#endif
/* procfs File System */
#ifdef CONFIG_FS_PROCFS
# ifdef CONFIG_NSH_PROC_MOUNTPOINT
# define STM32_PROCFS_MOUNTPOINT CONFIG_NSH_PROC_MOUNTPOINT
# else
# define STM32_PROCFS_MOUNTPOINT "/proc"
# endif
#endif
/* If we are going to mount the AT24, then they user must also have told
* us what to do with it by setting one of these.
*/
#ifndef CONFIG_FS_NXFFS
# undef CONFIG_STM32F103MINIMUM_AT24_NXFFS
#endif
#if !defined(CONFIG_STM32F103MINIMUM_AT24_FTL) && \
!defined(CONFIG_STM32F103MINIMUM_AT24_NXFFS)
# undef HAVE_AT24
#endif
/* 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
/* GPIOs ********************************************************************/
/* LEDs */
/* The Blue/Red pills have a different pinout to the Black pill,
* which includes the board's user LED.
*/
#ifdef CONFIG_STM32F103MINIMUM_BLACKPILL
# define GPIO_LED1 (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
GPIO_OUTPUT_CLEAR|GPIO_PORTB|GPIO_PIN12)
#else
# define GPIO_LED1 (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
GPIO_OUTPUT_CLEAR|GPIO_PORTC|GPIO_PIN13)
#endif
/* BUTTONs */
#define GPIO_BTN_USER1 (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\
GPIO_EXTI|GPIO_PORTA|GPIO_PIN0)
#define GPIO_BTN_USER2 (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\
GPIO_EXTI|GPIO_PORTA|GPIO_PIN1)
#define MIN_IRQBUTTON BUTTON_USER1
#define MAX_IRQBUTTON BUTTON_USER2
#define NUM_IRQBUTTONS (BUTTON_USER1 - BUTTON_USER2 + 1)
/* SPI chip selects */
#define FLASH_SPI1_CS (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
GPIO_OUTPUT_SET|GPIO_PORTA|GPIO_PIN4)
#define GPIO_CS_MFRC522 (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
GPIO_OUTPUT_SET|GPIO_PORTA|GPIO_PIN4)
#define STM32_LCD_CS (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
GPIO_OUTPUT_SET|GPIO_PORTA|GPIO_PIN4)
#define GPIO_MAX6675_CS (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
GPIO_OUTPUT_SET|GPIO_PORTA|GPIO_PIN4)
#define GPIO_MCP2515_CS (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
GPIO_OUTPUT_SET|GPIO_PORTA|GPIO_PIN4)
#define GPIO_NRF24L01_CS (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
GPIO_OUTPUT_SET|GPIO_PORTA|GPIO_PIN4)
#define GPIO_SDCARD_CS (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
GPIO_OUTPUT_SET|GPIO_PORTA|GPIO_PIN4)
#define STM32_LCD_RST (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
GPIO_OUTPUT_SET|GPIO_PORTA|GPIO_PIN3)
#define STM32_LCD_RS (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
GPIO_OUTPUT_SET|GPIO_PORTA|GPIO_PIN2)
#define STM32_LCD_CD (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
GPIO_OUTPUT_SET|GPIO_PORTA|GPIO_PIN2)
/* PWM Configuration */
#define STM32F103MINIMUM_PWMTIMER 3
#define STM32F103MINIMUM_PWMCHANNEL 3
/* LM-75 Temperature Sensor: PA.0 */
#define GPIO_LM75_OSINT (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_PORTA|GPIO_PIN0)
/* nRF24 Configuration */
/* MCP2515 IRQ line: PB.0 */
#define GPIO_MCP2515_IRQ (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_PORTB|GPIO_PIN0)
/* USB Soft Connect Pullup: PC.13 */
#define GPIO_USB_PULLUP (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
GPIO_OUTPUT_SET|GPIO_PORTA|GPIO_PIN12)
/* GPIO pins used by the GPIO Subsystem */
#define BOARD_NGPIOIN 1 /* Amount of GPIO Input pins */
#define BOARD_NGPIOOUT 1 /* Amount of GPIO Output pins */
#define BOARD_NGPIOINT 1 /* Amount of GPIO Input w/ Interruption pins */
#define GPIO_IN1 (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_PORTA|GPIO_PIN0)
#define GPIO_OUT1 (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
GPIO_OUTPUT_SET|GPIO_PORTA|GPIO_PIN1)
#define GPIO_INT1 (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_PORTA|GPIO_PIN2)
/* WS2812 LEDs */
#define WS2812_NLEDS 2
#define WS2812_SPI 1
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
#ifndef __ASSEMBLY__
/****************************************************************************
* Name: stm32_bringup
*
* Description:
* Perform architecture specific initialization
*
* CONFIG_LIB_BOARDCTL=y:
* If CONFIG_NSH_ARCHINITIALIZE=y:
* Called from the NSH library (or other application)
* Otherwise, assumed to be called from some other application.
*
* Otherwise CONFIG_BOARD_LATE_INITIALIZE=y:
* Called from board_late_initialize().
*
* Otherwise, bad news: Never called
*
****************************************************************************/
int stm32_bringup(void);
/****************************************************************************
* Name: stm32_gpio_initialize
*
* Description:
* Initialize GPIO drivers for use with /apps/examples/gpio
*
****************************************************************************/
#ifdef CONFIG_DEV_GPIO
int stm32_gpio_initialize(void);
#endif
/****************************************************************************
* Name: stm32_adc_setup
*
* Description:
* Initialize ADC and register the ADC driver.
*
****************************************************************************/
#ifdef CONFIG_ADC
int stm32_adc_setup(void);
#endif
/****************************************************************************
* Name: stm32_spidev_initialize
*
* Description:
* Called to configure SPI chip select GPIO pins for the Hy-Mini STM32v
* board.
*
****************************************************************************/
void stm32_spidev_initialize(void);
/****************************************************************************
* Name: stm32_mmcsd_initialize
*
* Description:
* Initializes SPI-based SD card
*
****************************************************************************/
#ifdef CONFIG_MMCSD
int stm32_mmcsd_initialize(int minor);
#endif
/****************************************************************************
* Name: stm32_w25initialize
*
* Description:
* Called to initialize Winbond W25 memory
*
****************************************************************************/
int stm32_w25initialize(int minor);
/****************************************************************************
* Name: stm32_rgbled_setup
*
* Description:
* This function is called by board initialization logic to configure the
* RGB LED driver. This function will register the driver as /dev/rgbled0.
*
* Input Parameters:
* None
*
* Returned Value:
* Zero is returned on success. Otherwise, a negated errno value is
* returned to indicate the nature of the failure.
*
****************************************************************************/
#ifdef CONFIG_RGBLED
int stm32_rgbled_setup(void);
#endif
/****************************************************************************
* Name: stm32_mcp2515initialize
*
* Description:
* Initialize and register the MCP2515 CAN driver.
*
****************************************************************************/
#ifdef CONFIG_CAN_MCP2515
int stm32_mcp2515initialize(FAR const char *devpath);
#endif
/****************************************************************************
* Name: stm32_usbinitialize
*
* Description:
* Called to setup USB-related GPIO pins for the Hy-Mini STM32v board.
*
****************************************************************************/
void stm32_usbinitialize(void);
/****************************************************************************
* Name: stm32_pwm_setup
*
* Description:
* Initialize PWM and register the PWM device.
*
****************************************************************************/
#ifdef CONFIG_PWM
int stm32_pwm_setup(void);
#endif
/****************************************************************************
* Name: stm32_mfrc522initialize
*
* Description:
* Function used to initialize the MFRC522 RFID Transceiver
*
****************************************************************************/
#ifdef CONFIG_CL_MFRC522
int stm32_mfrc522initialize(FAR const char *devpath);
#endif
#endif /* __ASSEMBLY__ */
#endif /* __BOARDS_ARM_STM32_STM32F103_MINIMUM_SRC_STM32F103_MINIMUM_H */