boards: cc3235sf_launchxl: add support for TI CC3235SF LaunchPad

This commit adds the TI CC3235SF LaunchPad as a new board in Zephyr.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
This commit is contained in:
Vincent Wan 2019-04-25 15:20:54 -07:00 committed by Jukka Rissanen
commit 8afe649144
11 changed files with 637 additions and 0 deletions

View file

@ -0,0 +1,8 @@
# SPDX-License-Identifier: Apache-2.0
zephyr_library()
zephyr_library_sources(
pinmux.c
dbghdr.c
)
zephyr_library_include_directories(${ZEPHYR_BASE}/drivers)

View file

@ -0,0 +1,10 @@
# Copyright (c) 2019, Texas Instruments Incorporated
#
# SPDX-License-Identifier: Apache-2.0
# Kconfig - TI SimpleLink CC3235SF LaunchXL Board
#
config BOARD_CC3235SF_LAUNCHXL
bool "TI CC3235SF LAUNCHXL"
depends on SOC_CC3235SF

View file

@ -0,0 +1,20 @@
# Copyright (c) 2019, Texas Instruments Incorporated
#
# SPDX-License-Identifier: Apache-2.0
# Kconfig - TI CC3235SF LaunchXL board configuration
#
if BOARD_CC3235SF_LAUNCHXL
config BOARD
default "cc3235sf_launchxl"
if I2C
config I2C_CC32XX
default y
endif # I2C
endif # BOARD_CC3235SF_LAUNCHXL

View file

@ -0,0 +1,8 @@
# SPDX-License-Identifier: Apache-2.0
# Use the TI OpenOCD (by default in /usr/local/openocd)
# See the Zephyr project CC3235SF_LAUNCHXL documentation on
# flashing prerequisites.
set(OPENOCD "/usr/local/bin/openocd" CACHE FILEPATH "" FORCE)
set(OPENOCD_DEFAULT_PATH ${OPENOCD}/scripts)
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)

View file

@ -0,0 +1,73 @@
/*
* Copyright (c) 2019, Texas Instruments Incorporated
*
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
#include <ti/cc3235sf.dtsi>
/ {
model = "TI CC3235SF LaunchXL";
compatible = "ti,cc3235sf-launchxl", "ti,cc3235sf", "ti,cc32xx";
aliases {
uart-0 = &uart0;
uart-1 = &uart1;
i2c-0 = &i2c0;
led0 = &led0;
led1 = &led1;
led2 = &led2;
/* sw0/1 alias defined for compatibility with samples */
sw0 = &sw2;
sw1 = &sw3;
};
chosen {
zephyr,sram = &sram0;
zephyr,flash = &flash1;
zephyr,console = &uart0;
zephyr,shell-uart = &uart0;
};
leds {
compatible = "gpio-leds";
led0: led_0 {
gpios = <&gpioa1 3 0>;
label = "Green LED";
};
led1: led_1 {
gpios = <&gpioa1 2 0>;
label = "Yellow LED";
};
led2: led_2 {
gpios = <&gpioa1 1 0>;
label = "Red LED";
};
};
buttons {
/* Push button 2 */
compatible = "gpio-keys";
sw2: button_0 {
gpios = <&gpioa2 6 GPIO_INT_ACTIVE_LOW>;
label = "Push button switch 2";
};
/* Push button 3 */
sw3: button_1 {
gpios = <&gpioa1 5 GPIO_INT_ACTIVE_LOW>;
label = "Push button switch 3";
};
};
};
&uart0 {
status = "okay";
current-speed = <115200>;
};
&i2c0 {
status = "okay";
clock-frequency = <I2C_BITRATE_FAST>;
};

View file

@ -0,0 +1,12 @@
identifier: cc3235sf_launchxl
name: SimpleLink Wi-Fi CC3235SF LaunchPad development kit
type: mcu
arch: arm
toolchain:
- zephyr
- gnuarmemb
- xtools
supported:
- netif:wifi
- i2c
- gpio

View file

@ -0,0 +1,25 @@
# SPDX-License-Identifier: Apache-2.0
CONFIG_ARM=y
CONFIG_BOARD_CC3235SF_LAUNCHXL=y
CONFIG_SOC_FAMILY_TISIMPLELINK=y
CONFIG_SOC_SERIES_CC32XX=y
CONFIG_SOC_CC3235SF=y
CONFIG_CORTEX_M_SYSTICK=y
CONFIG_PRINTK=y
#enable GPIO driver
CONFIG_GPIO=y
# enable uart driver
CONFIG_SERIAL=y
CONFIG_SERIAL_HAS_DRIVER=y
CONFIG_UART_CC32XX=y
# enable console
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
# Enable SimpleLink CC32XX SDK
CONFIG_HAS_CC3220SDK=y

View file

@ -0,0 +1,24 @@
/*
* Copyright (c) 2017, Texas Instruments Incorporated
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* This debug header, located at the start of flash, indicates
* to the bootloader that this is a debug image, allowing
* debuggers and flash-loaders to access the chip over JTAG.
* Also, on subsequent reboots, the bootloader skips the integrity
* check, preventing the image from being mass erased.
*
* See section 21.10: "Debugging Flash User Application Using JTAG"
* in the CC3220 TRM: http://www.ti.com/lit/ug/swru465/swru465.pdf
*/
#ifdef CONFIG_CC3235SF_DEBUG
__attribute__ ((section(".dbghdr")))
const unsigned long ulDebugHeader[] = {
0x5AA5A55A,
0x000FF800,
0xEFA3247D
};
#endif

View file

@ -0,0 +1,305 @@
.. _cc3235sf_launchxl:
CC3235SF LaunchXL
#################
Overview
********
The SimpleLink Wi-Fi CC3235SF LaunchPad development kit (CC3235SF-LAUNCHXL)
highlights CC3235SF, a single-chip wireless microcontroller (MCU) with
1MB internal flash, 4MB external serial flash, 256KB of RAM, and enhanced
security features. It supports 802.11 a/b/g/n, both 2.4 GHz and 5 GHz.
See the `TI CC3235 Product Page`_ for details.
Features:
=========
* Two separate execution environments: a user application dedicated ARM
Cortex-M4 MCU and a network processor MCU to run all Wi-Fi and
internet logical layers
* 40-pin LaunchPad standard leveraging the BoosterPack ecosystem
* On-board accelerometer and temperature sensor
* Two buttons and a RGB LED for user interaction
* UART through USB to PC
* BoosterPack plug-in module for adding graphical displays, audio
codecs, antenna selection, environmental sensing, and more
* Power from USB for the LaunchPad and optional external BoosterPack
* XDS110-based JTAG emulation with serial port for flash programming
Details on the CC3235SF LaunchXL development board can be found in the
`CC3235SF LaunchPad Dev Kit Hardware User's Guide`_.
Hardware
********
The CC3235SF SoC has two MCUs:
#. Applications MCU - an ARM |reg| Cortex |reg|-M4 Core at 80 MHz, with 256Kb RAM,
and access to external serial 4MB flash with bootloader and peripheral
drivers in ROM.
#. Network Coprocessor (NWP) - a dedicated ARM MCU, which completely
offloads Wi-Fi and internet protocols from the application MCU.
Complete details of the CC3235SF SoC can be found in the `CC3235 TRM`_.
Supported Features
==================
Zephyr has been ported to the Applications MCU, with basic peripheral
driver support.
+-----------+------------+-----------------------+
| Interface | Controller | Driver/Component |
+===========+============+=======================+
| UART | on-chip | serial port-interrupt |
+-----------+------------+-----------------------+
| GPIO | on-chip | gpio |
+-----------+------------+-----------------------+
| I2C | on-chip | i2c |
+-----------+------------+-----------------------+
| SPI_0 | on-chip | Wi-Fi host driver |
+-----------+------------+-----------------------+
.. note::
For consistency with TI SimpleLink SDK and BoosterPack examples,
the I2C driver defaults to I2C_BITRATE_FAST mode (400 kHz) bus speed
on bootup.
The accelerometer, temperature sensors, or other peripherals
accessible through the BoosterPack, are not currently supported.
Connections and IOs
====================
Peripherals on the CC3235SF LaunchXL are mapped to the following pins in
the file :zephyr_file:`boards/arm/cc3235sf_launchxl/pinmux.c`.
+------------+-------+-------+
| Function | PIN | GPIO |
+============+=======+=======+
| UART0_TX | 55 | N/A |
+------------+-------+-------+
| UART0_RX | 57 | N/A |
+------------+-------+-------+
| LED D7 (R) | 64 | 9 |
+------------+-------+-------+
| LED D6 (O) | 01 | 10 |
+------------+-------+-------+
| LED D5 (G) | 02 | 11 |
+------------+-------+-------+
| Switch SW2 | 15 | 22 |
+------------+-------+-------+
| Switch SW3 | 04 | 13 |
+------------+-------+-------+
The default configuration can be found in the Kconfig file at
:zephyr_file:`boards/arm/cc3235sf_launchxl/cc3235sf_launchxl_defconfig`.
Programming and Debugging
*************************
TI officially supports development on the CC3235SF using the TI
`CC32xx SDK`_ on Windows and Linux using TI tools: Code Composer
Studio for debugging and `UniFlash`_ for flashing.
For Windows developers, see the `CC32xx Quick Start Guide`_ for
instructions on installation of tools, and how to flash the board using
UniFlash.
Note that ``zephyr.bin`` produced by the Zephyr SDK may not load via
UniFlash tool. If encountering difficulties, use the ``zephyr.elf``
file and openocd instead (see below).
The following instructions are geared towards Linux developers who
prefer command line tools to an IDE.
Before flashing and debugging the board, there are a few one-time board
setup steps to follow.
Prerequisites:
==============
#. Download and install the latest version of `UniFlash`_.
#. Jumper SOP[2..0] (J15) to [010], and connect the USB cable to the PC.
This should result in a new device "Texas Instruments XDS110 Embed
with CMSIS-DAP" appearing at /dev/ttyACM1 and /dev/ttyACM0.
#. Update the service pack, and place the board in "Development Mode".
Setting "Development Mode" enables the JTAG interface, necessary
for subsequent use of OpenOCD and updating XDS110 firmware.
Follow the instructions in Section 2.4 "Download the Application",
in the `CC32xx Quick Start Guide`_, except for steps 5 and 6 in
Section 2.4.1 which select an MCU image.
#. Ensure the XDS-110 emulation firmware is updated.
Download and install the latest `XDS-110 emulation package`_.
Follow these `xds110 firmware update directions
<http://software-dl.ti.com/ccs/esd/documents/xdsdebugprobes/emu_xds110.html#updating-the-xds110-firmware>`_
Note that the emulation package install may place the xdsdfu utility
in ``<install_dir>/ccs_base/common/uscif/xds110/``.
#. Switch Jumper SOP[2..0] (J15) back to [001].
Remove power from the board (disconnect USB cable) before switching jumpers.
#. Install TI OpenOCD
Clone the TI OpenOCD git repository from: http://git.ti.com/sdo-emu/openocd.
Follow the instructions in the Release Notes in that repository to build
and install.
Since the default TI OpenOCD installation is ``/usr/local/bin/``,
and ``/usr/local/share/``, you may want to backup any current openocd
installations there.
If you decide to change the default installation location, also update
the OPENOCD path variable in :zephyr_file:`boards/arm/cc3235sf_launchxl/board.cmake`.
#. Ensure CONFIG_XIP=y (default) is set.
This locates the program into flash, and sets CONFIG_CC3235SF_DEBUG=y,
which prepends a debug header enabling the flash to persist over
subsequent reboots, bypassing the bootloader flash signature
verification.
See Section 21.10 "Debugging Flash User Application Using JTAG" of the
`CC3235 TRM`_ for details on the secure flash boot process.
Once the above prerequisites are met, applications for the ``_cc3235sf_launchxl``
board can be built, flashed, and debugged with openocd and gdb per the Zephyr
Application Development Primer (see :ref:`build_an_application` and
:ref:`application_run`).
Flashing
========
To build and flash an application, execute the following commands for <my_app>:
.. zephyr-app-commands::
:zephyr-app: <my_app>
:board: cc3235sf_launchxl
:goals: flash
This will load the image into flash.
To see program output from UART0, connect a separate terminal window:
.. code-block:: console
% screen /dev/ttyACM0 115200 8N1
Then press the reset button (SW1) on the board to run the program.
Debugging
=========
To debug a previously flashed image, after resetting the board, use the 'debug'
build target:
.. zephyr-app-commands::
:zephyr-app: <my_app>
:board: cc3235sf_launchxl
:maybe-skip-config:
:goals: debug
Wi-Fi Support
*************
The SimpleLink Host Driver, imported from the SimpleLink SDK, has been ported
to Zephyr, and communicates over a dedicated SPI to the network co-processor.
It is available as a Zephyr Wi-Fi device driver in
:zephyr_file:`drivers/wifi/simplelink`.
Usage:
======
Set :option:`CONFIG_WIFI_SIMPLELINK` and :option:`CONFIG_WIFI` to ``y``
to enable Wi-Fi.
See :zephyr_file:`samples/net/wifi/boards/cc3235sf_launchxl.conf`.
Provisioning:
=============
SimpleLink provides a few rather sophisticated Wi-Fi provisioning methods.
To keep it simple for Zephyr development and demos, the SimpleLink
"Fast Connect" policy is enabled, with one-shot scanning.
This enables the cc3235sf_launchxl to automatically reconnect to the last
good known access point (AP), without having to restart a scan, and
re-specify the SSID and password.
To connect to an AP, first run the Zephyr Wi-Fi shell sample application,
and connect to a known AP with SSID and password.
See :ref:`wifi_sample`
Once the connection succeeds, the network co-processor keeps the AP identity in
its persistent memory. Newly loaded Wi-Fi applications then need not explicitly
execute any Wi-Fi scan or connect operations, until the need to change to a new AP.
Secure Socket Offload
*********************
The SimpleLink Wi-Fi driver provides socket operations to the Zephyr socket
offload point, enabling Zephyr BSD socket API calls to be directed to the
SimpleLink Wi-Fi driver, by setting :option:`CONFIG_NET_SOCKETS_OFFLOAD`
to ``y``.
Secure socket (TLS) communication is handled as part of the socket APIs,
and enabled by:
- setting both :option:`CONFIG_NET_SOCKETS_SOCKOPT_TLS`
and :option:`CONFIG_TLS_CREDENTIAL_FILENAMES` to ``y``,
- using the TI Uniflash tool to program the required certificates and
keys to the secure flash filesystem, and enabling the TI Trusted
Root-Certificate Catalog.
See :ref:`sockets-http-get` and
:zephyr_file:`samples/net/sockets/http_get/boards/cc3235sf_launchxl.conf` for an
example.
See the document `Simplelink Wi-Fi Certificates Handling`_ for details on
using the TI UniFlash tool for certificate programming.
References
**********
TI SimpleLink MCUs:
http://www.ti.com/microcontrollers/simplelink-mcus/overview.html
.. _TI CC3235 Product Page:
http://www.ti.com/product/cc3235SF
.. _CC3235 TRM:
http://www.ti.com/lit/pdf/swru543
.. _CC3x20/CC3x35 SimpleLink Wi-Fi and IoT Network Processor Programmer's Guide:
http://www.ti.com/lit/pdf/swru455
.. _CC32xx Quick Start Guide:
http://dev.ti.com/tirex/content/simplelink_cc32xx_sdk_2_40_01_01/docs/simplelink_mcu_sdk/Quick_Start_Guide.html
.. _UniFlash:
http://processors.wiki.ti.com/index.php/Category:CCS_UniFlash
.. _CC32xx SDK:
http://www.ti.com/tool/download/SIMPLELINK-CC32xx-SDK/2.40.01.01
.. _CC3235SF LaunchPad Dev Kit Hardware User's Guide:
http://www.ti.com/lit/pdf/swru539
.. _XDS-110 emulation package:
http://processors.wiki.ti.com/index.php/XDS_Emulation_Software_Package#XDS_Emulation_Software_.28emupack.29_Download
.. _Simplelink Wi-Fi Certificates Handling:
http://www.ti.com/lit/pdf/swpu332

View file

@ -0,0 +1,142 @@
/*
* Copyright (c) 2019, Texas Instruments Incorporated
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* pinmux.c
*
* configure the device pins for different peripheral signals
*/
/*
* This file was automatically generated on 7/21/2014 at 3:06:20 PM
* by TI PinMux version 3.0.334
* (Then modified to meet Zephyr coding style)
*/
/*
* TI Recommends use of the PinMux utility to ensure consistent configuration
* of pins: http://processors.wiki.ti.com/index.php/TI_PinMux_Tool
*
* Zephyr GPIO API however allows runtime configuration by applications.
*
* For the TI CC32XX port we leverage this output file
* from the PinMux tool, and guard sections based on Kconfig variables.
*
* The individual (uart/gpio) driver init/configuration functions
* therefore assume pinmux initialization is done here rather in the drivers
* at runtime.
*/
#include <init.h>
#include "pinmux.h"
#include <inc/hw_types.h>
#include <inc/hw_memmap.h>
#include <inc/hw_gpio.h>
#include <driverlib/pin.h>
#include <driverlib/rom.h>
#include <driverlib/rom_map.h>
#include <driverlib/gpio.h>
#include <driverlib/prcm.h>
#include <driverlib/i2c.h>
/* Defines taken from SimpleLink SDK's I2CCC32XX.h: */
/*
* Macros defining possible I2C signal pin mux options
*
* The bits in the pin mode macros are as follows:
* The lower 8 bits of the macro refer to the pin, offset by 1, to match
* driverlib pin defines. For example, I2C_CC32XX_PIN_01_I2C_SCL & 0xff = 0,
* which equals PIN_01 in driverlib pin.h. By matching the PIN_xx defines in
* driverlib pin.h, we can pass the pin directly to the driverlib functions.
* The upper 8 bits of the macro correspond to the pin mux confg mode
* value for the pin to operate in the I2C mode. For example, pin 1 is
* configured with mode 1 to operate as I2C_SCL.
*/
#define I2C_CC32XX_PIN_01_I2C_SCL 0x100 /*!< PIN 1 is used for I2C_SCL */
#define I2C_CC32XX_PIN_02_I2C_SDA 0x101 /*!< PIN 2 is used for I2C_SDA */
#define I2C_CC32XX_PIN_03_I2C_SCL 0x502 /*!< PIN 3 is used for I2C_SCL */
#define I2C_CC32XX_PIN_04_I2C_SDA 0x503 /*!< PIN 4 is used for I2C_SDA */
#define I2C_CC32XX_PIN_05_I2C_SCL 0x504 /*!< PIN 5 is used for I2C_SCL */
#define I2C_CC32XX_PIN_06_I2C_SDA 0x505 /*!< PIN 6 is used for I2C_SDA */
#define I2C_CC32XX_PIN_16_I2C_SCL 0x90F /*!< PIN 16 is used for I2C_SCL */
#define I2C_CC32XX_PIN_17_I2C_SDA 0x910 /*!< PIN 17 is used for I2C_SDA */
int pinmux_initialize(struct device *port)
{
ARG_UNUSED(port);
#ifdef CONFIG_UART_CC32XX
/* Configure PIN_55 for UART0 UART0_TX */
MAP_PinTypeUART(PIN_55, PIN_MODE_3);
/* Configure PIN_57 for UART0 UART0_RX */
MAP_PinTypeUART(PIN_57, PIN_MODE_3);
#endif
#ifdef CONFIG_GPIO_CC32XX_A1
/* Enable Peripheral Clocks */
MAP_PRCMPeripheralClkEnable(PRCM_GPIOA1, PRCM_RUN_MODE_CLK);
/* The following enables the 3 LEDs for the blinking samples */
/* Configure PIN_64 for GPIOOutput */
MAP_PinTypeGPIO(PIN_64, PIN_MODE_0, false);
MAP_GPIODirModeSet(GPIOA1_BASE, 0x2, GPIO_DIR_MODE_OUT);
/* Configure PIN_01 for GPIOOutput */
MAP_PinTypeGPIO(PIN_01, PIN_MODE_0, false);
MAP_GPIODirModeSet(GPIOA1_BASE, 0x4, GPIO_DIR_MODE_OUT);
/* Configure PIN_02 for GPIOOutput */
MAP_PinTypeGPIO(PIN_02, PIN_MODE_0, false);
MAP_GPIODirModeSet(GPIOA1_BASE, 0x8, GPIO_DIR_MODE_OUT);
/* SW3: Configure PIN_04 (GPIO13) for GPIOInput */
MAP_PinTypeGPIO(PIN_04, PIN_MODE_0, false);
MAP_GPIODirModeSet(GPIOA1_BASE, 0x20, GPIO_DIR_MODE_IN);
#endif
#ifdef CONFIG_GPIO_CC32XX_A2
MAP_PRCMPeripheralClkEnable(PRCM_GPIOA2, PRCM_RUN_MODE_CLK);
/* SW2: Configure PIN_15 (GPIO22) for GPIOInput */
MAP_PinTypeGPIO(PIN_15, PIN_MODE_0, false);
MAP_GPIODirModeSet(GPIOA2_BASE, 0x40, GPIO_DIR_MODE_IN);
#endif
#ifdef CONFIG_GPIO_CC32XX_A3
MAP_PRCMPeripheralClkEnable(PRCM_GPIOA3, PRCM_RUN_MODE_CLK);
#endif
#ifdef CONFIG_I2C_CC32XX
{
unsigned long pin;
unsigned long mode;
/* Enable the I2C module clocks and wait for completion:*/
MAP_PRCMPeripheralClkEnable(PRCM_I2CA0,
PRCM_RUN_MODE_CLK |
PRCM_SLP_MODE_CLK);
while (!MAP_PRCMPeripheralStatusGet(PRCM_I2CA0)) {
}
pin = I2C_CC32XX_PIN_01_I2C_SCL & 0xff;
mode = (I2C_CC32XX_PIN_01_I2C_SCL >> 8) & 0xff;
MAP_PinTypeI2C(pin, mode);
pin = I2C_CC32XX_PIN_02_I2C_SDA & 0xff;
mode = (I2C_CC32XX_PIN_02_I2C_SDA >> 8) & 0xff;
MAP_PinTypeI2C(pin, mode);
}
#endif
return 0;
}
SYS_INIT(pinmux_initialize, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);

View file

@ -0,0 +1,10 @@
#
# TI CC3235SF-LaunchXL Evaluation Kit
#
source [find interface/xds110.cfg]
transport select swd
source [find target/ti_cc3220sf_vr.cfg]
if { ![using_hla] } {
cortex_m reset_config srst_only
}
adapter_khz 2500