Skip to content

Commit

Permalink
Merge pull request #229 from xmos/release/v3.1.0
Browse files Browse the repository at this point in the history
Release/v3.1.0
  • Loading branch information
shuchitak authored Jan 24, 2024
2 parents 9923425 + dec0846 commit 7be5724
Show file tree
Hide file tree
Showing 28 changed files with 139 additions and 67 deletions.
1 change: 1 addition & 0 deletions .xmos_ignore_source_check
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
modules/FreeRTOS
mqtt/FreeRTOS
modules/drivers/wifi
fatfs_mkimage/argtable/
fatfs_mkimage/src/tinydir.h
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
RTOS Framework change log
=========================

3.1.0
-----

* UPDATED: To latest tinyusb_src
* ADDED: Support for transitioning to USB test mode in tinyusb_src
* UPDATED: Increase SPI tx/rx buffer sizes from 64 to 256 bytes

3.0.5
-----

Expand Down
47 changes: 24 additions & 23 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@Library('xmos_jenkins_shared_library@v0.27.0') _
@Library('xmos_jenkins_shared_library@v0.28.0') _

getApproval()

Expand All @@ -13,22 +13,22 @@ pipeline {
numToKeepStr: env.BRANCH_NAME ==~ /develop/ ? '25' : '',
artifactNumToKeepStr: env.BRANCH_NAME ==~ /develop/ ? '25' : ''
))
}
}
parameters {
string(
name: 'TOOLS_VERSION',
defaultValue: '15.2.1',
description: 'The XTC tools version'
)
}
}
environment {
PYTHON_VERSION = "3.8.11"
VENV_DIRNAME = ".venv"
BUILD_DIRNAME = "dist"
RTOS_TEST_RIG_TARGET = "xcore_sdk_test_rig"
LOCAL_WIFI_SSID = credentials('hampton-office-network-ssid')
LOCAL_WIFI_PASS = credentials('hampton-office-network-wifi-password')
}
RTOS_TEST_RIG_TARGET = "XCORE-AI-EXPLORER"
LOCAL_WIFI_SSID = credentials('bristol-office-development-wifi-ssid')
LOCAL_WIFI_PASS = credentials('bristol-office-development-wifi-password')
}
stages {
stage('Build and Docs') {
parallel {
Expand Down Expand Up @@ -57,7 +57,7 @@ pipeline {
expression { !env.GH_LABEL_DOC_ONLY.toBoolean() }
}
agent {
label 'xcore.ai-explorer-us'
label 'xcore.ai-explorer-hil-tests'
}
stages {
stage('Checkout') {
Expand Down Expand Up @@ -106,20 +106,21 @@ pipeline {
sh "rm -f ~/.xtag/status.lock ~/.xtag/acquired"
}
}
stage('Run RTOS Drivers WiFi test') {
steps {
withTools(params.TOOLS_VERSION) {
withVenv {
script {
withXTAG(["$RTOS_TEST_RIG_TARGET"]) { adapterIDs ->
sh "test/rtos_drivers/wifi/check_wifi.sh " + adapterIDs[0]
}
sh "pytest test/rtos_drivers/wifi"
}
}
}
}
}
// TODO Disabled till https://xmosjira.atlassian.net/browse/AP-353 is fixed
//stage('Run RTOS Drivers WiFi test') {
// steps {
// withTools(params.TOOLS_VERSION) {
// withVenv {
// script {
// withXTAG(["$RTOS_TEST_RIG_TARGET"]) { adapterIDs ->
// sh "test/rtos_drivers/wifi/check_wifi.sh " + adapterIDs[0]
// }
// sh "pytest test/rtos_drivers/wifi"
// }
// }
// }
// }
//}
stage('Run RTOS Drivers HIL test') {
steps {
withTools(params.TOOLS_VERSION) {
Expand Down Expand Up @@ -168,7 +169,7 @@ pipeline {
post {
cleanup {
// cleanWs removes all output and artifacts of the Jenkins pipeline
// Comment out this post section to leave the workspace which can be useful for running items on the Jenkins agent.
// Comment out this post section to leave the workspace which can be useful for running items on the Jenkins agent.
// However, beware that this pipeline will not run if the workspace is not manually cleaned.
xcoreCleanSandbox()
}
Expand Down
11 changes: 6 additions & 5 deletions modules/drivers/uart/src/rtos_uart_rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// This Software is subject to the terms of the XMOS Public Licence: Version 1.

#define DEBUG_UNIT RTOS_UART_RX
#define DEBUG_PRINT_ENABLE_RTOS_UART_RX 1

#include <xcore/triggerable.h>
#include <string.h>
Expand All @@ -18,7 +17,7 @@ DEFINE_RTOS_INTERRUPT_CALLBACK(rtos_uart_rx_isr, arg)

/* Grab byte received from rx which triggered ISR */
uint8_t byte = s_chan_in_byte(ctx->c.end_b);

BaseType_t pxHigherPriorityTaskWoken = pdFALSE;

/* We already know the task handle of the receiver so cast to correct type */
Expand All @@ -44,6 +43,8 @@ static void uart_rx_error_callback(uart_callback_code_t callback_code, void * ap

static void uart_rx_hil_thread(rtos_uart_rx_t *ctx)
{
rtos_printf("UART Rx on tile %d core %d\n", THIS_XCORE_TILE, rtos_core_id_get());

/* consume token (synch with RTOS driver) */
(void) s_chan_in_byte(ctx->c.end_a);

Expand Down Expand Up @@ -80,7 +81,7 @@ static void uart_rx_app_thread(rtos_uart_rx_t *ctx)
bytes_read += 1;
} while(ret == UART_BUFFER_OK);
bytes_read -= 1; /* important as we incremented this for the last read fail too */

if(bytes_read){
size_t xBytesSent = xStreamBufferSend(ctx->app_byte_buffer, bytes, bytes_read, 0);

Expand Down Expand Up @@ -149,7 +150,7 @@ void rtos_uart_rx_init(
uart_rx_error_callback,
uart_rx_ctx
);


uart_rx_ctx->c = s_chan_alloc();

Expand Down Expand Up @@ -177,7 +178,7 @@ void rtos_uart_rx_start(
unsigned interrupt_core_id,
unsigned priority,
size_t app_rx_buff_size){

/* Init callbacks & args */
uart_rx_ctx->app_data = app_data;
uart_rx_ctx->rx_start_cb = rx_start;
Expand Down
5 changes: 2 additions & 3 deletions modules/drivers/uart/src/rtos_uart_tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// This Software is subject to the terms of the XMOS Public Licence: Version 1.

#define DEBUG_UNIT RTOS_UART_TX
#define DEBUG_PRINT_ENABLE_RTOS_UART_TX 1

#include "rtos_uart_tx.h"

Expand All @@ -21,7 +20,7 @@ static void uart_tx_local_write(
uart_tx(&ctx->dev, buff[i]);
rtos_interrupt_unmask_all();
}

rtos_osal_mutex_put(&ctx->lock);
}

Expand All @@ -44,7 +43,7 @@ void rtos_uart_tx_init(
const uart_parity_t parity,
const uint8_t stop_bits,
hwtimer_t tmr){

//uart init
uart_tx_blocking_init(
&ctx->dev,
Expand Down
9 changes: 9 additions & 0 deletions modules/drivers/usb/api/rtos_usb.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,15 @@ static inline void rtos_usb_endpoint_stall_clear(rtos_usb_t *ctx,
XUD_ClearStallByAddr(endpoint_addr);
}

/**
* Calls the XUD function to enter the specified test mode.
*
* \param ctx A pointer to the USB driver instance to use.
* \param test_mode Desired test mode.
*/
void rtos_usb_enter_test_mode(rtos_usb_t *ctx,
unsigned test_mode);

/**
* Starts the USB driver instance's low level USB I/O thread and enables its interrupts
* on the requested core. This must only be called by the tile that owns the driver instance.
Expand Down
6 changes: 6 additions & 0 deletions modules/drivers/usb/src/rtos_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,12 @@ XUD_BusSpeed_t rtos_usb_endpoint_reset(rtos_usb_t *ctx,
return XUD_ResetEndpoint(one, two);
}

void rtos_usb_enter_test_mode(rtos_usb_t *ctx,
unsigned test_mode)
{
XUD_SetTestMode(ctx->ep[0][RTOS_USB_OUT_EP], test_mode);
}

static void ep_cfg(rtos_usb_t *ctx,
int ep_num,
int direction)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#include "rtos_printf.h"
#include "device_control.h"

#define SPI_XFER_RX_SIZE (64)
#define SPI_XFER_TX_SIZE (64)
#define SPI_XFER_RX_SIZE (256)
#define SPI_XFER_TX_SIZE (256)
static uint8_t spi_xfer_rx_buf[SPI_XFER_RX_SIZE];
static uint8_t spi_xfer_tx_buf[SPI_XFER_TX_SIZE];
static uint8_t spi_xfer_rx_default_buf[SPI_XFER_RX_SIZE];
Expand Down Expand Up @@ -73,4 +73,4 @@ void device_control_spi_xfer_done_cb(rtos_spi_slave_t *ctx,
}
}
spi_slave_xfer_prepare(ctx, spi_xfer_rx_buf, SPI_XFER_RX_SIZE, spi_xfer_tx_buf, SPI_XFER_TX_SIZE);
}
}
2 changes: 0 additions & 2 deletions modules/sw_services/mqtt/FreeRTOS/MQTTFreeRTOS.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// Copyright 2020-2023 XMOS LIMITED.
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
/*******************************************************************************
* Copyright (c) 2014, 2015 IBM Corp.
*
Expand Down
2 changes: 0 additions & 2 deletions modules/sw_services/mqtt/FreeRTOS/MQTTFreeRTOS.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// Copyright 2020-2023 XMOS LIMITED.
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
/*******************************************************************************
* Copyright (c) 2014, 2015 IBM Corp.
*
Expand Down
1 change: 1 addition & 0 deletions modules/sw_services/usb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ if((${CMAKE_SYSTEM_NAME} STREQUAL XCORE_XS3A) OR (${CMAKE_SYSTEM_NAME} STREQUAL
target_sources(framework_rtos_sw_services_usb
INTERFACE
portable/dcd_xcore.c
portable/tusb_nstackwords.S
FreeRTOS/usb_support.c
${TUSB_ROOT_SOURCES}
${TUSB_CLASS_SOURCES}
Expand Down
17 changes: 17 additions & 0 deletions modules/sw_services/usb/portable/dcd_xcore.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ static void dcd_xcore_int_handler(rtos_usb_t *ctx,
}
}


/*------------------------------------------------------------------*/
/* Device API
*------------------------------------------------------------------*/
Expand Down Expand Up @@ -541,3 +542,19 @@ void dcd_edpt_clear_stall (uint8_t rhport, uint8_t ep_addr)
rtos_printf("STALL EP %02x: Clear\n", ep_addr);
rtos_usb_endpoint_stall_clear(&usb_ctx, ep_addr);
}

void dcd_sof_enable(uint8_t rhport, bool en)
{
(void) rhport;
(void) en;
}

bool dcd_check_test_mode_support(test_mode_t test_selector)
{
return true;
}

void dcd_enter_test_mode(uint8_t rhport, test_mode_t test_selector)
{
rtos_usb_enter_test_mode(&usb_ctx, ((unsigned)test_selector) << 8);
}
5 changes: 5 additions & 0 deletions modules/sw_services/usb/portable/tusb_nstackwords.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Copyright (c) 2024, XMOS Ltd, All rights reserved
// This Software is subject to the terms of the XMOS Public Licence: Version 1.

.global dcd_event_handler.nstackwords
.set dcd_event_handler.nstackwords, 100
18 changes: 16 additions & 2 deletions modules/sw_services/usb/portable/tusb_os_custom.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,23 @@ static inline osal_queue_t osal_queue_create(osal_queue_def_t* qdef)
return xQueueCreate(qdef->depth, qdef->item_sz);
}

static inline bool osal_queue_receive(osal_queue_t qhdl, void* data)
static inline bool osal_queue_receive(osal_queue_t qhdl, void* data, uint32_t msec)
{
return xQueueReceive(qhdl, data, portMAX_DELAY);
uint32_t ticks = 0;
if ( msec == OSAL_TIMEOUT_WAIT_FOREVER )
{
ticks = portMAX_DELAY;
}
else if( msec == 0 )
{
ticks = 0;
}
else
{
ticks = pdMS_TO_TICKS(msec);
}

return xQueueReceive(qhdl, data, ticks);
}

static inline bool osal_queue_send(osal_queue_t qhdl, void const * data, bool in_isr)
Expand Down
2 changes: 1 addition & 1 deletion modules/sw_services/usb/thirdparty/tinyusb_src
Submodule tinyusb_src updated 161 files
4 changes: 4 additions & 0 deletions test/rtos_drivers/clock_control/check_clock_control.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ elif [ "$UNAME" == "Darwin" ] ; then
gtimeout ${TIMEOUT_S}s xrun --xscope ${REPO_ROOT}/dist/${FIRMWARE} 2>&1 | tee -a ${REPORT}
fi

if [[ $? -eq 124 ]]; then
echo "ERROR: TEST TIMED OUT after ${TIMEOUT_S} seconds"
fi

echo "****************"
echo "* Parse Result *"
echo "****************"
Expand Down
6 changes: 5 additions & 1 deletion test/rtos_drivers/hil/check_drivers_hil.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ done
# assign vars
REPORT=testing/test.rpt
FIRMWARE=dist/test_rtos_driver_hil.xe
TIMEOUT_S=60
TIMEOUT_S=100
if [ ! -z "${@:$OPTIND:1}" ]
then
ADAPTER_ID="--adapter-id ${@:$OPTIND:1}"
Expand All @@ -53,6 +53,10 @@ elif [ "$UNAME" == "Darwin" ] ; then
gtimeout ${TIMEOUT_S}s xrun --xscope ${ADAPTER_ID} ${REPO_ROOT}/${FIRMWARE} 2>&1 | tee -a ${REPORT}
fi

if [[ $? -eq 124 ]]; then
echo "ERROR: TEST TIMED OUT after ${TIMEOUT_S} seconds"
fi

echo "****************"
echo "* Parse Result *"
echo "****************"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ static int main_test(qspi_flash_test_ctx_t *ctx)
{
return -1;
}

if (read_write_read(ctx->qspi_flash_ctx, addr, 131072) == -1)
{
return -1;
Expand Down
3 changes: 2 additions & 1 deletion test/rtos_drivers/hil_add/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ Description

The RTOS driver tests are designed to regression test RTOS driver behavior for the following drivers:

- spi
- qspi_fast_read
- spi
- uart

These tests assume that the associated RTOS and HILs used have been verified by their own localized separate testing.

Expand Down
4 changes: 4 additions & 0 deletions test/rtos_drivers/hil_add/check_drivers_hil_add.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ elif [ "$UNAME" == "Darwin" ] ; then
gtimeout ${TIMEOUT_S}s xrun --xscope ${ADAPTER_ID} ${REPO_ROOT}/${FIRMWARE} 2>&1 | tee -a ${REPORT}
fi

if [[ $? -eq 124 ]]; then
echo "ERROR: TEST TIMED OUT after ${TIMEOUT_S} seconds"
fi

echo "****************"
echo "* Parse Result *"
echo "****************"
Expand Down
2 changes: 1 addition & 1 deletion test/rtos_drivers/hil_add/hil_add.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Individual tests
#**********************
set(SPI_TEST 1)
set(UART_TEST 0) # Appears to be broken
set(UART_TEST 1)
set(QSPI_FLASH_FAST_READ_TEST 1)

#**********************
Expand Down
2 changes: 1 addition & 1 deletion test/rtos_drivers/hil_add/src/app_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#define SPI_TEST_BUF_SIZE 4096

#define UART_RX_CORE_MASK (1 << 2)
#define UART_RX_ISR_CORE 2
#define UART_RX_ISR_CORE 3
#define UART_BAUD_RATE 921600


Expand Down
Loading

0 comments on commit 7be5724

Please sign in to comment.