Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sanitycheck: Support filtering based on DTS configuration data #11800

Merged
merged 6 commits into from
Dec 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions samples/basic/blinky/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ sample:
tests:
test:
tags: LED gpio
# The filters below are from DTS
filter: LED0_GPIO_CONTROLLER
depends_on: gpio
3 changes: 2 additions & 1 deletion samples/basic/button/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ sample:
name: Button Sample
tests:
test:
platform_whitelist: nucleo_f103rb quark_se_c1000_devboard
tags: button gpio
# The filters below are from DTS
filter: SW0_GPIO_CONTROLLER
depends_on: gpio
35 changes: 10 additions & 25 deletions samples/basic/disco/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@ GPIO outputs of the MCU/board.
Wiring
******

The code may need some work before running on another board: set PORT,
LED1 and LED2 according to the board's GPIO configuration.
This sample should work on board with multiple built-in LEDs without any
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is contradictory, so let's simplify and say:

This sample may need some code changes to run on specific
boards by setting the PORT, LED0, and LED1 according to
the board's GPIO configuration.  As examples, see the instructions
below for some of our supported boards.

changes, otherwise, the code may need some changes before running on various
board: set PORT, LED0 and LED1 according to the board's GPIO configuration.

For example, on the following boards with additional LEDs, follow the
instructions below:

Nucleo-64 F103RB/F401RE boards
==============================
Expand All @@ -26,31 +30,12 @@ these boards see:
- https://developer.mbed.org/platforms/ST-Nucleo-F103RB/
- https://developer.mbed.org/platforms/ST-Nucleo-F401RE/

Arduino 101 (x86)
=================

Connect two LEDs to D4 (IO4) and D7 (IO7) pins. The schematics for the Arduino
101 board is available at:

https://www.arduino.cc/en/uploads/Main/Arduino101-REV4Schematic.pdf

For Arduino 101's pinmux mapping in Zephyr, see: :file:`boards/x86/arduino_101/pinmux.c`

Modify the src/main.c file and set:

.. code-block:: c

#define PORT CONFIG_GPIO_QMSI_0_NAME
/* GPIO_19 is Arduino's D4 */
#define LED1 19
/* GPIO_20 is Arduino's D7 */
#define LED2 20

Building and Running
*********************

After startup, the program looks up a predefined GPIO device defined by 'PORT',
and configures pins 'LED1' and 'LED2' in output mode. During each iteration of
and configures pins 'LED0' and 'LED1' in output mode. During each iteration of
the main loop, the state of GPIO lines will be changed so that one of the lines
is in high state, while the other is in low, thus switching the LEDs on and off
in an alternating pattern.
Expand Down Expand Up @@ -78,11 +63,11 @@ Nucleo F401RE
:goals: build
:compact:

Arduino 101
============
reel Board
==========

.. zephyr-app-commands::
:zephyr-app: samples/basic/disco
:board: arduino_101
:board: reel_board
:goals: build
:compact:
4 changes: 2 additions & 2 deletions samples/basic/disco/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ sample:
name: Disco Lights
tests:
test:
platform_whitelist: nucleo_f103rb nucleo_f401re
# The filters below are from DTS
filter: LED0_GPIO_CONTROLLER and LED1_GPIO_PIN and LED0_GPIO_PIN
tags: LED gpio
depends_on: gpio
19 changes: 6 additions & 13 deletions samples/basic/disco/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,10 @@
#include <device.h>
#include <gpio.h>

/**
* the demo assumes use of nucleo_f103rb board, adjust defines below
* to fit your board
*/
#define PORT LED0_GPIO_CONTROLLER

/* we're going to use PB8 and PB5 */
#define PORT "GPIOB"
/* PB5 */
#define LED1 5
/* PB8 */
#define LED2 8
#define LED0 LED0_GPIO_PIN
#define LED1 LED1_GPIO_PIN

#define SLEEP_TIME 500

Expand All @@ -29,12 +22,12 @@ void main(void)

gpiob = device_get_binding(PORT);

gpio_pin_configure(gpiob, LED0, GPIO_DIR_OUT);
gpio_pin_configure(gpiob, LED1, GPIO_DIR_OUT);
gpio_pin_configure(gpiob, LED2, GPIO_DIR_OUT);

while (1) {
gpio_pin_write(gpiob, LED1, cnt % 2);
gpio_pin_write(gpiob, LED2, (cnt + 1) % 2);
gpio_pin_write(gpiob, LED0, cnt % 2);
gpio_pin_write(gpiob, LED1, (cnt + 1) % 2);
k_sleep(SLEEP_TIME);
cnt++;
}
Expand Down
2 changes: 0 additions & 2 deletions samples/basic/rgb_led/prj.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
CONFIG_PRINTK=y
CONFIG_PWM=y
CONFIG_PWM_QMSI_NUM_PORTS=3
CONFIG_LOG=y
CONFIG_PWM_LOG_LEVEL_DBG=y
4 changes: 2 additions & 2 deletions samples/basic/rgb_led/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ sample:
name: RGB LED
tests:
test:
# FIXME: We should remove those and just rely on depends_on
platform_whitelist: arduino_101 hexiwear_k64
# The filters below are from DTS
filter: RED_PWM_LED_PWM_CONTROLLER
tags: drivers pwm
depends_on: pwm
9 changes: 1 addition & 8 deletions samples/basic/rgb_led/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,7 @@
#include <device.h>
#include <pwm.h>

#if defined(CONFIG_SOC_QUARK_SE_C1000)
#define PWM_DEV0 CONFIG_PWM_QMSI_DEV_NAME
#define PWM_CH0 0
#define PWM_DEV1 CONFIG_PWM_QMSI_DEV_NAME
#define PWM_CH1 1
#define PWM_DEV2 CONFIG_PWM_QMSI_DEV_NAME
#define PWM_CH2 2
#elif defined(RED_PWM_LED_PWM_CONTROLLER) && \
#if defined(RED_PWM_LED_PWM_CONTROLLER) && \
defined(RED_PWM_LED_PWM_CHANNEL) && \
defined(GREEN_PWM_LED_PWM_CONTROLLER) && \
defined(GREEN_PWM_LED_PWM_CHANNEL) && \
Expand Down
4 changes: 2 additions & 2 deletions samples/basic/threads/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ sample:
name: Basic Thread Demo
tests:
test:
platform_whitelist: 96b_carbon
tags: kernel threads gpio
depends_on: gpio
# The filters below are from DTS
filter: LED0_GPIO_CONTROLLER and LED1_GPIO_CONTROLLER
6 changes: 3 additions & 3 deletions samples/drivers/gpio/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ sample:
name: GPIO toggling
tests:
test:
platform_whitelist: quark_se_c1000_devboard arduino_101
arduino_101_sss arduino_due
tags: drivers
# The filters below are from DTS
filter: LED0_GPIO_CONTROLLER and LED0_GPIO_PIN and SW0_GPIO_PIN
harness: console
harness_config:
type: one_line
regex:
- "Toggling GPIO_(.*)"
- "Toggling (.*)"
depends_on: gpio
Loading