boards: arm: add support for NUCLEO-L011K4 board
Support for the NUCLEO-L011K4 development board with STM32L011K4 SoC. Although the SoC only contains 16K flash and 2K RAM, it has been tested on a number of samples and has worked as expected. Signed-off-by: Steven Daglish <s.c.daglish@gmail.com>
This commit is contained in:
parent
b777647517
commit
f4ed379cce
11 changed files with 379 additions and 0 deletions
7
boards/arm/nucleo_l011k4/CMakeLists.txt
Normal file
7
boards/arm/nucleo_l011k4/CMakeLists.txt
Normal file
|
@ -0,0 +1,7 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
if(CONFIG_PINMUX)
|
||||
zephyr_library()
|
||||
zephyr_library_sources(pinmux.c)
|
||||
zephyr_library_include_directories(${ZEPHYR_BASE}/drivers)
|
||||
endif()
|
8
boards/arm/nucleo_l011k4/Kconfig.board
Normal file
8
boards/arm/nucleo_l011k4/Kconfig.board
Normal file
|
@ -0,0 +1,8 @@
|
|||
# STM32 Nucleo-32 development board with STM32L011K4 MCU configuration
|
||||
|
||||
# Copyright (c) 2020 Steven Daglish <s.c.daglish@gmail.com>
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
config BOARD_NUCLEO_L011K4
|
||||
bool "NUCLEO-32 L011K4 Development Board"
|
||||
depends on SOC_STM32L011XX
|
15
boards/arm/nucleo_l011k4/Kconfig.defconfig
Normal file
15
boards/arm/nucleo_l011k4/Kconfig.defconfig
Normal file
|
@ -0,0 +1,15 @@
|
|||
# STM32 Nucleo-32 development board with STM32L011K4 MCU
|
||||
|
||||
# Copyright (c) 2020 Steven Daglish <s.c.daglish@gmail.com>
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
if BOARD_NUCLEO_L011K4
|
||||
|
||||
config BOARD
|
||||
default "nucleo_l011k4"
|
||||
|
||||
config SPI_STM32_INTERRUPT
|
||||
default y
|
||||
depends on SPI
|
||||
|
||||
endif # BOARD_NUCLEO_L011K4
|
6
boards/arm/nucleo_l011k4/board.cmake
Normal file
6
boards/arm/nucleo_l011k4/board.cmake
Normal file
|
@ -0,0 +1,6 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
board_runner_args(jlink "--device=STM32L011K4" "--speed=4000")
|
||||
|
||||
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
|
||||
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
|
BIN
boards/arm/nucleo_l011k4/doc/img/nucleo_l011k4.jpg
Normal file
BIN
boards/arm/nucleo_l011k4/doc/img/nucleo_l011k4.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 96 KiB |
169
boards/arm/nucleo_l011k4/doc/index.rst
Normal file
169
boards/arm/nucleo_l011k4/doc/index.rst
Normal file
|
@ -0,0 +1,169 @@
|
|||
.. _nucleo_l011k4_board:
|
||||
|
||||
ST Nucleo L011K4
|
||||
################
|
||||
|
||||
Overview
|
||||
********
|
||||
The STM32 Nucleo-32 development board with STM32L011K4 MCU, supports Arduino Nano V3 connectivity.
|
||||
|
||||
The STM32 Nucleo board provides an affordable, and flexible way for users to try out new concepts,
|
||||
and build prototypes with the STM32 microcontroller, choosing from the various
|
||||
combinations of performance, power consumption, and features.
|
||||
|
||||
The Arduino* Nano V3 connectivity support allow easy functionality
|
||||
expansion of the STM32 Nucleo open development platform with a wide choice of
|
||||
specialized shields.
|
||||
|
||||
The STM32 Nucleo board integrates the ST-LINK/V2-1 debugger and programmer.
|
||||
|
||||
The STM32 Nucleo board comes with the STM32 comprehensive software HAL library together
|
||||
with various packaged software examples.
|
||||
|
||||
.. image:: img/nucleo_l011k4.jpg
|
||||
:width: 426px
|
||||
:height: 319px
|
||||
:align: center
|
||||
:alt: Nucleo L011K4
|
||||
|
||||
More information about the board can be found at the `Nucleo L011K4 website`_.
|
||||
|
||||
Hardware
|
||||
********
|
||||
Nucleo L011K4 provides the following hardware components:
|
||||
|
||||
- STM32 microcontroller in LQFP32 package
|
||||
- Extension resource:
|
||||
|
||||
- Arduino* Nano V3 connectivity
|
||||
|
||||
- ARM* mbed*
|
||||
- On-board ST-LINK/V2-1 debugger/programmer with SWD connector:
|
||||
|
||||
- Selection-mode switch to use the kit as a standalone ST-LINK/V2-1
|
||||
|
||||
- Flexible board power supply:
|
||||
|
||||
- USB VBUS or external source (3.3V, 5V, 7 - 12V)
|
||||
- Power management access point
|
||||
|
||||
- Three LEDs:
|
||||
|
||||
- USB communication (LD1), user LED (LD2), power LED (LD3)
|
||||
|
||||
- One push-button: RESET
|
||||
- USB re-enumeration capability. Three different interfaces supported on USB:
|
||||
|
||||
- Virtual COM port
|
||||
- Mass storage
|
||||
- Debug port
|
||||
|
||||
- Support of wide choice of Integrated Development Environments (IDEs) including:
|
||||
|
||||
- IAR
|
||||
- ARM Keil
|
||||
- GCC-based IDEs
|
||||
|
||||
More information about STM32L011K4 can be found in the
|
||||
`STM32L0x1 reference manual`_
|
||||
|
||||
|
||||
Supported Features
|
||||
==================
|
||||
|
||||
The Zephyr nucleo_l011k4 board configuration supports the following hardware features:
|
||||
|
||||
+-----------+------------+-------------------------------------+
|
||||
| Interface | Controller | Driver/Component |
|
||||
+===========+============+=====================================+
|
||||
| NVIC | on-chip | nested vector interrupt controller |
|
||||
+-----------+------------+-------------------------------------+
|
||||
| UART | on-chip | serial port-polling; |
|
||||
| | | serial port-interrupt |
|
||||
+-----------+------------+-------------------------------------+
|
||||
| PINMUX | on-chip | pinmux |
|
||||
+-----------+------------+-------------------------------------+
|
||||
| GPIO | on-chip | gpio |
|
||||
+-----------+------------+-------------------------------------+
|
||||
| CLOCK | on-chip | reset and clock control |
|
||||
+-----------+------------+-------------------------------------+
|
||||
| I2C | on-chip | i2c controller |
|
||||
+-----------+------------+-------------------------------------+
|
||||
| SPI | on-chip | spi controller |
|
||||
+-----------+------------+-------------------------------------+
|
||||
| EEPROM | on-chip | eeprom |
|
||||
+-----------+------------+-------------------------------------+
|
||||
|
||||
Other hardware features are not yet supported in this Zephyr port.
|
||||
|
||||
The default configuration can be found in the defconfig file:
|
||||
``boards/arm/nucleo_l011k4/nucleo_l011k4_defconfig``
|
||||
|
||||
Connections and IOs
|
||||
===================
|
||||
|
||||
Each of the GPIO pins can be configured by software as output (push-pull or open-drain), as
|
||||
input (with or without pull-up or pull-down), or as peripheral alternate function. Most of the
|
||||
GPIO pins are shared with digital or analog alternate functions. All GPIOs are high current
|
||||
capable except for analog inputs.
|
||||
|
||||
Default Zephyr Peripheral Mapping:
|
||||
----------------------------------
|
||||
|
||||
- UART_2 TX/RX : PA2/PA15 (ST-Link Virtual Port Com)
|
||||
- I2C1 SCL/SDA : PA4/PA10 (Arduino I2C)
|
||||
- SPI1 SCK/MISO/MOSI : PA5/PA6/PA7 (Arduino SPI)
|
||||
- LD2 : PB3
|
||||
|
||||
For mode details please refer to `STM32 Nucleo-32 board User Manual`_.
|
||||
|
||||
Programming and Debugging
|
||||
*************************
|
||||
|
||||
Applications for the ``nucleo_l011k4`` board configuration can be built and
|
||||
flashed in the usual way (see :ref:`build_an_application` and
|
||||
:ref:`application_run` for more details).
|
||||
|
||||
Flashing
|
||||
========
|
||||
|
||||
Nucleo L011K4 board includes an ST-LINK/V2-1 embedded debug tool interface.
|
||||
This interface is supported by the openocd version included in the Zephyr SDK.
|
||||
|
||||
Flashing an application to Nucleo L011K4
|
||||
----------------------------------------
|
||||
|
||||
Here is an example for the :ref:`blinky-sample` application.
|
||||
|
||||
.. zephyr-app-commands::
|
||||
:zephyr-app: samples/basic/blinky
|
||||
:board: nucleo_l011k4
|
||||
:goals: build flash
|
||||
|
||||
You will see the LED blinking every second.
|
||||
|
||||
Debugging
|
||||
=========
|
||||
|
||||
You can debug an application in the usual way. Here is an example for the
|
||||
:ref:`hello_world` application.
|
||||
|
||||
.. zephyr-app-commands::
|
||||
:zephyr-app: samples/hello_world
|
||||
:board: nucleo_l011k4
|
||||
:maybe-skip-config:
|
||||
:goals: debug
|
||||
|
||||
References
|
||||
**********
|
||||
|
||||
.. target-notes::
|
||||
|
||||
.. _Nucleo L011K4 website:
|
||||
http://www.st.com/en/evaluation-tools/nucleo-l011k4.html
|
||||
|
||||
.. _STM32L0x1 reference manual:
|
||||
https://www.st.com/resource/en/reference_manual/dm00108282-ultralowpower-stm32l0x1-advanced-armbased-32bit-mcus-stmicroelectronics.pdf
|
||||
|
||||
.. _STM32 Nucleo-32 board User Manual:
|
||||
https://www.st.com/resource/en/user_manual/dm00231744-stm32-nucleo32-boards-mb1180-stmicroelectronics.pdf
|
62
boards/arm/nucleo_l011k4/nucleo_l011k4.dts
Normal file
62
boards/arm/nucleo_l011k4/nucleo_l011k4.dts
Normal file
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* Copyright (c) 2020 Steven Daglish <s.c.daglish@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/dts-v1/;
|
||||
#include <st/l0/stm32l011X4.dtsi>
|
||||
#include <st/l0/stm32l011k(3-4)tx-pinctrl.dtsi>
|
||||
|
||||
/ {
|
||||
model = "STMicroelectronics STM32L011K4-NUCLEO board";
|
||||
compatible = "st,stm32l011k4-nucleo";
|
||||
|
||||
chosen {
|
||||
zephyr,console = &usart2;
|
||||
zephyr,shell-uart = &usart2;
|
||||
zephyr,sram = &sram0;
|
||||
zephyr,flash = &flash0;
|
||||
};
|
||||
|
||||
leds {
|
||||
compatible = "gpio-leds";
|
||||
green_led_2: led_2 {
|
||||
gpios = <&gpiob 3 GPIO_ACTIVE_HIGH>;
|
||||
label = "User LD2";
|
||||
};
|
||||
};
|
||||
|
||||
gpio_keys {
|
||||
compatible = "gpio-keys";
|
||||
user_button: button {
|
||||
label = "User";
|
||||
gpios = <&gpioa 12 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
};
|
||||
|
||||
aliases {
|
||||
led0 = &green_led_2;
|
||||
eeprom-0 = &eeprom;
|
||||
};
|
||||
};
|
||||
|
||||
&usart2 {
|
||||
pinctrl-0 = <&usart2_tx_pa2 &usart2_rx_pa15>;
|
||||
current-speed = <115200>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&i2c1 {
|
||||
pinctrl-0 = <&i2c1_scl_pa4 &i2c1_sda_pa10>;
|
||||
status = "okay";
|
||||
clock-frequency = <I2C_BITRATE_FAST>;
|
||||
};
|
||||
|
||||
&spi1 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&eeprom {
|
||||
status = "okay";
|
||||
};
|
15
boards/arm/nucleo_l011k4/nucleo_l011k4.yaml
Normal file
15
boards/arm/nucleo_l011k4/nucleo_l011k4.yaml
Normal file
|
@ -0,0 +1,15 @@
|
|||
identifier: nucleo_l011k4
|
||||
name: ST Nucleo L011K4
|
||||
type: mcu
|
||||
arch: arm
|
||||
toolchain:
|
||||
- zephyr
|
||||
- gnuarmemb
|
||||
- xtools
|
||||
supported:
|
||||
- gpio
|
||||
- i2c
|
||||
- spi
|
||||
- eeprom
|
||||
ram: 2
|
||||
flash: 16
|
41
boards/arm/nucleo_l011k4/nucleo_l011k4_defconfig
Normal file
41
boards/arm/nucleo_l011k4/nucleo_l011k4_defconfig
Normal file
|
@ -0,0 +1,41 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Zephyr Kernel Configuration
|
||||
CONFIG_SOC_SERIES_STM32L0X=y
|
||||
|
||||
# Platform Configuration
|
||||
CONFIG_SOC_STM32L011XX=y
|
||||
|
||||
# General Kernel Options
|
||||
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=32000000
|
||||
|
||||
# Kernel Options due to Low Memory (2k)
|
||||
CONFIG_MAIN_STACK_SIZE=320
|
||||
CONFIG_IDLE_STACK_SIZE=100
|
||||
CONFIG_ISR_STACK_SIZE=256
|
||||
|
||||
# Serial Drivers
|
||||
CONFIG_SERIAL=y
|
||||
CONFIG_UART_INTERRUPT_DRIVEN=y
|
||||
# enable console
|
||||
CONFIG_CONSOLE=y
|
||||
CONFIG_UART_CONSOLE=y
|
||||
|
||||
# Pinmux Driver
|
||||
CONFIG_PINMUX=y
|
||||
|
||||
# GPIO Controller
|
||||
CONFIG_GPIO=y
|
||||
|
||||
# Clock configuration
|
||||
CONFIG_CLOCK_CONTROL=y
|
||||
# SYSCLK selection
|
||||
CONFIG_CLOCK_STM32_SYSCLK_SRC_PLL=y
|
||||
# PLL configuration
|
||||
CONFIG_CLOCK_STM32_PLL_SRC_HSI=y
|
||||
# produce 32MHz clock at PLL output
|
||||
CONFIG_CLOCK_STM32_PLL_MULTIPLIER=4
|
||||
CONFIG_CLOCK_STM32_PLL_DIVISOR=2
|
||||
CONFIG_CLOCK_STM32_AHB_PRESCALER=1
|
||||
CONFIG_CLOCK_STM32_APB1_PRESCALER=1
|
||||
CONFIG_CLOCK_STM32_APB2_PRESCALER=1
|
33
boards/arm/nucleo_l011k4/pinmux.c
Normal file
33
boards/arm/nucleo_l011k4/pinmux.c
Normal file
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) 2020 Steven Daglish <s.c.daglish@gmail.com>
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <kernel.h>
|
||||
#include <device.h>
|
||||
#include <init.h>
|
||||
#include <drivers/pinmux.h>
|
||||
#include <sys/sys_io.h>
|
||||
|
||||
#include <pinmux/stm32/pinmux_stm32.h>
|
||||
|
||||
/* pin assignments for NUCLEO-L011K4 board */
|
||||
static const struct pin_config pinconf[] = {
|
||||
#if DT_NODE_HAS_STATUS(DT_NODELABEL(spi1), okay) && CONFIG_SPI
|
||||
{STM32_PIN_PA5, STM32L0_PINMUX_FUNC_PA5_SPI1_SCK},
|
||||
{STM32_PIN_PA6, STM32L0_PINMUX_FUNC_PA6_SPI1_MISO},
|
||||
{STM32_PIN_PA7, STM32L0_PINMUX_FUNC_PA7_SPI1_MOSI},
|
||||
#endif
|
||||
};
|
||||
|
||||
static int pinmux_stm32_init(const struct device *port)
|
||||
{
|
||||
ARG_UNUSED(port);
|
||||
|
||||
stm32_setup_pins(pinconf, ARRAY_SIZE(pinconf));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
SYS_INIT(pinmux_stm32_init, PRE_KERNEL_1,
|
||||
CONFIG_PINMUX_STM32_DEVICE_INITIALIZATION_PRIORITY);
|
23
boards/arm/nucleo_l011k4/support/openocd.cfg
Normal file
23
boards/arm/nucleo_l011k4/support/openocd.cfg
Normal file
|
@ -0,0 +1,23 @@
|
|||
# This is an ST NUCLEO-L011K4 board with single STM32L011K4 chip.
|
||||
# http://www.st.com/en/evaluation-tools/nucleo-l011k4.html
|
||||
source [find interface/stlink.cfg]
|
||||
|
||||
transport select hla_swd
|
||||
|
||||
#set WORKAREASIZE 0x2000
|
||||
|
||||
source [find target/stm32l0.cfg]
|
||||
|
||||
# There is only system reset line and JTAG/SWD command can be issued when SRST
|
||||
reset_config srst_only
|
||||
|
||||
$_TARGETNAME configure -event gdb-attach {
|
||||
echo "Debugger attaching: halting execution"
|
||||
reset halt
|
||||
gdb_breakpoint_override hard
|
||||
}
|
||||
|
||||
$_TARGETNAME configure -event gdb-detach {
|
||||
echo "Debugger detaching: resuming execution"
|
||||
resume
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue